:root {
  --bg:       #0D1117;
  --surface:  #161B22;
  --card:     #21262D;
  --card2:    #2D333B;
  --border:   #30363D;
  --accent:   #7C3AED;
  --accent-h: #8B5CF6;
  --accent-l: #4C1D95;
  --success:  #22C55E;
  --warning:  #F59E0B;
  --danger:   #EF4444;
  --info:     #3B82F6;
  --text:     #E6EDF3;
  --muted:    #8B949E;
  --radius:   8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Inter', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: .5px;
}

.app-title { font-size: 15px; font-weight: 600; }
.app-user  { margin-left: auto; font-size: 12px; color: var(--muted); }

.nav-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 16px;
  gap: 2px;
}

.nav-tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-tab:hover  { color: var(--text); }
.nav-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.main-content { padding: 24px; max-width: 1280px; margin: 0 auto; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Form elements ────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 11px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B949E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.field { display: flex; flex-direction: column; }

/* Table-style rows for RFI sections */
.table-head, .table-row {
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.table-head span, .row-num {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.days-badge {
  background: var(--card2);
  border-radius: 6px;
  padding: 7px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-h);
  text-align: center;
  min-width: 54px;
}
.days-badge.has-value { color: var(--success); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

.btn-secondary { background: var(--card2); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }

.btn-danger    { background: #7F1D1D; color: #FCA5A5; border: 1px solid #B91C1C; }
.btn-danger:hover:not(:disabled) { background: #991B1B; }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Result cards ─────────────────────────────────────────────────────────── */
.deadline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .deadline-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .deadline-grid { grid-template-columns: 1fr; }
}

.deadline-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 90px;
}

.deadline-card .d-date {
  font-size: 20px;
  font-weight: 700;
}
.deadline-card .d-day  { font-size: 11px; color: var(--muted); }
.deadline-card .d-label {
  margin-top: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--card2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td      { background: rgba(255,255,255,.02); }

.tbl-wrap {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.timeline { padding: 8px 0; }

.tl-item {
  display: flex;
  gap: 0;
  position: relative;
}

.tl-date {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 16px;
  padding-top: 2px;
}

.tl-date .date-str  { font-size: 13px; font-weight: 500; }
.tl-date .day-str   { font-size: 10px; color: var(--muted); }

.tl-dot-col {
  width: 24px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tl-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 5px;
}
.tl-item.important .tl-dot {
  background: var(--accent);
  border-color: var(--accent);
  width: 14px; height: 14px;
  margin-top: 3px;
}

.tl-line {
  width: 2px;
  background: var(--border);
  flex-grow: 1;
  min-height: 20px;
  margin-top: 2px;
}

.tl-content {
  padding: 0 0 20px 16px;
  flex: 1;
}

.tl-label {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.tl-item.important .tl-label {
  font-weight: 700;
  font-size: 14px;
  background: var(--card);
  border-left: 3px solid var(--accent);
  padding: 6px 12px;
  border-radius: 4px;
  color: var(--text);
}

.tl-item.important .tl-date .date-str {
  color: var(--accent-h);
  font-weight: 700;
  font-size: 14px;
}

.tl-legal {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Badges / tags ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-info    { background: rgba(59,130,246,.15); color: var(--info); }
.badge-muted   { background: var(--card2); color: var(--muted); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  transform: translateY(20px);
  transition: transform .2s;
}
.modal-backdrop.open .modal { transform: translateY(0); }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #FCA5A5; }
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: #86EFAC; }
.alert-info    { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #93C5FD; }

/* ── Separator ─────────────────────────────────────────────────────────────── */
.sep { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Utils ─────────────────────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mb-0   { margin-bottom: 0 !important; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.text-xs    { font-size: 11px; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-accent  { color: var(--accent-h); }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }

/* ── Login page ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-logo .logo-badge { font-size: 15px; padding: 6px 14px; }
.login-logo .logo-text  { font-size: 16px; font-weight: 700; }

/* ── Disclaimer tab ─────────────────────────────────────────────────────── */
.nav-tab--disclaimer { color: var(--warning) !important; opacity: 0.8; }
.nav-tab--disclaimer:hover { opacity: 1; }
.nav-tab--disclaimer.active { color: var(--warning) !important; border-bottom-color: var(--warning) !important; opacity: 1; }

.disclaimer-block {
  background: var(--card2);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.disclaimer-block p { margin: 0; line-height: 1.7; }
.disclaimer-heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 0 0 8px 0;
}

/* ── Date format hint (in result/timeline headers) ──────────────────────── */
.date-fmt-hint {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.5;
  letter-spacing: 0.03em;
  margin-left: 3px;
  vertical-align: middle;
}

/* ── Settings sidebar layout ────────────────────────────────────────────── */
.settings-layout {
  display: flex;
  gap: 0;
  min-height: 400px;
}
.settings-sidebar {
  width: 190px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 4px 0;
  margin-right: 28px;
}
.settings-nav-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-right: 3px solid transparent;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  border-radius: 4px 0 0 4px;
}
.settings-nav-item:hover  { color: var(--text); background: var(--card2); }
.settings-nav-item.active { color: var(--text); font-weight: 600; border-right-color: var(--accent); background: var(--card); }
.settings-section         { display: none; flex: 1; }
.settings-section.active  { display: block; }
