/* Keystone standalone app — phone-first, calm, olive + gold used sparingly. */
:root {
  --olive: #4a5d23;
  --olive-dark: #3b4a1c;
  --gold: #b8860b;
  --gold-soft: #c9a227;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f7f3;
  --card: #ffffff;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --green: #166534;
  --green-bg: #f0fdf4;
  --amber-bg: #fffbeb;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
a { color: var(--olive); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; margin-top: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 14px 110px; }

/* Header */
header.topbar {
  max-width: 640px; margin: 0 auto; padding: 14px 14px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.kbadge {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--olive); color: #fff;
  border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; flex: none;
}
.brand strong { display: block; font-size: 18px; line-height: 1.1; }
.brand span.sub { display: block; font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.userbox { text-align: right; font-size: 14px; }
.userbox button { margin-top: 4px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.card h3 { margin-bottom: 4px; }
.card .meta { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.card .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card .row + .row { margin-top: 4px; }
.flag { color: var(--red); font-weight: 600; font-size: 14px; }
.ok { color: var(--green); font-weight: 600; }
.gold { color: var(--gold); font-weight: 600; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: #eef2e4; color: var(--olive-dark);
  white-space: nowrap;
}
.badge.submitted { background: #e0e7ff; color: #3730a3; }
.badge.won { background: var(--green-bg); color: var(--green); }
.badge.lost { background: var(--red-bg); color: var(--red); }
.badge.drafting { background: var(--amber-bg); color: #92400e; }
.badge.watching { background: #f3f4f6; color: var(--muted); }

/* Buttons and inputs — big touch targets */
button, .btn {
  min-height: 48px; padding: 12px 18px; border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; background: var(--olive); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
button.secondary, .btn.secondary { background: #fff; color: var(--olive-dark); border-color: var(--olive); }
button.ghost, .btn.ghost { background: transparent; color: var(--olive-dark); border-color: var(--line); min-height: 40px; padding: 8px 14px; font-size: 14px; }
button.danger { background: #fff; color: var(--red); border-color: var(--red); }
button.block { width: 100%; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 11px 12px;
  font-size: 16px; border: 1px solid #d1d5db; border-radius: 10px;
  background: #fff; color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
label .hint { font-weight: 400; color: var(--muted); }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--olive); }
.checkrow { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-weight: 600; }
.checkrow label { margin: 0; }

/* Tabs — bottom nav, scrollable */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1 0 auto; min-width: 74px; min-height: 56px;
  background: transparent; color: var(--muted); border: none; border-radius: 0;
  font-size: 13px; font-weight: 600; padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
nav.tabs button.active { color: var(--olive-dark); border-top: 3px solid var(--gold); }

/* Login */
.login { max-width: 420px; margin: 40px auto 0; text-align: center; }
.login .kbadge { width: 72px; height: 72px; font-size: 40px; margin: 0 auto 12px; }
.login form { text-align: left; margin-top: 20px; }
.notice {
  border: 1px solid #fcd34d; background: var(--amber-bg);
  border-radius: var(--radius); padding: 14px; margin-top: 16px; text-align: left;
}
.notice.error { border-color: #fca5a5; background: var(--red-bg); }

/* Stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat .num { font-size: 22px; font-weight: 700; }
.stat .lbl { font-size: 13px; color: var(--muted); }

/* Lists */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f3f4f6; font-size: 15px; }
.kv:last-child { border-bottom: none; }
.kv b { font-weight: 600; }
.kv span:last-child { text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions button, .actions .btn { flex: 1 1 auto; }
.divider { border-top: 1px solid var(--line); margin: 16px 0; }
.chiprow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.chiprow button { flex: 0 0 auto; min-height: 40px; padding: 8px 14px; font-size: 14px; background: #fff; color: var(--ink); border: 1px solid var(--line); }
.chiprow button.active { background: var(--olive); color: #fff; border-color: var(--olive); }
.search { margin-bottom: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.step:last-child { border-bottom: none; }
.step input[type="checkbox"] { margin-top: 2px; flex: none; }
.step .done { text-decoration: line-through; color: var(--muted); }
.step .note { font-size: 14px; color: var(--muted); }
.linklike { background: none; border: none; color: var(--olive); font-size: 15px; font-weight: 600; padding: 0; min-height: 0; text-align: left; }
.backlink { margin-bottom: 10px; }

/* Modal sheet */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
#modal.hidden { display: none; }
#modal .sheet {
  background: #fff; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
#modal .sheet h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks .checkrow { margin: 0; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-weight: 500; font-size: 14px; }
.checks .checkrow input { width: 18px; height: 18px; }

/* Print — project sheet only */
#print-sheet { display: none; }
@media print {
  body { background: #fff; }
  #app, #modal, nav.tabs { display: none !important; }
  #print-sheet { display: block; font-size: 14px; color: #000; }
  #print-sheet h1 { font-size: 20px; }
  #print-sheet table { width: 100%; border-collapse: collapse; margin-top: 12px; }
  #print-sheet td, #print-sheet th { border: 1px solid #999; padding: 6px 8px; text-align: left; }
}
