/* ═══════════════════════════════════════════
   SecureFrame 27K — Responsive CSS
   Mobile-first, works on all screen sizes
═══════════════════════════════════════════ */

:root {
  --bg:         #f7f6f3;
  --surface:    #ffffff;
  --surface2:   #f1efe8;
  --surface3:   #e8e6df;
  --border:     rgba(0,0,0,0.10);
  --border2:    rgba(0,0,0,0.18);
  --text:       #18180f;
  --text2:      #5a5951;
  --text3:      #8c8b83;
  --accent:     #1a5fa8;
  --accent-bg:  #e4eef8;
  --green:      #2d6a0f;
  --green-bg:   #e8f3dc;
  --amber:      #7a4a09;
  --amber-bg:   #faebd6;
  --red:        #922828;
  --red-bg:     #faeaea;
  --purple:     #4a42b0;
  --purple-bg:  #eeecfd;
  --teal:       #0d6652;
  --teal-bg:    #dff2ec;
  --sidebar-w:  220px;
  --topbar-h:   52px;
  --r:          8px;
  --rlg:        12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ── LAYOUT SHELL ─────────────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #13130c;
  color: #ccc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sb-logo   { padding: 18px 15px 12px; border-bottom: 0.5px solid rgba(255,255,255,0.08); }
.sb-tagline{ font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,0.3); margin-bottom: 3px; }
.sb-name   { font-size: 15px; font-weight: 600; color: #fff; }
.sb-ver    { font-size: 10px; color: rgba(255,255,255,0.22); margin-top: 2px; }

.sb-tenant  { padding: 11px 12px 9px; border-bottom: 0.5px solid rgba(255,255,255,0.07); }
.sb-tlabel  { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,0.28); margin-bottom: 5px; }
.sb-tselect {
  width: 100%; background: rgba(255,255,255,0.08);
  border: 0.5px solid rgba(255,255,255,0.14);
  border-radius: var(--r); color: #fff;
  padding: 6px 8px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.sb-tselect option { background: #1e1e18; }

.sb-section { padding: 6px 0; }
.sb-slabel  { font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,0.26); padding: 8px 14px 3px; }

.sb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 12px;
  color: rgba(255,255,255,0.58);
  transition: background .12s, color .12s;
  cursor: pointer;
}
.sb-item:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.88); }
.sb-item.active { background: rgba(255,255,255,0.10); color: #fff; }

.sb-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}

.sb-bottom {
  margin-top: auto;
  padding: 11px 12px;
  border-top: 0.5px solid rgba(255,255,255,0.07);
}
.sb-user-name  { font-size: 12px; color: #fff; font-weight: 500; }
.sb-user-email { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 1px; }
.sb-logout     { display: inline-block; margin-top: 7px; font-size: 11px; color: rgba(255,255,255,0.45); }
.sb-logout:hover { color: rgba(255,255,255,0.8); }

/* ── MAIN AREA ────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ───────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; gap: 8px; align-items: center; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text2); border-radius: 2px;
}

.breadcrumb { font-size: 12px; color: var(--text3); }
.breadcrumb b { color: var(--text2); font-weight: 500; }
.breadcrumb span { margin: 0 4px; }

/* ── CONTENT ──────────────────────────────── */
.content { padding: 20px; flex: 1; }

/* ── BUTTONS ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  border-radius: var(--r);
  border: 0.5px solid var(--border2);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  font-family: inherit;
  transition: all .13s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover         { background: var(--surface2); color: var(--text); }
.btn-primary       { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #0f4a8a; color: #fff; }
.btn-danger        { background: var(--red-bg); color: var(--red); border-color: rgba(146,40,40,0.2); }
.btn-sm            { padding: 4px 10px; font-size: 11px; }
.btn-xs            { padding: 3px 8px; font-size: 10px; }
.btn-block         { width: 100%; justify-content: center; }

/* ── CARDS ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--rlg);
  padding: 16px;
}
.card-title {
  font-size: 11px; font-weight: 500;
  color: var(--text2); margin-bottom: 12px;
  letter-spacing: .03em; text-transform: uppercase;
}

/* ── STAT CARDS ───────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--rlg);
  padding: 15px;
}
.stat-label { font-size: 10px; color: var(--text3); margin-bottom: 5px; }
.stat-value { font-size: 28px; font-weight: 500; line-height: 1; }
.stat-sub   { font-size: 10px; color: var(--text3); margin-top: 3px; }

/* ── GRID LAYOUTS ─────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }

/* ── TABLE ────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; min-width: 500px; }
.tbl th {
  text-align: left; font-size: 10px; font-weight: 500;
  color: var(--text3); letter-spacing: .05em; text-transform: uppercase;
  padding: 8px 11px; border-bottom: 0.5px solid var(--border);
  background: var(--surface2); white-space: nowrap;
}
.tbl td {
  padding: 9px 11px; border-bottom: 0.5px solid var(--border);
  font-size: 12px; vertical-align: middle;
}
.tbl tr:last-child td  { border-bottom: none; }
.tbl tr.clickable      { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface2); }

/* ── STATUS PILLS ─────────────────────────── */
.pill {
  display: inline-block; padding: 2px 8px;
  border-radius: 20px; font-size: 10px; font-weight: 500;
  white-space: nowrap;
}
.pill-g    { background: var(--green-bg);  color: var(--green);  }
.pill-a    { background: var(--amber-bg);  color: var(--amber);  }
.pill-r    { background: var(--red-bg);    color: var(--red);    }
.pill-b    { background: var(--accent-bg); color: var(--accent); }
.pill-p    { background: var(--purple-bg); color: var(--purple); }
.pill-t    { background: var(--teal-bg);   color: var(--teal);   }
.pill-gray { background: var(--surface2);  color: var(--text3);  }

/* ── PROGRESS BAR ─────────────────────────── */
.pbar      { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 2px; transition: width .5s; }

/* ── BANNER ───────────────────────────────── */
.banner {
  padding: 10px 14px; border-radius: var(--r);
  font-size: 12px; display: flex; gap: 9px;
  align-items: flex-start; margin-bottom: 14px; line-height: 1.5;
}
.banner-info    { background: var(--accent-bg); border: 0.5px solid #b5d4f4; color: var(--accent); }
.banner-warn    { background: var(--amber-bg);  border: 0.5px solid #e8b96a; color: var(--amber);  }
.banner-danger  { background: var(--red-bg);    border: 0.5px solid #f0b0b0; color: var(--red);    }
.banner-success { background: var(--green-bg);  border: 0.5px solid #a0cc7a; color: var(--green);  }

/* ── SECTION HEADER ───────────────────────── */
.section-hd {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-label {
  font-size: 11px; font-weight: 500;
  color: var(--text2); text-transform: uppercase; letter-spacing: .03em;
}

/* ── FORMS ────────────────────────────────── */
.form-group    { margin-bottom: 14px; }
.form-label    { display: block; font-size: 11px; font-weight: 500; color: var(--text2); margin-bottom: 4px; }
.form-required { color: var(--red); }
.form-hint     { font-size: 10px; color: var(--text3); margin-top: 3px; }

.form-control {
  width: 100%; padding: 8px 10px;
  border: 0.5px solid var(--border2); border-radius: var(--r);
  font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color .12s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,95,168,0.08); }

textarea.form-control { resize: vertical; min-height: 75px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── MODAL ────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--rlg);
  width: 100%; max-width: 660px;
  max-height: 90vh; overflow-y: auto;
  border: 0.5px solid var(--border);
  display: flex; flex-direction: column;
}
.modal-hd {
  padding: 16px 20px; border-bottom: 0.5px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 14px; font-weight: 500; }
.modal-close {
  cursor: pointer; color: var(--text3); font-size: 22px;
  line-height: 1; border: none; background: none;
  padding: 2px 8px; border-radius: var(--r); font-family: inherit;
}
.modal-close:hover { background: var(--surface2); }
.modal-body { padding: 20px; flex: 1; }
.modal-ft {
  padding: 12px 20px; border-top: 0.5px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface2);
  border-radius: 0 0 var(--rlg) var(--rlg);
  position: sticky; bottom: 0;
}

/* ── DOMAIN COVERAGE BARS ─────────────────── */
.domain-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 0.5px solid var(--border);
}
.domain-row:last-child { border-bottom: none; }
.domain-name  { font-size: 12px; flex: 1; color: var(--text2); }
.domain-pct   { font-size: 11px; font-weight: 500; width: 32px; text-align: right; }
.domain-bar   { width: 80px; }

/* ── CHECKLIST ────────────────────────────── */
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 0.5px solid var(--border);
}
.check-item:last-child { border-bottom: none; }
.check-box {
  width: 20px; height: 20px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.check-box.done { background: var(--green-bg); color: var(--green); }
.check-box.todo { background: var(--red-bg);   color: var(--red);   }

/* ── TOGGLE SWITCH ────────────────────────── */
.toggle-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 0; border-bottom: 0.5px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-name { font-size: 13px; font-weight: 500; }
.toggle-desc { font-size: 11px; color: var(--text3); margin-top: 2px; }
.toggle-sw {
  width: 36px; height: 20px; border-radius: 10px;
  cursor: pointer; position: relative;
  flex-shrink: 0; border: none; font-family: inherit;
  transition: background .18s;
}
.toggle-sw.on  { background: var(--accent); }
.toggle-sw.off { background: var(--border2); }
.toggle-sw::after {
  content: ''; position: absolute; top: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; transition: left .18s;
}
.toggle-sw.on::after  { left: 18px; }
.toggle-sw.off::after { left: 2px; }

/* ── LOGIN PAGE ───────────────────────────── */
.login-wrap {
  min-height: 100vh; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-card {
  background: var(--surface); border-radius: 16px;
  border: 0.5px solid var(--border);
  padding: 40px 36px; width: 100%; max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}
.login-logo   { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-mark   {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.login-title  { font-size: 18px; font-weight: 600; color: var(--text); }
.login-sub    { font-size: 11px; color: var(--text3); margin-top: 2px; }
.login-hint   {
  margin-top: 18px; font-size: 11px; color: var(--text3);
  text-align: center; background: var(--surface2);
  padding: 9px 12px; border-radius: var(--r);
}
.login-error  {
  background: var(--red-bg); border: 0.5px solid #f0b0b0;
  color: var(--red); border-radius: var(--r);
  padding: 9px 12px; font-size: 12px; margin-bottom: 14px;
}

/* ── ALERT / TOAST ────────────────────────── */
.alert {
  padding: 10px 14px; border-radius: var(--r);
  font-size: 12px; margin-bottom: 14px;
}
.alert-success { background: var(--green-bg); color: var(--green); border: 0.5px solid #a0cc7a; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 0.5px solid #f0b0b0; }

.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: #13130c; color: #fff;
  padding: 11px 16px; border-radius: var(--r);
  font-size: 12px; z-index: 999;
  opacity: 0; transform: translateY(8px);
  transition: all .22s ease; pointer-events: none;
  max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── EMPTY STATE ──────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-icon  { font-size: 32px; margin-bottom: 10px; }
.empty-text  { font-size: 13px; }

/* ── CODE INLINE ──────────────────────────── */
code {
  font-family: 'SF Mono','Fira Mono',monospace;
  background: var(--surface2); padding: 1px 5px;
  border-radius: 3px; font-size: 11px;
}

/* ── EVIDENCE ITEMS ───────────────────────── */
.ev-icon {
  width: 32px; height: 32px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

/* ── FILE UPLOAD ──────────────────────────── */
.file-upload-area {
  border: 2px dashed var(--border2); border-radius: var(--r);
  padding: 20px; text-align: center;
  cursor: pointer; transition: border-color .13s;
}
.file-upload-area:hover { border-color: var(--accent); }
.file-upload-area input[type=file] { display: none; }

/* ── SEARCH/FILTER BAR ────────────────────── */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 14px; flex-wrap: wrap;
}
.filter-bar .form-control { width: auto; flex: 1; min-width: 120px; }
.search-input { max-width: 220px; }

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET (≤900px)
═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main {
    margin-left: 0;
  }
  .hamburger {
    display: flex;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }
  .topbar-action {
    display: none;
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — MOBILE (≤600px)
═══════════════════════════════════════════ */
@media (max-width: 600px) {
  .content {
    padding: 12px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
  }
  .stat-value { font-size: 22px; }
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .card { padding: 12px; }
  .modal { border-radius: var(--r); }
  .modal-body { padding: 14px; }
  .login-card { padding: 28px 20px; }
  .tbl th, .tbl td { padding: 7px 8px; font-size: 11px; }
  .form-row-3 { grid-template-columns: 1fr; }
  .filter-bar .form-control { min-width: 100%; }
  .domain-bar { display: none; }
  .btn { font-size: 12px; }
}

/* ── PRINT ────────────────────────────────── */
@media print {
  .sidebar, .topbar, .hamburger, .sidebar-overlay,
  .btn, .modal-overlay, .toast, .filter-bar { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  body { font-size: 12px; }
}
