@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ---- Color tokens: light blue & white, per the brief ---- */
  --color-bg: #EDF5FC;
  --color-bg-alt: #E4F0FB;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F6FAFE;

  --color-primary: #2472CC;
  --color-primary-dark: #1B5AA3;
  --color-primary-light: #DCEBFA;
  --color-primary-lighter: #EFF6FD;

  --color-ink: #142B3E;
  --color-ink-muted: #5B7A93;
  --color-ink-faint: #90A9BE;

  --color-border: #D8E7F4;
  --color-border-strong: #BBD6EC;

  --color-success: #1E9A6C;
  --color-success-bg: #E1F6EC;
  --color-warning: #C9821A;
  --color-warning-bg: #FBF0DB;
  --color-danger: #CC4141;
  --color-danger-bg: #FBE6E6;
  --color-info: #2472CC;

  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20, 43, 62, 0.06);
  --shadow-md: 0 2px 8px rgba(20, 43, 62, 0.06), 0 8px 24px rgba(20, 43, 62, 0.05);
  --shadow-lg: 0 12px 32px rgba(20, 43, 62, 0.12);

  --sidebar-w: 248px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-ink);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }

p { margin: 0 0 12px; color: var(--color-ink-muted); }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------- App shell ---------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 22px 18px;
}

.sidebar-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--color-primary), var(--color-primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--color-ink);
  line-height: 1.1;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--color-ink-faint);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 14px;
  overflow-y: auto;
}

.sidebar-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ink-faint);
  font-weight: 700;
  padding: 16px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-ink-muted);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--color-surface-alt);
  color: var(--color-ink);
  text-decoration: none;
}

.nav-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.nav-item svg { flex-shrink: 0; opacity: 0.85; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--color-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  font-family: var(--font-display);
}

.sidebar-user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11.5px;
  color: var(--color-ink-faint);
}

.main-col {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  background: rgba(237, 245, 252, 0.88);
  backdrop-filter: blur(6px);
  z-index: 10;
  border-bottom: 1px solid transparent;
}

.topbar-title { font-size: 18px; font-weight: 700; font-family: var(--font-display); }
.topbar-date { font-size: 12.5px; color: var(--color-ink-faint); margin-top: 1px; }

.content {
  padding: 24px 28px 56px;
  max-width: 1180px;
  width: 100%;
}

.mobile-topbar { display: none; }

/* ---------------- Cards ---------------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-header p { margin: 2px 0 0; font-size: 13px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--color-ink-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--color-ink);
}

.stat-card .stat-sub { font-size: 12px; color: var(--color-ink-faint); margin-top: 4px; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }

.btn-secondary { background: var(--color-surface); color: var(--color-ink); border-color: var(--color-border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--color-surface-alt); }

.btn-ghost { background: transparent; color: var(--color-ink-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-alt); color: var(--color-ink); }

.btn-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.btn-danger:hover:not(:disabled) { background: var(--color-danger); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

/* ---------------- Forms ---------------- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--color-ink-faint); margin-top: 5px; }

.input, select.input, textarea.input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-ink);
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
textarea.input { resize: vertical; min-height: 80px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--color-primary); }
.checkbox-row label { margin: 0; font-weight: 500; }

.file-drop {
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.file-drop:hover { border-color: var(--color-primary); background: var(--color-primary-lighter); }
.file-drop.has-file { border-color: var(--color-success); background: var(--color-success-bg); }
.file-drop input[type=file] { display: none; }
.file-drop-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--color-primary-light); color: var(--color-primary-dark);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-drop.has-file .file-drop-icon { background: var(--color-success-bg); color: var(--color-success); }
.file-drop-text { font-size: 13px; font-weight: 600; color: var(--color-ink); }
.file-drop-sub { font-size: 12px; color: var(--color-ink-faint); margin-top: 1px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------- Tables ---------------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--color-surface); }
thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-faint);
  font-weight: 700;
  background: var(--color-surface-alt);
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-ink);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--color-surface-alt); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cell-muted { color: var(--color-ink-faint); }

/* ---------------- Badges ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-neutral { background: var(--color-surface-alt); color: var(--color-ink-muted); border: 1px solid var(--color-border); }
.badge-primary { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ---------------- Alerts / flash ---------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--color-success-bg); color: #146848; border-color: #b9e6d1; }
.alert-error { background: var(--color-danger-bg); color: #8f2c2c; border-color: #f2c2c2; }
.alert-info { background: var(--color-primary-lighter); color: var(--color-primary-dark); border-color: var(--color-border-strong); }

/* ---------------- Progress ring (signature element) ---------------- */

.ring-hero {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 26px;
  flex-wrap: wrap;
}
.ring-wrap { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--color-primary-light); stroke-width: 11; }
.ring-progress {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-label .ring-count { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--color-ink); line-height: 1; }
.ring-label .ring-total { font-size: 12px; color: var(--color-ink-faint); font-weight: 600; margin-top: 2px; }
.ring-hero-text h2 { margin-bottom: 6px; }
.ring-hero-text p { margin-bottom: 0; }

.ring-mini { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.ring-mini svg { transform: rotate(-90deg); }
.ring-mini .ring-track { stroke-width: 5; }
.ring-mini .ring-progress { stroke-width: 5; }
.ring-mini .ring-mini-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; color: var(--color-ink); font-family: var(--font-display);
}

/* ---------------- Checklist item cards ---------------- */

.checklist-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--color-surface);
  transition: border-color 0.15s ease;
}
.checklist-item.is-done { border-color: #bfe8d5; background: linear-gradient(180deg, #fff 0%, #f7fdfa 100%); }
.checklist-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 4px; }
.checklist-item-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-family: var(--font-display); font-size: 15px; }
.checklist-item-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--color-surface-alt); color: var(--color-ink-muted);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
  font-family: var(--font-body);
}
.checklist-item.is-done .checklist-item-num { background: var(--color-success-bg); color: var(--color-success); }
.checklist-item-desc { font-size: 13px; color: var(--color-ink-muted); margin: 4px 0 12px 36px; }
.checklist-item-body { margin-left: 36px; }
.checklist-item-done-file {
  display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 10px 12px;
  background: var(--color-success-bg); border-radius: var(--radius-sm); color: #146848;
}
.checklist-item-done-file a { color: #146848; font-weight: 700; }

/* ---------------- Auth pages ---------------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #DCEBFA 0%, var(--color-bg) 55%);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
  border: 1px solid var(--color-border);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-title { font-size: 21px; margin-bottom: 4px; }
.auth-sub { font-size: 13.5px; margin-bottom: 22px; }
.auth-foot { text-align: center; font-size: 13px; margin-top: 18px; color: var(--color-ink-muted); }
.auth-default-note {
  margin-top: 18px; padding: 12px 14px; background: var(--color-primary-lighter);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--color-primary-dark); line-height: 1.55;
}

/* ---------------- Empty states ---------------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-ink-faint);
}
.empty-state svg { margin: 0 auto 14px; opacity: 0.6; }
.empty-state-title { font-weight: 700; color: var(--color-ink-muted); font-size: 14.5px; margin-bottom: 4px; }
.empty-state-sub { font-size: 13px; }

/* ---------------- Misc utility ---------------- */

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flex-gap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--color-ink-muted); }
.text-faint { color: var(--color-ink-faint); }
.text-sm { font-size: 12.5px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; }
.section-title:first-child { margin-top: 0; }
.divider { height: 1px; background: var(--color-border); margin: 18px 0; border: none; }
.pill-tabs { display: flex; gap: 6px; background: var(--color-surface-alt); padding: 4px; border-radius: var(--radius-pill); width: fit-content; margin-bottom: 18px; border: 1px solid var(--color-border); }
.pill-tab { padding: 7px 16px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--color-ink-muted); }
.pill-tab.active { background: var(--color-primary); color: #fff; }
.pill-tab:hover { text-decoration: none; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 43, 62, 0.42);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: var(--color-surface); border-radius: var(--radius-lg); padding: 24px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow-lg);
}
.modal-box h3 { margin-bottom: 8px; }
.modal-box p { font-size: 13.5px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

code.mono { font-family: 'SFMono-Regular', Consolas, monospace; background: var(--color-surface-alt); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 60px; padding: 0 16px; background: var(--color-surface);
    border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 15;
  }
  .topbar { display: none; }
  .content { padding: 18px 16px 44px; }
  .sidebar-scrim {
    display: none; position: fixed; inset: 0; background: rgba(20,43,62,0.35); z-index: 19;
  }
  .sidebar-scrim.open { display: block; }
  .ring-hero { padding: 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 26px 22px; }
}
