:root {
  --bg: #ffffff;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #252525;
  --charcoal: #252525;
  --muted: #4a4a4a;
  --primary: #f47b20;
  --primary-dark: #e06a0f;
  --primary-text: #c2410c;
  --primary-light: #f9a25c;
  --accent: #f47b20;
  --stride-orange: #f47b20;
  --stride-green: #00a86b;
  --success: #00a86b;
  --danger: #dc2626;
  --warn: #f47b20;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 24px rgba(16, 24, 40, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.topbar {
  background: var(--charcoal);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.topbar .brand span { font-size: 20px; }

/* Stride logo */
.brand-img {
  height: 30px;
  width: auto;
  display: block;
  object-fit: contain;
}
.logo-img {
  display: block;
  margin: 0 auto;
  width: auto;
  object-fit: contain;
}
.logo-img--lg { height: 54px; }
.topbar .user-area { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar .user-area .role-badge {
  background: rgba(255,255,255,0.15);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
}
.topbar button {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
}
.topbar button:hover { background: rgba(255,255,255,0.1); }

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 { margin-top: 0; font-size: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.card-head h3 { margin: 0; }

.export-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.export-group .btn.small { padding: 5px 11px; font-size: 12px; }
.export-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.export-bar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 220px;
  font-size: 13px;
  color: var(--muted);
}
.export-bar-text strong { color: var(--text); font-size: 14px; }
.export-bar-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  background: var(--primary);
  color: var(--charcoal);
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f9fafb; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 6px 12px; font-size: 13px; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid rgba(22, 101, 52, 0.3);
  border-color: var(--primary);
}
.textarea { min-height: 80px; resize: vertical; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #374151; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.draft { background: #f3f4f6; color: #4a4a4a; }
.badge.pending_review { background: #fef3c7; color: #b45309; }
.badge.in_revision { background: #fef3c7; color: #b45309; }
.badge.approved { background: #fff7ed; color: #c2410c; }
  .badge.filed { background: #fdecdc; color: #b04a06; }
.badge.registered { background: #fff7ed; color: #c2410c; }
.badge.category { background: #eef2ff; color: #4338ca; }

.case-list { list-style: none; padding: 0; margin: 0; }
.case-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.case-list li:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.case-list .case-name { font-weight: 600; }
.case-list .case-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.case-list .right { display: flex; align-items: center; gap: 10px; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.tabs button {
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
  .tabs button.active { background: var(--primary); color: var(--charcoal); }

.section-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.section-nav button {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.section-nav button.active { background: var(--primary); color: var(--charcoal); border-color: var(--primary); }

.sub-row { display: flex; gap: 12px; align-items: center; }
.sub-row .grow { flex: 1; }
.sub-row .remove { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 18px; }

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.doc-list .doc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  cursor: pointer;
}
.check-row input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}
.check-row input:disabled,
.check-row[aria-disabled="true"] {
  cursor: not-allowed;
}
.check-copy { flex: 1; }

.comments { max-height: 300px; overflow-y: auto; }
.comment {
  padding: 10px 14px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 14px;
}
.comment .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.success { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.alert.info { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #252525 0%, #3d3d3d 100%);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { text-align: center; font-size: 28px; margin-bottom: 8px; }
.auth-card h1 { text-align: center; color: #fff; margin: 0 0 20px; font-size: 22px; }
.auth-card .card { padding: 28px; }
.auth-switch { text-align: center; font-size: 13px; color: rgba(255,255,255,0.85); margin-top: 16px; }
.auth-switch a { color: #fff; font-weight: 600; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--charcoal);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

.status-timeline { display: flex; gap: 4px; margin: 8px 0 16px; }
.status-timeline .step { flex: 1; height: 6px; border-radius: 3px; background: #e5e7eb; }
.status-timeline .step.done { background: var(--success); }
.status-timeline .step.current { background: var(--primary); }

table.review-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.review-table th, table.review-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.review-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------------------------------------------------------------------------
   Document auto-fill
   --------------------------------------------------------------------------- */

.autofill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 20px;
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  background: #fffaf5;
}
.autofill-bar-text { font-size: 14px; color: var(--muted); flex: 1; min-width: 240px; }
.autofill-bar-text strong { color: var(--text); }

.af-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 37, 37, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 200;
}
.af-modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.af-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.af-head h3 { margin: 0; font-size: 17px; }
.af-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}
.af-close:hover { color: var(--text); }
.af-body { padding: 20px 22px; }
.af-hint { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.af-upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.af-upload input[type=file] {
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.af-group { margin: 16px 0; }
.af-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.af-group-head input { margin: 0; }
.af-row {
  display: grid;
  grid-template-columns: 20px 180px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}
.af-row input { margin: 0; }
.af-k { color: var(--muted); font-weight: 600; }
.af-v { color: var(--text); word-break: break-word; }
.af-item {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
  padding: 7px 0 7px 26px;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}
.af-item b { min-width: 160px; }
.af-item span { color: var(--muted); }
.af-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .af-row { grid-template-columns: 20px 1fr; }
  .af-v { grid-column: 2; }
}

/* Register of Members */
.reg-overlay { padding: 24px 16px; }
.reg-modal { max-width: 1180px; }
.reg-head-actions { display: flex; align-items: center; gap: 12px; }
.reg-body { padding: 22px 26px 30px; }
.reg-title { text-align: center; margin-bottom: 22px; }
.reg-company { font-size: 20px; font-weight: 700; letter-spacing: 0.02em; }
.reg-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.reg-title h2 { margin: 16px 0 0; font-size: 16px; text-transform: uppercase; letter-spacing: 0.08em; }
.reg-body > h4 { font-size: 14px; margin: 24px 0 8px; }
.reg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 6px;
}
.reg-table th,
.reg-table td {
  border: 1px solid #d1d5db;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}
.reg-table th {
  background: #f3f4f6;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}
.reg-table td.num { text-align: right; white-space: nowrap; }
.reg-member { margin-bottom: 18px; }
.reg-member-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-bottom: none;
  font-size: 13px;
}
.reg-member-head span { color: var(--muted); font-size: 12px; }
.reg-muted { color: var(--muted); font-style: italic; }
.reg-actions { white-space: nowrap; }
.reg-actions .btn { padding: 3px 8px; font-size: 11px; }
.reg-movement {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.reg-movement h4 { margin: 0 0 12px; }
.reg-form-actions { display: flex; gap: 10px; margin-top: 8px; }

@media (max-width: 760px) {
  .reg-body { padding: 16px; }
  .reg-modal { max-width: none; }
  .reg-table { display: block; overflow-x: auto; }
}

@media print {
  body.reg-print { background: #fff; }
  body.reg-print > * { display: none !important; }
  body.reg-print .reg-overlay {
    display: block !important;
    position: static;
    inset: auto;
    background: none;
    padding: 0;
    overflow: visible;
  }
  body.reg-print .reg-modal {
    max-width: none;
    width: auto;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  body.reg-print .reg-no-print { display: none !important; }
  body.reg-print .reg-body { padding: 0; }
  body.reg-print .reg-table { font-size: 10px; }
  body.reg-print .reg-table th,
  body.reg-print .reg-table td { padding: 4px 5px; }
  body.reg-print .reg-member { page-break-inside: avoid; }
}