:root {
  /* Sync & Solve Brand: Red, Brown, Light Creme */
  --bg: #2d1f1a;
  --bg-2: #3d2723;
  --surface: #ffffff;
  --surface-2: #faf8f6;
  --border: #e6e0da;
  --text: #2d1f1a;
  --muted: #8b7355;
  --primary: #c41e3a;
  --primary-dark: #a01729;
  --green: #16a34a;
  --amber: #d97706;
  --red: #c41e3a;
  --brown: #8b5a3c;
  --creme: #f5f1ee;
  --shadow: 0 1px 3px rgba(45, 31, 26, 0.1), 0 1px 2px rgba(45, 31, 26, 0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; }
a { color: var(--primary); }

/* ---------- Auth screen ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #2d1f1a, #c41e3a);
}
.auth-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 1.6rem; }
.auth-card .sub { color: var(--muted); margin: 0 0 24px; font-size: .9rem; }
.auth-toggle { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--muted); }
.auth-toggle button { background: none; border: none; color: var(--primary); cursor: pointer; font-weight: 600; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px;
  background: var(--bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.brand { font-weight: 800; font-size: 1.2rem; color: #fff; padding: 0 12px 20px; display:flex; align-items:center; gap:8px;}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  color: #cbd5e1; font-weight: 500; font-size: .95rem; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico { font-size: 1.1rem; }
.nav-spacer { flex: 1; }
.nav-user { padding: 12px; font-size: .85rem; color: #94a3b8; border-top: 1px solid rgba(255,255,255,.1); }
.nav-user .name { color: #fff; font-weight: 600; }

.content { flex: 1; padding: 28px 32px 100px; max-width: 1100px; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 24px; }

/* Live meeting banner */
.live-banner {
  background: linear-gradient(90deg, #c41e3a, #8b5a3c);
  color: #fff; padding: 12px 16px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 20px; cursor: pointer;
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #4ade80; display: inline-block; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card.overdue { background: #fdf6f6; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card .desc { color: var(--muted); font-size: .9rem; margin: 0 0 12px; white-space: pre-wrap; }
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 14px; }
.section-head h2 { margin: 0; font-size: 1.2rem; }
.empty { color: var(--muted); text-align: center; padding: 30px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* Progress bar */
.progress { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; height: 12px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.progress.green > span { background: var(--green); }
.progress.amber > span { background: var(--amber); }
.progress.red > span { background: var(--red); }
.progress-label { font-size: .8rem; color: var(--muted); margin-top: 6px; display:flex; justify-content: space-between;}

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  padding: 10px 16px; font-size: .92rem; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--red); }
.btn.ghost { background: none; color: var(--muted); padding: 6px 8px; }
.btn.small { padding: 6px 10px; font-size: .82rem; }
.btn.green { background: var(--green); }
.btn.block { width: 100%; }

label { display: block; font-size: .85rem; font-weight: 600; margin: 12px 0 5px; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: .95rem; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 12px; }
.form-row > div { flex: 1; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* Badges / tags */
.badge { display: inline-flex; align-items:center; gap:4px; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.blue { background: #e0e7ff; color: #3730a3; }
.tag-chip { background: #eef2ff; color: #4338ca; padding: 2px 8px; border-radius: 999px; font-size: .78rem; }

/* Table */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.table th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.table .row-click { cursor: pointer; }
.table .row-click:hover { background: var(--surface-2); }

/* ---------- Meeting / timer ---------- */
.meeting-stage { text-align: center; }
.timer-ring {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 14vw, 6rem); font-weight: 800; line-height: 1;
  margin: 10px 0; color: var(--text);
}
.timer-ring.over { color: var(--red); }
.seg-name { font-size: 1.6rem; font-weight: 700; }
.seg-purpose { color: var(--muted); max-width: 540px; margin: 10px auto 0; }
.seg-progress { max-width: 540px; margin: 18px auto; }
.agenda-rail { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0; }
.agenda-pill {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: .85rem; font-weight: 600; color: var(--muted); cursor: default;
}
.agenda-pill.done { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.agenda-pill.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.agenda-pill.clickable { cursor: pointer; }
.controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* Modal */
#modal-host:empty { display: none; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal {
  background: var(--surface); border-radius: 16px; padding: 24px;
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.modal h2 { margin: 0 0 16px; font-size: 1.25rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Rating */
.rating-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 16px 0; }
.rating-btn {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  font-size: 1.3rem; font-weight: 700; cursor: pointer; color: var(--text);
}
.rating-btn:hover { border-color: var(--primary); }
.rating-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Toast */
#toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--bg); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.3); animation: slideUp .25s; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } }

/* File list */
.file-chip { display: inline-flex; align-items:center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); padding: 5px 10px; border-radius: 8px; font-size: .82rem; margin: 4px 4px 0 0; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.8rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .85rem; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mobile ---------- */
.mobile-nav { display: none; }
@media (max-width: 820px) {
  .sidebar { display: none; }
  .content { padding: 18px 16px 90px; }
  .form-row { flex-direction: column; gap: 0; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg); padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around; z-index: 40; box-shadow: 0 -2px 12px rgba(0,0,0,.2);
  }
  .mobile-nav .nav-item { flex-direction: column; gap: 2px; font-size: .68rem; padding: 6px 4px; text-align: center; }
  .mobile-nav .nav-item .ico { font-size: 1.25rem; }
  .mobile-nav .nav-item.active { background: none; color: #fff; }
  .mobile-nav .nav-item.active .ico { transform: scale(1.1); }
  .mobile-topbar { display: flex; }
}
.mobile-topbar { display: none; }
@media (max-width: 820px) {
  .mobile-topbar {
    align-items: center; justify-content: space-between;
    background: var(--bg); color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 30;
  }
  .mobile-topbar .brand { padding: 0; font-size: 1.05rem; }
  .mobile-topbar button { background: none; border: none; color: #cbd5e1; font-size: .85rem; }
}
