/* Customer portal: sign-in and the two workspaces. Colours, type and shapes come from
   theme.css; widths that depend on data (meters, bars) are set by portal.js. */
.small { font-size: var(--ld-type-small); }
.wide { width: 100%; }
.avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: var(--ld-type-caption); font-weight: 700; background: rgb(var(--ld-light) / 12%); box-shadow: inset 0 0 0 1px var(--ld-line-strong); }
.icon-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgb(var(--ld-light) / 7%); color: var(--ld-text-2); cursor: pointer; text-decoration: none; transition: background .25s, color .25s; }
.icon-btn:hover { background: rgb(var(--ld-light) / 14%); color: var(--ld-text); }
.icon-btn svg, #nav svg, .workspace svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ── Sign-in ─────────────────────────────────────────────────────────────────────── */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side { position: relative; padding: 40px 56px 56px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border-right: 1px solid var(--ld-line); }
.login-orb { position: relative; min-height: 300px; }
.login-orb canvas { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 594px; height: 594px; max-width: none; }
.login-pitch { display: grid; gap: 18px; }
.login-pitch h1 { font-size: clamp(38px, 4.6vw, 62px); }
.login-points { display: flex; flex-wrap: wrap; gap: 10px 22px; font-weight: 600; font-size: var(--ld-type-small); }
.login-points li { display: flex; align-items: center; gap: 10px; }
.login-panel { padding: 40px 24px; display: grid; align-content: center; justify-items: center; gap: 22px; }
.login-card { width: min(440px, 100%); padding: 38px; display: grid; gap: 22px; animation: card-in .9s var(--ld-ease-liquid) both; transition: opacity .5s, transform .6s var(--ld-ease-out), filter .5s; }
@keyframes card-in { from { opacity: 0; transform: translateY(26px) scale(.97); filter: blur(8px); } }
.login-card.leaving { opacity: 0; transform: scale(1.04); filter: blur(10px); }
.login-card .chip { justify-self: start; }
.step { display: grid; gap: 16px; animation: step-in .5s var(--ld-ease-out) both; }
@keyframes step-in { from { opacity: 0; transform: translateX(14px); } }
.step h2 { font-size: 28px; }
.field { display: grid; gap: 8px; font-size: var(--ld-type-small); font-weight: 600; }
.field span { display: flex; justify-content: space-between; } .field a { color: var(--ld-text-2); font-weight: 500; }
.field input, .search input, .code-boxes input { height: 50px; padding: 0 16px; border: 0; border-radius: var(--ld-radius-control); background: rgb(var(--ld-shade) / 36%); box-shadow: inset 0 0 0 1px var(--ld-line-strong); font-size: var(--ld-type-body); font-weight: 500; transition: box-shadow .25s, background .25s; }
.field input::placeholder, .search input::placeholder { color: var(--ld-text-3); }
.field input:focus, .search input:focus, .code-boxes input:focus { outline: 0; background: rgb(var(--ld-shade) / 50%); box-shadow: inset 0 0 0 1.5px var(--ld-action), 0 0 0 5px rgb(var(--ld-light) / 8%); }
.form-error { color: var(--ld-danger-text); font-size: var(--ld-type-small); }
.or { display: flex; align-items: center; gap: 14px; color: var(--ld-text-3); font-size: var(--ld-type-small); }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--ld-line); }
.back { justify-self: start; padding: 0; border: 0; background: none; color: var(--ld-text-2); font-size: var(--ld-type-small); font-weight: 600; cursor: pointer; }
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code-boxes input { width: 100%; height: 58px; padding: 0; text-align: center; font: 500 24px var(--ld-mono); }
.demo-entries { display: grid; gap: 12px; padding-top: 20px; border-top: 1px solid var(--ld-line); }
.demo-entries div { display: flex; flex-wrap: wrap; gap: 8px; }
.login-foot { display: flex; gap: 22px; color: var(--ld-text-3); font-size: var(--ld-type-small); }
.login-foot a { text-decoration: none; } .login-foot a:hover { color: var(--ld-text); }

/* ── Portal shell ────────────────────────────────────────────────────────────────── */
.portal { display: grid; grid-template-columns: 276px 1fr; }
.rail { position: sticky; top: 14px; height: calc(100vh - 28px); margin: 14px 0 14px 14px; padding: 20px 14px 14px; display: flex; flex-direction: column; gap: 16px; }
.rail > .brand { padding: 0 8px; }
.workspace { width: 100%; padding: 10px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: var(--ld-radius-control); background: rgb(var(--ld-shade) / 30%); box-shadow: inset 0 0 0 1px var(--ld-line); text-align: left; cursor: pointer; transition: background .25s; }
.workspace:hover { background: rgb(var(--ld-shade) / 46%); }
.workspace > span:nth-child(2), .rail-foot > span:nth-child(2), .workspace-menu a > span:last-child, .person > span:last-child { display: grid; min-width: 0; flex: 1; }
.workspace strong, .rail-foot strong, .workspace-menu strong, .person strong { font-size: var(--ld-type-small); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace small, .rail-foot small, .workspace-menu small, .person small { color: var(--ld-text-2); font-size: var(--ld-type-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace svg { color: var(--ld-text-3); }
.workspace-menu { position: absolute; z-index: 5; left: 14px; right: 14px; top: 128px; padding: 6px; display: grid; gap: 2px; background: var(--ld-surface-raised); box-shadow: inset 0 0 0 1px var(--ld-line-strong), var(--ld-shadow-lift); animation: pop .3s var(--ld-ease-liquid); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
.workspace-menu a { padding: 10px; display: flex; align-items: center; gap: 12px; border-radius: var(--ld-radius-control); text-decoration: none; }
.workspace-menu a:hover { background: rgb(var(--ld-light) / 8%); }
#nav { display: grid; gap: 2px; align-content: start; flex: 1; overflow-y: auto; }
#nav a { position: relative; padding: 11px 12px; display: flex; align-items: center; gap: 12px; border-radius: var(--ld-radius-control); color: var(--ld-text-2); font-weight: 600; font-size: 14px; text-decoration: none; transition: background .25s, color .25s, transform .35s var(--ld-ease-liquid); }
#nav a:hover { color: var(--ld-text); background: rgb(var(--ld-light) / 6%); transform: translateX(2px); }
#nav a[aria-current] { color: var(--ld-on-action); background: var(--ld-gradient-primary); box-shadow: var(--ld-shadow-primary); }
#nav b { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: var(--ld-radius-pill); font-size: var(--ld-type-caption); font-weight: 700; color: var(--ld-on-action); background: var(--ld-warn); }
.rail-foot { padding: 12px 6px 0; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--ld-line); }

.stage { min-width: 0; padding: 30px clamp(18px, 3.4vw, 46px) 80px; }
.stage-top { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.stage-top > div { flex: 1; min-width: 0; }
.stage-top h1 { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.035em; line-height: 1.1; }
.rail-toggle { display: none; }
#view { display: grid; gap: 16px; max-width: 1180px; outline: 0; }
#view.enter { animation: view-in .55s var(--ld-ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } }

.panel { padding: 26px; display: grid; gap: 18px; align-content: start; }
.panel > header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel > header > div:first-child { display: grid; gap: 4px; min-width: 0; flex: 1 1 260px; }
.panel h2 { font-size: 20px; font-weight: 500; letter-spacing: -.01em; } .panel h3 { font-size: var(--ld-type-body); margin-top: 6px; }
.panel .btn { justify-self: start; }
article.panel { transition: transform .5s var(--ld-ease-liquid); } article.panel:hover { transform: translateY(-3px); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two.wide-left { grid-template-columns: 1.35fr 1fr; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat { padding: 22px; display: grid; gap: 4px; align-content: start; }
.stat small, .stat span { color: var(--ld-text-2); font-size: var(--ld-type-small); }
.stat strong { font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; } .stat em { font-style: normal; font-size: 18px; color: var(--ld-text-3); }

.hero-card { padding: 32px; display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; }
.hero-card > div:first-child { display: grid; gap: 14px; justify-items: start; }
.hero-card h2 { font-size: clamp(24px, 2.8vw, 34px); letter-spacing: -.03em; max-width: 22ch; }
.ring { position: relative; width: 148px; height: 148px; display: grid; place-items: center; text-align: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: rgb(var(--ld-light) / 9%); stroke-width: 9; }
.ring .value { stroke: var(--ld-ok); stroke-linecap: round; animation: ring 1.5s .2s var(--ld-ease-out) both; }
@keyframes ring { from { stroke-dashoffset: 100; } }
.ring b { display: block; font-size: 42px; font-weight: 700; line-height: 1; letter-spacing: -.04em; } .ring small { color: var(--ld-text-2); font-size: var(--ld-type-caption); }

.meter { height: 6px; min-width: 70px; border-radius: var(--ld-radius-pill); background: rgb(var(--ld-light) / 9%); overflow: hidden; }
.meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--ld-text); transition: width 1.1s .15s var(--ld-ease-out); }
.risk { display: grid; grid-template-columns: 70px auto; gap: 10px; align-items: center; }
.risk.ok .meter i { background: var(--ld-ok); } .risk.warn .meter i { background: var(--ld-warn); } .risk.danger .meter i { background: var(--ld-danger); }
.bars { height: 104px; display: flex; align-items: flex-end; gap: 6px; }
.bars i { flex: 1; height: 0; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, rgb(var(--ld-light) / 70%), rgb(var(--ld-light) / 18%)); transition: height 1s var(--ld-ease-liquid); }
.bars i:nth-child(2n) { transition-delay: .08s; } .bars i:nth-child(3n) { transition-delay: .16s; }

.devices, .todo, .incidents, .factors, .features { display: grid; gap: 8px; }
.devices li, .todo li { display: grid; grid-template-columns: auto 1.2fr 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--ld-radius-control); background: rgb(var(--ld-shade) / 28%); box-shadow: inset 0 0 0 1px var(--ld-line); }
.todo li { grid-template-columns: auto 1fr auto; }
.devices small, .incidents small { display: block; color: var(--ld-text-2); font-size: var(--ld-type-caption); }
.devices strong, .todo strong, .incidents strong { font-weight: 600; }
.incidents button { width: 100%; padding: 14px 16px; display: grid; grid-template-columns: auto 1.6fr auto 110px 120px; gap: 14px; align-items: center; border: 0; border-radius: var(--ld-radius-control); background: rgb(var(--ld-shade) / 28%); box-shadow: inset 0 0 0 1px var(--ld-line); text-align: left; cursor: pointer; transition: background .25s, transform .35s var(--ld-ease-liquid); }
.incidents button:hover { background: rgb(var(--ld-light) / 7%); transform: translateX(3px); }
.factors li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: var(--ld-type-small); } .factors .meter { grid-column: 1 / -1; } .factors b { font-weight: 700; }
.features li { display: flex; align-items: center; gap: 12px; }
.secret { padding: 16px 18px; border-radius: var(--ld-radius-control); background: rgb(var(--ld-shade) / 40%); box-shadow: inset 0 0 0 1px var(--ld-line); font-size: 17px; letter-spacing: .08em; }
.person { display: flex; align-items: center; gap: 12px; }

.table-wrap { overflow-x: auto; margin-inline: -8px; }
table { width: 100%; border-collapse: collapse; font-size: var(--ld-type-small); }
th { padding: 0 12px 10px; text-align: left; font-weight: 600; color: var(--ld-text-3); white-space: nowrap; }
td { padding: 13px 12px; border-top: 1px solid var(--ld-line); vertical-align: middle; white-space: nowrap; }
tbody tr { transition: background .2s; } tbody tr:hover { background: rgb(var(--ld-light) / 4%); }
td:last-child { text-align: right; }
.empty { padding: 26px; text-align: center; color: var(--ld-text-2); }

.filters, .tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filters button, .tabs button { min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--ld-radius-pill); background: rgb(var(--ld-light) / 6%); color: var(--ld-text-2); font-size: var(--ld-type-small); font-weight: 600; cursor: pointer; transition: background .25s, color .25s; }
.filters button:hover, .tabs button:hover { color: var(--ld-text); }
.filters .on, .tabs .on { background: var(--ld-gradient-primary); color: var(--ld-on-action); }
.search { margin-left: auto; } .search input { height: 38px; width: 220px; border-radius: var(--ld-radius-pill); font-size: var(--ld-type-small); }
.command { margin: 0; padding: 18px; border-radius: var(--ld-radius-control); background: rgb(var(--ld-shade) / 46%); box-shadow: inset 0 0 0 1px var(--ld-line); color: var(--ld-text-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Incident drawer, scrim and notices */
.drawer { position: fixed; z-index: 30; top: 14px; right: 14px; bottom: 14px; width: min(460px, calc(100% - 28px)); padding: 26px; display: grid; gap: 18px; align-content: start; overflow-y: auto; border-radius: var(--ld-radius-card); background: var(--ld-surface-raised); box-shadow: inset 0 0 0 1px var(--ld-line-strong), var(--ld-shadow-lift); transform: translateX(calc(100% + 28px)); transition: transform .5s var(--ld-ease-liquid); }
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; } .drawer h2 { font-size: 24px; font-weight: 500; } .drawer h3 { font-size: var(--ld-type-body); }
.chain { display: grid; gap: 0; }
.chain li { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 0 0 18px 22px; }
.chain li::before { content: ''; position: absolute; left: 3px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--ld-text); box-shadow: 0 0 0 4px rgb(var(--ld-light) / 10%); }
.chain li::after { content: ''; position: absolute; left: 7px; top: 20px; bottom: 0; width: 1px; background: var(--ld-line-strong); }
.chain li:last-child::after { display: none; }
.chain time { color: var(--ld-text-3); font: 500 var(--ld-type-small) var(--ld-mono); }
/* Forms and one-time secrets shown in the drawer */
.drawer form { display: grid; gap: 16px; }
.field select { height: 50px; padding: 0 16px; border: 0; border-radius: var(--ld-radius-control); background: rgb(var(--ld-shade) / 36%); box-shadow: inset 0 0 0 1px var(--ld-line-strong); color: var(--ld-text); font: 500 var(--ld-type-body) var(--ld-font); }
.field select:focus { outline: 0; box-shadow: inset 0 0 0 1.5px var(--ld-action), 0 0 0 5px rgb(var(--ld-light) / 8%); }
.secret.wrap { font-size: var(--ld-type-small); letter-spacing: 0; overflow-wrap: anywhere; user-select: all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font: 500 var(--ld-type-small) var(--ld-mono); }
.codes li { padding: 10px 12px; border-radius: var(--ld-radius-control); box-shadow: inset 0 0 0 1px var(--ld-line); user-select: all; }
.scrim { position: fixed; z-index: 20; inset: 0; background: rgb(var(--ld-shade) / 55%); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .3s both; }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 26px; translate: -50% 0; max-width: calc(100% - 28px); padding: 13px 20px; border-radius: var(--ld-radius-pill); background: var(--ld-bar-fill); color: var(--ld-bar-ink-strong); font-size: var(--ld-type-small); font-weight: 600; box-shadow: 0 20px 50px -18px rgb(var(--ld-shade)); opacity: 0; transform: translateY(16px) scale(.96); transition: opacity .3s, transform .45s var(--ld-ease-liquid); }
.toast.show { opacity: 1; transform: none; }
.noscript { padding: 40px; }

@media (max-width: 1080px) { .three { grid-template-columns: 1fr 1fr; } .two, .two.wide-left { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; } .login-side { padding: 28px 24px; border-right: 0; grid-template-rows: auto; gap: 20px; } .login-orb, .login-points { display: none; }
  .portal { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 25; top: 0; left: 0; width: 286px; margin: 10px; height: calc(100vh - 20px); background: var(--ld-surface-raised); transform: translateX(-120%); transition: transform .5s var(--ld-ease-liquid); }
  .rail-open .rail { transform: none; }
  .rail-toggle { display: grid; }
  .stage-top { display: grid; grid-template-columns: auto 1fr; } .stage-top .chip { grid-column: 1 / -1; grid-row: 1; justify-self: start; }
  .three { grid-template-columns: 1fr; }
  .hero-card { grid-template-columns: 1fr; } .hero-card .ring { justify-self: start; }
  .devices li { grid-template-columns: auto 1fr; } .devices li > span, .devices li > button { grid-column: 2; justify-self: start; }
  .incidents button { grid-template-columns: auto 1fr auto; } .incidents button > span.muted { display: none; }
  .todo li { grid-template-columns: auto 1fr; } .todo li > a { grid-column: 2; justify-self: start; }
  .search { margin-left: 0; width: 100%; } .search input { width: 100%; }
}
