/* Panduan Makan Mbah — theme derived from Crypto Blue DESIGN.md
   Font stack uses system fonts (not Google Fonts CDN) so the guide keeps
   working offline — this is a medical reference the family may need without
   a connection. Body/base sizes are bumped above the source spec to meet
   the brief's own accessibility requirement (min 18px, sec. 16). */

:root {
  --primary: #0052FF;
  --primary-hover: #003ECB;
  --secondary: #5B616E;
  --neutral: #8A919E;
  --bg: #F9FAFB;
  --surface: #FFFFFF;
  --text: #050F1A;
  --text-secondary: #5B616E;
  --border: #D1D5DB;
  --success: #05B169;
  --success-bg: #E6F6EF;
  --warning: #F0AD4E;
  --warning-bg: #FDF3E3;
  --error: #DF2935;
  --error-bg: #FDECEE;
  --medical: #0052FF;
  --medical-bg: #EAF0FF;

  --font-display: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --font-body: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-1: 0 1px 3px rgba(5, 15, 26, 0.06);
  --shadow-2: 0 4px 12px rgba(5, 15, 26, 0.08);
  --shadow-3: 0 12px 24px rgba(5, 15, 26, 0.12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --font-body-size: 18px;
  --font-body-small-size: 15px;
  --font-caption-size: 13px;
}

html.large-text {
  --font-body-size: 22px;
  --font-body-small-size: 19px;
  --font-caption-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--font-body-size);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 var(--space-3);
  color: var(--text);
}
h1 { font-size: clamp(28px, 6vw, 36px); }
h2 { font-size: clamp(22px, 5vw, 26px); }
h3 { font-size: clamp(18px, 4vw, 20px); }

p { margin: 0 0 var(--space-3); }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-5);
}

/* Top bar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.topbar-actions { display: flex; gap: var(--space-2); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  min-width: 100px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #C11F2C; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { height: 36px; padding: 6px 14px; font-size: 14px; min-width: unset; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--space-4); }
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s ease; }
a.card:hover, a.card:focus-visible { border-color: var(--primary); }

/* Inputs */
.input {
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 16px;
  font-family: var(--font-body);
  background: #fff;
  color: var(--text);
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 82, 255, 0.1);
}
.search-wrap { position: relative; }
.search-wrap .input { padding-left: 44px; background: #F3F4F6; border: none; }
.search-wrap .input:focus { background: #fff; border: 2px solid var(--primary); padding-left: 43px; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
}

/* Chips (status) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: var(--font-caption-size);
  font-weight: 700;
  white-space: nowrap;
}
.chip-success { background: var(--success-bg); color: var(--success); }
.chip-warning { background: var(--warning-bg); color: #9A6A17; }
.chip-error { background: var(--error-bg); color: var(--error); }
.chip-primary { background: var(--medical-bg); color: var(--primary); }
.chip-medical { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.chip-neutral { background: #F3F4F6; color: var(--secondary); }

/* Lists */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.list-row:last-child { border-bottom: none; }
a.list-row { text-decoration: none; color: inherit; }
a.list-row:hover, a.list-row:focus-visible { background: var(--bg); }
.list-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row-main strong { font-size: 17px; }
.list-row-sub { color: var(--text-secondary); font-size: var(--font-caption-size); }

/* Section spacing */
section + section { margin-top: var(--space-12); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

/* Name grid (kategori: mode Urutan Risiko) */
.name-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.name-grid .chip { white-space: normal; height: auto; min-height: 28px; padding: 6px 10px; text-align: center; justify-content: center; }
@media (max-width: 600px) { .name-grid { grid-template-columns: repeat(2, 1fr); } }
.card > div:first-child { margin-top: 0; }

/* Callouts */
.callout {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--border);
}
.callout-warning { background: var(--warning-bg); border-color: #EAC079; }
.callout-error { background: var(--error-bg); border-color: #F0A9AF; }
.callout-medical { background: var(--medical-bg); border-color: #A9C0FF; }
.callout-neutral { background: #F3F4F6; }
.callout h3 { margin-bottom: var(--space-2); }
.callout ul { margin: var(--space-2) 0 0; padding-left: 20px; }
.callout li { margin-bottom: var(--space-1); }

/* Disclaimer banner */
.disclaimer {
  background: var(--medical-bg);
  border: 1px solid #A9C0FF;
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-body-small-size);
  color: var(--text);
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  background: #F3F4F6;
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}
.mode-toggle button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
}
.mode-toggle button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-1);
}

/* Quick action grid on dashboard */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.action-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  min-height: 100px;
}
.action-tile:hover, .action-tile:focus-visible { border-color: var(--primary); }
.action-tile .icon { font-size: 26px; }
.action-tile.emergency {
  background: var(--error-bg);
  border-color: #F0A9AF;
  color: var(--error);
  font-weight: 700;
}
.action-tile.emergency:hover, .action-tile.emergency:focus-visible { border-color: var(--error); }

/* Tabs (kategori/status filter) */
.tabs { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 4px; }
.tabs button {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}
.tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Detail sheet */
.detail-field { margin-bottom: var(--space-4); }
.detail-field .label {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--neutral);
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.detail-field ul { margin: 0; padding-left: 20px; }

/* Nav footer */
.bottom-nav {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  padding: var(--space-2) var(--space-4) calc(var(--space-2) + env(safe-area-inset-bottom));
  gap: var(--space-1);
  z-index: 20;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 2px;
  border-radius: var(--radius-md);
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a .icon { font-size: 20px; }

.tts-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
}
.tts-btn.speaking { border-color: var(--primary); color: var(--primary); }

/* Print */
@media print {
  .topbar, .bottom-nav, .no-print { display: none !important; }
  body { background: #fff; font-size: 13px; }
  .container { max-width: 100%; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

.footer-space { height: 24px; }
.text-secondary { color: var(--text-secondary); }
.small { font-size: var(--font-caption-size); }
