:root {
  --ink: #10192f;
  --ink-2: #1a274a;
  --fog: #eef1f5;
  --card: #ffffff;
  --oxblood: #7a2e2e;
  --oxblood-dark: #5e2222;
  --verdigris: #2f6e5d;
  --verdigris-light: #e4f1ec;
  --gold: #b08d3f;
  --gold-light: #f6efdd;
  --slate: #2b3245;
  --slate-500: #6b7280;
  --slate-200: #e2e5eb;
  --oxblood-light: #f5e7e5;
  --navy-light: #e7eaf3;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--fog);
  color: var(--slate);
  margin: 0;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.mono { font-family: 'IBM Plex Mono', monospace; }

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

/* ---------- Shell layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #cfd6e6;
  display: flex;
  flex-direction: column;
  padding: 28px 0 20px;
}

.sidebar-brand {
  padding: 0 24px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 18px;
}

.sidebar-brand .mark {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 20px;
  color: #fff;
  line-height: 1.15;
}

.sidebar-brand .sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(207,214,230,0.45);
  padding: 4px 24px;
  margin-top: 14px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  font-size: 14px;
  color: #cfd6e6;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover { background: rgba(255,255,255,0.05); }

.nav-link.active {
  background: rgba(255,255,255,0.07);
  border-left-color: var(--gold);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 24px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
}
.sidebar-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(207,214,230,0.6);
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar-title { font-size: 17px; font-weight: 600; color: var(--ink); font-family: 'Fraunces', serif; }

.content { padding: 28px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 22px;
}

.stat-card { padding: 18px 20px; }
.stat-value { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; color: var(--ink); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate-500); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
.btn-primary { background: var(--oxblood); color: #fff; }
.btn-primary:hover { background: var(--oxblood-dark); }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-secondary:hover { filter: brightness(1.15); }
.btn-outline { background: transparent; border-color: var(--slate-200); color: var(--slate); }
.btn-outline:hover { background: var(--fog); }
.btn-ghost { background: transparent; color: var(--slate-500); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Forms ---------- */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--slate); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--slate);
  background: #fff;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  border-color: var(--ink);
}
.dropzone {
  border: 1.5px dashed var(--slate-200);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  color: var(--slate-500);
  background: var(--fog);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-slate { background: var(--slate-200); color: var(--slate); }
.badge-gold { background: var(--gold-light); color: #7a5f24; }
.badge-verdigris { background: var(--verdigris-light); color: var(--verdigris); }
.badge-oxblood { background: var(--oxblood-light); color: var(--oxblood); }
.badge-navy { background: var(--navy-light); color: var(--ink); }

/* ---------- Ribbon timeline (signature element) ---------- */
.ribbon {
  position: relative;
  padding-left: 34px;
}
.ribbon::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--gold) 0, var(--gold) 5px,
    transparent 5px, transparent 9px
  );
  border-radius: 3px;
}
.ribbon-item {
  position: relative;
  padding-bottom: 22px;
}
.ribbon-item:last-child { padding-bottom: 0; }
.ribbon-node {
  position: absolute;
  left: -34px;
  top: 1px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ribbon-item.complete .ribbon-node {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light);
}
.ribbon-item.complete .ribbon-node::after {
  content: "";
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}
.ribbon-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.ribbon-item:not(.complete) .ribbon-title { color: var(--slate-500); font-weight: 500; }
.ribbon-date { font-size: 12px; color: var(--slate-500); margin-top: 1px; }

/* ---------- Table ---------- */
table.tms-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tms-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-200);
}
table.tms-table td {
  padding: 12px;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}
table.tms-table tr:last-child td { border-bottom: none; }
table.tms-table tr:hover td { background: var(--fog); }

/* ---------- Similarity meter ---------- */
.sim-meter { width: 100%; height: 8px; border-radius: 4px; background: var(--slate-200); overflow: hidden; }
.sim-meter-fill { height: 100%; border-radius: 4px; }
.sim-low { background: var(--verdigris); }
.sim-moderate { background: var(--gold); }
.sim-high { background: var(--oxblood); }

/* ---------- Auth pages ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  background: var(--ink);
}
.auth-visual {
  flex: 1.1;
  background: radial-gradient(circle at 20% 20%, rgba(176,141,63,0.18), transparent 45%), linear-gradient(160deg, var(--ink) 0%, #0a1120 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  color: #fff;
  position: relative;
}
.auth-form-side {
  flex: 1;
  background: var(--fog);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-card { width: 100%; max-width: 400px; }

@media (max-width: 900px) {
  .auth-visual { display: none; }
  .sidebar { display: none; }
}
