/*
 * Sat-Cable panel — the new stylesheet.
 *
 * Hand-written, using daisyUI's CLASS VOCABULARY: btn / btn-primary / table /
 * badge / card / input / menu / drawer. That is deliberate. Ubuntu 22.04 ships
 * Node 12 and Vite 8 needs 20+, so a real Tailwind + daisyUI build would mean
 * adding a third-party apt repository and ~300 npm packages to the box that
 * holds the SSH keys to eight card servers. Writing the same class names by
 * hand means the markup is what daisyUI expects, so swapping in the real thing
 * later is a stylesheet change rather than a rewrite of every view - and until
 * then there is no build step, and therefore no stale-artefact failure mode.
 *
 * Themes: the bare :root block is the complete light palette. The dark palette
 * is redefined in two places - a prefers-color-scheme block guarded so an
 * explicit light choice still wins, and a [data-theme="dark"] block so the
 * toggle wins in the other direction. Nothing outside these blocks names a
 * colour literal.
 */

:root {
  --ground:      #F7F8FA;
  --surface:     #FFFFFF;
  --surface-2:   #F1F3F7;
  --row-hover:   #EEF1F6;
  --sidebar:     #1B2129;
  --sidebar-ink: #C3CBD6;
  --sidebar-ink-strong: #FFFFFF;

  --ink:         #171C23;
  --ink-2:       #4A5563;
  --ink-3:       #77808E;
  --rule:        #E1E5EC;
  --rule-strong: #C9D0DA;

  --primary:      #0F766E;
  --primary-ink:  #FFFFFF;
  --primary-soft: #E2F3F1;

  --success: #15803D;
  --warning: #B45309;  --warning-soft: #FBF0DF;
  --error:   #B91C1C;  --error-soft:   #FBE9E9;

  --font-ui:   'Archivo', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-data: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --radius: 6px;
  --gutter: clamp(12px, 2vw, 20px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #12161C; --surface: #1A1F27; --surface-2: #222834; --row-hover: #232A35;
    --sidebar: #0D1116; --sidebar-ink: #9BA6B4; --sidebar-ink-strong: #FFFFFF;
    --ink: #EDF1F6; --ink-2: #AFB9C6; --ink-3: #7E8998;
    --rule: #2A313C; --rule-strong: #3A4350;
    --primary: #5EEAD4; --primary-ink: #06201D; --primary-soft: #143631;
    --success: #4ADE80;
    --warning: #FBBF24; --warning-soft: #33260B;
    --error: #F87171;   --error-soft: #35191A;
  }
}

:root[data-theme="dark"] {
  --ground: #12161C; --surface: #1A1F27; --surface-2: #222834; --row-hover: #232A35;
  --sidebar: #0D1116; --sidebar-ink: #9BA6B4; --sidebar-ink-strong: #FFFFFF;
  --ink: #EDF1F6; --ink-2: #AFB9C6; --ink-3: #7E8998;
  --rule: #2A313C; --rule-strong: #3A4350;
  --primary: #5EEAD4; --primary-ink: #06201D; --primary-soft: #143631;
  --success: #4ADE80;
  --warning: #FBBF24; --warning-soft: #33260B;
  --error: #F87171;   --error-soft: #35191A;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-ui); text-wrap: balance; margin: 0 0 .4em; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 .7em; }
a { color: var(--primary); }
img { max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-radius: 3px; }

.mono, .font-data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.dim   { color: var(--ink-2); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: var(--gutter); display: flex; flex-direction: column; gap: 14px; }

/* ---------- drawer (the sidebar) ---------- */
.drawer-side {
  background: var(--sidebar); color: var(--sidebar-ink);
  padding: 14px 10px; display: flex; flex-direction: column; gap: 16px;
}
.drawer-brand { display: flex; align-items: center; gap: 8px; padding: 0 6px 2px; }
.drawer-brand-mark {
  width: 24px; height: 24px; border-radius: 5px; flex: none;
  background: var(--primary); color: var(--primary-ink);
  display: grid; place-items: center; font-family: var(--font-ui); font-weight: 700; font-size: 13px;
}
.drawer-brand-name { font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--sidebar-ink-strong); }

.menu { display: flex; flex-direction: column; gap: 1px; list-style: none; margin: 0; padding: 0; }
.menu-title {
  font-family: var(--font-ui); font-size: 10px; letter-spacing: .11em;
  text-transform: uppercase; color: #6C7787; padding: 6px 6px 3px;
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 8px; border: 0; background: none; border-radius: 4px;
  color: var(--sidebar-ink); text-decoration: none; font-size: 13px; text-align: left;
}
.menu a:hover, .menu button:hover { background: rgba(255,255,255,.06); color: var(--sidebar-ink-strong); }
.menu a.active, .menu a[aria-current="page"] {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--sidebar-ink-strong); font-weight: 500;
}
.menu .icon { width: 14px; text-align: center; opacity: .8; flex: none; font-size: 12px; }
.menu .badge-count { margin-left: auto; font-size: 11px; color: #6C7787; font-family: var(--font-data); }

/* ---------- navbar ---------- */
.navbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.navbar-title { font-family: var(--font-ui); font-size: 15px; font-weight: 600; margin: 0; }
.navbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- a single line of numbers, not a wall of tiles ---------- */
.stats-line {
  display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap;
  padding: 7px var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--rule);
  font-size: 13px; color: var(--ink-2);
}
.stats-line b { font-family: var(--font-data); font-weight: 500; color: var(--ink); font-size: 13.5px; }
.stats-line .divider { color: var(--rule-strong); }
.stats-line .attention {
  color: var(--warning); background: var(--warning-soft);
  padding: 1px 8px; border-radius: 999px; font-weight: 500;
}
.stats-line .attention b { color: var(--warning); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 5px; justify-content: center;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  padding: 5px 10px; border-radius: var(--radius);
  font-family: var(--font-ui); font-weight: 500; font-size: 12.5px;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.07); border-color: var(--primary); }
.btn-error { background: var(--error); border-color: var(--error); color: #fff; }
.btn-ghost { border-color: transparent; background: none; }
.btn-xs { padding: 2px 7px; font-size: 11.5px; }
.btn-block { width: 100%; }

/* ---------- form controls ---------- */
.input, .select, .textarea {
  width: 100%; padding: 5px 10px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); outline: none; }
.label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 3px; }
.form-control { margin-bottom: 10px; }

.join { display: inline-flex; background: var(--surface-2); border-radius: 5px; padding: 2px; gap: 1px; }
.join button, .join a {
  border: 0; background: none; color: var(--ink-2); text-decoration: none;
  padding: 3px 9px; border-radius: 4px; font-size: 12px; font-family: var(--font-ui); font-weight: 500;
}
.join button[aria-pressed="true"], .join a[aria-current="page"] {
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.12);
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 999px;
  font-family: var(--font-ui); font-weight: 600; font-size: 11px; white-space: nowrap;
}
.badge-success { color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-error   { background: var(--error-soft);   color: var(--error); }
.badge-ghost   { color: var(--ink-3); }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.card-title {
  font-family: var(--font-ui); font-weight: 600; font-size: 13px;
  padding: 8px 12px; border-bottom: 1px solid var(--rule); margin: 0;
}
.card-body { padding: 12px; }

/* ---------- table: the thing most pages are ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.table { border-collapse: collapse; width: 100%; font-size: 13px; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; white-space: nowrap;
  font-family: var(--font-ui); font-weight: 600; font-size: 10.5px;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
  background: var(--surface-2);
  padding: 6px 10px; border-bottom: 1px solid var(--rule);
}
.table thead th button {
  border: 0; background: none; color: inherit; font: inherit; padding: 0;
  display: inline-flex; align-items: center; gap: 3px;
  letter-spacing: inherit; text-transform: inherit;
}
.table thead th .sort-arrow { color: var(--primary); font-size: 9px; }
.table tbody td { padding: 6px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tbody tr:last-child > td { border-bottom: 0; }
.table tbody tr:hover > td { background: var(--row-hover); }
.table tbody tr.selected > td { background: var(--primary-soft); }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.table .empty { padding: 20px 10px; text-align: center; color: var(--ink-3); }

.table-foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding-top: 8px; color: var(--ink-3); font-size: 12px;
}

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.toolbar .search { position: relative; flex: 1 1 240px; min-width: 0; }
.toolbar .search .input { padding-left: 28px; }
.toolbar .search .icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 13px; pointer-events: none;
}

/* ---------- alerts ---------- */
.alert {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 12px; border-radius: var(--radius); font-size: 13px;
  border: 1px solid var(--rule);
}
.alert-success { background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-color: var(--success); color: var(--ink); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning); color: var(--ink); }
.alert-error   { background: var(--error-soft);   border-color: var(--error);   color: var(--ink); }
.alert-info    { background: var(--primary-soft); border-color: var(--primary); color: var(--ink); }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 3px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.pagination li > * {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 7px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
  font-family: var(--font-data); font-size: 12px;
}
.pagination li.active > * { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.pagination li.disabled > * { opacity: .45; }

/* ---------- modal ---------- */
.modal {
  border: 1px solid var(--rule); border-radius: 8px; padding: 0;
  background: var(--surface); color: var(--ink);
  width: min(420px, calc(100vw - 24px));
  box-shadow: 0 16px 40px rgba(0,0,0,.3);
}
.modal::backdrop { background: rgba(8,12,18,.55); }
.modal-title { padding: 13px 15px 0; }
.modal-body { padding: 11px 15px; display: flex; flex-direction: column; gap: 6px; }
.modal-action { display: flex; gap: 6px; justify-content: flex-end; padding: 0 15px 13px; }

/* A second line inside a table cell: the customer's note, the owning reseller,
   the masked address. Block, so it sits under the value rather than running on
   after it. */
.sub { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.sub img { vertical-align: -1px; margin-right: 3px; }

/* Operating somebody else's account. Deliberately loud: everything done here
   is attributed to them, not to you. */
.impersonation-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px var(--gutter);
  background: var(--warning-soft); color: var(--ink);
  border-bottom: 1px solid var(--warning);
  font-size: 12.5px;
}

/* A body of text somebody wrote: a ticket, a post, a broadcast. Rendered from
   an allow-list, so these are the tags it can contain. */
.prose { line-height: 1.55; overflow-wrap: anywhere; }
.prose > :last-child { margin-bottom: 0; }
.prose img { max-width: 100%; height: auto; border-radius: 4px; }
.prose blockquote {
  margin: 0 0 .7em; padding: 2px 0 2px 12px;
  border-left: 3px solid var(--rule-strong); color: var(--ink-2);
}
.prose pre { background: var(--surface-2); padding: 8px 10px; border-radius: 5px; overflow-x: auto; }
.prose code { font-family: var(--font-data); font-size: .92em; }
.prose table { border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--rule); padding: 4px 7px; }

.textarea { min-height: 9em; resize: vertical; font-family: inherit; line-height: 1.5; }

/* A config file, shown for copying. Monospace, scrollable, never wrapped -
   a wrapped C: line is a line somebody pastes wrong. */
.config {
  font-family: var(--font-data); font-size: 12.5px; line-height: 1.5;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 5px;
  padding: 9px 11px; margin: 0; overflow-x: auto; white-space: pre;
  user-select: all;
}

/* A state-changing action, which is a form rather than a link. Inline-flex so
   it sits on the line in a toolbar; a <form> is block-level by default. */
.post-action { display: inline-flex; margin: 0; }

.flash { gap: 6px; }

/* ---------- utility ---------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.mobile-only { display: none; }

/* ---------- the signed-out pages ---------- */
/*
 * Every session starts here, so this is the whole of the refreshed design that
 * most resellers see before they see anything else. Two columns on a desktop -
 * a quiet brand panel and the form - collapsing to the form alone below 760px,
 * which is where roughly a tenth of the traffic is.
 */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  background: var(--ground);
}

.auth-aside {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: clamp(24px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}
.auth-aside h2 {
  color: var(--sidebar-ink-strong);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
  margin: 0;
  max-width: 15ch;
}
.auth-aside p { margin: 0; max-width: 42ch; font-size: 14px; }
.auth-facts { display: flex; flex-direction: column; gap: 9px; margin: 6px 0 0; padding: 0; list-style: none; }
.auth-facts li { display: flex; gap: 9px; align-items: baseline; font-size: 13px; }
.auth-facts b {
  font-family: var(--font-data); font-weight: 500; font-size: 13px;
  color: var(--sidebar-ink-strong); min-width: 2.6em; text-align: right;
}

.auth-main {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: clamp(20px, 4vw, 44px) var(--gutter);
  gap: 14px;
}
.auth-card { width: min(370px, 100%); display: flex; flex-direction: column; gap: 13px; }
.auth-card h1 { font-size: 21px; margin: 0; }
.auth-card > .lede { color: var(--ink-2); font-size: 13.5px; margin: -8px 0 0; }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-field { display: flex; flex-direction: column; gap: 3px; }
.auth-check { display: flex; gap: 7px; align-items: center; font-size: 13px; color: var(--ink-2); }
.auth-links {
  display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between;
  font-size: 13px; color: var(--ink-2);
}
.auth-foot { width: min(370px, 100%); display: flex; align-items: center; gap: 10px; }
.auth-foot small { color: var(--ink-3); font-size: 12px; }

.brand-lockup { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px; flex: none;
  background: var(--primary); color: var(--primary-ink);
  font-family: var(--font-ui); font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
}
.brand-name { font-family: var(--font-ui); font-weight: 600; font-size: 15px; }
.auth-aside .brand-name { color: var(--sidebar-ink-strong); }

@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; min-height: 100dvh; }
  .auth-aside { display: none; }
}

/* ---------- the public page ---------- */
/*
 * / takes 263 hits a day and was titled "CCcamPanel Login". It sits on the same
 * tokens as the panel, so somebody who signs up lands somewhere that looks like
 * where they came from - which is the point of having one stylesheet.
 */
.landing { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter) 60px; }

.landing-nav {
  display: flex; align-items: center; gap: 10px;
  padding-block: 18px; flex-wrap: wrap;
}
.landing-nav .brand-lockup { margin-right: auto; }

.landing-hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 44px); align-items: center;
  padding-block: clamp(18px, 4vw, 40px);
}
.landing-hero h1 {
  font-size: clamp(28px, 4.4vw, 44px); line-height: 1.08;
  letter-spacing: -.015em; margin: 0 0 .45em; max-width: 16ch;
}
.landing-hero p { font-size: clamp(15px, 1.6vw, 17px); color: var(--ink-2); max-width: 46ch; }
.landing-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.landing-actions .btn { padding: 7px 15px; font-size: 14px; }

/* The subject's own material: the four lines a customer actually pastes. */
.landing-terminal {
  background: var(--sidebar); border-radius: 9px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(8, 12, 18, .22);
}
.landing-terminal-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 11px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-family: var(--font-data); font-size: 11px; color: #7E8998;
}
.landing-terminal-bar i { width: 8px; height: 8px; border-radius: 50%; background: #3A4350; }
.landing-terminal pre {
  margin: 0; padding: 13px 14px; overflow-x: auto;
  font-family: var(--font-data); font-size: 12.5px; line-height: 1.7;
  color: #C3CBD6; white-space: pre;
}
.landing-terminal .k { color: #5EEAD4; }

.landing-section { padding-block: clamp(26px, 5vw, 48px); border-top: 1px solid var(--rule); }
.landing-section h2 { font-size: clamp(20px, 2.6vw, 26px); margin: 0 0 .3em; letter-spacing: -.01em; }
.landing-section > p { color: var(--ink-2); max-width: 60ch; }

.landing-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 22px; }
.landing-step h3 { font-size: 15px; margin: 0 0 .25em; }
.landing-step p { color: var(--ink-2); font-size: 13.5px; margin: 0; }
.landing-step .step-n {
  display: block; font-family: var(--font-data); font-size: 11px;
  color: var(--primary); margin-bottom: 5px; letter-spacing: .06em;
}

.landing-figures { display: flex; gap: 26px; flex-wrap: wrap; align-items: baseline; margin: 18px 0 0; }
.landing-figure b {
  display: block; font-family: var(--font-ui); font-size: clamp(26px, 4vw, 38px);
  font-weight: 700; line-height: 1; letter-spacing: -.02em;
}
.landing-figure span { font-size: 12.5px; color: var(--ink-3); }

.landing-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 7px; }
.landing-list li { display: flex; gap: 9px; font-size: 14px; color: var(--ink-2); }
.landing-list li::before { content: "\2713"; color: var(--primary); flex: none; }

.landing-foot {
  border-top: 1px solid var(--rule); padding-block: 20px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-3);
}

@media (max-width: 760px) {
  .landing-hero { grid-template-columns: 1fr; }
  .landing-steps { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .drawer-side { display: none; }
  .drawer-side.open { display: flex; }
  .mobile-only { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
