/* ============================================================
   Sentinel Capital — Admin Dashboard
   Brand match: Libre Baskerville (display) + Lato (body)
   Palette: Ink #0F2B26, Mint #14B8A6, Paper #FAFAF7, Gold #C9A14B
   ============================================================ */

:root {
  --ink:        #0F2B26;
  --ink-soft:   #1E3A33;
  --ink-mute:   #4A6B63;
  --paper:      #FAFAF7;
  --paper-warm: #F5F1E8;
  --mint:       #14B8A6;
  --mint-deep:  #0F8F80;
  --mint-bg:    #ECFDF5;
  --gold:       #C9A14B;
  --gold-deep:  #8A6D20;
  --line:       rgba(15,43,38,0.12);
  --line-soft:  rgba(15,43,38,0.06);
  --error:      #B42318;
  --error-bg:   #FEF3F2;
  --ok:         #0F8F80;
  --ok-bg:      #ECFDF5;
  --warn:       #8A6D20;
  --warn-bg:    #FBF6E9;
  --shadow-card: 0 18px 50px -20px rgba(15,43,38,0.18), 0 4px 14px -6px rgba(15,43,38,0.06);
  --shadow-soft: 0 2px 12px rgba(15,43,38,0.05);
  --radius-input: 14px;
  --radius-card:  20px;
  --transition:   320ms cubic-bezier(.22,.61,.36,1);
  --serif:        'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --sans:         'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
}
::selection { background: var(--mint); color: #fff; }
a { color: var(--mint-deep); }

.wordmark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.28em;
  color: var(--ink);
  text-transform: uppercase;
}
.eyebrow {
  font-family: var(--sans);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--mint-deep);
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   SHARED — inputs, buttons
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field-label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.input {
  width: 100%;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-input);
  padding: 15px 18px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: var(--shadow-soft);
}
.input::placeholder { color: rgba(15,43,38,0.38); }
.input:hover { border-color: rgba(15,43,38,0.22); }
.input:focus, .input:focus-visible {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(20,184,166,0.18), var(--shadow-soft);
}

.btn {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 12px;
  padding: 15px 26px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 200ms ease, background 200ms ease, color 200ms ease, opacity 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 3px solid rgba(20,184,166,0.45); outline-offset: 3px; }
.btn-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 14px 28px -12px rgba(15,43,38,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #143b34 0%, #0F2B26 100%);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--ink-mute);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--ink); background: rgba(15,43,38,0.04); border-color: rgba(15,43,38,0.22); }
.btn[disabled], .btn.is-loading { pointer-events: none; opacity: 0.6; }
.btn .spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  display: none; animation: spin 700ms linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
.btn-ghost .spinner { border-color: rgba(15,43,38,0.25); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(20,184,166,0.06), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(201,161,75,0.05), transparent 70%);
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 40px 38px 34px;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .wordmark { font-size: 13px; }
.login-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.3px;
  margin-top: 14px;
}
.login-sub { font-size: 14px; color: var(--ink-mute); margin-top: 4px; }
.login-card .field:last-of-type { margin-bottom: 18px; }
.login-card .btn { width: 100%; }

/* Remember-me checkbox */
.remember {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--ink-mute);
  cursor: pointer;
  user-select: none;
}
.remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--mint);
  cursor: pointer;
}

/* ============================================================
   DASHBOARD SHELL
   ============================================================ */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 252px; flex-shrink: 0;
  background: var(--ink);
  color: #fff;
  display: flex; flex-direction: column;
  padding: 26px 18px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.sidebar-brand { padding: 0 10px 24px; }
.sidebar-brand .wordmark { color: #fff; font-size: 13px; }
.sidebar-brand .sub {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255,255,255,0.45); margin-top: 6px; font-weight: 700;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.is-active {
  background: rgba(20,184,166,0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(20,184,166,0.35);
}
.sidebar-foot { margin-top: auto; padding-top: 18px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.05);
  font-size: 13px; color: rgba(255,255,255,0.8);
  margin-bottom: 10px;
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--mint); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; flex-shrink: 0;
}
.logout-btn {
  width: 100%; background: transparent; color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 10px;
  padding: 10px; font-family: var(--sans); font-weight: 700; font-size: 13px;
  cursor: pointer; transition: background 180ms ease, color 180ms ease;
}
.logout-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(250,250,247,0.85);
  backdrop-filter: saturate(180%) blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.page-title {
  font-family: var(--serif); font-weight: 700;
  font-size: 24px; letter-spacing: -0.3px;
}
.page-meta { font-size: 13px; color: var(--ink-mute); margin-top: 2px; }
.content { padding: 32px 36px 64px; max-width: 920px; width: 100%; }

/* ============================================================
   CARDS, TABS
   ============================================================ */
.card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.lede { font-size: 16px; color: var(--ink-soft); margin-bottom: 24px; max-width: 64ch; }
.lede strong { color: var(--ink); }

.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 8px 8px 0;
  background: var(--paper-warm);
}
.tab {
  border: none; background: transparent;
  font-family: var(--sans); font-weight: 700; font-size: 14px;
  color: var(--ink-mute); cursor: pointer;
  padding: 14px 20px; border-radius: 10px 10px 0 0;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--mint); background: #fff; }

.tab-panel { padding: 30px 32px; display: none; }
.tab-panel.is-active { display: block; }
.tab-panel h2 {
  font-family: var(--serif); font-weight: 700; font-size: 20px;
  margin-bottom: 6px;
}
.tab-panel .hint { font-size: 14px; color: var(--ink-mute); margin-bottom: 22px; max-width: 60ch; }

/* ============================================================
   DND ACTION TOGGLE (Enable / Disable)
   ============================================================ */
.seg {
  display: inline-flex; padding: 4px;
  background: var(--paper-warm); border: 1px solid var(--line);
  border-radius: 12px; gap: 4px; margin-bottom: 4px;
}
.seg label {
  position: relative; cursor: pointer;
  padding: 10px 18px; border-radius: 9px;
  font-size: 14px; font-weight: 700; color: var(--ink-mute);
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:hover { color: var(--ink); }
.seg input:checked + .seg-txt { }
.seg label:has(input:checked) {
  background: #fff; color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.seg label:has(input[value="true"]:checked) { color: var(--error); box-shadow: 0 0 0 1px rgba(180,35,24,0.25), var(--shadow-soft); }
.seg label:has(input[value="false"]:checked) { color: var(--ok); box-shadow: 0 0 0 1px rgba(15,143,128,0.3), var(--shadow-soft); }
.seg-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: 0.55; }

/* ============================================================
   FILE DROP (CSV)
   ============================================================ */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius-input);
  background: var(--paper-warm);
  padding: 34px 24px; margin-top: 8px; text-align: center;
  cursor: pointer; transition: border-color 180ms ease, background 180ms ease;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--mint); background: var(--mint-bg); }
.dropzone .dz-icon { color: var(--mint-deep); margin-bottom: 10px; }
.dropzone .dz-title { font-weight: 700; font-size: 16px; }
.dropzone .dz-sub { font-size: 13px; color: var(--ink-mute); margin-top: 4px; }
.dropzone input[type="file"] { display: none; }
.file-summary {
  display: none; align-items: center; gap: 12px;
  margin-top: 14px; padding: 14px 16px;
  background: var(--mint-bg); border: 1px solid rgba(20,184,166,0.3);
  border-radius: 12px; font-size: 14px;
}
.file-summary.is-visible { display: flex; }
.file-summary .fs-count { font-weight: 900; color: var(--mint-deep); }
.file-summary .fs-clear {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--ink-mute); font-weight: 700; font-size: 13px;
}
.file-summary .fs-clear:hover { color: var(--error); }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 24px; }

/* ============================================================
   ALERTS / RESULTS
   ============================================================ */
.alert {
  display: none; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 12px; margin-top: 18px;
  font-size: 14px; line-height: 1.5;
}
.alert.is-visible { display: flex; }
.alert-ok    { background: var(--ok-bg);    border: 1px solid rgba(15,143,128,0.25); color: var(--ink); }
.alert-error { background: var(--error-bg); border: 1px solid rgba(180,35,24,0.2);  color: var(--ink); }
.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert-ok .alert-icon { color: var(--ok); }
.alert-error .alert-icon { color: var(--error); }

.result-grid {
  display: none; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px; margin-top: 20px;
}
.result-grid.is-visible { display: grid; }
.stat {
  background: #fff; border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-soft);
}
.stat .num { font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1; }
.stat .lbl { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); margin-top: 8px; }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }
.stat.err .num { color: var(--error); }

.detail {
  display: none; margin-top: 18px;
  border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden;
}
.detail.is-visible { display: block; }
.detail summary {
  padding: 12px 16px; cursor: pointer; font-weight: 700; font-size: 14px;
  background: var(--paper-warm); color: var(--ink-soft);
}
.detail ul { list-style: none; padding: 10px 16px; max-height: 220px; overflow: auto; }
.detail li { font-size: 13px; padding: 4px 0; color: var(--ink-mute); border-bottom: 1px solid var(--line-soft); }
.detail li:last-child { border-bottom: none; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 14px 22px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-card);
  opacity: 0; pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease; z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .sidebar {
    position: static; width: 100%; height: auto; flex-direction: row;
    align-items: center; padding: 14px 18px; gap: 14px;
  }
  .sidebar-brand { padding: 0; }
  .sidebar-brand .sub { display: none; }
  .nav { flex-direction: row; flex: 1; }
  .nav-item { padding: 10px 12px; }
  .sidebar-foot { margin: 0; padding: 0; }
  .user-chip { display: none; }
  .logout-btn { width: auto; padding: 10px 16px; }
  .app { flex-direction: column; }
  .topbar { padding: 18px 20px; }
  .content { padding: 22px 18px 56px; }
  .tab-panel { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
