/* ============================================================================
   NLT Platform theme — "Console" look (Twilio Paste design tokens)
   Loaded on every page (admin + client). Light theme only.
   Source of truth for colors, type, radii, shadows and shared components.
   Legacy variable names (--charcoal, --cream, --gray, --border, --success …)
   are REMAPPED here so older inline styles pick up the new palette automatically.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ---- palette (Paste) ---- */
  --nlt-ground: #f4f4f6;        /* gray-10  page background */
  --nlt-ground-top: #eef2f8;    /* faint blue tint at the top of the page */
  --nlt-surface: #ffffff;       /* cards, tables, inputs */
  --nlt-surface-2: #f9f9fa;     /* gray-05 table heads, hover rows */
  --nlt-surface-3: #f4f4f6;     /* gray-10 chips, subtle fills */
  --nlt-ink: #121c2d;           /* gray-100 primary text */
  --nlt-ink-2: #4b5671;         /* gray-70 secondary text */
  --nlt-muted: #606b85;         /* gray-60 labels, help text */
  --nlt-faint: #8891aa;         /* gray-50 placeholders, timestamps */
  --nlt-line: #e1e3ea;          /* gray-20 borders */
  --nlt-line-2: #cacdd8;        /* gray-30 input borders */
  --nlt-primary: #0263e0;       /* blue-60 */
  --nlt-primary-hover: #043cb5; /* blue-70 */
  --nlt-primary-soft: #ebf4ff;  /* blue-10 */
  --nlt-primary-ring: #99cdff;  /* blue-30 focus ring */
  --nlt-ok: #14b053;            /* green-60 */
  --nlt-ok-ink: #0e7c3a;        /* green-70 */
  --nlt-ok-soft: #edfdf3;       /* green-10 */
  --nlt-warn: #f47c22;          /* orange-60 */
  --nlt-warn-ink: #c35323;      /* orange-70 */
  --nlt-warn-soft: #fef5ee;     /* orange-10 */
  --nlt-bad: #DB132A;           /* red-60 */
  --nlt-bad-ink: #ad1111;       /* red-70 */
  --nlt-bad-soft: #feecec;      /* red-10 */
  --nlt-info-ink: #6d2ed1;      /* purple-60 */
  --nlt-info-soft: #f5f0fc;     /* purple-10 */
  --nlt-ok-line: #d1fae0;       /* green-20  soft alert/callout border */
  --nlt-warn-line: #fddcc4;     /* orange-20 */
  --nlt-bad-line: #fccfcf;      /* red-20 */
  --nlt-info-line: #cce4ff;     /* blue-20 */
  --nlt-purple-line: #e4d5fb;   /* purple-20 */

  /* ---- shape / depth / type ---- */
  --nlt-r: 4px;
  --nlt-r2: 8px;
  --nlt-shadow: 0 1px 4px rgba(18,28,45,.08), 0 0 0 1px rgba(18,28,45,.02);
  --nlt-shadow-2: 0 8px 24px rgba(18,28,45,.12);
  --nlt-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --nlt-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --nlt-sidebar: 232px;
  --nlt-topbar: 56px;

  /* ---- LEGACY NAMES → new palette (keeps older inline styles on-brand) ---- */
  --charcoal: var(--nlt-ink);
  --cream: var(--nlt-ground);
  --gray: var(--nlt-muted);
  --white: var(--nlt-surface);
  --black: var(--nlt-ink);
  --border: var(--nlt-line);
  --primary: var(--nlt-primary);
  --background: var(--nlt-ground);
  --text: var(--nlt-ink);
  --text-muted: var(--nlt-muted);
  --success: var(--nlt-ok-ink);
  --warning: var(--nlt-warn-ink);
  --error: var(--nlt-bad);
  --info: var(--nlt-primary);
}

/* ---------- base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--nlt-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--nlt-ink);
  background: linear-gradient(180deg, var(--nlt-ground-top) 0, var(--nlt-ground) 240px) fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .page-title, .card-title, .section-title, .logo {
  font-family: var(--nlt-font) !important;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--nlt-ink);
}
h1, .page-title { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4, h5, h6 { font-size: 14px; }
button, input, select, textarea { font-family: var(--nlt-font) !important; }
[hidden] { display: none !important; }
code, pre, kbd, samp, .mono { font-family: var(--nlt-mono) !important; }
a { color: var(--nlt-primary); }
a:hover { color: var(--nlt-primary-hover); }
hr { border: 0; border-top: 1px solid var(--nlt-line); }
::placeholder { color: var(--nlt-faint); }
:focus-visible { outline: 2px solid var(--nlt-primary); outline-offset: 2px; }
::selection { background: var(--nlt-primary-soft); }

/* ---------- page furniture ---------- */
.page-header, .page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header h1, .page-head h1 { margin: 0; }
.page-header p, .page-subtitle, .subtitle { color: var(--nlt-muted); font-size: 14px; margin: 4px 0 0; }
.breadcrumb, .breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--nlt-muted); margin-bottom: 14px; }
.breadcrumb a, .breadcrumbs a { color: var(--nlt-muted); text-decoration: none; }
.breadcrumb a:hover, .breadcrumbs a:hover { color: var(--nlt-primary); text-decoration: underline; }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.empty-state, .empty { color: var(--nlt-muted); text-align: center; padding: 40px 20px; }
.loading { color: var(--nlt-muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border-radius: var(--nlt-r); border: 1px solid transparent;
  font-family: var(--nlt-font); font-size: 14px; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--nlt-surface); color: var(--nlt-ink-2); border-color: var(--nlt-line);
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
}
.btn:hover { background: var(--nlt-surface-3); color: var(--nlt-ink); text-decoration: none; }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--nlt-primary-ring); outline: 0; }
.btn:disabled, .btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--nlt-primary); color: #fff; border-color: var(--nlt-primary); }
.btn-primary:hover { background: var(--nlt-primary-hover); border-color: var(--nlt-primary-hover); color: #fff; }
.btn-secondary { background: var(--nlt-surface); color: var(--nlt-primary); border-color: var(--nlt-primary); }
.btn-secondary:hover { background: var(--nlt-primary-soft); color: var(--nlt-primary-hover); }
.btn-outline { background: transparent; color: var(--nlt-ink-2); border-color: var(--nlt-line-2); }
.btn-outline:hover { background: var(--nlt-surface-3); color: var(--nlt-ink); }
.btn-success { background: var(--nlt-ok-ink); color: #fff; border-color: var(--nlt-ok-ink); }
.btn-success:hover { background: #0b602d; border-color: #0b602d; color: #fff; }
.btn-warning { background: var(--nlt-warn-ink); color: #fff; border-color: var(--nlt-warn-ink); }
.btn-warning:hover { background: #8d3118; border-color: #8d3118; color: #fff; }
.btn-danger { background: var(--nlt-surface); color: var(--nlt-bad-ink); border-color: var(--nlt-bad); }
.btn-danger:hover { background: var(--nlt-bad); color: #fff; }
.btn-link { background: transparent; border-color: transparent; color: var(--nlt-primary); }
.btn-link:hover { background: var(--nlt-primary-soft); }
.btn-ghost { background: var(--nlt-surface); border-color: var(--nlt-line); color: var(--nlt-ink-2); }
.btn-ghost:hover { background: var(--nlt-surface-3); color: var(--nlt-ink); }
.btn-sm, .btn-small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-xs { min-height: 24px; padding: 0 8px; font-size: 12px; }
.btn-large, .btn-lg { min-height: 42px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- cards & stats ---------- */
.card, .stat-card, .panel, .box, .section, .sessions-table, .cam-card, .ticket-card {
  background: var(--nlt-surface);
  border: 1px solid var(--nlt-line);
  border-radius: var(--nlt-r2);
  box-shadow: var(--nlt-shadow);
}
.card-title { font-size: 15px; }
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--nlt-muted); }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; color: var(--nlt-ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-card .stat-label + .stat-value, .stat-card .stat-value { margin-top: 4px; }

/* ---------- tables ---------- */
table.table, .table table, .data-table, table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .data-table th, table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--nlt-muted); letter-spacing: .02em;
  background: var(--nlt-surface-2); border-bottom: 1px solid var(--nlt-line); white-space: nowrap;
}
.table td, .data-table td, table td { border-bottom: 1px solid var(--nlt-line); vertical-align: middle; color: var(--nlt-ink); }
.table tbody tr:hover td, .data-table tbody tr:hover td { background: var(--nlt-surface-2); }
.table tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }

/* ---------- forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label, label.label { display: block; font-size: 13px; font-weight: 600; color: var(--nlt-ink); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea, .form-control,
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="url"], input[type="tel"], input[type="date"], input[type="datetime-local"], input[type="month"], input[type="time"], select, textarea {
  font-family: var(--nlt-font); font-size: 14px; color: var(--nlt-ink);
  background: var(--nlt-surface); border: 1px solid var(--nlt-line-2); border-radius: var(--nlt-r);
  transition: border-color .12s, box-shadow .12s;
}
.form-input, .form-select, .form-control, input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="url"], input[type="tel"], input[type="date"], input[type="datetime-local"], input[type="month"], input[type="time"], select { min-height: 36px; padding: 0 10px; }
.form-textarea, textarea { padding: 8px 10px; min-height: 96px; resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus, .form-control:focus, input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--nlt-primary); box-shadow: 0 0 0 3px var(--nlt-primary-ring);
}
.form-select, select { padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23606b85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
select[multiple], select[size] { background-image: none; padding: 6px 10px; min-height: 0; }
.form-help, .help-text, .hint, .form-hint { font-size: 12px; color: var(--nlt-muted); margin-top: 4px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--nlt-primary); }

/* ---------- badges / pills ---------- */
.badge, .pill, .tag, .status-badge, .priority-badge {
  display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 8px;
  border-radius: 100px; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap;
  background: var(--nlt-surface-3); color: var(--nlt-ink-2);
}
.badge-submitted, .badge-open, .badge-new, .badge-info, .badge-primary { background: var(--nlt-primary-soft); color: var(--nlt-primary); }
.badge-assigned { background: var(--nlt-primary-soft); color: var(--nlt-primary); }
.badge-in_progress, .badge-in-progress, .badge-pending, .badge-warning, .badge-waiting { background: var(--nlt-warn-soft); color: var(--nlt-warn-ink); }
.badge-resolved, .badge-success, .badge-active, .badge-online { background: var(--nlt-ok-soft); color: var(--nlt-ok-ink); }
.badge-closed { background: var(--nlt-surface-3); color: var(--nlt-ink-2); }
.badge-danger, .badge-error, .badge-critical, .badge-offline, .badge-high { background: var(--nlt-bad-soft); color: var(--nlt-bad-ink); }
.badge-ai, .badge-purple { background: var(--nlt-info-soft); color: var(--nlt-info-ink); }
.priority-critical { color: var(--nlt-bad-ink); font-weight: 600; }
.priority-high { color: var(--nlt-warn-ink); font-weight: 600; }
.priority-medium { color: var(--nlt-ink-2); font-weight: 500; }
.priority-low { color: var(--nlt-muted); }

/* ---------- alerts ---------- */
.alert { padding: 12px 14px; border-radius: var(--nlt-r2); border: 1px solid var(--nlt-line); background: var(--nlt-surface-2); color: var(--nlt-ink); font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.alert-success { background: var(--nlt-ok-soft); border-color: var(--nlt-ok-line); color: var(--nlt-ok-ink); }
.alert-error, .alert-danger { background: var(--nlt-bad-soft); border-color: var(--nlt-bad-line); color: var(--nlt-bad-ink); }
.alert-warning { background: var(--nlt-warn-soft); border-color: var(--nlt-warn-line); color: var(--nlt-warn-ink); }
.alert-info { background: var(--nlt-primary-soft); border-color: var(--nlt-info-line); color: var(--nlt-primary-hover); }

/* ---------- tabs ---------- */
.tabs, .tab-bar, .tab-nav { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; box-shadow: inset 0 -1px 0 var(--nlt-line); }
.tabs .tab, .tab-bar .tab, .tab-nav .tab, .tabs button, .tabs a, .tab-btn {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: 0; border-radius: 0;
  padding: 10px 12px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--nlt-muted); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.tabs .tab:hover, .tabs button:hover, .tabs a:hover, .tab-btn:hover { color: var(--nlt-ink); }
.tabs .tab.active, .tabs button.active, .tabs a.active, .tab-btn.active, .tab[aria-selected="true"] { color: var(--nlt-primary); border-bottom-color: var(--nlt-primary); }

/* ---------- modals ---------- */
.modal-overlay, .modal-backdrop { background: rgba(18,28,45,.45); }
.modal, .modal-content, .modal-dialog { background: var(--nlt-surface); border: 1px solid var(--nlt-line); border-radius: var(--nlt-r2); box-shadow: var(--nlt-shadow-2); }
.modal-header { border-bottom: 1px solid var(--nlt-line); }
.modal-header h2, .modal-header h3 { font-size: 16px; margin: 0; }
.modal-footer { border-top: 1px solid var(--nlt-line); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { color: var(--nlt-muted); background: none; border: 0; cursor: pointer; }
.modal-close:hover { color: var(--nlt-ink); }

/* ---------- filters / toolbars ---------- */
.filters, .toolbar, .filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }

/* ---------- misc ---------- */
.muted, .text-muted { color: var(--nlt-muted); }
.small, .text-small { font-size: 12px; }
.divider { border-top: 1px solid var(--nlt-line); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--nlt-line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
