/*
 * DM Data Vault — Portal Stylesheet  v9.0.1
 * Copyright (c) 2024-2026 D.H.Maree / SupportCALL AU
 * Design tokens shared with tools/admin-portal/static/portal.css
 */

/* ═══════════════════════════════════════════════════════════
   1. Design tokens
   ═══════════════════════════════════════════════════════════ */
:root {
  --navy:      #0d1b2e;
  --navy-2:    #112236;
  --navy-3:    #1a3350;
  --blue:      #2563eb;
  --blue-d:    #1d4ed8;
  --blue-l:    #dbeafe;
  --green:     #16a34a;
  --green-l:   #dcfce7;
  --red:       #dc2626;
  --red-l:     #fee2e2;
  --amber:     #d97706;
  --amber-l:   #fef3c7;
  --purple:    #7c3aed;
  --purple-l:  #ede9fe;
  --bg:        #f1f5f9;
  --white:     #ffffff;
  --border:    #e2e8f0;
  --border-2:  #cbd5e1;
  --gray-l:    #f8fafc;
  --gray:      #64748b;
  --gray-2:    #94a3b8;
  --text:      #0f172a;
  --text-2:    #334155;
  --text-3:    #475569;
  --sb-bg:     #0d1b2e;
  --sb-hover:  #152840;
  --sb-active: #1a3350;
  --sb-text:   #94a3b8;
  --sb-text-h: #e2e8f0;
  --sb-border: rgba(255,255,255,.06);
  --sb-width:  220px;
  --hdr-h:     54px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'Consolas', 'Monaco', 'Courier New', monospace;
  --r:    6px;
  --r-sm: 4px;
  --shadow:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --t: .14s ease;
}

/* ═══════════════════════════════════════════════════════════
   2. Reset
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 13px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }

/* ═══════════════════════════════════════════════════════════
   3. Login page
   ═══════════════════════════════════════════════════════════ */
.login-body {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1b2e 0%, #1a3350 100%);
}
.login-wrap { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
  background: var(--white);
  border-radius: 10px;
  padding: 2rem 2.25rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-brand {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.login-brand-icon { font-size: 2rem; flex-shrink: 0; }
.login-brand-name { font-size: 1.15rem; font-weight: 700; color: var(--navy); }
.login-brand-name strong { color: var(--blue); }
.login-brand-sub  { font-size: .8rem; color: var(--gray); margin-top: .2rem; }
.login-form { display: flex; flex-direction: column; gap: .875rem; }
.login-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--gray-2);
  text-align: center;
  line-height: 1.6;
}
.login-meta {
  margin-top: 1.25rem;
  font-size: .75rem;
  color: rgba(255,255,255,.4);
  text-align: center;
}
.login-meta a { color: rgba(255,255,255,.6); }

/* ═══════════════════════════════════════════════════════════
   4. Form fields
   ═══════════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.field-label small { font-weight: 400; color: var(--gray); }
.field-input {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: .55rem .75rem;
  width: 100%;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.field-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field-input.is-error { border-color: var(--red); }
.field-input::placeholder { color: var(--gray-2); }
.pw-wrap { position: relative; }
.pw-wrap .field-input { padding-right: 2.5rem; }
.pw-toggle {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: .25rem;
  color: var(--gray); font-size: .9rem;
}

/* ═══════════════════════════════════════════════════════════
   5. Alerts
   ═══════════════════════════════════════════════════════════ */
.alert {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .75rem 1rem;
  border-radius: var(--r-sm);
  font-size: .85rem;
  margin-bottom: .875rem;
  line-height: 1.5;
}
.alert-error   { background: var(--red-l);   color: #7f1d1d;  border: 1px solid #fecaca; }
.alert-warning { background: var(--amber-l); color: #78350f;  border: 1px solid #fde68a; }
.alert-success { background: var(--green-l); color: #14532d;  border: 1px solid #bbf7d0; }
.alert-info    { background: var(--blue-l);  color: #1e3a8a;  border: 1px solid #bfdbfe; }

/* ═══════════════════════════════════════════════════════════
   6. App shell (header + sidebar + content)
   ═══════════════════════════════════════════════════════════ */
body:not(.login-body) {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#hdr {
  height: var(--hdr-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px 0 0;
  flex-shrink: 0;
  z-index: 200;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.hdr-brand {
  width: var(--sb-width);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  height: 100%;
}
.brand-link {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--navy);
  text-decoration: none;
}
.brand-link:hover { text-decoration: none; }
.brand-icon { font-size: 18px; }
.brand-name { letter-spacing: -.3px; }
.brand-name em { font-style: normal; color: var(--blue); font-weight: 400; }
.brand-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; padding: 2px 6px;
  background: var(--blue-l); color: var(--blue-d); border-radius: 3px;
}
.hdr-center {
  flex: 1; padding: 0 16px;
  display: flex; align-items: center;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--gray);
}
.breadcrumb a { color: var(--gray); }
.breadcrumb a:hover { color: var(--text-2); text-decoration: none; }
.bc-sep { color: var(--border-2); }
.bc-current { color: var(--text-2); font-weight: 500; }
.hdr-right {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
}
.role-pill {
  padding: 3px 9px; border-radius: 4px;
  background: var(--navy); color: #93c5fd;
  font-size: 11px; font-weight: 600;
}
.user-name { color: var(--text-2); font-weight: 500; }

.app-shell {
  display: flex; flex: 1; overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   7. Sidebar
   ═══════════════════════════════════════════════════════════ */
#sidebar {
  width: var(--sb-width);
  background: var(--sb-bg);
  flex-shrink: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid rgba(0,0,0,.2);
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: rgba(148,163,184,.5);
  padding: 14px 14px 4px; display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 14px; height: 34px;
  cursor: pointer; font-size: 13px; color: var(--sb-text);
  transition: background var(--t), color var(--t);
  text-decoration: none; position: relative;
}
.nav-item:hover { background: var(--sb-hover); color: var(--sb-text-h); text-decoration: none; }
.nav-item.active { background: var(--sb-active); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 3px; background: var(--blue); border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.nav-divider { height: 1px; background: var(--sb-border); margin: 6px 14px; }
.sidebar-footer {
  margin-top: auto; padding: 10px 14px;
  border-top: 1px solid var(--sb-border);
  font-size: 11px; color: rgba(148,163,184,.4); line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════
   8. Content area
   ═══════════════════════════════════════════════════════════ */
#content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
}
#content::-webkit-scrollbar { width: 6px; }
#content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════
   9. Panel
   ═══════════════════════════════════════════════════════════ */
.panel { padding: 20px 24px; max-width: 1280px; }
.panel-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 20px; gap: 12px;
}
.panel-title { font-size: 18px; font-weight: 700; color: var(--navy); letter-spacing: -.3px; }
.panel-sub   { font-size: 12px; color: var(--gray); margin-top: 3px; }
.panel-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   10. Cards
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card-warn { border-color: #fde68a; background: #fffbeb; }
.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
}

/* ═══════════════════════════════════════════════════════════
   11. KPI tiles
   ═══════════════════════════════════════════════════════════ */
.kpi-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.kpi {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
  flex: 1; min-width: 140px;
}
.kpi-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--gray); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; color: var(--navy); line-height: 1; }
.kpi-value.ok    { color: var(--green); }
.kpi-value.warn  { color: var(--amber); }
.kpi-value.error { color: var(--red);   }
.kpi-sub { font-size: 10.5px; color: var(--gray-2); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════
   12. Tables
   ═══════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--r-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  background: var(--navy); color: rgba(255,255,255,.9);
  padding: 8px 12px; text-align: left;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8faff; }
.data-table .mono { font-family: var(--mono); font-size: 11.5px; }

/* ═══════════════════════════════════════════════════════════
   13. Tags / badges
   ═══════════════════════════════════════════════════════════ */
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 10px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
}
.tag-green  { background: var(--green-l);  color: #14532d; }
.tag-blue   { background: var(--blue-l);   color: #1e3a8a; }
.tag-amber  { background: var(--amber-l);  color: #78350f; }
.tag-red    { background: var(--red-l);    color: #7f1d1d; }
.tag-gray   { background: #f1f5f9;         color: #374151; }
.tag-purple { background: var(--purple-l); color: #4c1d95; }
.tag-dark   { background: var(--navy);     color: #93c5fd; }

/* ═══════════════════════════════════════════════════════════
   14. Buttons
   ═══════════════════════════════════════════════════════════ */
.btn {
  font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  padding: 6px 13px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background var(--t), border-color var(--t), opacity var(--t);
  white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary   { background: var(--blue);  color: #fff; border-color: var(--blue-d); }
.btn-primary:hover:not(:disabled) { background: var(--blue-d); }
.btn-secondary { background: var(--white); color: var(--text-2); border-color: var(--border-2); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-danger    { background: var(--red);   color: #fff; border-color: #b91c1c; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-ghost { background: none; color: var(--gray); border-color: transparent; padding: 5px 8px; }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text-2); }
.btn-sm  { padding: 4px 10px; font-size: 11.5px; }
.btn-xs  { padding: 2px 7px;  font-size: 11px; }
.btn-full { width: 100%; justify-content: center; padding: .7rem; font-size: .95rem; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   15. Flash messages
   ═══════════════════════════════════════════════════════════ */
.flash-stack { padding: 12px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500;
}
.flash-success { background: var(--green-l); color: #14532d; border: 1px solid #bbf7d0; }
.flash-error   { background: var(--red-l);   color: #7f1d1d; border: 1px solid #fecaca; }
.flash-warning { background: var(--amber-l); color: #78350f; border: 1px solid #fde68a; }
.flash-info    { background: var(--blue-l);  color: #1e3a8a; border: 1px solid #bfdbfe; }
.flash-icon { flex-shrink: 0; }
.flash-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  font-size: 16px; opacity: .5; padding: 0 4px; color: inherit;
}
.flash-close:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   16. Empty state
   ═══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 3rem 2rem; gap: 10px; color: var(--gray);
}
.empty-state span { font-size: 2.5rem; opacity: .5; }
.empty-state p { font-size: 13px; }

/* ═══════════════════════════════════════════════════════════
   17. Multi-step wizard (unlock flow)
   ═══════════════════════════════════════════════════════════ */
.wizard-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 24px;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--gray-2);
  flex: 1;
}
.wizard-step.active { color: var(--blue); }
.wizard-step.done   { color: var(--green); }
.ws-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  background: var(--border); color: var(--gray);
  border: 2px solid var(--border-2);
}
.wizard-step.active .ws-num { background: var(--blue);  color: #fff; border-color: var(--blue); }
.wizard-step.done   .ws-num { background: var(--green); color: #fff; border-color: var(--green); }
.ws-line { flex: 1; height: 2px; background: var(--border); margin: 0 6px; }
.ws-line.done { background: var(--green); }

/* ═══════════════════════════════════════════════════════════
   18. Secret verification box
   ═══════════════════════════════════════════════════════════ */
.secret-box {
  background: var(--amber-l); border: 1px solid #fde68a;
  border-radius: var(--r); padding: 16px;
  margin: 14px 0;
}
.secret-box h4 { color: #78350f; font-size: 13px; margin-bottom: 8px; }
.secret-box p  { color: #92400e; font-size: 12px; margin: 0 0 10px; }

/* Key display box */
.key-display {
  background: var(--navy); border-radius: var(--r);
  padding: 16px 20px; text-align: center; margin: 16px 0;
}
.key-display .key-value {
  font-family: var(--mono); font-size: 1.15rem;
  color: #93c5fd; letter-spacing: .08em;
  word-break: break-all;
}
.key-display .key-meta { font-size: 11px; color: #64748b; margin-top: 8px; }

/* ═══════════════════════════════════════════════════════════
   19. Paginator
   ═══════════════════════════════════════════════════════════ */
.paginator {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 0; font-size: 12px;
}
.pg-info { color: var(--gray); }

/* ═══════════════════════════════════════════════════════════
   20. Utilities
   ═══════════════════════════════════════════════════════════ */
.hidden       { display: none !important; }
.mt-8         { margin-top: 8px; }
.mt-14        { margin-top: 14px; }
.mt-16        { margin-top: 16px; }
.mb-8         { margin-bottom: 8px; }
.mb-14        { margin-bottom: 14px; }
.text-gray    { color: var(--gray); }
.text-sm      { font-size: 11.5px; }
.text-right   { text-align: right; }
.font-mono    { font-family: var(--mono); }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider      { height: 1px; background: var(--border); margin: 14px 0; }
.section-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--gray); margin-bottom: 8px; display: block;
}

/* ═══════════════════════════════════════════════════════════
   21. Toast notifications
   ═══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--r);
  box-shadow: var(--shadow-md); font-size: 12.5px; font-weight: 500;
  pointer-events: all;
  animation: toast-in .2s ease;
  max-width: 340px;
}
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.toast-info    { background: var(--navy);  color: #e2e8f0; }
.toast-success { background: #14532d;      color: #dcfce7; }
.toast-error   { background: #7f1d1d;      color: #fee2e2; }

/* ═══════════════════════════════════════════════════════════
   22. Responsive
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #sidebar { display: none; }
  .kpi-row { flex-direction: column; }
  .panel   { padding: 14px 16px; }
}
@media (max-width: 480px) {
  .login-card { padding: 1.5rem; }
  .hdr-right .user-name { display: none; }
}
