/* Client license portal — design tokens shared with the license console
   (licgen-web) and lifted from smartapc.live, so the portal, the console and
   the marketing site read as one product: dark navy, sky-blue accent, glassy
   panels, gradient CTAs. */

:root {
  --bg: #08111f;
  --bg-soft: #0f1b2d;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --muted-2: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --accent-soft: #bfefff;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --max-width: 1180px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Author display rules on classes otherwise beat the UA hidden style. */
[hidden] { display: none !important; }

body {
  font-family: Arial, sans-serif;
  /* Signed-in pages carry a muted concentrator-mill watermark under a heavy
     wash + sky glow, so the dashboard isn't flat black. On the login screen
     the opaque .login-bg sits on top of this, so its own backdrop wins there. */
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(7, 16, 29, 0.74) 0%, rgba(10, 20, 36, 0.86) 100%),
    url("/static/dash-bg.jpg") center center / cover no-repeat;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------- header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 26px;
  min-height: 72px;
  backdrop-filter: blur(14px);
  background: rgba(7, 16, 29, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 16px rgba(14, 165, 233, 0.28));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
}
.brand-text span {
  color: var(--muted-2);
  font-weight: 600;
  font-size: 0.82rem;
}

.who { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 0.92rem; }

main { max-width: var(--max-width); margin: 34px auto; padding: 0 20px; }

/* ------------------------------------------------------------- cards + grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

/* A card that wants the whole row rather than a column — the grouped licence
   directory, whose rows read as "id · site · binding" on one line. */
.grid > .card.wide { grid-column: 1 / -1; }

.card {
  /* Frosted, a touch more opaque than pure glass so dense text stays crisp
     over the mill-hall watermark. */
  background: rgba(17, 26, 42, 0.72);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

/* ------------------------------------------------------------- welcome banner */

.welcome { margin-bottom: 24px; max-width: 760px; }
.welcome .label {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.82rem;
  display: inline-block;
}
.welcome h1 { font-size: 1.9rem; line-height: 1.15; margin: 4px 0 8px; font-weight: 800; }
.welcome p { color: var(--muted); font-size: 1rem; }

/* ------------------------------------------------------------- login page */

/* Full-bleed wrapper so the mining watermark can sit behind the login card.
   Because #authView carries the `hidden` attribute on the other views, the
   fixed backdrop only exists while the login screen is on-screen. */
.authwrap {
  position: relative;
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 18px;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* Muted, watermark-like: a light slate wash over the mine photo, plus a
     faint sky-blue glow so it ties into the palette. Matches the console. */
  background:
    radial-gradient(circle at 78% 15%, rgba(56, 189, 248, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(8, 17, 31, 0.54) 0%, rgba(8, 17, 31, 0.66) 55%, rgba(8, 17, 31, 0.82) 100%),
    url("/static/plant-bg.jpg") center center / cover no-repeat;
}

.auth {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  padding: 38px 34px;
  text-align: left;
  /* Translucent + blur lets a hint of the mine show through the card. */
  background: rgba(26, 34, 44, 0.82);
  backdrop-filter: blur(8px);
}
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .brand-logo { height: 64px; margin: 0 auto 16px; }
.auth-head h1 { font-size: 1.45rem; font-weight: 800; margin-bottom: 8px; }
.auth-head p { color: var(--muted); font-size: 0.95rem; line-height: 1.5; }

.photo-credit {
  position: fixed;
  right: 12px;
  bottom: 9px;
  z-index: 2;
  margin: 0;
  font-size: 0.62rem;
  color: var(--muted-2);
  opacity: 0.4;
  text-align: right;
  pointer-events: none;
}

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  padding: 10px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  transition: 0.2s ease;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.tab.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.28);
  color: var(--accent-soft);
}

.authform { display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------------------- forms */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input, textarea, select {
  font-family: Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}
select option { background: var(--bg-soft); color: var(--text); }
input[type="file"] { padding: 8px; font-size: 0.9rem; color: var(--muted); }

/* Roomier login fields — the one form users hit cold. */
.authform input { padding: 12px 14px; }
.authform label { font-size: 0.9rem; color: var(--muted); }

textarea {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  resize: vertical;
}

/* Admin "Issue a license" form: stack every control with even spacing so the
   Load-template / Sign-&-issue buttons never crowd the fields. */
#issueForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
#issueForm > label,
#issueForm > .rebind,
#issueForm > textarea { align-self: stretch; }

/* Customer "Request a license" panel: its file input / textarea / button sit
   directly in the card (not a flex form), so give them breathing room. */
#requestFile,
#requestText,
#uploadRequestBtn,
#requestMsg,
#requestList { margin-top: 12px; }

/* ------------------------------------------------------------- buttons */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.2s ease;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04111d;
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.22);
  white-space: nowrap;
}
button:hover { transform: translateY(-1px); filter: brightness(1.05); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
  box-shadow: none;
}
button.secondary:hover { background: rgba(255, 255, 255, 0.09); }

button.link {
  background: none;
  color: var(--accent);
  padding: 0;
  min-height: 0;
  font-weight: 600;
  box-shadow: none;
}
button.link:hover { transform: none; filter: none; text-decoration: underline; }

/* ------------------------------------------------------------- messages */

.hint { color: var(--muted); font-size: 0.85rem; }
.hint code, code {
  background: rgba(3, 9, 18, 0.6);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.82rem;
}

.msg { min-height: 18px; font-size: 0.88rem; margin: 8px 0 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--bad); }

/* ------------------------------------------------------------- lists + rows */

.list { display: flex; flex-direction: column; gap: 10px; }

.row {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px 12px;
  align-items: center;
  /* Wrap the action group below the details when the card is narrow, rather
     than letting the badge and Download button collide. */
  flex-wrap: wrap;
}
/* min-width:0 lets the details column shrink and wrap its text instead of
   squeezing the actions; the action group keeps its size and can wrap whole. */
.row .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 60%; }
.row > div:not(.meta) { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: auto; }
.row .id { font-weight: 700; }
.row .sub { color: var(--muted-2); font-size: 0.82rem; }
.row.dim { opacity: 0.5; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: rgba(52, 211, 153, 0.16); color: #86e8c3; }
.badge.warn { background: rgba(251, 191, 36, 0.16); color: #fcd980; }
.badge.bad { background: rgba(248, 113, 113, 0.16); color: #f9a8a8; }

.empty { color: var(--muted-2); font-size: 0.9rem; padding: 6px 0; }

/* The site a licence or request is for — sits between the id and the technical
   sub-line, so "what is this for" reads before "how is it bound". */
.row .site { color: var(--muted); font-size: 0.85rem; }
.row .site.muted { color: var(--muted-2); font-style: italic; }

/* ------------------------------------------- admin: licences by account */

/* Each account is a <details> group so a busy console can be collapsed down
   to one line per customer. */
.acct {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.acct > summary {
  cursor: pointer;
  padding: 11px 14px;
  display: flex;
  align-items: baseline;
  gap: 6px 12px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.05);
  list-style: none;
}
/* Replace the default disclosure triangle with one that matches .chev. */
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary::before {
  content: "\25B8";
  color: var(--accent);
  font-size: 0.85em;
  transition: transform 0.15s ease;
  display: inline-block;
}
.acct[open] > summary::before { transform: rotate(90deg); }
.acct > summary:hover { background: rgba(255, 255, 255, 0.08); }
.acct-name { font-weight: 700; }
.acct-email { color: var(--muted); font-size: 0.85rem; }
.acct-count {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 0.78rem;
  white-space: nowrap;
}
/* The sites this account holds licences for — wraps under the name on narrow
   cards rather than pushing the count off the row. */
.acct-sites {
  flex-basis: 100%;
  color: var(--muted-2);
  font-size: 0.8rem;
}
.acct-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }

/* ------------------------------------------------------- licence details */

.lic-item { display: flex; flex-direction: column; }
.lic-item.dim { opacity: 0.55; }

.lic-row { cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.lic-row:hover { border-color: rgba(56, 189, 248, 0.4); background: rgba(255, 255, 255, 0.06); }

.chev {
  display: inline-block;
  color: var(--accent);
  font-size: 0.85em;
  transition: transform 0.15s ease;
}
.lic-item.open .chev { transform: rotate(90deg); }

.lic-details {
  margin-top: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px 16px;
  background: rgba(3, 9, 18, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.det-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.det-sec h4 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 700;
}
.det-kv {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 4px 12px;
  font-size: 0.85rem;
}
.det-kv dt { color: var(--muted-2); }
.det-kv dd { color: var(--text); overflow-wrap: anywhere; }

.det-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.det-table th {
  text-align: left;
  color: var(--muted-2);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 4px 8px;
  border-bottom: 1px solid var(--panel-border);
}
.det-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--muted);
}
.det-table td strong { color: var(--text); }

.det-note {
  border-left: 3px solid var(--warn);
  background: rgba(251, 191, 36, 0.08);
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  font-size: 0.83rem;
  color: var(--muted);
}
.ok-text { color: #86e8c3; }
.warn-text { color: #fcd980; }

/* ------------------------------------------------------------- admin stats */

.admin-overview .stats { margin-top: 4px; }
.stats { display: flex; gap: 30px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 1.6rem; font-weight: 800; }
.stat span { color: var(--muted-2); font-size: 0.8rem; }

/* ------------------------------------------------------------- rebind panel */

.rebind {
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
}
.rebind.over { border-color: rgba(248, 113, 113, 0.55); }
.rebind-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rebind-move { color: var(--muted-2); }

.hist { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.hrow {
  display: grid;
  grid-template-columns: 90px 70px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  background: rgba(3, 9, 18, 0.5);
  border-radius: 8px;
  font-size: 0.78rem;
}
.hrow .sub { text-align: right; }

.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Licence rows carry a status badge plus a Download button — let the pair wrap
   inside the card instead of spilling past its edge. */
.row .row-actions { flex-wrap: wrap; justify-content: flex-end; flex-shrink: 1 !important; }

.subhead { margin: 18px 0 4px; font-size: 0.95rem; }

/* Account rows sit in a full-width card, so the identity gets the room and the
   Delete button stays pinned right rather than squeezing the text. */
.acct-row .meta { min-width: 0; }
.acct-row .meta .sub { white-space: normal; }

/* A licence group whose login has been deleted. Marked, not dimmed — the
   licences under it are still in force and still get downloaded. */
.acct.gone > summary { border-left: 3px solid rgba(250, 204, 21, 0.55); padding-left: 9px; }

/* --------------------------------------------------- emailed link pages */

/* /verify and /reset stand alone: no top bar, no dashboard — just one card
   centred on the page, reusing the auth card's proportions. */
.linkpage {
  max-width: 480px;
  margin: 12vh auto;
  padding: 0 20px;
  text-align: center;
}
.linkpage .card { padding: 34px 30px; }
.linkpage .brand-logo { height: 44px; margin-bottom: 14px; }
.linkpage h1 { font-size: 1.35rem; margin: 0 0 10px; }
.linkpage p { color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.linkpage .authform { text-align: left; margin-top: 18px; }
.gobtn {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.gobtn:hover { text-decoration: underline; }

/* The dashboard's own tabs. Same pills as the login card, but they sit above a
   full-width grid rather than inside a narrow card, so they are held to a
   readable width instead of stretching across the page. */
.dashtabs {
  max-width: 420px;
  margin: 0 0 18px;
}

/* The enquiry is a form, not a dashboard: held to a readable measure rather
   than stretched across the grid's full width. */
#dashInterest { max-width: 660px; }
#dashInterest .hint { margin-bottom: 18px; }
#interestForm textarea { min-height: 110px; }

/* A field label with "optional" pushed out to the right of it. The label is a
   flex column, so the two words need their own row to share. */
.lbl {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.opt {
  font-size: 0.75rem;
  color: var(--muted-2);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* The honeypot. Off-screen rather than display:none — a bot that reads the
   stylesheet skips what is plainly hidden, and this is meant to be filled in
   by exactly the kind of bot that doesn't look. */
.nothing-to-see {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* "Check your email": the pane the auth card turns into once a verification
   or reset link is out. No form to fill in — just what happened, and the one
   escape hatch (send it again) for a link that never arrived. */
.sentpane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 6px 0 2px;
}
.sentpane .sent-mark {
  font-size: 1.6rem;
  line-height: 1;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-soft);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.sentpane h2 { margin: 4px 0 0; font-size: 1.15rem; }
.sentpane p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.sentpane .hint { color: var(--muted-2); font-size: 0.85rem; }
.sentpane button.link { margin-top: 2px; }

/* "Forgot password?" / "Back to log in": quiet text links under the form's
   primary button, not competing with it. */
/* `button.link` is (0,1,1), so match it to win — these are secondary to the
   form's primary button and must not compete with it. */
button.link.forgot {
  align-self: center;
  margin-top: -2px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
}
button.link.forgot:hover { color: var(--accent); }

/* The console's destructive actions — visibly not an ordinary button, and
   visibly inert when the server would refuse the deletion anyway. */
button.danger { border-color: rgba(248, 113, 113, 0.45); color: #fca5a5; }
button.danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.12); }
button.danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  main { margin: 22px auto; }
  .auth { padding: 30px 24px; }
  .welcome h1 { font-size: 1.5rem; }
}
