/* ============================================================
   EQ Pre-Opening & Compliance CRM — design system
   Navy / gold / cream, Playfair Display + Inter, 14px radius
   ============================================================ */

:root {
  --navy: #0D1B2A;
  --navy-2: #16263A;
  --navy-3: #1F3350;
  --gold: #C9A84C;
  --gold-2: #E4D5A8;
  --gold-deep: #A9863A;
  --cream: #F7F4EC;
  --cream-2: #EFE9DA;
  --ink: #0D1B2A;
  --ink-soft: #4A5568;
  --line: #E4DECD;
  --white: #FFFFFF;
  --green: #2F6F52;
  --green-bg: #E7F1EC;
  --red: #8C3B33;
  --red-bg: #F5E9E7;
  --amber: #92661B;
  --amber-bg: #FBF0DC;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(13, 27, 42, 0.06);
  --shadow-md: 0 6px 24px rgba(13, 27, 42, 0.10);
  --shadow-lg: 0 12px 40px rgba(13, 27, 42, 0.16);
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); margin: 0 0 8px; font-weight: 700; }
p { margin: 0 0 8px; line-height: 1.5; }
a { color: var(--navy-2); }
button { font-family: var(--font-body); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); }
::selection { background: var(--gold-2); }

/* ---------- boot / loading ---------- */
.boot-loader { height: 100vh; display: flex; align-items: center; justify-content: center; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--cream-2); border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; transition: all .15s ease; white-space: nowrap;
}
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-2); }
.btn-navy { background: var(--navy); color: var(--cream); }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--navy-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--cream-2); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #efd9d5; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--line); color: var(--navy-2); }
.btn-icon:hover { background: var(--cream-2); }

/* ---------- form fields ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--navy-2); margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px; background: var(--white); color: var(--ink); transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.2);
}
.field textarea { resize: vertical; min-height: 72px; }
.field-hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---------- toast ---------- */
.toast-root { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow-md);
  font-size: 14px; font-weight: 500; max-width: 340px; animation: slideIn .2s ease;
}
.toast-success { background: var(--green-bg); color: var(--green); }
.toast-error { background: var(--red-bg); color: var(--red); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--navy-3), var(--navy) 60%);
  padding: 20px;
}
.login-card {
  background: var(--cream); border-radius: var(--radius); padding: 40px 36px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo-mark {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 14px; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); color: var(--gold); font-size: 22px; font-weight: 700;
}
.login-brand h1 { font-size: 22px; margin-bottom: 4px; }
.login-brand p { color: var(--ink-soft); font-size: 13px; margin: 0; }
.login-error {
  background: var(--red-bg); color: var(--red); padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--navy); color: var(--cream); padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-brand { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: var(--gold); letter-spacing: .3px; }
.topbar-brand small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 10px; color: var(--gold-2); letter-spacing: 1px; text-transform: uppercase; }
.topbar-crumb { color: var(--gold-2); font-size: 14px; }
.topbar-crumb button { background: none; border: none; color: var(--cream); font-size: 14px; font-weight: 600; padding: 0; }
.topbar-crumb button:hover { color: var(--gold); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 13px; color: var(--cream); opacity: .9; }
.topbar-user strong { color: var(--gold-2); }

.page { flex: 1; padding: 32px 24px 60px; max-width: 1180px; margin: 0 auto; width: 100%; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-size: 26px; }
.page-header p { color: var(--ink-soft); font-size: 14px; }

/* ---------- dashboard: project cards ---------- */
.project-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px;
}
.project-card {
  background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--line); transition: transform .15s, box-shadow .15s; text-align: left;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.project-card h3 { font-size: 18px; margin-bottom: 6px; }
.project-card .role-badge { margin-top: 10px; }
.project-card-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700;
  margin-bottom: 14px; font-size: 17px;
}
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--ink-soft); background: var(--white);
  border-radius: var(--radius); border: 1px dashed var(--line);
}

/* ---------- badges / pills ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
}
.badge-admin { background: var(--gold-2); color: var(--gold-deep); }
.badge-member { background: var(--cream-2); color: var(--navy-2); }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-not-started { background: var(--cream-2); color: var(--ink-soft); }
.status-in-progress { background: var(--amber-bg); color: var(--amber); }
.status-done { background: var(--green-bg); color: var(--green); }
.status-delayed { background: var(--red-bg); color: var(--red); }

/* ============================================================
   PROJECT TABS
   ============================================================ */
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tab-btn {
  background: none; border: none; padding: 12px 18px; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }

/* ============================================================
   CHECKLIST (Sector A / B)
   ============================================================ */
.progress-bar-wrap { background: var(--white); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.progress-bar-track { height: 10px; background: var(--cream-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); border-radius: 999px; transition: width .3s; }
.progress-bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); }

.section-block { background: var(--white); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); overflow: hidden; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  background: var(--cream); cursor: pointer; user-select: none;
}
.section-head h3 { font-size: 15px; margin: 0; color: var(--navy); font-family: var(--font-body); font-weight: 700; }
.section-head .section-code { color: var(--gold-deep); font-family: var(--font-head); font-weight: 700; margin-right: 8px; }
.section-head .chev { transition: transform .2s; color: var(--ink-soft); }
.section-head.open .chev { transform: rotate(180deg); }
.section-progress { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.section-body { display: none; }
.section-body.open { display: block; }

.checklist-item { padding: 16px 20px; border-top: 1px solid var(--line); }
.checklist-item-text { font-size: 14px; margin-bottom: 10px; color: var(--ink); }
.checklist-item-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.status-toggle button {
  border: none; background: var(--white); padding: 6px 14px; font-size: 12px; font-weight: 700;
  color: var(--ink-soft); border-right: 1px solid var(--line);
}
.status-toggle button:last-child { border-right: none; }
.status-toggle button.sel-yes.active { background: var(--green); color: var(--white); }
.status-toggle button.sel-no.active { background: var(--red); color: var(--white); }
.status-toggle button.sel-partial.active { background: var(--amber); color: var(--white); }
.notes-toggle { background: none; border: none; font-size: 12px; color: var(--navy-2); font-weight: 600; text-decoration: underline; }
.checklist-item-notes { margin-top: 10px; }
.checklist-item-meta { font-size: 11px; color: var(--ink-soft); margin-top: 8px; }

/* ============================================================
   SECTOR C — task tracker
   ============================================================ */
.task-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.task-grid { display: flex; flex-direction: column; gap: 12px; }
.task-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow .15s;
}
.task-card:hover { box-shadow: var(--shadow-md); }
.task-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.task-card h4 { font-family: var(--font-body); font-size: 15px; margin: 0 0 4px; color: var(--navy); }
.task-card-desc { font-size: 13px; color: var(--ink-soft); margin: 6px 0; }
.task-card-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.task-card-meta strong { color: var(--navy-2); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13,27,42,0.55); display: flex; align-items: center;
  justify-content: center; z-index: 1000; padding: 20px; overflow-y: auto;
}
.modal {
  background: var(--cream); border-radius: var(--radius); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column;
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 19px; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--ink-soft); line-height: 1; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- comments thread ---------- */
.comment-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; max-height: 240px; overflow-y: auto; }
.comment-item { background: var(--white); border-radius: var(--radius-sm); padding: 10px 14px; border: 1px solid var(--line); }
.comment-item-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.comment-item-head strong { color: var(--navy-2); }
.comment-item-head span { color: var(--ink-soft); }
.comment-item p { font-size: 13px; margin: 0; }
.comment-form { display: flex; gap: 8px; }
.comment-form textarea { flex: 1; min-height: 42px; }

/* ---------- members / invite ---------- */
.member-list { background: var(--white); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.member-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--line); }
.member-row:first-child { border-top: none; }
.member-row .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; margin-right: 12px;
}
.member-row-left { display: flex; align-items: center; }
.member-row-name { font-weight: 600; font-size: 14px; }
.member-row-email { font-size: 12px; color: var(--ink-soft); }
.section-title-row { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 12px; }
.section-title-row h3 { font-size: 15px; margin: 0; }

/* ---------- misc ---------- */
.muted { color: var(--ink-soft); }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.spacer-sm { height: 8px; }
.spacer-md { height: 16px; }

@media (max-width: 640px) {
  .page { padding: 20px 14px 40px; }
  .topbar { padding: 0 14px; }
  .task-card-meta { gap: 10px; }
  .field-row { flex-direction: column; gap: 0; }
}
