:root {
  --navy: #1b3b63;
  --navy-dark: #12294a;
  --navy-light: #eaf0f8;
  --bg: #eef1f6;
  --card: #ffffff;
  --border: #e3e7ee;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #1f9d6b;
  --green-bg: #e5f6ee;
  --amber: #b45309;
  --amber-bg: #fdf0e0;
  --red: #b91c1c;
  --red-bg: #fdecec;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  font-size: 15px;
}

* { box-sizing: border-box; }

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

#app { min-height: 100vh; display: flex; flex-direction: column; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 20px 48px; width: 100%; }

/* ---------- Top nav ---------- */
.topnav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.topnav .brand { font-weight: 700; color: var(--navy); font-size: 17px; }
.topnav .brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.topnav .nav-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.who { text-align: right; font-size: 13px; color: var(--muted); }
.who b { color: var(--text); }

/* ---------- Buttons ---------- */
button { font: inherit; cursor: pointer; }
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-outline { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--navy); }
.btn-danger-outline { background: #fff; color: var(--red); border: 1px solid var(--border); }
.btn-block { width: 100%; display: block; text-align: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.link-btn { background: none; border: none; color: var(--navy); font-weight: 600; padding: 0; text-decoration: underline; font-size: 13px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-body { padding: 20px; }
.card-header-navy {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card-header-navy .eyebrow { text-transform: uppercase; font-size: 11px; letter-spacing: .06em; opacity: .8; font-weight: 700; }
.card-header-navy h2 { margin: 4px 0 4px; font-size: 21px; }
.card-header-navy p { margin: 0; opacity: .85; font-size: 13px; }
.card-header-navy .stat-badge { text-align: right; }
.card-header-navy .stat-badge .num { font-size: 26px; font-weight: 700; line-height: 1; }
.card-header-navy .stat-badge .label { font-size: 11px; opacity: .8; }
.pill-badge {
  display: inline-block;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.readout {
  background: var(--navy-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.readout .label { font-size: 12px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; }
.readout .value { font-size: 20px; font-weight: 700; color: var(--navy); }
.readout .sub { font-size: 12px; color: var(--muted); }

/* Yes/No toggle buttons */
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle-btn {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.toggle-btn .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c9cfd8; display: inline-block; }
.toggle-btn.selected-yes { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.toggle-btn.selected-yes .dot { border-color: var(--green); background: var(--green); }
.toggle-btn.selected-no { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.toggle-btn.selected-no .dot { border-color: var(--red); background: var(--red); }

/* ---------- Lists / rows ---------- */
.list-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--navy-light); }
.list-header h3 { margin: 0; font-size: 15px; }
.list-header .count { color: var(--muted); font-weight: 400; font-size: 13px; }
.list-header .hint { color: var(--muted); font-size: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); gap: 12px; }
.row:last-child { border-bottom: none; }
.row .row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row .idx { font-weight: 700; color: var(--navy); min-width: 28px; }
.row .title { font-weight: 600; font-size: 14px; }
.row .subtitle { color: var(--muted); font-size: 12.5px; }
.row .row-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-yes { background: var(--green-bg); color: var(--green); }
.badge-no { background: var(--red-bg); color: var(--red); }
.badge-open { background: var(--amber-bg); color: var(--amber); }
.badge-resolved { background: var(--green-bg); color: var(--green); }
.badge-neutral { background: var(--navy-light); color: var(--navy); }
.badge-missing { background: var(--red-bg); color: var(--red); }

/* ---------- Dashboard layout ---------- */
.date-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 12px; }
.date-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  text-align: center;
  background: #fff;
}
.date-chip .wd { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.date-chip .d { font-size: 17px; font-weight: 700; color: var(--navy); }
.date-chip.active { background: var(--navy); border-color: var(--navy); }
.date-chip.active .wd, .date-chip.active .d { color: #fff; }

.dash-grid { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; margin-top: 16px; }
@media (max-width: 780px) { .dash-grid { grid-template-columns: 1fr; } }
.store-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-weight: 600; margin-bottom: 6px; border: 1px solid transparent;
}
.store-list-item.active { background: var(--navy); color: #fff; }
.store-list-item:not(.active):hover { background: var(--navy-light); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
@media (max-width: 780px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-tile { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-tile .icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 16px; }
.stat-tile .value { font-size: 22px; font-weight: 700; }
.stat-tile .label { color: var(--muted); font-size: 12.5px; }

.progress-track { background: var(--border); border-radius: 999px; height: 8px; overflow: hidden; margin: 10px 0 16px; }
.progress-fill { background: var(--navy); height: 100%; }
.completion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 600px) { .completion-grid { grid-template-columns: repeat(2, 1fr); } }
.completion-chip { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; }
.completion-chip.done { border-style: solid; border-color: var(--green); background: var(--green-bg); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn { background: none; border: none; padding: 12px 6px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ---------- Auth screen ---------- */
.auth-shell { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { text-align: center; margin-bottom: 18px; }
.auth-card .logo b { color: var(--navy); font-size: 20px; }
.auth-card .logo div { color: var(--muted); font-size: 13px; margin-top: 4px; }

.empty-note { color: var(--muted); font-size: 13.5px; padding: 6px 0; }
.error-note { color: var(--red); font-size: 13px; margin-top: 8px; }

.section-title { font-weight: 700; font-size: 15px; margin: 22px 0 10px; color: var(--navy); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); background: var(--navy-dark); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 999; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.table-simple { width: 100%; border-collapse: collapse; }
.table-simple th, .table-simple td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.table-simple th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select .chip { border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; background: #fff; }
.chip-select .chip.selected { background: var(--navy); border-color: var(--navy); color: #fff; }
