/* Derek Sales — PWA styles. imPower palette: navy #004987, blue #0082CA, green #93D500. */
:root {
  --navy: #004987;
  --blue: #0082CA;
  --green: #93D500;
  --ink: #1c2833;
  --muted: #6b7785;
  --line: #e3e8ee;
  --bg: #f4f6f8;
  --card: #ffffff;
  --danger: #c0392b;
  --warn: #e08600;
  --radius: 12px;
  --nav-h: 60px;
  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45;
}
.hidden { display: none !important; }

/* ---------- PIN screen ---------- */
.pin-screen {
  position: fixed; inset: 0; background: var(--navy);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pin-box { width: 100%; max-width: 340px; text-align: center; }
.pin-logo { font-size: 30px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.pin-logo span { color: var(--green); }
.pin-prompt { color: #cfe0ee; margin: 18px 0 10px; }
.pin-input {
  width: 100%; font-size: 26px; text-align: center; letter-spacing: 8px;
  padding: 14px; border: none; border-radius: var(--radius); margin-bottom: 14px;
}
.pin-error { color: #ffd0c8; margin-top: 12px; font-size: 14px; }

/* ---------- App shell ---------- */
.app { min-height: 100%; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.app-header {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  background: var(--navy); color: #fff; display: flex; align-items: center;
  padding: 0 8px; gap: 6px;
}
.app-header h1 { font-size: 18px; font-weight: 700; flex: 1; text-align: center; }
.back-btn, .header-action {
  background: transparent; border: none; color: #fff; cursor: pointer;
  min-width: 44px; height: 44px; font-size: 15px;
}
.back-btn { font-size: 30px; line-height: 1; }
.header-action { font-weight: 700; color: var(--green); white-space: nowrap; padding: 0 8px; }

.view { padding: 14px; max-width: 720px; margin: 0 auto; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
  display: flex;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; text-decoration: none;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.nav-item .nav-icon { font-size: 17px; }
.nav-item.active { color: var(--blue); }

/* ---------- Cards / lists ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.card-tappable { cursor: pointer; }
.card-tappable:active { background: #fbfcfd; }
.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); margin: 18px 4px 8px;
}
.section-title:first-child { margin-top: 4px; }

.row-title { font-weight: 700; font-size: 16px; }
.row-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.row-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.empty { text-align: center; color: var(--muted); padding: 32px 16px; font-size: 14px; }
.list-head {
  display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 10px;
}
.list-head h2 { font-size: 17px; }

/* ---------- Stat cards (dashboard) ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px;
}
.stat .stat-num { font-size: 26px; font-weight: 800; color: var(--navy); }
.stat .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.stat.accent .stat-num { color: var(--blue); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-open { background: #e1f0fa; color: var(--blue); }
.badge-won { background: #eef7d4; color: #5a7d00; }
.badge-lost { background: #f1f3f5; color: var(--muted); }
.badge-var { background: #e1f0fa; color: var(--blue); }
.badge-msp { background: #ede4f7; color: #6a3fa0; }
.badge-overdue { background: #fbe3df; color: var(--danger); }
.badge-warn { background: #fdeed3; color: var(--warn); }

/* ---------- Buttons ---------- */
.btn {
  font-size: 15px; font-weight: 700; padding: 11px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #1c3300; }
.btn-danger { background: #fff; border-color: #e6b3ac; color: var(--danger); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:active { opacity: 0.85; }
.btn-add {
  background: var(--blue); color: #fff; border: none; border-radius: 999px;
  font-size: 14px; font-weight: 700; padding: 8px 14px;
}

/* ---------- Forms ---------- */
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 5px;
}
.form-field input, .form-field select, .form-field textarea {
  width: 100%; font-size: 16px; font-family: inherit; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.form-field textarea { min-height: 84px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--blue);
}
.form-field .req { color: var(--danger); }
.field-row { display: flex; gap: 10px; }
.field-row .form-field { flex: 1; }
.checkbox-field { display: flex; align-items: center; gap: 10px; }
.checkbox-field input { width: 22px; height: 22px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-actions .btn { flex: 1; }
.form-error { color: var(--danger); font-size: 14px; margin-top: 10px; }

/* ---------- Detail (pre-meeting brief) ---------- */
.detail-head { margin-bottom: 6px; }
.detail-head .detail-name { font-size: 22px; font-weight: 800; color: var(--navy); }
.detail-kv { display: flex; gap: 8px; font-size: 14px; margin-top: 4px; }
.detail-kv .k { color: var(--muted); min-width: 84px; }
.notes-block { white-space: pre-wrap; font-size: 14px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 16px); z-index: 50;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; max-width: 90%;
}
.loading { text-align: center; color: var(--muted); padding: 40px; }
.link-btn {
  background: none; border: none; color: var(--blue); font-weight: 700;
  font-size: 14px; cursor: pointer; padding: 4px; font-family: inherit;
}
