/* 2chanify Vendor: styles on top of theme.css (the 2chanify design system,
   copied unchanged). Same tokens, fonts, logo and components as the POS. */

:root {
  --logo-ink: #1b1f23;
  --logo-keys: #ffffff;
  --brand-green: #00c987;
}
[data-theme="dark"] {
  --logo-ink: #edf5f5;
  --logo-keys: #1a2831;
}

[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
body { min-height: 100vh; }
code { font-family: Consolas, 'Cascadia Mono', monospace; font-size: 12px; }

/* ------------------------------------------------------------------ logo */
.logo { display: flex; align-items: center; gap: 10px; }
.logo .brand-name { color: var(--ink); }
.logo-mark { flex-shrink: 0; }
.sidebar .brand { padding: 0 18px; }
.auth-left { --logo-ink: #ffffff; --logo-keys: #0c4e57; }
.auth-left .brand-name { color: #ffffff; }
.auth-left .brand-sub { color: #aad1d2; }
.auth-left .tiny { color: #aad1d2; }
.auth-logo-small { display: none; margin-bottom: 26px; }

/* ----------------------------------------------------------------- login */
.auth-page { min-height: 100vh; }
.code-input { font-family: Consolas, 'Cascadia Mono', monospace; font-size: 22px !important; letter-spacing: 6px; text-align: center; }
.enroll { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 16px; background: var(--subtle); border: 1px solid var(--line2); border-radius: 12px; }
.qr-box { background: #fff; padding: 10px; border-radius: 10px; border: 1px solid var(--line); line-height: 0; }
.qr-box img { width: 168px; height: 168px; }
.steps { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.steps li + li { margin-top: 8px; }
code.secret { display: inline-block; margin-top: 4px; padding: 3px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); letter-spacing: .5px; user-select: all; word-break: break-all; }
.msg { font-size: 12px; font-weight: 650; margin: 0; }
.msg:empty { display: none; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }
form > .msg { margin: 4px 0 6px; }

/* ----------------------------------------------------------------- shell */
.app { min-height: 100vh; height: 100vh; }
.side-status { width: 100%; border: 0; text-align: left; cursor: pointer; }
.side-status.is-missing { background: var(--danger-soft); color: var(--danger); }
.side-foot span:first-child { font-weight: 650; }
.nav-trailing { background: var(--danger-soft); color: var(--danger); }
.user-chip { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 8px 4px 4px; border-radius: 10px; color: var(--ink); text-align: left; }
.user-chip:hover { background: var(--subtle); }
.user-text { display: flex; flex-direction: column; }
.top-role { text-transform: capitalize; }
.system-banner { background: var(--warning-soft); color: var(--warning); }
.system-banner.missing { background: var(--danger-soft); color: var(--danger); }
.content > section { max-width: 1320px; }

/* --------------------------------------------------------------- metrics */
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric-tile { text-align: left; padding: 16px 16px 14px; color: var(--ink); border: 1px solid var(--line); transition: border-color .12s, box-shadow .12s; }
.metric-tile:hover { border-color: var(--accent); }
.metric-tile.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(32, 158, 166, .14); }
.metric-tile .metric-value { font-size: 26px; letter-spacing: -.9px; font-weight: 760; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.metric-tile .metric-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-tile .metric-foot { font-size: 11px; color: var(--muted); }
.metric-tile .dot { width: 9px; height: 9px; }
.tone-all .dot { color: var(--accent); }
.tone-active .dot { color: var(--success); }
.tone-soon .dot { color: var(--warning); }
.tone-grace .dot { color: #d0772b; }
.tone-expired .dot { color: var(--danger); }
.tone-none .dot { color: var(--faint); }

/* ----------------------------------------------------------------- table */
.panel-heading.filterbar { margin: 0; align-items: center; }
.search-box .search-icon { top: 13px; }
.search-box input { height: 44px; padding-right: 14px; }
.table tbody tr.row { cursor: pointer; }
.table tbody tr.row:hover { background: var(--accent-soft); }
.badge-grace { background: #fdebdc; color: #a24a0b; }
[data-theme="dark"] .badge-grace { background: #47301f; color: #f3a86b; }
.empty { min-height: 220px; }

/* ---------------------------------------------------------------- modals */
dialog.modal { padding: 0; color: var(--ink); }
dialog.modal::backdrop { background: rgba(12, 28, 39, .49); }
dialog.modal.xl { width: min(100% - 32px, 1140px); }
dialog.modal.wide { width: min(100% - 32px, 760px); }
dialog.modal:not(.wide):not(.xl) { width: min(100% - 32px, 515px); }
.modal-head { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head .eyebrow { margin-bottom: 4px; }
.modal-foot { align-items: center; }
.client-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; }
.client-cols > * { min-width: 0; }
#licence-card { border-left: 1px solid var(--line2); padding-left: 26px; }
.formgrid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.branch { display: grid; grid-template-columns: 1.1fr 1.3fr .9fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.branch input { min-height: 40px; }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex !important; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font-weight: 600 !important; margin: 0 !important; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice input { width: 16px; min-height: 16px; accent-color: var(--accent); }
.link-btn { border: 0; background: none; padding: 0; color: inherit; font-weight: 750; text-decoration: underline; cursor: pointer; }
.keybox { margin: 0; padding: 14px 16px; background: var(--subtle); border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; color: var(--ink); }
.plain-list { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.6; }
.plain-list li + li { margin-top: 4px; }
.history-table td, .history-table th { padding: 10px; }
.history-table tr.current td:first-child { font-weight: 750; color: var(--ink); }
.table td.note { white-space: normal; color: var(--muted); max-width: 360px; word-break: break-word; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn + .btn { margin-left: 6px; }
.table select { min-height: 36px; padding: 6px 28px 6px 10px; width: auto; font-size: 12px; }
.key-state { display: flex; gap: 14px; align-items: flex-start; }

/* ----------------------------------------------------------------- toasts */
.toast { animation: toast-in .18s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1220px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .client-cols { grid-template-columns: 1fr; }
  #licence-card { border-left: 0; padding-left: 0; border-top: 1px solid var(--line2); padding-top: 20px; }
  .formgrid.four { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .user-text { display: none; }
  #btn-logout span { display: none; }
}
@media (max-width: 650px) {
  .auth-logo-small { display: flex; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .enroll { grid-template-columns: 1fr; justify-items: center; }
  .branch { grid-template-columns: 1fr 1fr; }
  .formgrid.four { grid-template-columns: 1fr; }
}
.danger-text { color: var(--danger) !important; }
