/* Highview Logic portal. Brand colours (--brand*) come from /brand.css, set on the Customize page. */
:root {
  --accent: var(--brand, #0f7fa8);
  --accent-ink: var(--brand-ink, #ffffff);
  --link: color-mix(in srgb, var(--accent) 80%, #000000);
  --ring: color-mix(in srgb, var(--accent) 26%, transparent);
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --input: #ffffff;
  --border: #e2e5ea;
  --border-strong: #d0d5dd;
  --text: #16191f;
  --muted: #5f6673;
  --faint: #8a909b;
  --ok: #1a7a45; --ok-soft: #e3f5ea;
  --warn: #8a5a12; --warn-soft: #fdf3e1;
  --danger: #b42318; --danger-soft: #fdecec;
  --off: #6b7280; --off-soft: #eef0f3;
  --night: #0a1013;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --pop: 0 10px 30px rgba(16, 24, 40, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: var(--brand-dark, #0f7fa8);
    --accent-ink: var(--brand-dark-ink, #ffffff);
    --link: color-mix(in srgb, var(--accent) 70%, #ffffff);
    --bg: #0f1115; --panel: #171a21; --panel-2: #1d212a; --input: #12151b;
    --border: #2a2f3a; --border-strong: #353b47;
    --text: #e8eaee; --muted: #a3a9b5; --faint: #737a87;
    --ok: #3ccf7d; --ok-soft: #173426; --warn: #f3d9a4; --warn-soft: #3a2c12;
    --danger: #f07171; --danger-soft: #3a1c1c; --off: #9aa1ad; --off-soft: #22262e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --pop: 0 10px 30px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
[hidden] { display: none !important; }
.muted { color: var(--faint); }

/* ---------- Brand mark ---------- */
.mark {
  width: 40px; height: 40px; flex: none; overflow: hidden; border-radius: 10px;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 800; letter-spacing: -.02em;
}
.mark.has-logo { background: transparent; }
.mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name { font-weight: 650; letter-spacing: -.01em; line-height: 1.2; min-width: 0; }
.brand-name small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; letter-spacing: 0; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 6px; }
.form label { margin-top: 10px; font-size: 13px; font-weight: 600; }
.form label:first-of-type { margin-top: 0; }
input:not([type=checkbox]):not([type=hidden]), select {
  width: 100%; height: 44px; padding: 0 13px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--input); color: var(--text);
  font: inherit; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
select { padding-right: 32px; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
input[readonly] { background: var(--panel-2); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.fine { margin: 22px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: filter .15s, background .15s, border-color .15s;
}
.btn:hover { background: var(--panel-2); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; height: 44px; margin-top: 12px; font-size: 15px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
form.inline { display: inline; }

.alert { margin: 0 0 18px; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; line-height: 1.4; }
.alert.error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent); }
.alert.info { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent); }

/* ---------- Sign-in pages: brand panel | form ---------- */
body.auth { display: grid; grid-template-columns: minmax(380px, 44%) minmax(0, 1fr); background: var(--panel); }
body.auth.plain { grid-template-columns: 1fr; }
.brand-panel {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  min-height: 100vh; padding: 40px 48px 36px; color: #e8eef0;
  background:
    radial-gradient(70% 55% at 12% 8%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    radial-gradient(55% 45% at 95% 70%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 400' preserveAspectRatio='none'%3E%3Cpath fill='%23ffffff' fill-opacity='0.028' d='M0 400V250l140-90 90 50 150-150 110 110 90-60 170 140 120-80 150 100 110-70 70 40v160z'/%3E%3C/svg%3E") left bottom / 100% 46% no-repeat,
    var(--night);
}
.brand-panel::after {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; height: 28%; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 38%, var(--night)) 0%, var(--night) 80%);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300' preserveAspectRatio='none'%3E%3Cpath d='M0 300V170l120-60 110 70 170-140 120 110 80-40 160 120 140-90 120 70 100-50 80 40v200z'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300' preserveAspectRatio='none'%3E%3Cpath d='M0 300V170l120-60 110 70 170-140 120 110 80-40 160 120 140-90 120 70 100-50 80 40v200z'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
}
.brand-top { display: flex; align-items: center; gap: 12px; }
.brand-panel .brand-name { font-size: 17px; color: #ffffff; }
.brand-panel .brand-name small { color: rgba(232, 238, 240, .6); }
.brand-mid { max-width: 440px; margin-bottom: 12vh; }
.brand-mid h2 { margin: 0 0 14px; font-size: clamp(30px, 3.1vw, 44px); font-weight: 650; line-height: 1.12; letter-spacing: -.025em; color: #ffffff; text-wrap: balance; }
.brand-mid p { margin: 0; max-width: 46ch; font-size: 16px; line-height: 1.55; color: rgba(232, 238, 240, .72); text-wrap: pretty; }
.brand-foot { font-size: 12.5px; color: rgba(232, 238, 240, .5); }

.auth-main { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 56px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { margin-bottom: 6px; font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -.02em; }
.auth-box .sub { margin: 0 0 26px; font-size: 14.5px; color: var(--muted); }

.steps { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 12px; }
.steps li { padding-left: 4px; color: var(--muted); }
.steps li b { color: var(--text); font-weight: 600; }
.qr { width: 184px; margin: 12px 0 4px; padding: 10px; border-radius: 12px; background: #ffffff; border: 1px solid var(--border); }
.qr svg { display: block; width: 100%; height: auto; }
.manual summary { cursor: pointer; color: var(--link); font-size: 13px; }
.manual p { margin: 6px 0; font-size: 13px; }
.key { display: block; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); color: var(--text); font-size: 14px; letter-spacing: .06em; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.codes code { font-size: 15px; letter-spacing: .04em; text-align: center; }

@media (max-width: 880px) {
  body.auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .brand-panel { min-height: 0; padding: 14px 20px; }
  .brand-panel::after, .brand-mid, .brand-foot { display: none; }
  .brand-panel .mark { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }
  .brand-panel .brand-name { font-size: 15.5px; }
  .auth-main { align-items: flex-start; padding: 36px 20px 28px; }
}

/* ---------- Signed-in pages ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; min-width: 0; }
.brand .mark { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }
.brand .brand-name small { color: var(--muted); font-size: 12px; margin-top: 0; }
.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; text-decoration: none; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a[aria-current=page] { background: var(--panel-2); color: var(--text); }
.menu { position: relative; margin-left: auto; }
.menu summary { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 99px; cursor: pointer; list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--panel-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, var(--panel)); color: var(--link); font-size: 12px; font-weight: 700; }
.menu-name { font-weight: 550; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--pop); }
.menu-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-head b, .menu-head span { display: block; }
.menu-head span { color: var(--muted); font-size: 12.5px; }
.menu-pop a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.menu-pop a:hover { background: var(--panel-2); }

.content { max-width: 1100px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-h { font-size: 24px; font-weight: 650; margin-bottom: 4px; }
.page-h + .cards, .page-h + .card { margin-top: 20px; }
.page-sub { margin: 0 0 24px; color: var(--muted); }
.page-head .page-sub { margin: 0; }
.crumb { margin: 0 0 6px; font-size: 13px; }
.crumb a::before { content: "\2190  "; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tile {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px; min-height: 104px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  color: var(--text); text-decoration: none !important; transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.tile:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--pop); transform: translateY(-1px); }
.tile-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 11px; background: color-mix(in srgb, var(--accent) 13%, var(--panel)); color: var(--link); }
.tile-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile-body { display: grid; gap: 3px; min-width: 0; }
.tile-body b { font-size: 15.5px; font-weight: 650; }
.tile-body span { color: var(--muted); font-size: 13.5px; }
.tile-body em { margin-top: 4px; font-style: normal; font-size: 12px; font-weight: 600; color: var(--faint); }
.tile.disabled { box-shadow: none; background: transparent; border-style: dashed; }
.tile.disabled .tile-icon { background: var(--panel-2); color: var(--faint); }
.tile.disabled b { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.card { padding: 20px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.card + .card, .card + .cards, .cards + .card { margin-top: 16px; }
.cards .card + .card { margin-top: 0; }
.card h2 { margin-bottom: 12px; font-size: 16px; font-weight: 650; }
.card p { margin: 0 0 12px; color: var(--muted); }
.card.narrow { max-width: 520px; }
.card.highlight { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); margin-bottom: 16px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.off { background: var(--off-soft); color: var(--off); }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .sub { display: block; color: var(--muted); font-size: 12.5px; }

@media (max-width: 700px) {
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .brand .brand-name small, .menu-name { display: none; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .content { padding: 24px 16px 48px; }
  .page-head { flex-direction: column; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}
