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

:root {
  --navy:    #002f6c;
  --navy2:   #003d8f;
  --blue:    #1a2e72;
  --mid:     #4a7fa4;
  --cyan:    #9ddced;
  --cyan2:   #6ecde8;
  --bg:      #f0f4f9;
  --card:    #ffffff;
  --border:  #e1e8f0;
  --text:    #111827;
  --muted:   #6b7280;
  --green:   #16a34a;
  --amber:   #d97706;
  --red:     #dc2626;
  --radius:  14px;
  --shadow:  0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

body {
  font-family: 'Glacial Indifference', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  background-attachment: initial;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Override landing page h-tag weight so app headings stay bold */
h1, h2, h3, h4, h5, h6 { font-weight: 700; }

/* ── App header ───────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #002050 0%, #002f6c 60%, #003d8f 100%);
  color: white;
  padding: 0 36px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 20px rgba(0,0,0,0.22);
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--cyan2) 50%, transparent 100%);
  opacity: 0.7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.4px;
  color: white;
  text-decoration: none;
}

.brand-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--cyan), var(--cyan2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(157,220,237,0.4);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-module {
  background: rgba(157,220,237,0.15);
  border: 1px solid rgba(157,220,237,0.3);
  color: var(--cyan);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan2) 100%);
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(110,205,232,0.35);
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(110,205,232,0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255,255,255,0.10);
  color: white;
  border: 1px solid rgba(255,255,255,0.20);
  backdrop-filter: blur(4px);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}

.btn-outline {
  background: white;
  color: var(--navy);
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.btn-outline:hover {
  border-color: var(--mid);
  background: #f8fbff;
}

.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 7px; }

.btn-navy {
  background: var(--navy);
  color: white;
  box-shadow: 0 2px 8px rgba(0,47,108,0.25);
}

.btn-navy:hover {
  background: var(--navy2);
  box-shadow: 0 4px 14px rgba(0,47,108,0.35);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Status badges ────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-pending {
  background: #fff7e6;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-opened {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-signed {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Form controls ────────────────────────────────────── */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.1px;
}

input, select, textarea {
  padding: 10px 14px;
  border: 1.5px solid #d1dbe8;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fafcff;
  transition: all 0.15s;
  outline: none;
  width: 100%;
}

input::placeholder, textarea::placeholder { color: #b0bac8; }

input:focus, select:focus, textarea:focus {
  border-color: var(--mid);
  background: white;
  box-shadow: 0 0 0 3px rgba(74,127,164,0.12);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── Modal ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(2, 14, 36, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: white;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.26), 0 4px 16px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.34,1.2,0.64,1);
  border: 1px solid rgba(255,255,255,0.9);
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.15s;
  flex-shrink: 0;
  margin-top: 1px;
}

.modal-close:hover { background: #e2e8f0; color: var(--text); }

.modal-body {
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #fafbfc;
  border-radius: 0 0 18px 18px;
}

/* ── Audit timeline ───────────────────────────────────── */
.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.timeline-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.timeline-connector {
  width: 2px;
  flex: 1;
  background: linear-gradient(to bottom, var(--border), transparent);
  margin: 4px 0;
  min-height: 16px;
}

.timeline-item:last-child .timeline-connector { display: none; }

.timeline-content { padding-top: 7px; }

.timeline-event {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.timeline-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
