/* ============================================================================
   QRLib — Client panel (SPA) styles. Depends on broadsheet.css.
   ========================================================================== */

/* ============ AUTH ============ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside { background: var(--ink); color: var(--ink-inverse); padding: var(--s-8) var(--s-7); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.06) 1px, transparent 0); background-size: 22px 22px; pointer-events: none; }
.auth-aside .brand-word { color: #fff; }
.auth-aside .brand-mark { color: #6fce9f; }
.auth-aside .aside-body { margin-top: auto; position: relative; z-index: 1; }
.auth-aside .masthead { color: #fff; font-size: clamp(1.9rem, 3vw, 2.8rem); max-width: 16ch; }
.auth-aside .lede { color: rgba(247,243,234,.72); margin-top: var(--s-4); }
.auth-aside .aside-proof { margin-top: var(--s-6); display: flex; gap: var(--s-6); border-top: 1px solid rgba(255,255,255,.16); padding-top: var(--s-5); }
.auth-aside .aside-proof strong { display: block; font-family: var(--font-display); font-size: 1.6rem; }
.auth-aside .aside-proof span { font-size: var(--t-xs); color: rgba(247,243,234,.6); }

.auth-main { display: grid; place-items: center; padding: var(--s-6); overflow-y: auto; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .kicker { margin-bottom: var(--s-3); }
.auth-card h1 { font-size: var(--t-h2); margin-bottom: var(--s-2); }
.auth-card .sub { color: var(--ink-2); margin-bottom: var(--s-6); }
.auth-alt { margin-top: var(--s-5); font-size: var(--t-sm); color: var(--ink-2); text-align: center; }
.auth-divider { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-5) 0; color: var(--ink-3); font-size: var(--t-xs); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.otp-row { display: flex; gap: var(--s-3); justify-content: space-between; }
.otp-row input { width: 100%; aspect-ratio: 1; text-align: center; font-size: 1.5rem; font-family: var(--font-display); font-weight: 700; padding: 0; }
.pw-meter { height: 5px; border-radius: 3px; background: var(--paper-3); overflow: hidden; margin-top: var(--s-2); }
.pw-meter span { display: block; height: 100%; width: 0; transition: width var(--dur), background var(--dur); }

/* ============ APP SHELL ============ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--paper-2); border-inline-end: 1px solid var(--rule); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: var(--s-4) var(--s-5); height: var(--topbar-h); border-bottom: 1px solid var(--rule); }
.workspace-switch { margin: var(--s-4) var(--s-4) var(--s-2); padding: var(--s-3); background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); display: flex; align-items: center; gap: var(--s-3); cursor: pointer; }
.workspace-switch .ws-avatar { width: 34px; height: 34px; border-radius: var(--r); background: var(--brand); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; flex: none; }
.workspace-switch .ws-name { font-weight: 600; font-size: var(--t-sm); line-height: 1.2; }
.workspace-switch .ws-plan { font-size: var(--t-2xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.nav-list { flex: 1; overflow-y: auto; padding: var(--s-3) var(--s-3); display: flex; flex-direction: column; gap: 2px; }
.nav-list .nav-section { font-size: var(--t-2xs); text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); padding: var(--s-4) var(--s-3) var(--s-2); }
.nav-item { display: flex; align-items: center; gap: var(--s-3); padding: 9px 12px; border-radius: var(--r); color: var(--ink-2); font-size: var(--t-sm); font-weight: 500; transition: background var(--dur), color var(--dur); position: relative; }
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.nav-item.active::before { content: ""; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--brand); }
.nav-item .ico { width: 20px; height: 20px; flex: none; color: currentColor; }
.nav-item .badge-count { margin-inline-start: auto; background: var(--brand); color: #fff; font-size: var(--t-2xs); font-weight: 700; padding: 1px 7px; border-radius: var(--r-pill); }
.sidebar-foot { border-top: 1px solid var(--rule); padding: var(--s-3); }
.user-chip { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2); border-radius: var(--r); cursor: pointer; }
.user-chip:hover { background: var(--paper-3); }

.ico { display: inline-flex; }
.ico svg { width: 100%; height: 100%; display: block; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: var(--t-xs); font-weight: 700; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: var(--t-2xs); }

/* topbar */
.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: var(--s-4); padding: 0 var(--s-6); position: sticky; top: 0; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(8px); z-index: 40; }
.topbar .search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: var(--s-2); background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r); padding: 7px 12px; color: var(--ink-3); }
.topbar .search input { border: 0; background: none; outline: none; flex: 1; font-size: var(--t-sm); }
.topbar-actions { display: flex; align-items: center; gap: var(--s-2); margin-inline-start: auto; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r); color: var(--ink-2); position: relative; }
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn .dot-badge { position: absolute; top: 8px; inset-inline-end: 8px; width: 7px; height: 7px; background: var(--signal); border-radius: 50%; border: 1.5px solid var(--paper); }
.hamburger { display: none; }

/* main content */
.main { padding: var(--s-6); max-width: 1240px; width: 100%; margin-inline: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-head .kicker { margin-bottom: var(--s-2); }
.page-head h1 { font-size: var(--t-h2); }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.page-actions { display: flex; gap: var(--s-3); align-items: center; }

/* dashboard */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s-5); margin-top: var(--s-5); }
.chart-line { display: block; }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-4); }
.chart-x { display: flex; justify-content: space-between; font-size: var(--t-2xs); color: var(--ink-3); margin-top: var(--s-2); font-variant-numeric: tabular-nums; }

/* bar list breakdown */
.barlist { display: flex; flex-direction: column; gap: var(--s-3); }
.barlist-row { display: grid; grid-template-columns: 90px 1fr auto auto; align-items: center; gap: var(--s-3); font-size: var(--t-sm); }
.bl-label { color: var(--ink-2); truncate: true; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { height: 8px; background: var(--paper-3); border-radius: var(--r-pill); overflow: hidden; }
.bl-fill { display: block; height: 100%; border-radius: var(--r-pill); }
.bl-val { font-weight: 600; min-width: 42px; text-align: end; }
.bl-pct { color: var(--ink-3); min-width: 44px; text-align: end; font-size: var(--t-xs); }

/* donut legend */
.donut-wrap { display: flex; align-items: center; gap: var(--s-5); }
.donut-legend { display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--t-sm); }
.donut-legend .dl { display: flex; align-items: center; gap: var(--s-2); }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 2px; }

/* activity list */
.activity { display: flex; flex-direction: column; }
.activity-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); font-size: var(--t-sm); }
.activity-row:last-child { border-bottom: 0; }
.activity-row .a-dot { width: 30px; height: 30px; border-radius: var(--r); background: var(--paper-2); display: grid; place-items: center; color: var(--brand); flex: none; }
.activity-row .a-meta { color: var(--ink-3); font-size: var(--t-xs); margin-inline-start: auto; white-space: nowrap; }

/* code list */
.code-row { display: grid; grid-template-columns: auto auto 1fr auto auto auto; align-items: center; gap: var(--s-4); }
.qr-thumb { width: 44px; height: 44px; border-radius: var(--r); border: 1px solid var(--rule); background: #fff; padding: 4px; flex: none; }
.qr-thumb svg { width: 100%; height: 100%; }
.toolbar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.bulk-bar { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--brand-tint); border: 1px solid var(--brand-tint-2); border-radius: var(--r); margin-bottom: var(--s-4); }

/* responsive */
@media (max-width: 1000px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; } .auth-aside { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; width: var(--sidebar-w); transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-3); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none; }
  .hamburger { display: grid; }
  .main { padding: var(--s-4); }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .code-row { grid-template-columns: auto 1fr auto; }
  .code-row .hide-row { display: none; }
}

/* mobile bottom nav (app-like) */
.mobile-nav { display: none; }
@media (max-width: 700px) {
  .mobile-nav { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 70; height: 62px; background: var(--card); border-top: 1px solid var(--rule); align-items: center; justify-content: space-around; padding: 0 8px calc(env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 14px rgba(27,26,23,.06); }
  .mobile-nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--ink-3); flex: 1; padding: 6px 0; letter-spacing: .02em; }
  .mobile-nav-item.active { color: var(--brand); }
  .mobile-nav-item .ico { width: 22px; height: 22px; }
  .mobile-nav-fab { display: grid; place-items: center; width: 52px; height: 52px; margin-top: -20px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: var(--shadow-2); flex: none; border: 3px solid var(--paper); }
  .mobile-nav-fab .ico { width: 24px; height: 24px; }
  .main { padding-bottom: 86px; }
}
