/* Hotspot panel look. The colours come from the client (set in panel.js: --brand, --brand-dark and their tints), so every client's panel wears its own colours. */
:root {
  --bg: #f5f6f8; --card: #fff; --text: #1c2430; --muted: #667085; --line: #e4e7ec; --line-strong: #cbd2db;
  --brand: #0f6b5c; --brand-dark: #0a4d42; --on-brand: #fff; --on-header: #fff; --brand-d: #0c5a4d;
  --brand-t6: #f1f8f6; --brand-t12: #e3f1ee; --brand-t25: #c5e2dc; --brand-a25: rgba(15, 107, 92, .25);
  --danger: #b3261e; --warn-bg: #fff4d6; --ok-bg: #e2f5ea; --err-bg: #fde7e5;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 10px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
a { color: var(--brand); text-underline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .86rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ---- top bar: logo + name, who is logged in, one account menu ---- */
header.top { background: var(--brand-dark); color: var(--on-header); box-shadow: 0 1px 0 rgba(0, 0, 0, .12); }
header.top .wrap { display: flex; align-items: center; gap: 14px; padding-top: 10px; padding-bottom: 10px; }
header.top .brand { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; font-weight: 700; font-size: 1.08rem; }
header.top .brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { height: 40px; width: auto; flex: none; border-radius: 9px; background: #fff; padding: 3px; vertical-align: middle; }
header.top .who { opacity: .85; white-space: nowrap; }
details.menu { position: relative; }
details.menu summary { list-style: none; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: rgba(255, 255, 255, .2); color: var(--on-header); user-select: none; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary:hover, details.menu[open] summary { background: rgba(255, 255, 255, .32); }
details.menu .menu-body { position: absolute; right: 0; top: 48px; z-index: 30; min-width: 230px; padding: 6px; background: #fff; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .22); }
.menu-who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-body button { display: block; width: 100%; text-align: left; background: transparent; color: var(--text); border: 0; border-radius: 8px; padding: 10px 12px; min-height: 0; box-shadow: none; }
.menu-body button:hover { background: var(--brand-t6); color: var(--text); }
.menu-body button.out { color: var(--danger); }

/* ---- tabs: one scrollable row, the open one underlined in the brand colour, and a Refresh button at the end ---- */
.tabbar { display: flex; align-items: stretch; gap: 8px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
button.refresh { align-self: center; flex: none; min-height: 36px; padding: 6px 14px; margin-bottom: 4px; font-size: .9rem; }
nav.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; margin: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a { flex: none; padding: 12px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
nav.tabs a:hover { color: var(--text); background: var(--brand-t6); }
nav.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }

/* ---- cards, rows, forms ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child { padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.row > * { flex: 1 1 190px; }
.row > .shrink { flex: 0 0 auto; }
label { display: block; font-size: .86rem; font-weight: 600; margin: 0 0 5px; color: #344054; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; background: #fff; color: inherit; transition: border-color .12s, box-shadow .12s; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-a25); }
textarea { min-height: 84px; }
button { font: inherit; font-weight: 600; min-height: 42px; padding: 9px 18px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); cursor: pointer;
  transition: background .12s, box-shadow .12s, transform .05s; }
button:hover { background: var(--brand-d); border-color: var(--brand-d); }
button:active { transform: translateY(1px); }
button:focus-visible, summary:focus-visible, nav.tabs a:focus-visible { outline: 3px solid var(--brand-a25); outline-offset: 2px; }
button.secondary { background: #fff; color: var(--brand); }
button.secondary:hover { background: var(--brand-t6); border-color: var(--brand); }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--err-bg); }
button:disabled { opacity: .5; cursor: default; }

/* ---- tables (desktop) ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: #fafbfc; }
tbody tr:hover td { background: var(--brand-t6); }
.table-scroll { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eceff3; color: #344054; white-space: nowrap; }
.badge.active, .badge.issued { background: var(--ok-bg); color: #14532d; } .badge.suspended { background: var(--warn-bg); color: #6b4a00; }
.badge.closed, .badge.disabled { background: var(--err-bg); color: #7a1710; }
.badge.st-unused { background: #eceff3; } .badge.st-online { background: #bfe8cf; color: #0b3d20; } .badge.st-active { background: var(--ok-bg); color: #14532d; }
.badge.st-paused { background: var(--warn-bg); color: #6b4a00; } .badge.st-expired { background: #ece7e4; color: #6b625c; } .badge.st-disabled { background: var(--err-bg); color: #7a1710; }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.banner { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.banner.err { background: var(--err-bg); border-color: #f2b8b5; } .banner.ok { background: var(--ok-bg); border-color: #a8dcb9; }
.banner button { margin-left: 8px; }
.codes { font: 600 1.05rem/1.8 ui-monospace, Consolas, monospace; columns: 2 220px; margin: 10px 0; padding: 14px 16px; background: var(--brand-t6); border: 1px dashed var(--brand-t25); border-radius: 12px; }
.radio-list label { font-weight: 400; display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: .95rem; }
.radio-list small { display: block; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; padding: 12px 16px; }
legend { font-weight: 650; padding: 0 6px; }
.stack > * + * { margin-top: 14px; }
.hidden { display: none !important; }
.ml { margin-left: 6px; }
label.plain { font-weight: 400; display: flex; gap: 10px; align-items: center; color: inherit; }
code.k { font-family: ui-monospace, Consolas, monospace; background: var(--brand-t6); border: 1px solid var(--brand-t12); padding: 2px 7px; border-radius: 6px; }

/* ---- pop-up dialogs (change password, two-step login) ---- */
dialog.modal { border: 0; border-radius: 16px; padding: 22px; width: min(540px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; background: #fff; color: var(--text);
  box-shadow: 0 24px 60px rgba(16, 24, 40, .35); }
dialog.modal::backdrop { background: rgba(16, 24, 40, .5); }

/* ---- login ---- */
.login-box { max-width: 400px; margin: 10vh auto 0; padding: 28px 26px; border-top: 5px solid var(--brand); }
.login-box h1 { margin-bottom: 4px; }
.login-box button[type=submit] { width: 100%; }

.logo-preview { max-height: 80px; max-width: 240px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; background: #fff; }
.welcome { background: #fff; border-left: 4px solid var(--brand); color: #2a3441; }
.sample-bar { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-radius: 10px; color: #fff; }
.sample-bar .brand { font-weight: 700; margin-right: auto; }
.sample-link { border-bottom: 3px solid #fff; padding-bottom: 2px; }
.sample-btn { color: #fff; }
.switch-list { display: grid; gap: 4px; }
label.switch { align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
label.switch small { display: block; color: var(--muted); }
.badge.soon { margin-left: 8px; background: var(--warn-bg); }

input[type=color] { height: 44px; padding: 3px; cursor: pointer; }

/* ---- slips: the same rules draw the on-screen preview and the paper ---- */
.slip { background: #fff; color: #000; padding: 12px 14px; box-sizing: border-box; }
.slip.bordered { border: 1px dashed #666; }
.slip.align-center { text-align: center; }
.slip .biz { font-weight: 700; font-size: 14pt; }
.slip .label { font-size: 9pt; color: #444; margin-top: 6px; }
.slip .code { font-weight: 700; letter-spacing: .04em; margin: 4px 0 6px; overflow-wrap: anywhere; }
.slip.font-mono .code { font-family: ui-monospace, Consolas, "Courier New", monospace; }
.slip.font-sans .code { font-family: system-ui, "Segoe UI", Arial, sans-serif; }
.slip.code-medium .code { font-size: 13pt; } .slip.code-large .code { font-size: 17pt; } .slip.code-xlarge .code { font-size: 22pt; }
.slip .wifi { font-size: 10pt; font-weight: 600; } .slip .rule, .slip .how { font-size: 9.5pt; margin-top: 3px; }
.slip .footer { font-size: 9pt; margin-top: 6px; font-style: italic; }
.slip-logo { display: block; max-height: 1.4cm; max-width: 4cm; margin-bottom: 4px; }
.slip.align-center .slip-logo { margin-left: auto; margin-right: auto; }
.slip.size-thermal80 { width: 74mm; } .slip.size-thermal58 { width: 54mm; } .slip.size-card { width: 84mm; } .slip.size-a4_grid { width: 100%; }
.slip.size-thermal58 .biz { font-size: 11pt; } .slip.size-thermal58.code-xlarge .code { font-size: 17pt; } .slip.size-thermal58.code-large .code { font-size: 14pt; }
.preview-paper { background: #e9edf0; padding: 18px; border-radius: 8px; overflow-x: auto; }
.preview-paper .slip { box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.slip-designer > .card { flex: 1 1 340px; }
.preview-card { position: sticky; top: 8px; align-self: flex-start; }

/* printing: only the slips are shown; the paper size follows the chosen design */
#print-area { display: none; }
@page a4sheet { size: A4; margin: 10mm; }
@page cardsize { size: 90mm 55mm; margin: 3mm; }
@page roll80 { size: 80mm auto; margin: 3mm; }
@page roll58 { size: 58mm auto; margin: 2mm; }
@media print {
  body { background: #fff; }
  #app { display: none !important; }
  #print-area { display: block !important; }
  #print-area .slip { break-inside: avoid; }
  #print-area.print-a4_grid { page: a4sheet; display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 0; }
  #print-area.print-a4_grid .slip { min-height: 6.2cm; }
  #print-area.print-card { page: cardsize; }
  #print-area.print-thermal80 { page: roll80; }
  #print-area.print-thermal58 { page: roll58; }
  #print-area.print-card .slip, #print-area.print-thermal80 .slip, #print-area.print-thermal58 .slip { break-after: page; }
  #print-area.print-card .slip:last-child, #print-area.print-thermal80 .slip:last-child, #print-area.print-thermal58 .slip:last-child { break-after: auto; }
}

/* usage */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: inset 0 3px 0 var(--brand), var(--shadow); }
.stat-n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; color: var(--brand); }
.stat-l { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.chart { display: block; width: 100%; max-width: 900px; height: auto; }
.chart .bar { fill: var(--brand); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10px; }

/* chat */
.msg-badge { display: inline-block; background: #d32f2f; color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-left: 6px; line-height: 1.5; }
.chat-log { height: 55vh; min-height: 260px; overflow-y: auto; padding: 10px; background: #f3f6f8; border-radius: 8px; display: flex; flex-direction: column; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 12px; margin: 5px 0; overflow-wrap: anywhere; }
.bubble .text { white-space: pre-wrap; }
.bubble .who { font-size: .72rem; opacity: .8; margin-bottom: 2px; }
.bubble.mine { margin-left: auto; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 3px; }
.bubble.theirs { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-input textarea { flex: 1; min-height: 56px; resize: vertical; }
.inbox { display: grid; }
.inbox-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); align-items: baseline; }
.inbox-row:hover { background: #f3f6f8; }
.inbox-name { font-weight: 600; }
.inbox-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .inbox-row { grid-template-columns: 1fr auto; } .inbox-last { grid-column: 1 / -1; } }

/* warnings */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; border: 1px solid; }
.alert.critical { background: var(--err-bg); border-color: #f2b8b5; }
.alert.warning { background: var(--warn-bg); border-color: #ecd48f; }
.alert.info { background: #eaf2fb; border-color: #bcd3ee; }
.alert a { color: inherit; }
.alert-badge { background: #b26a00; }

/* tickets */
.ticket { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ticket button { margin-left: auto; padding: 4px 10px; }
.ticket-form { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 10px; background: #fafcfd; }

/* help assistant */
.answer { white-space: pre-wrap; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { background: #eef3f6; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .85rem; }
.chip:hover { background: #e2eaef; }

/* routers */
td.actions { white-space: nowrap; }
td.actions button { margin: 2px 4px 2px 0; padding: 4px 10px; }
.setup { border-color: var(--brand); }
.setup-line { display: grid; grid-template-columns: 170px 1fr auto; gap: 10px; align-items: center; }
.setup-line code { overflow-wrap: anywhere; padding: 4px 8px; }
@media (max-width: 600px) { .setup-line { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 12px; background: #fff; box-shadow: inset 0 3px 0 var(--brand-t25), var(--shadow); }
.tile.warn { background: var(--warn-bg); }
.tile-n { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.tile-l { color: var(--muted); font-size: .82rem; }

/* two-step login */
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.backup-codes code { padding: 10px; text-align: center; font-size: 1.05rem; letter-spacing: .06em; }
ol.steps { margin: 0; padding-left: 20px; }
ol.steps li { margin: 4px 0; }

/* ---- Home page, copy buttons, branded login, footer ---- */
.hello { background: linear-gradient(135deg, var(--brand-t6), #fff 70%); border-left: 4px solid var(--brand); }
.hello h2 { border: 0; padding: 0; margin-bottom: 4px; font-size: 1.35rem; }
.hello p { margin: 0; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
a.action { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s, transform .05s; }
a.action strong { color: var(--brand); font-size: 1.08rem; }
a.action span { color: var(--muted); font-size: .9rem; }
a.action:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-a25); }
a.action:active { transform: translateY(1px); }
a.action.primary { background: var(--brand); border-color: var(--brand); }
a.action.primary strong, a.action.primary span { color: var(--on-brand); }
a.action.primary span { opacity: .88; }
a.action.primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.router-list { display: grid; gap: 4px; }
.router-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.router-row:last-child { border-bottom: 0; }
.router-state { text-align: right; }
button.copy { min-height: 0; padding: 3px 10px; font-size: .8rem; border-radius: 8px; margin-left: 8px; vertical-align: middle; }
.code-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; break-inside: avoid; padding: 2px 0; }
td.code-cell { white-space: nowrap; }
.login-brand { text-align: center; }
.login-brand:not(:empty) { margin-bottom: 4px; }
.login-logo { display: block; margin: 0 auto 8px; max-height: 90px; max-width: 70%; object-fit: contain; }
.login-name { font-weight: 700; font-size: 1.1rem; color: var(--brand); }
.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 22px 12px 30px; }


/* ---- phones and small screens: bigger touch targets, one column, tables turn into cards ---- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 12px; }
  header.top .who { display: none; }
  header.top .brand { font-size: 1rem; }
  .brand-logo { height: 34px; }
  .tabbar { position: sticky; top: 0; z-index: 10; margin: 0 -12px 14px; padding: 0 8px; background: var(--bg); }
  dialog.modal { padding: 18px; }
  .card { padding: 16px; border-radius: 12px; }
  .row > * { flex: 1 1 100%; }
  .row > .shrink { flex: 1 1 auto; }
  button { min-height: 46px; }
  input, select, textarea { font-size: 16px; min-height: 46px; }
  .login-box { margin-top: 6vh; padding: 22px 18px; }
  .backup-codes { grid-template-columns: 1fr 1fr; }

  .table-scroll { overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; margin-bottom: 10px; background: #fff; box-shadow: var(--shadow); }
  table.stack td { border: 0; border-bottom: 1px solid var(--line); padding: 9px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 14px; text-align: right; overflow-wrap: anywhere; }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); flex: 0 0 38%; max-width: 40%; text-align: left; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
  table.stack td[data-label=""]::before { display: none; }
  table.stack td[data-label=""] { justify-content: flex-start; flex-wrap: wrap; }
  table.stack tbody tr:hover td { background: transparent; }
  td.actions { white-space: normal; }
  td.code-cell { white-space: normal; }
  .router-row { flex-wrap: wrap; }
}
