/* ==========================================================================
   JRV PCI Hardware Compliance — shadcn-style design system + Masabi colors
   ========================================================================== */

:root {
  /* Masabi official palette in HSL (shadcn convention)
     Guardrail: red is the HIGHLIGHT, not the base — used sparingly for CTAs,
     destructive actions, brand mark, and critical alerts only. */
  --masabi-red:       0 88% 62%;    /* #F44747 — hero accent, primary CTAs, brand */
  --masabi-red-2:     0 68% 48%;    /* #C33636 — red hover / darker */
  --masabi-charcoal:  228 28% 14%;  /* #1A1E2E — dark backgrounds, headers */
  --masabi-charcoal-2:228 28% 20%;  /* — slightly lighter charcoal for hover */
  --masabi-mid:       0 0% 30%;     /* #4C4C4C — body copy, secondary text */
  --masabi-light:     240 12% 96%;  /* #F5F5F7 — section backgrounds */
  --masabi-slate:     219 22% 39%;  /* #4C5B78 — nav headers, enterprise */
  --masabi-slate-2:   219 22% 32%;  /* — slate hover */
  --masabi-teal:      175 54% 36%;  /* #2A8C82 — data callouts, feature highlights */
  --masabi-teal-2:    175 54% 29%;  /* — teal hover */

  /* shadcn tokens (mapped to Masabi palette) */
  --background:              0 0% 100%;
  --foreground:              var(--masabi-charcoal);
  --card:                    0 0% 100%;
  --card-foreground:         var(--masabi-charcoal);
  --popover:                 0 0% 100%;
  --popover-foreground:      var(--masabi-charcoal);
  --primary:                 var(--masabi-teal);     /* CTA workhorse */
  --primary-foreground:      0 0% 100%;
  --secondary:               var(--masabi-light);
  --secondary-foreground:    var(--masabi-charcoal);
  --muted:                   var(--masabi-light);
  --muted-foreground:        var(--masabi-mid);
  --accent:                  240 12% 93%;
  --accent-foreground:       var(--masabi-charcoal);
  --destructive:             var(--masabi-red);      /* semantic red = brand red */
  --destructive-foreground:  0 0% 100%;
  --success:                 var(--masabi-teal);
  --success-foreground:      0 0% 100%;
  --warning:                 32 95% 44%;
  --warning-foreground:      0 0% 100%;
  --info:                    var(--masabi-slate);
  --info-foreground:         0 0% 100%;
  --page-bg:                 var(--masabi-light);
  --border:                  240 10% 88%;
  --input:                   240 10% 86%;
  --ring:                    var(--masabi-teal);

  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.75rem;

  --sidebar-width: 260px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow:    0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

/* ==========================================================================
   Base
   ========================================================================== */

* { box-sizing: border-box; border-color: hsl(var(--border)); }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Vue mounts under #app — this is the flex container that holds sidebar + content */
#app {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================
   Scrollbars — invisible on the sidebar, ultra-thin elsewhere
   ========================================================== */

/* Sidebar: fully hide the scrollbar (short nav, doesn't need one) */
.sidebar { scrollbar-width: none; }               /* Firefox */
.sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Everywhere else: 6px overlay-style, only visible on hover */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
*:hover {
  scrollbar-color: hsl(var(--foreground) / 0.18) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
  transition: background 0.15s;
}
*:hover > ::-webkit-scrollbar-thumb,
*:hover::-webkit-scrollbar-thumb {
  background: hsl(var(--foreground) / 0.18);
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--foreground) / 0.32) !important;
}
::-webkit-scrollbar-corner { background: transparent; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom */
  color: inherit;
}
@media (min-width: 900px) {
  button, input, select, textarea { font-size: 14px; }
}

a { color: hsl(var(--masabi-teal)); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; color: hsl(var(--masabi-teal-2)); }

::selection { background: hsl(var(--masabi-teal) / 0.28); color: hsl(var(--masabi-charcoal)); }

/* Universal focus ring — shadcn style */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  background: hsl(var(--masabi-charcoal));
  color: hsl(0 0% 88%);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  border-right: 1px solid hsl(var(--masabi-charcoal-2));
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
/* Brand mark carries the one guaranteed Masabi Red highlight per view */
.brand-logo {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: hsl(var(--masabi-red));
  color: #fff;
  font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 0 hsl(var(--masabi-red-2) / 0.6) inset;
}
.brand-title { color: #fff; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 10.5px; color: hsl(0 0% 65%);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
}

.sidebar nav { display: flex; flex-direction: column; padding: 0 4px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; }
.nav-group-title {
  padding: 12px 12px 6px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(0 0% 40%);
  font-weight: 600;
}
.nav-group:first-child .nav-group-title { padding-top: 0; }
.sidebar nav a {
  color: hsl(0 0% 78%);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  display: flex; align-items: center;
  position: relative;
  border-left: 2px solid transparent;
  margin-left: 2px;
}
.sidebar nav a:hover { background: hsl(var(--masabi-charcoal-2)); color: #fff; text-decoration: none; }
/* Active nav uses Slate Blue tint — red is reserved for the brand mark & CTAs */
.sidebar nav a.active {
  background: hsl(var(--masabi-slate) / 0.32);
  color: #fff;
  font-weight: 600;
  border-left-color: hsl(var(--masabi-teal));
}

.nav-role {
  padding: 4px 8px 10px;
  border-bottom: 1px solid hsl(var(--masabi-charcoal-2));
  margin: 0 4px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(0 0% 55%);
  font-weight: 600;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.version {
  color: hsl(0 0% 45%); font-size: 10.5px;
  text-align: center; margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Agency mode: keep charcoal sidebar; swap active accent to teal (still red in brand mark) */
body.role-agency .sidebar nav a.active {
  background: hsl(var(--masabi-teal) / 0.22);
  border-left-color: hsl(var(--masabi-teal));
}

/* ==========================================================================
   Content / Topbar
   ========================================================================== */

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  position: sticky; top: 0; z-index: 40;
  min-height: 56px;
  backdrop-filter: saturate(180%) blur(8px);
  background: hsl(var(--background) / 0.85);
}
.topbar h1 {
  margin: 0; font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.hamburger {
  display: none;
  background: transparent; border: 1px solid transparent;
  padding: 6px; border-radius: var(--radius-sm);
  cursor: pointer; color: hsl(var(--foreground));
  transition: background 0.12s;
}
.hamburger:hover { background: hsl(var(--accent)); }
.hamburger svg { display: block; }

/* Persona switcher chip */
.persona-switch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--background));
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s;
}
.persona-switch:hover { border-color: hsl(var(--foreground) / 0.2); }
.persona-switch-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground)); font-weight: 600;
}
#persona-select {
  border: 0; background: transparent;
  font-weight: 500; padding: 5px 8px; border-radius: var(--radius);
  cursor: pointer; font-family: inherit;
  color: hsl(var(--foreground));
}
#persona-select:focus { outline: none; }

.view { padding: 24px; flex: 1; background: hsl(var(--page-bg)); }

@media (max-width: 900px) {
  .view { padding: 16px; background: hsl(var(--background)); }
}

/* ==========================================================================
   Card
   ========================================================================== */

.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
}
.card-header h2 {
  margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
}
.card-desc {
  color: hsl(var(--muted-foreground));
  font-size: 13px; margin-top: -6px; margin-bottom: 14px;
  line-height: 1.55;
}

/* ==========================================================================
   Grid
   ========================================================================== */

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ==========================================================================
   Stat / Progress
   ========================================================================== */

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label {
  color: hsl(var(--muted-foreground)); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.stat-value {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12.5px; color: hsl(var(--muted-foreground)); }

.progress {
  height: 6px;
  background: hsl(var(--muted));
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%;
  background: hsl(var(--primary));
  transition: width 0.24s ease-out;
}
.progress.ok > span     { background: hsl(var(--masabi-teal)); }
.progress.warn > span   { background: hsl(var(--warning)); }
/* Danger progress uses the Masabi Red — this is a legitimate "critical" highlight */
.progress.danger > span { background: hsl(var(--masabi-red)); }

/* ==========================================================================
   Badge (shadcn pill)
   ========================================================================== */

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: 0.01em;
}
.badge-muted   { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.badge-success { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); border-color: hsl(var(--success) / 0.28); }
.badge-warning { background: hsl(var(--warning) / 0.13); color: hsl(var(--warning)); border-color: hsl(var(--warning) / 0.28); }
.badge-danger  { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / 0.28); }
.badge-info    { background: hsl(var(--info) / 0.12); color: hsl(var(--info)); border-color: hsl(var(--info) / 0.28); }

/* Persona chip color-differentiates the two roles — neither uses red */
body.role-masabi #persona-badge {
  background: hsl(var(--masabi-slate) / 0.12);
  color: hsl(var(--masabi-slate));
  border: 1px solid hsl(var(--masabi-slate) / 0.3);
}
body.role-agency #persona-badge {
  background: hsl(var(--masabi-teal) / 0.12);
  color: hsl(var(--masabi-teal));
  border: 1px solid hsl(var(--masabi-teal) / 0.3);
}

/* ==========================================================================
   Button (shadcn variants)
   ========================================================================== */

/* Primary button uses Deep Teal (feature/action workhorse).
   Red is reserved for .btn-danger and .btn-cta below. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  transition: background 0.12s, box-shadow 0.12s, transform 0.05s;
  min-height: 36px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-sm);
  user-select: none;
}
.btn:hover { background: hsl(var(--masabi-teal-2)); }
.btn:active { transform: translateY(0.5px); box-shadow: none; }

.btn-secondary {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.btn-secondary:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--foreground) / 0.2);
}

.btn-ghost {
  background: transparent;
  color: hsl(0 0% 78%);
  border-color: hsl(var(--masabi-charcoal-2));
  box-shadow: none;
}
.btn-ghost:hover { background: hsl(var(--masabi-charcoal-2)); color: #fff; }

/* Destructive uses Masabi Red — semantic and brand-aligned */
.btn-danger {
  background: hsl(var(--masabi-red));
  color: hsl(var(--destructive-foreground));
}
.btn-danger:hover { background: hsl(var(--masabi-red-2)); }

/* .btn-cta — Masabi Red for hero calls-to-action. Use ONE per view (brand guardrail). */
.btn-cta {
  background: hsl(var(--masabi-red));
  color: #fff;
  border-color: hsl(var(--masabi-red-2) / 0.4);
}
.btn-cta:hover { background: hsl(var(--masabi-red-2)); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; min-height: 30px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

/* Mobile touch min */
@media (max-width: 700px) {
  .btn { min-height: 40px; padding: 10px 14px; }
  .btn-sm { min-height: 32px; padding: 6px 10px; }
}

/* ==========================================================================
   Table
   ========================================================================== */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th, .table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}
.table thead th {
  background: transparent;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  padding: 8px 14px;
  border-bottom: 1px solid hsl(var(--border));
}
.table tbody tr { transition: background 0.08s; }
.table tbody tr:hover { background: hsl(var(--accent) / 0.6); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn { margin-left: 4px; }

.table-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.table-toolbar .search {
  flex: 1; min-width: 200px; max-width: 340px;
  padding: 8px 12px;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-sm);
  background: hsl(var(--background));
  transition: border-color 0.12s, box-shadow 0.12s;
}
.table-toolbar .search:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: hsl(var(--muted-foreground));
  font-size: 13.5px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 12.5px;
  color: hsl(var(--foreground));
  font-weight: 500;
  letter-spacing: -0.005em;
}
.field input,
.field select,
.field textarea {
  padding: 8px 12px;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-sm);
  background: hsl(var(--background));
  min-height: 36px;
  color: hsl(var(--foreground));
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  cursor: not-allowed;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field-full { grid-column: 1 / -1; }

@media (max-width: 700px) {
  .field input, .field select, .field textarea { min-height: 42px; }
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed; inset: 0;
  background: hsl(var(--foreground) / 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 12px;
  animation: overlay-in 0.15s ease-out;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  width: 640px; max-width: 100%;
  max-height: calc(100vh - 24px);
  overflow: auto;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: modal-in 0.15s ease-out;
}
@keyframes modal-in { from { transform: translateY(6px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: hsl(var(--card)); z-index: 2;
}
.modal-header h3 {
  margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
}
.modal-body { padding: 20px; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid hsl(var(--border));
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: hsl(var(--card)); z-index: 2;
  flex-wrap: wrap;
}
.icon-close {
  cursor: pointer; background: transparent; border: 0;
  font-size: 22px; color: hsl(var(--muted-foreground));
  padding: 4px 8px; border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.icon-close:hover { background: hsl(var(--accent)); }

@media (max-width: 700px) {
  .modal { max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
  .modal-backdrop { padding: 0; }
  .modal-footer .btn { flex: 1; }
}

/* ==========================================================================
   Toast
   ========================================================================== */

#toast-root {
  position: fixed; bottom: 20px; right: 20px; left: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; pointer-events: none;
  align-items: flex-end;
}
.toast {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease-out;
  pointer-events: auto;
  max-width: 420px;
  border: 1px solid hsl(var(--foreground));
}
.toast.success {
  background: hsl(var(--success));
  color: hsl(var(--success-foreground));
  border-color: hsl(var(--success));
}
.toast.error {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(var(--destructive));
}
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ==========================================================================
   Compliance widgets
   ========================================================================== */

.attest-checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.attest-checklist li {
  display: flex; gap: 10px; padding: 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  transition: border-color 0.1s, background 0.1s;
}
.attest-checklist li:hover { border-color: hsl(var(--foreground) / 0.15); }
.attest-checklist input[type=checkbox] {
  margin-top: 2px; width: 18px; height: 18px;
  accent-color: hsl(var(--primary)); cursor: pointer;
}
.attest-checklist .req {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: hsl(var(--muted));
  padding: 1px 6px; border-radius: var(--radius-sm);
  color: hsl(var(--foreground));
}
.attest-checklist .desc { color: hsl(var(--muted-foreground)); font-size: 12.5px; margin-top: 2px; }

.raci-table td { vertical-align: top; }
.raci-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: hsl(var(--muted-foreground));
}

.section-title {
  margin: 24px 0 12px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  font-weight: 600;
}

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

.summary-line {
  display: flex; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid hsl(var(--border));
  font-size: 13px; gap: 12px; flex-wrap: wrap;
}
.summary-line:last-child { border-bottom: 0; }
.summary-line > span:first-child { color: hsl(var(--muted-foreground)); }

/* Role picker (radio cards) */
.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .role-picker { grid-template-columns: 1fr; } }

.role-option {
  display: flex; gap: 10px;
  padding: 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  background: hsl(var(--background));
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.role-option:hover {
  border-color: hsl(var(--foreground) / 0.25);
  background: hsl(var(--accent) / 0.5);
}
.role-option input[type=radio] {
  margin-top: 2px; accent-color: hsl(var(--primary));
  width: 16px; height: 16px; cursor: pointer;
}
.role-option.selected {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.06);
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.08);
}
.role-option .role-title { font-weight: 600; font-size: 13.5px; letter-spacing: -0.005em; }
.role-option .role-desc { color: hsl(var(--muted-foreground)); font-size: 12.5px; margin-top: 3px; line-height: 1.45; }
.role-option-body { flex: 1; }

.role-picker-prompt {
  padding: 14px 16px;
  border: 1px solid hsl(var(--primary) / 0.25);
  background: hsl(var(--primary) / 0.05);
  border-left: 3px solid hsl(var(--primary));
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
  color: hsl(var(--foreground));
  line-height: 1.55;
}

/* Inspection checklist */
.check-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.check-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  transition: border-color 0.1s, background 0.1s;
}
.check-list li:hover { border-color: hsl(var(--foreground) / 0.15); }
.check-list input[type=checkbox] {
  width: 20px; height: 20px;
  accent-color: hsl(var(--primary));
  flex-shrink: 0; cursor: pointer;
}
.check-list .item-text { flex: 1; font-size: 13.5px; cursor: pointer; }
.check-list li.fail {
  background: hsl(var(--destructive) / 0.06);
  border-color: hsl(var(--destructive) / 0.25);
}
.check-list li.pass {
  background: hsl(var(--success) / 0.06);
  border-color: hsl(var(--success) / 0.25);
}

.kind-pill {
  display: inline-block;
  padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
}
.kind-pill.delivery-receipt { background: hsl(var(--warning) / 0.12); color: hsl(var(--warning)); border-color: hsl(var(--warning) / 0.3); }
.kind-pill.pre-installation,
.kind-pill.post-installation,
.kind-pill.final-visual   { background: hsl(var(--info) / 0.12); color: hsl(var(--info)); border-color: hsl(var(--info) / 0.3); }
.kind-pill.daily          { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.kind-pill.annual-audit   { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); border-color: hsl(var(--primary) / 0.28); }

/* Photo picker */
.photo-picker { display: flex; flex-direction: column; gap: 10px; }
.photo-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  box-shadow: var(--shadow-sm);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .remove {
  position: absolute; top: 6px; right: 6px;
  background: hsl(var(--foreground) / 0.75);
  color: #fff;
  border: 0; width: 24px; height: 24px; border-radius: 50%;
  cursor: pointer; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.photo-tile .remove:hover { background: hsl(var(--destructive)); }
.photo-empty {
  padding: 14px;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  font-size: 12.5px; text-align: center;
  background: hsl(var(--muted) / 0.5);
}

/* Row-cards for narrow screens */
@media (max-width: 700px) {
  .row-cards .table thead { display: none; }
  .row-cards .table, .row-cards .table tbody, .row-cards .table tr, .row-cards .table td { display: block; width: 100%; }
  .row-cards .table tr {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    margin-bottom: 10px; padding: 12px;
    background: hsl(var(--background));
    box-shadow: var(--shadow-sm);
  }
  .row-cards .table td {
    border: 0; padding: 6px 0;
    display: flex; justify-content: space-between; gap: 10px;
    font-size: 13.5px;
  }
  .row-cards .table td::before {
    content: attr(data-label);
    font-weight: 500; color: hsl(var(--muted-foreground));
    font-size: 11.5px;
    text-transform: uppercase; letter-spacing: 0.06em;
  }
  .row-cards .table td.actions { justify-content: flex-start; flex-wrap: wrap; padding-top: 10px; }
  .row-cards .table td.actions::before { display: none; }
}

/* ==========================================================================
   Login screen
   ========================================================================== */

.login-screen {
  min-height: 100vh; width: 100%;
  background: hsl(var(--page-bg));
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 480px; max-width: 100%;
  padding: 32px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .brand-title { color: hsl(var(--foreground)); }
.login-brand .brand-sub   { color: hsl(var(--muted-foreground)); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; font-weight: 700; }
.login-desc { color: hsl(var(--muted-foreground)); font-size: 13px; margin: 0 0 20px; }
.login-desc code { background: hsl(var(--muted)); padding: 1px 6px; border-radius: var(--radius-sm); font-size: 12px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-error {
  background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive));
  border: 1px solid hsl(var(--destructive) / 0.3);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 14px;
}
.login-info {
  background: hsl(var(--info) / 0.1); color: hsl(var(--info));
  border: 1px solid hsl(var(--info) / 0.3);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 14px;
}
.login-section { margin-bottom: 16px; }
.login-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground)); font-weight: 600; margin-bottom: 10px;
}
.login-google-wrap { display: flex; justify-content: center; }
.login-google-placeholder {
  padding: 14px;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius); background: hsl(var(--muted));
  font-size: 12.5px;
}
.login-google-placeholder code {
  background: hsl(var(--background));
  padding: 1px 5px; border-radius: 3px; font-size: 11.5px;
}
.login-divider {
  text-align: center; margin: 18px 0; position: relative;
}
.login-divider::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  background: hsl(var(--border));
}
.login-divider span {
  position: relative; background: hsl(var(--card));
  padding: 0 12px; font-size: 11px;
  color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.08em;
}
.login-dev {
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid hsl(var(--border));
}
.login-dev summary {
  cursor: pointer; font-size: 12.5px;
  color: hsl(var(--muted-foreground)); font-weight: 500;
  padding: 4px 0;
  list-style: none;
}
.login-dev summary::before { content: '▸ '; }
.login-dev[open] summary::before { content: '▾ '; }
.login-dev summary:hover { color: hsl(var(--foreground)); }
.login-dev > .login-form { margin: 12px 0 16px; }
.login-quick { border-top: 1px solid hsl(var(--border)); padding-top: 16px; }
.login-quick-title {
  text-align: center; color: hsl(var(--muted-foreground));
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px;
}
.login-group { margin-bottom: 14px; }
.login-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground)); font-weight: 600; margin-bottom: 6px;
}
.login-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px; color: hsl(var(--masabi-slate));
  background: hsl(var(--muted)); padding: 1px 6px; border-radius: 4px; margin-left: 6px;
}
.login-choices { display: flex; flex-direction: column; gap: 4px; }
.login-choice {
  text-align: left; padding: 8px 12px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.login-choice:hover { border-color: hsl(var(--foreground) / 0.2); background: hsl(var(--accent)); }
.login-choice-name { font-weight: 500; font-size: 13.5px; }
.login-choice-sub  { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 2px; }

/* ==========================================================================
   PCI Compliance Report — print-ready document
   ========================================================================== */

.pci-controls { margin-bottom: 24px; }

.pci-report {
  background: white;
  color: #111;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 48px 56px;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  font-size: 13px;
  line-height: 1.55;
}

.pci-cover {
  border-bottom: 3px solid hsl(var(--masabi-red));
  padding-bottom: 24px;
  margin-bottom: 32px;
}
.pci-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.pci-brand .brand-title { color: hsl(var(--foreground)); }
.pci-brand .brand-sub   { color: hsl(var(--muted-foreground)); }
.pci-report h1 {
  font-size: 28px; letter-spacing: -0.02em; margin: 0 0 4px;
  color: hsl(var(--masabi-charcoal));
}
.pci-subtitle { color: hsl(var(--muted-foreground)); font-size: 13px; margin-bottom: 20px; }
.pci-meta {
  width: 100%; border-collapse: collapse;
}
.pci-meta td {
  padding: 6px 8px;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 12.5px;
}
.pci-meta td:first-child {
  color: hsl(var(--muted-foreground));
  width: 200px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px;
}
.pci-meta tr:last-child td { border-bottom: 0; }

.pci-section {
  margin-bottom: 32px;
  page-break-inside: avoid;
}
.pci-section h2 {
  font-size: 18px; letter-spacing: -0.01em;
  padding-bottom: 8px;
  border-bottom: 1px solid hsl(var(--border));
  margin: 0 0 14px;
  color: hsl(var(--masabi-charcoal));
}
.pci-section p { margin: 0 0 12px; }

.pci-callout {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: hsl(var(--warning) / 0.1);
  border-left: 3px solid hsl(var(--warning));
  color: hsl(var(--warning));
  margin-top: 12px;
  font-size: 13px;
}
.pci-callout.pci-ok {
  background: hsl(var(--success) / 0.08);
  border-left-color: hsl(var(--success));
  color: hsl(var(--success));
}

.pci-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.pci-table th, .pci-table td {
  padding: 8px 10px;
  border: 1px solid hsl(var(--border));
  vertical-align: top;
  text-align: left;
}
.pci-table th {
  background: hsl(var(--muted));
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pci-findings ol {
  padding-left: 22px;
  margin: 0;
}
.pci-findings li {
  padding: 8px 0;
  border-bottom: 1px dashed hsl(var(--border));
  font-size: 13px;
}
.pci-findings li:last-child { border-bottom: 0; }
.pci-findings li.severity-high    { background: hsl(var(--destructive) / 0.04); padding-left: 10px; margin-left: -10px; border-radius: 4px; }
.pci-findings li.severity-medium  { background: hsl(var(--warning) / 0.04); padding-left: 10px; margin-left: -10px; border-radius: 4px; }

.pci-signature-grid {
  display: grid; grid-template-columns: 1fr 1fr 1.5fr;
  gap: 24px; margin-top: 16px;
}
.pci-signature-line {
  height: 40px; border-bottom: 2px solid hsl(var(--foreground));
}

.pci-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid hsl(var(--border));
  display: flex; justify-content: space-between;
  font-size: 11px; color: hsl(var(--muted-foreground));
}

.no-shadow .card { box-shadow: none; }

/* Print styles — hide everything except the report */
@media print {
  html, body {
    background: white !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .sidebar, .topbar, .pci-controls, #toast-root, #modal-root,
  .tour-root, .tips-btn, .persona-switch { display: none !important; }
  .content, .view, #app { display: block !important; }
  .view { padding: 0 !important; background: white !important; }
  .pci-report {
    padding: 0; max-width: 100%; border: 0; box-shadow: none; margin: 0;
    font-size: 11px;
  }
  .pci-report h1 { font-size: 22px; }
  .pci-section h2 { font-size: 15px; }
  .pci-table { font-size: 10.5px; }
  .pci-section { margin-bottom: 20px; page-break-inside: avoid; }
  .pci-cover { page-break-after: avoid; }
  .pci-findings, .pci-signature { page-break-inside: avoid; }
  .card { box-shadow: none !important; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ==========================================================================
   Inventory Dashboard — alert cards + bar charts
   ========================================================================== */

.alert-card {
  cursor: pointer;
  transition: transform 0.1s, border-color 0.12s, background 0.12s;
  border-left: 3px solid hsl(var(--border));
}
.alert-card:hover { transform: translateY(-1px); border-color: hsl(var(--foreground) / 0.2); }
.alert-card.alert-ok       { border-left-color: hsl(var(--success)); }
.alert-card.alert-info     { border-left-color: hsl(var(--info)); background: hsl(var(--info) / 0.03); }
.alert-card.alert-warning  { border-left-color: hsl(var(--warning)); background: hsl(var(--warning) / 0.04); }
.alert-card.alert-danger   { border-left-color: hsl(var(--destructive)); background: hsl(var(--destructive) / 0.04); }
.alert-card.alert-danger .stat-value  { color: hsl(var(--destructive)); }
.alert-card.alert-warning .stat-value { color: hsl(var(--warning)); }

/* Bar list */
.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 80px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.bar-label { color: hsl(var(--foreground)); font-weight: 500; }
.bar-track {
  height: 20px;
  background: hsl(var(--muted));
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: hsl(var(--masabi-teal));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px;
}
.bar-fill.fill-installed  { background: hsl(var(--success)); }
.bar-fill.fill-in-storage { background: hsl(var(--info)); }
.bar-fill.fill-received   { background: hsl(var(--warning)); }
.bar-fill.fill-in-transit { background: hsl(var(--warning)); }
.bar-fill.fill-damaged    { background: hsl(var(--destructive)); }
.bar-fill.fill-disposed   { background: hsl(var(--muted-foreground)); }
.bar-value {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.bar-value .stat-sub { font-size: 11px; }

@media (max-width: 700px) {
  .bar-row { grid-template-columns: 80px 1fr 60px; }
}

/* ==========================================================================
   Salesforce sync
   ========================================================================== */

/* Live connection card */
.sf-status { background: linear-gradient(135deg, hsl(207 82% 42% / 0.08), hsl(207 82% 42% / 0.02)); }
.sf-status-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.sf-status-badge { display: flex; align-items: center; gap: 14px; }
.sf-cloud {
  width: 48px; height: 48px; border-radius: 12px;
  background: hsl(207 82% 42%); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: bold;
  box-shadow: 0 3px 8px hsl(207 82% 42% / 0.3);
}
.sf-status-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sf-status-dot {
  width: 8px; height: 8px; border-radius: 999px; background: hsl(var(--success));
  box-shadow: 0 0 0 3px hsl(var(--success) / 0.25);
  animation: sf-pulse 1.6s ease-in-out infinite;
}
@keyframes sf-pulse {
  0%, 100% { box-shadow: 0 0 0 3px hsl(var(--success) / 0.25); }
  50%      { box-shadow: 0 0 0 6px hsl(var(--success) / 0.15); }
}

/* Chip embedded in the incident table */
.sf-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: hsl(207 82% 42% / 0.1);
  color: hsl(207 82% 42%);
  border: 1px solid hsl(207 82% 42% / 0.3);
  font-size: 11px; font-weight: 600;
  text-decoration: none;
}
.sf-chip:hover { background: hsl(207 82% 42% / 0.16); text-decoration: none; }
.sf-cloud-inline { font-size: 12px; }

/* Case detail header */
.sf-case-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 6px;
}
.sf-case-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.sf-case-sub { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.sf-case-tags { display: flex; gap: 6px; flex-shrink: 0; }

/* Owner + avatar */
.sf-owner { display: flex; align-items: center; gap: 10px; }
.sf-owner-compact { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.sf-avatar, .sf-avatar-sm {
  border-radius: 999px;
  background: hsl(var(--masabi-slate));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; letter-spacing: 0;
}
.sf-avatar    { width: 36px; height: 36px; font-size: 13px; }
.sf-avatar-sm { width: 22px; height: 22px; font-size: 10px; }

/* Feed & sync log */
.sf-feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.sf-feed-item { display: flex; gap: 10px; }
.sf-feed-icon {
  width: 28px; height: 28px; border-radius: 999px;
  background: hsl(var(--muted));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.sf-feed-body { flex: 1; }
.sf-feed-line { font-size: 13px; }
.sf-feed-quote {
  margin-top: 4px;
  padding: 6px 10px;
  background: hsl(var(--muted));
  border-left: 3px solid hsl(207 82% 42%);
  border-radius: var(--radius-sm);
  white-space: pre-wrap; font-size: 12.5px;
}
.sf-feed-when { font-size: 11px; color: hsl(var(--muted-foreground)); margin-top: 3px; }

.sf-log { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
.sf-log-item {
  display: flex; gap: 10px; padding: 8px 4px;
  border-bottom: 1px solid hsl(var(--border));
}
.sf-log-item:last-child { border-bottom: 0; }
.sf-log-arrow {
  width: 20px; height: 20px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; flex-shrink: 0; font-size: 13px;
}
.sf-log-item.outbound .sf-log-arrow { background: hsl(207 82% 42% / 0.12); color: hsl(207 82% 42%); }
.sf-log-item.inbound  .sf-log-arrow { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); }
.sf-log-item.error    .sf-log-arrow { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
.sf-log-body { flex: 1; }
.sf-log-msg { font-size: 12.5px; }
.sf-log-when { font-size: 11px; color: hsl(var(--muted-foreground)); margin-top: 2px; }

/* ==========================================================================
   Serial-number help
   ========================================================================== */

.serial-help-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: hsl(var(--masabi-teal) / 0.1);
  color: hsl(var(--masabi-teal));
  border: 1px solid hsl(var(--masabi-teal) / 0.3);
  font-size: 10.5px; font-weight: 600;
  cursor: pointer; margin-left: 6px;
  transition: background 0.12s;
}
.serial-help-link:hover { background: hsl(var(--masabi-teal) / 0.18); }
.serial-help-link svg { flex-shrink: 0; }

.serial-figure {
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--muted));
  overflow: hidden;
}
.serial-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 30%;
}
.serial-figure figcaption {
  padding: 8px 12px;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}

.serial-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.serial-legend li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.serial-tag {
  flex-shrink: 0; min-width: 90px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; font-weight: 600;
  background: hsl(var(--foreground)); color: hsl(var(--background));
  padding: 2px 8px; border-radius: 4px;
  text-align: center;
}
.serial-legend code {
  background: hsl(var(--muted));
  padding: 1px 5px; border-radius: 3px;
  font-size: 12px;
}

.pre-install-serial-hint {
  padding: 10px 14px;
  border: 1px solid hsl(var(--masabi-teal) / 0.3);
  background: hsl(var(--masabi-teal) / 0.06);
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: space-between;
}
.pre-install-serial-hint .serial-help-link { margin-left: 0; }

/* ==========================================================================
   Device history timeline
   ========================================================================== */

.history-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--muted));
  margin-bottom: 20px;
  gap: 12px; flex-wrap: wrap;
}
.history-serial {
  font-size: 14px; font-weight: 600; color: hsl(var(--foreground));
}
.history-meta {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin-top: 6px;
}
.history-count { text-align: right; }
.history-count .stat-value { font-size: 22px; line-height: 1; }
.history-count .stat-sub   { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px; }

.timeline {
  list-style: none; padding: 0; margin: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 15px; top: 8px; bottom: 8px;
  width: 2px;
  background: hsl(var(--border));
}
.timeline-item {
  position: relative;
  padding-left: 44px;
  padding-bottom: 22px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-icon {
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: hsl(var(--card));
  border: 2px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: center;
  color: hsl(var(--foreground));
  z-index: 1;
  box-shadow: 0 0 0 3px hsl(var(--page-bg));
}
.timeline-item.variant-success .timeline-icon {
  border-color: hsl(var(--success));
  color: hsl(var(--success));
  background: hsl(var(--success) / 0.08);
}
.timeline-item.variant-info .timeline-icon {
  border-color: hsl(var(--info));
  color: hsl(var(--info));
  background: hsl(var(--info) / 0.08);
}
.timeline-item.variant-warning .timeline-icon {
  border-color: hsl(var(--warning));
  color: hsl(var(--warning));
  background: hsl(var(--warning) / 0.08);
}
.timeline-item.variant-danger .timeline-icon {
  border-color: hsl(var(--destructive));
  color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.08);
}
.timeline-item.variant-muted .timeline-icon {
  border-color: hsl(var(--muted-foreground));
  color: hsl(var(--muted-foreground));
}

.timeline-body {
  padding: 8px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  transition: border-color 0.12s, background 0.12s;
}
.timeline-item.variant-danger .timeline-body { border-color: hsl(var(--destructive) / 0.35); }
.timeline-item.variant-warning .timeline-body { border-color: hsl(var(--warning) / 0.35); }
.timeline-item.variant-success .timeline-body { border-color: hsl(var(--success) / 0.35); }

.timeline-title-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px;
}
.timeline-title { font-weight: 600; font-size: 13.5px; letter-spacing: -0.005em; }
.timeline-open { flex-shrink: 0; }
.timeline-subtitle {
  color: hsl(var(--muted-foreground));
  font-size: 12.5px;
  margin-top: 3px;
}
.timeline-notes {
  margin-top: 4px;
  font-size: 12.5px;
  color: hsl(var(--foreground));
  padding: 6px 10px;
  background: hsl(var(--muted));
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
}
.timeline-when {
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  .timeline-title-row { flex-direction: column; align-items: stretch; }
  .timeline-open { align-self: flex-start; }
}

/* ==========================================================================
   Tour — step-by-step coach marks with spotlight
   ========================================================================== */

.tour-root {
  position: fixed; inset: 0; z-index: 300;
  pointer-events: none;
}

/* Full-viewport dim used when a step has no target (welcome / finish) */
.tour-dim {
  position: fixed; inset: 0;
  background: hsl(228 28% 14% / 0.55);
  pointer-events: auto;
  animation: overlay-in 0.18s ease-out;
}

/* Spotlight rectangle around the current target — the huge box-shadow creates
   the "cutout" dim effect around the highlighted element. */
.tour-spotlight {
  position: fixed;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px hsl(228 28% 14% / 0.55),
              0 0 0 3px hsl(var(--masabi-red) / 0.75),
              0 0 30px hsl(var(--masabi-red) / 0.3);
  pointer-events: none;
  transition: top .25s ease-out, left .25s ease-out,
              width .25s ease-out, height .25s ease-out;
}

/* Popover */
.tour-popover {
  position: fixed;
  width: 320px; max-width: calc(100vw - 24px);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px hsl(228 28% 14% / 0.3), 0 4px 8px hsl(228 28% 14% / 0.15);
  padding: 16px 18px 14px;
  pointer-events: auto;
  z-index: 301;
  animation: tour-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes tour-in {
  from { opacity: 0; transform: translate(var(--tx, 0), var(--ty, 4px)) scale(0.96); }
  to   { opacity: 1; }
}

.tour-popover.is-centered { max-width: 440px; width: 440px; }

/* Small arrow pointing at the target */
.tour-popover::before {
  content: ''; position: absolute; width: 12px; height: 12px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  transform: rotate(45deg);
  z-index: -1;
}
.tour-popover.is-bottom::before { top: -7px; left: 50%; margin-left: -6px; border-right: 0; border-bottom: 0; }
.tour-popover.is-top::before    { bottom: -7px; left: 50%; margin-left: -6px; border-left: 0; border-top: 0; }
.tour-popover.is-right::before  { left: -7px; top: 50%; margin-top: -6px; border-right: 0; border-top: 0; }
.tour-popover.is-left::before   { right: -7px; top: 50%; margin-top: -6px; border-left: 0; border-bottom: 0; }
.tour-popover.is-centered::before { display: none; }

.tour-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.tour-step-num {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground)); font-weight: 600;
}
.tour-close {
  cursor: pointer; background: transparent; border: 0;
  font-size: 20px; color: hsl(var(--muted-foreground));
  padding: 2px 6px; border-radius: var(--radius-sm);
  line-height: 1;
}
.tour-close:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

.tour-title {
  margin: 0 0 6px; font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
}
.tour-body {
  margin: 0 0 12px; font-size: 13.5px; line-height: 1.55;
  color: hsl(var(--foreground));
}

.tour-dots {
  display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap;
}
.tour-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: hsl(var(--border));
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}
.tour-dot:hover { transform: scale(1.3); }
.tour-dot.active { background: hsl(var(--masabi-red)); }

.tour-footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
}

/* "?" trigger in topbar */
.tips-btn {
  background: transparent; border: 1px solid hsl(var(--border));
  padding: 6px 8px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: hsl(var(--muted-foreground)); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.tips-btn:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

@media (max-width: 700px) {
  .tour-popover {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }
  .tour-popover.is-centered { width: calc(100vw - 20px); }
}

/* ==========================================================================
   Mobile layout
   ========================================================================== */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: "";
    position: fixed; inset: 0;
    background: hsl(var(--foreground) / 0.4);
    z-index: 45;
    animation: overlay-in 0.15s ease-out;
  }
  .hamburger { display: inline-flex; }
  .content { width: 100%; }
  .view { padding: 16px; }
  .topbar { padding: 10px 14px; }
  .topbar-title h1 { font-size: 15px; }
  .persona-switch-label { display: none; }
  .persona-switch { padding-left: 8px; }
  .card { padding: 16px; border-radius: var(--radius); }
}
