/* ── Strand Design System ───────────────────────────────────────────────── */
:root {
  --navy:        #1E3177;
  --navy-dark:   #15234F;
  --navy-pale:   #EEF0FA;
  --teal:        #2A9D8F;
  --teal-light:  #E0F5F2;
  --amber:       #F0A800;
  --amber-light: #FFF4CC;
  --bg:          #F5F6FA;
  --white:       #FFFFFF;
  --text:        #1E2530;
  --text-muted:  #6B7280;
  --border:      #E0E4F0;
  --danger:      #DC2626;
  --danger-light:#FEE2E2;
  --success:     #16A34A;
  --success-light:#DCFCE7;
  --sidebar-w:   240px;
  --radius:      8px;
  --radius-sm:   4px;
}

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

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

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

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
h2 { font-size: 1.2rem; font-weight: 600; color: var(--navy); }
h3 { font-size: 1rem;   font-weight: 600; color: var(--text); }

.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12px; }
.text-mono   { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }

/* ── Admin Layout ────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.3px;
}
.sidebar-logo .sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.35);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}
.nav-item.active {
  color: var(--white);
  background: rgba(255,255,255,0.12);
  border-left-color: var(--teal);
}
.nav-item .badge {
  margin-left: auto;
  background: var(--teal);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

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

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-content {
  padding: 32px;
  flex: 1;
}

/* ── Portal Layout ───────────────────────────────────────────────────────── */
.portal-nav {
  background: var(--navy);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-nav .brand { color: white; font-size: 16px; font-weight: 700; }
.portal-nav-links {
  display: flex;
  gap: 4px;
}
.portal-nav-links a {
  color: rgba(255,255,255,0.7);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}
.portal-nav-links a:hover,
.portal-nav-links a.active {
  color: white;
  background: rgba(255,255,255,0.12);
}
.portal-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card-sm { padding: 16px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
/* The strand thread motif — left border accent on cards */
.card-strand {
  border-left: 3px solid var(--teal);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card.warning { border-top: 3px solid var(--amber); }
.stat-card.danger  { border-top: 3px solid var(--danger); }
.stat-card.teal    { border-top: 3px solid var(--teal); }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase;
              letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tr:hover td { background: var(--navy-pale); }
tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-pending    { background: var(--amber-light); color: #92600A; }
.badge-approved   { background: var(--teal-light);  color: #145C54; }
.badge-active     { background: var(--teal-light);  color: #145C54; }
.badge-accepted   { background: var(--success-light); color: #14532D; }
.badge-submitted  { background: var(--navy-pale);   color: var(--navy); }
.badge-revision   { background: var(--amber-light); color: #92600A; }
.badge-rejected   { background: var(--danger-light); color: #7F1D1D; }
.badge-completed  { background: var(--success-light); color: #14532D; }
.badge-overdue    { background: var(--danger-light); color: #7F1D1D; }
.badge-assigned   { background: var(--navy-pale);   color: var(--navy); }

/* ── Cap bar ─────────────────────────────────────────────────────────────── */
.cap-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cap-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.cap-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--teal);
  transition: width 0.4s;
}
.cap-bar-fill.warning { background: var(--amber); }
.cap-bar-fill.danger  { background: var(--danger); }
.cap-label { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-dark); color: white; text-decoration: none; }
.btn-teal     { background: var(--teal); color: white; }
.btn-teal:hover { background: #228076; color: white; text-decoration: none; }
.btn-ghost    { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); text-decoration: none; }
.btn-danger   { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; color: white; text-decoration: none; }
.btn-sm       { padding: 5px 12px; font-size: 12px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
label .required { color: var(--danger); margin-left: 2px; }
label .hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}

input[type=text], input[type=email], input[type=tel],
input[type=number], input[type=date], input[type=password],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.12);
}
textarea { min-height: 100px; resize: vertical; }
select   { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

.form-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; }
.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* File upload */
.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.file-drop:hover, .file-drop.dragover {
  border-color: var(--teal);
  background: var(--teal-light);
}
.file-drop input[type=file] { display: none; }

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.checkbox-group input[type=checkbox] {
  width: auto;
  margin-top: 2px;
  accent-color: var(--teal);
}
.checkbox-group label { font-weight: 400; cursor: pointer; }

/* ── Alerts / Flash ──────────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}
.flash-success { background: var(--success-light); color: #14532D; border-left: 3px solid var(--success); }
.flash-info    { background: var(--navy-pale);     color: var(--navy);  border-left: 3px solid var(--navy); }
.flash-warning { background: var(--amber-light);   color: #92600A; border-left: 3px solid var(--amber); }
.flash-danger  { background: var(--danger-light);  color: #7F1D1D; border-left: 3px solid var(--danger); }

.error-list {
  background: var(--danger-light);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.error-list li { color: #7F1D1D; font-size: 13px; margin-left: 16px; }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill { height: 100%; background: var(--teal); border-radius: 3px; transition: width 0.4s; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state h3 { margin-bottom: 8px; color: var(--text-muted); }

.id-chip {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--navy-pale);
  color: var(--navy);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .brand-name {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.5px;
}
.login-logo .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Public pages */
.public-wrap {
  min-height: 100vh;
  background: var(--bg);
}
.public-header {
  background: var(--navy);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.public-header .brand { color: white; font-size: 18px; font-weight: 700; }
.public-header .sub   { color: rgba(255,255,255,0.5); font-size: 12px; }

.apply-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* Task item */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--white);
  transition: border-color 0.15s;
}
.task-item:hover { border-color: var(--teal); }
.task-item.accepted  { border-left: 3px solid var(--success); }
.task-item.submitted { border-left: 3px solid var(--navy); }
.task-item.revision  { border-left: 3px solid var(--amber); }
.task-item.overdue   { border-left: 3px solid var(--danger); }

.task-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--navy-pale);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
}
.alert-item.warning { background: var(--amber-light); }
.alert-item.critical { background: var(--danger-light); }
.alert-item.info { background: var(--navy-pale); }
