/* ============================================================
   DocuAI Platform — app.css  (complete, conflict-free)
   ============================================================ */

/* ─── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: #F0F2F7;
  color: #1A1D27;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 6px; }

/* ─── CSS VARIABLES ────────────────────────────────────────── */
:root {
  --sidebar-w:  240px;
  --topbar-h:   58px;
  --blue:       #2563EB;
  --blue-d:     #1D4ED8;
  --blue-l:     #EFF6FF;
  --blue-m:     #BFDBFE;
  --green:      #059669;
  --green-l:    #ECFDF5;
  --amber:      #D97706;
  --amber-l:    #FFFBEB;
  --red:        #DC2626;
  --red-l:      #FEF2F2;
  --purple:     #7C3AED;
  --purple-l:   #F5F3FF;
  --cyan:       #0891B2;
  --cyan-l:     #ECFEFF;
  --teal:       #0D9488;
  --teal-l:     #F0FDFA;
  --ink:        #1A1D27;
  --ink-2:      #374151;
  --ink-3:      #6B7280;
  --ink-4:      #9CA3AF;
  --surface:    #FFFFFF;
  --surface-2:  #F8F9FB;
  --surface-3:  #F0F2F7;
  --border:     #E5E8EF;
  --border-2:   #D1D5DB;
  --radius:     8px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.07);
  --shadow:     0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  --transition: .18s ease;
}

/* ─── APP LAYOUT ────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ────────────────────────────────────────────────
   NOTE: sidebar structure/position is set inline in app.php
   This file only provides colors + component styles           */
.sidebar { background: #111827; }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff; flex-shrink: 0;
}
.brand-name { font-weight: 800; font-size: 17px; color: #fff; }
.brand-name em { font-style: normal; color: #60A5FA; }
.brand-org {
  font-size: 10px; color: rgba(255,255,255,.35); display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.sidebar-close {
  display: none; margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,.4); font-size: 16px; padding: 4px; cursor: pointer;
}
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.s-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0;
}
.s-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.s-user-role { font-size: 10px; color: rgba(255,255,255,.38); }
.plan-badge { font-size: 9px; font-weight: 700; letter-spacing:.05em; padding: 2px 7px; border-radius: 20px; margin-left: auto; flex-shrink: 0; }
.plan-basic      { background: rgba(107,114,128,.2); color: #9CA3AF; }
.plan-premium    { background: rgba(37,99,235,.25);  color: #93C5FD; }
.plan-enterprise { background: rgba(124,58,237,.25); color: #C4B5FD; }

/* ── Nav ── */
.sidebar-nav    { flex: 1; padding: 8px 0 20px; overflow-y: auto; overflow-x: hidden; }
.nav-section    { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.22); padding: 14px 18px 4px; }
.nav-group      { margin-bottom: 2px; }
.nav-item {
  display: flex !important; align-items: center !important; gap: 10px !important;
  padding: 9px 14px !important; margin: 1px 8px !important;
  border-radius: 8px !important;
  color: rgba(255,255,255,.65) !important;
  font-size: 13px !important; font-weight: 500 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: background .15s, color .15s !important;
  line-height: 1.4 !important;
}
.nav-item:hover  { background: rgba(255,255,255,.09) !important; color: #fff !important; }
.nav-item.active { background: rgba(37,99,235,.32)   !important; color: #fff !important; }
.nav-item.active i { color: #60A5FA !important; }
.nav-item i      { width: 16px !important; text-align: center !important; font-size: 14px !important; flex-shrink: 0 !important; }
.nav-item span   { flex: 1 !important; overflow: hidden !important; text-overflow: ellipsis !important; }
.nav-lock        { font-size: 10px !important; color: #F59E0B !important; flex-shrink: 0 !important; }
.nav-logout      { color: rgba(239,68,68,.7) !important; }
.nav-logout:hover{ background: rgba(239,68,68,.12) !important; color: #FCA5A5 !important; }

/* ─── MAIN WRAP ─────────────────────────────────────────────── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* prevent overflow */
}

/* ─── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 18px; gap: 12px;
  position: sticky; top: 0; z-index: 30; box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.topbar-menu-btn { display: none; background: none; border: none; color: var(--ink-3); font-size: 18px; padding: 4px; }
.topbar-title    { font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; }
.topbar-search   { flex: 1; max-width: 340px; position: relative; }
.topbar-search form { position: relative; }
.topbar-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-4); font-size: 13px; pointer-events: none; }
.topbar-search input {
  width: 100%; padding: 8px 12px 8px 32px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); font-size: 13.5px; font-family: inherit;
  color: var(--ink); outline: none; transition: var(--transition);
}
.topbar-search input:focus { border-color: var(--blue); background: var(--surface); }
.topbar-right    { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink-3); cursor: pointer; position: relative;
  transition: var(--transition);
}
.icon-btn:hover { background: var(--blue-l); border-color: var(--blue-m); color: var(--blue); }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px;
  padding: 0 3px; background: #EF4444; color: #fff; border-radius: 10px;
  font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.notif-wrap, .user-menu-wrap { position: relative; }
.notif-dropdown, .user-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 100; min-width: 300px; animation: dropIn .15s ease;
}
.notif-dropdown.open, .user-dropdown.open { display: block; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.mark-all-read  { background: none; border: none; color: var(--blue); font-size: 12px; cursor: pointer; font-family: inherit; }
.notif-list     { max-height: 300px; overflow-y: auto; }
.notif-item     { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid #F9FAFB; cursor: pointer; font-size: 13px; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--blue-l); }
.notif-icon     { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-l); color: var(--blue); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; }
.notif-empty    { padding: 28px; text-align: center; color: var(--ink-4); font-size: 13px; }
.notif-empty i  { display: block; font-size: 22px; margin-bottom: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; background: none; border: 1.5px solid var(--border); border-radius: 30px; padding: 4px 12px 4px 4px; cursor: pointer; transition: var(--transition); }
.user-chip:hover { background: var(--surface-2); }
.uc-avatar  { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }
.uc-name    { font-size: 13px; font-weight: 500; color: var(--ink); }
.uc-caret   { font-size: 10px; color: var(--ink-4); }
.ud-header  { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.ud-name    { font-weight: 600; font-size: 14px; }
.ud-email   { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.ud-item    { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; transition: var(--transition); }
.ud-item:hover { background: var(--surface-2); }
.ud-item i  { width: 16px; color: var(--ink-4); }
.ud-divider { height: 1px; background: var(--border); margin: 4px 0; }
.ud-logout  { color: var(--red) !important; }
.ud-logout i { color: var(--red) !important; }
.ud-logout:hover { background: var(--red-l) !important; }

/* ─── FLASH MESSAGES ─────────────────────────────────────────── */
.flash-zone { padding: 12px 20px 0; display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 15px; border-radius: 9px; font-size: 13.5px;
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.flash-success { background: var(--green-l); color: #065F46; border: 1px solid #A7F3D0; }
.flash-error   { background: var(--red-l);   color: #991B1B; border: 1px solid #FECACA; }
.flash-info    { background: var(--blue-l);  color: #1E40AF; border: 1px solid var(--blue-m); }
.flash i       { flex-shrink: 0; margin-top: 1px; }
.flash span    { flex: 1; line-height: 1.5; }
.flash button  { background: none; border: none; color: inherit; opacity: .5; font-size: 14px; margin-left: auto; cursor: pointer; }

/* ─── PAGE CONTENT ───────────────────────────────────────────── */
.page-content { flex: 1; padding: 22px; }
.page-header  { margin-bottom: 22px; }
.page-header h1 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; color: var(--ink); }
.page-header p  { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; }
.page-header-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 22px;
}
.page-header-row h1 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.page-header-row p  { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── CARDS ──────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-body   { padding: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title  { font-size: 14px; font-weight: 700; color: var(--ink); }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ─── STAT CARDS ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); transition: var(--transition); }
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-icon  { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 17px; margin-bottom: 14px; }
.stat-val   { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1; margin-bottom: 5px; }
.stat-lbl   { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.stat-sub   { font-size: 12px; margin-top: 8px; font-weight: 500; }
.si-blue   { background: var(--blue-l);   color: var(--blue); }
.si-green  { background: var(--green-l);  color: var(--green); }
.si-amber  { background: var(--amber-l);  color: var(--amber); }
.si-red    { background: var(--red-l);    color: var(--red); }
.si-purple { background: var(--purple-l); color: var(--purple); }
.si-cyan   { background: var(--cyan-l);   color: var(--cyan); }
.up    { color: var(--green); }
.down  { color: var(--red); }
.muted { color: var(--ink-4); }

/* ─── GRIDS ──────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.col-span-2 { grid-column: span 2; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ─── TABLE ──────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
.data-tbl { width: 100%; border-collapse: collapse; }
.data-tbl th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--ink); vertical-align: middle; }
.data-tbl tbody tr:last-child td { border-bottom: none; }
.data-tbl tbody tr:hover td { background: #F9FAFB; }
.td-main { font-weight: 600; }
.td-sub  { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.td-mono { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }

/* ─── BADGES ─────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-blue   { background: var(--blue-l);   color: var(--blue); }
.badge-green  { background: var(--green-l);  color: var(--green); }
.badge-amber  { background: var(--amber-l);  color: var(--amber); }
.badge-red    { background: var(--red-l);    color: var(--red); }
.badge-purple { background: var(--purple-l); color: var(--purple); }
.badge-cyan   { background: var(--cyan-l);   color: var(--cyan); }
.badge-teal   { background: var(--teal-l);   color: var(--teal); }
.badge-gray   { background: #F3F4F6;         color: var(--ink-3); }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius); font-size: 13.5px; font-weight: 600; border: none; cursor: pointer; transition: var(--transition); font-family: inherit; white-space: nowrap; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--blue);     color: #fff; }
.btn-primary:hover  { background: var(--blue-d); }
.btn-success  { background: var(--green);    color: #fff; }
.btn-success:hover  { filter: brightness(.9); }
.btn-danger   { background: var(--red-l);    color: var(--red); border: 1px solid #FECACA; }
.btn-danger:hover   { background: #FEE2E2; }
.btn-ghost    { background: var(--surface);  color: var(--ink-2); border: 1.5px solid var(--border); }
.btn-ghost:hover    { background: var(--surface-2); }
.btn-outline-blue   { background: var(--blue-l); color: var(--blue); border: 1px solid var(--blue-m); }
.btn-outline-blue:hover { background: var(--blue-m); }
.btn-sm  { padding: 6px 12px; font-size: 12.5px; gap: 5px; border-radius: 7px; }
.btn-xs  { padding: 4px 9px;  font-size: 11.5px; gap: 4px; border-radius: 6px; }
.btn-icon { padding: 8px; border-radius: var(--radius); }
.w-full  { width: 100%; }
.hide-sm { /* shown on desktop */ }

/* ─── FORMS ──────────────────────────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-control, .form-select, .form-textarea {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-family: inherit;
  outline: none; transition: var(--transition);
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-control.is-invalid { border-color: var(--red); }
.form-hint    { font-size: 11.5px; color: var(--ink-4); margin-top: 5px; }
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.input-group  { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.ig-addon { padding: 9px 13px; background: var(--surface-2); border: 1.5px solid var(--border); border-left: none; border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; display: flex; align-items: center; }
.mt-4 { margin-top: 4px; }

/* ─── TOGGLE SWITCH ──────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 23px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #D1D5DB; border-radius: 12px; transition: .2s; cursor: pointer; }
.toggle-slider::before { content: ''; position: absolute; width: 17px; height: 17px; background: #fff; border-radius: 50%; left: 3px; top: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(19px); }

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; backdrop-filter: blur(3px); }
.modal-box { background: var(--surface); border-radius: 18px; width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: modalIn .2s ease; }
.modal-box.modal-lg { max-width: 720px; }
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head  { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--ink-4); font-size: 17px; padding: 4px; border-radius: 6px; cursor: pointer; }
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-body  { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ─── TABS ───────────────────────────────────────────────────── */
.tab-nav { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 4px; }
.tab-btn { padding: 10px 16px; font-size: 13.5px; font-weight: 500; color: var(--ink-3); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 6px; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── PAGINATION ─────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 16px 0; }
.pg-btn { min-width: 34px; height: 34px; padding: 0 10px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--surface); transition: var(--transition); text-decoration: none; }
.pg-btn:hover  { background: var(--blue-l); border-color: var(--blue-m); color: var(--blue); }
.pg-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ─── FILTER BAR ─────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar .form-control, .filter-bar .form-select { padding: 7px 12px; font-size: 13px; }

/* ─── CHART WRAPPER ──────────────────────────────────────────── */
.chart-wrap { position: relative; height: 240px; }
.chart-wrap canvas { max-height: 240px; }

/* ─── DOCUMENT ITEMS EDITOR ──────────────────────────────────── */
.items-editor { width: 100%; border-collapse: collapse; }
.items-editor th { padding: 8px 10px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.items-editor td { padding: 6px 4px; vertical-align: top; }
.items-editor td:first-child { padding-left: 10px; }
.items-editor td:last-child  { padding-right: 10px; }
.items-editor .item-total { font-weight: 700; text-align: right; }
.items-editor input, .items-editor select { width: 100%; }
.totals-box { background: var(--surface-2); border-radius: var(--radius); padding: 16px; }
.totals-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; }
.totals-row.total { font-size: 16px; font-weight: 700; border-top: 1.5px solid var(--border); padding-top: 10px; margin-top: 4px; }

/* ─── DOCUMENT VIEW ──────────────────────────────────────────── */
.doc-view-content { font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; background: var(--surface-2); border-radius: var(--radius); padding: 20px; max-height: 500px; overflow-y: auto; }
.wa-message { background: #DCF8C6; border-radius: 12px 12px 12px 0; padding: 14px 18px; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; max-width: 420px; color: #111; }
.info-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.info-box { background: var(--surface-2); border-radius: var(--radius); padding: 12px 16px; min-width: 130px; }
.info-box label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-4); display: block; margin-bottom: 4px; }
.info-box span  { font-size: 15px; font-weight: 700; color: var(--ink); }

/* ─── UPGRADE BANNER ─────────────────────────────────────────── */
.upgrade-banner { background: linear-gradient(135deg, #1E40AF, #7C3AED); color: #fff; border-radius: var(--radius-lg); padding: 18px 22px; display: flex; align-items: center; gap: 16px; }
.upgrade-banner i { font-size: 24px; flex-shrink: 0; }
.upgrade-banner p { flex: 1; font-size: 13.5px; opacity: .9; margin: 0; }
.upgrade-banner .btn { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.3); flex-shrink: 0; }

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 30px; color: var(--ink-3); }
.empty-state i { font-size: 40px; display: block; margin: 0 auto 16px; color: var(--border); }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.empty-state p  { font-size: 13.5px; max-width: 320px; margin: 0 auto 20px; }

/* ─── PROGRESS BARS ──────────────────────────────────────────── */
.progress { height: 6px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 6px; transition: width .4s ease; }
.progress-bar.blue   { background: var(--blue); }
.progress-bar.green  { background: var(--green); }
.progress-bar.amber  { background: var(--amber); }
.progress-bar.purple { background: var(--purple); }
.progress-bar.red    { background: var(--red); }

/* ─── TOAST ──────────────────────────────────────────────────── */
.g-toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 999; transform: translateY(12px); opacity: 0; pointer-events: none; transition: .25s; display: flex; align-items: center; gap: 8px; max-width: 350px; }
.g-toast.show    { transform: none; opacity: 1; }
.g-toast.success { background: var(--green); }
.g-toast.error   { background: var(--red); }
.g-toast.warning { background: var(--amber); }

/* ─── USERS PAGE ─────────────────────────────────────────────── */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 16px; }
.user-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.uc-header  { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.uc-av      { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0; }
.uc-name    { font-weight: 700; font-size: 15px; }
.uc-email   { font-size: 12px; color: var(--ink-3); }
.uc-stats-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.uc-stat    { background: var(--surface-2); border-radius: 7px; padding: 9px 12px; }
.uc-stat label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-4); display: block; margin-bottom: 3px; }
.uc-stat span  { font-size: 16px; font-weight: 700; }
.uc-actions { display: flex; gap: 6px; align-items: center; }

/* ─── SETTINGS PAGE ──────────────────────────────────────────── */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.settings-nav    { height: fit-content; }
.sn-item { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; transition: var(--transition); }
.sn-item:hover  { background: var(--surface-2); }
.sn-item.active { background: var(--blue-l); color: var(--blue); font-weight: 600; }
.sn-item i { width: 16px; text-align: center; }
.settings-section { display: none; }
.settings-section.active { display: block; }
.section-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.section-desc  { color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }

/* ─── PERM MATRIX ────────────────────────────────────────────── */
.perm-matrix { overflow-x: auto; }
.perm-table  { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table th, .perm-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; font-weight: 500; }
.perm-table th { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }

/* ─── REPORTS ────────────────────────────────────────────────── */
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 20px; }
.ss-item { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.ss-val  { font-size: 22px; font-weight: 800; color: var(--ink); }
.ss-lbl  { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; font-weight: 500; }

/* ─── AUDIT LOG ──────────────────────────────────────────────── */
.audit-action { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--surface-2); padding: 2px 8px; border-radius: 4px; color: var(--ink-2); border: 1px solid var(--border); }

/* ─── GENERATOR PAGE ─────────────────────────────────────────── */
.dt-btn.selected { border-color: var(--blue) !important; color: var(--blue) !important; background: var(--blue-l) !important; }
.doc-view-content { font-family: inherit; color: var(--ink); }

/* ─── DIVIDER ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.d-flex  { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-muted { color: var(--ink-3); }
.text-small { font-size: 12px; }

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .main-wrap { margin-left: 0; }
  .topbar-menu-btn { display: block; }
  .topbar-search   { display: none; }
  .hide-sm { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .page-content   { padding: 14px; }
  .stats-grid     { grid-template-columns: 1fr 1fr; }
  .users-grid     { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar     { padding: 0 12px; gap: 8px; }
}
@media print {
  .sidebar, .topbar, .flash-zone, .btn, .tab-nav, .filter-bar { display: none !important; }
  .main-wrap { margin: 0; }
  .page-content { padding: 0; }
}

/* ─── DT BUTTON SELECTED STATE ─────────────────────────────── */
.dt-btn.dt-selected, .dt-btn.selected {
  border-color: var(--blue) !important;
  color: var(--blue) !important;
  background: var(--blue-l) !important;
}
