/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #1a2a3e;
  --blue:    #2980b9;
  --blue-lt: #d0dcea;
  --bg:      #f4f6fa;
  --card:    #ffffff;
  --row-alt: #f0f4f9;
  --border:  #dde3ed;
  --text:    #1c2b3a;
  --muted:   #6b7a8d;
  --green:   #27ae60;
  --red:     #e74c3c;
  --warn:    #f39c12;
  --radius:  10px;
  --shadow:  0 2px 8px rgba(0,0,0,.08);
  --tap:     48px;   /* minimum touch target height */
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: 80px; /* room for bottom nav */
}

/* ── Login ────────────────────────────────────────────────────────────────── */
#login-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100dvh; padding: 24px;
  background: var(--navy);
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%; max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  text-align: center;
}

.login-logo {
  font-size: 2.4rem; margin-bottom: 4px;
}

.login-card h1 {
  font-size: 1.15rem; font-weight: 700;
  color: var(--navy); margin-bottom: 4px;
  letter-spacing: .5px; text-transform: uppercase;
}

.login-card p {
  font-size: .85rem; color: var(--muted); margin-bottom: 24px;
}

.login-card input[type="password"] {
  width: 100%; padding: 14px 16px;
  font-size: 1.1rem; border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg); color: var(--text);
  margin-bottom: 12px;
  transition: border-color .2s;
}

.login-card input:focus {
  outline: none; border-color: var(--blue);
}

.btn-primary {
  width: 100%; padding: 14px;
  background: var(--blue); color: #fff;
  font-size: 1rem; font-weight: 700;
  border: none; border-radius: var(--radius);
  cursor: pointer; letter-spacing: .5px;
  transition: background .2s, transform .1s;
}
.btn-primary:active { transform: scale(.98); background: #1f6fa0; }

.login-error {
  color: var(--red); font-size: .85rem; margin-top: 10px;
  min-height: 1.2em;
}

/* ── App Shell ────────────────────────────────────────────────────────────── */
#app-screen { display: none; }
#app-screen.visible { display: block; }

/* ── Top Header ───────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy);
  padding: 12px 16px 10px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.header-title {
  flex: 1;
  font-size: 1rem; font-weight: 700;
  color: #fff; letter-spacing: .5px; text-transform: uppercase;
}

/* Language toggle */
.lang-toggle {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: .8rem; font-weight: 700;
  padding: 6px 12px; border-radius: 20px;
  cursor: pointer; white-space: nowrap;
  transition: background .2s;
}
.lang-toggle:hover { background: rgba(255,255,255,.25); }

/* ── Bottom Navigation ────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--navy);
  display: flex;
  box-shadow: 0 -2px 8px rgba(0,0,0,.2);
  z-index: 50;
}

.nav-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  padding: 10px 4px;
  color: rgba(255,255,255,.55);
  font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  border: none; background: none; cursor: pointer;
  transition: color .2s;
  min-height: var(--tap);
}

.nav-btn .nav-icon { font-size: 1.3rem; }
.nav-btn.active { color: #fff; }
.nav-btn.active .nav-icon { filter: drop-shadow(0 0 4px rgba(255,255,255,.5)); }

/* ── Sheet Pages ──────────────────────────────────────────────────────────── */
.sheet-page { display: none; padding: 12px 12px 0; }
.sheet-page.active { display: block; }

/* ── Section ──────────────────────────────────────────────────────────────── */
.section-block {
  margin-bottom: 14px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.section-header {
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  font-size: .9rem; font-weight: 700;
  letter-spacing: .4px;
  display: flex; align-items: center; gap: 6px;
}

.section-header .timer-badge {
  margin-left: auto;
  background: rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
  font-size: .68rem; font-weight: 600;
  padding: 2px 8px; border-radius: 12px;
  letter-spacing: .3px;
}

.section-header.weekly {
  background: #6d3a9c;
}

.section-header.amuse {
  background: #c0392b;
}

/* ── Item Row (prep / order) ──────────────────────────────────────────────── */
.item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  min-height: var(--tap);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.item-row:last-child { border-bottom: none; }
.item-row:nth-child(odd) { background: var(--row-alt); }
.item-row:nth-child(even) { background: var(--card); }
.item-row:active { background: #e8f0fb; }

/* Checked state */
.item-row.checked { background: #eafaf1 !important; }

/* Custom checkbox */
.item-check {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: border-color .2s, background .2s;
}

.item-row.checked .item-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.item-label {
  flex: 1; font-size: .95rem; line-height: 1.3;
}

.item-timer {
  font-size: .7rem; color: var(--muted);
  white-space: nowrap; text-align: right;
}

.item-row.checked .item-label { color: var(--muted); }
.item-row.checked .item-timer { color: var(--green); }

/* ── Count rows ───────────────────────────────────────────────────────────── */
.count-header-row {
  display: grid;
  grid-template-columns: 1fr 56px 68px 56px;
  gap: 4px; padding: 6px 14px;
  background: var(--blue-lt);
  font-size: .7rem; font-weight: 700;
  color: var(--navy); text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 1px solid var(--border);
}

.count-item-row {
  display: grid;
  grid-template-columns: 1fr 56px 68px 56px;
  gap: 4px; padding: 4px 14px;
  min-height: var(--tap);
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.count-item-row:last-child { border-bottom: none; }
.count-item-row:nth-child(odd)  { background: var(--row-alt); }
.count-item-row:nth-child(even) { background: var(--card); }

.count-label {
  font-size: .9rem; line-height: 1.3;
}

.count-input {
  width: 100%; padding: 6px 6px;
  font-size: .95rem; text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 6px; background: #fff;
  color: var(--text);
  -moz-appearance: textfield;
}
.count-input:focus { outline: none; border-color: var(--blue); }
.count-input::-webkit-inner-spin-button,
.count-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.count-need {
  font-size: .95rem; font-weight: 700;
  text-align: center; color: var(--navy);
}
.count-need.positive { color: var(--red); }
.count-need.zero     { color: var(--green); }

/* ── Notes section ────────────────────────────────────────────────────────── */
.notes-block {
  margin: 0 0 16px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.notes-header {
  background: #34495e;
  color: #fff;
  padding: 10px 14px;
  font-size: .9rem; font-weight: 700;
  letter-spacing: .4px;
}

.notes-inner { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

.note-field {
  display: flex; flex-direction: column; gap: 4px;
}

.note-label {
  font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase;
}

.note-textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  font-size: .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
}
.note-textarea:focus { outline: none; border-color: var(--blue); }

.notes-meta {
  font-size: .7rem; color: var(--muted); text-align: right;
  padding: 0 14px 10px;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* loading spinner */
.spinner {
  width: 36px; height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap { text-align: center; padding: 40px 0; }
.loading-wrap p { color: var(--muted); font-size: .9rem; margin-top: 10px; }

/* toast */
#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff;
  padding: 10px 20px; border-radius: 20px;
  font-size: .85rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  z-index: 100; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── Responsive helpers ───────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .sheet-page { max-width: 720px; margin: 0 auto; }
}
