:root {
  --ground: #F4F6F8; --card: #FFFFFF; --ink: #14202B; --muted: #4B5866;
  --line: #D5DCE3; --accent: #0B5CAD; --accent-dark: #08427D; --danger: #B42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; -webkit-text-size-adjust: 100%;
}
/* iPhone: inputs under 16px zoom the page on tap. */
input, textarea, select, button { font: inherit; font-size: 16px; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button svg, a svg { pointer-events: none; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; width: 100%; border: 0; border-radius: 12px;
  background: var(--accent); color: #FFFFFF; font-weight: 600; font-size: 17px;
  user-select: none; -webkit-user-select: none;
}
.btn:active { background: var(--accent-dark); }
.btn:disabled { opacity: 0.6; }
.btn-plain { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; color: var(--muted); }
.field input {
  height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); outline: none;
}
.field input:focus { border-color: var(--accent); }
.error { color: var(--danger); font-size: 15px; min-height: 20px; }
.muted { color: var(--muted); }
.version { text-align: center; font-size: 12px; color: var(--muted); padding: 12px 0; }

/* Login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { margin: 0; font-size: 32px; letter-spacing: -0.5px; }

/* App shell */
.shell { min-height: 100%; display: flex; flex-direction: column; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.topbar { padding: calc(16px + env(safe-area-inset-top)) 16px 8px; display: flex; align-items: center; justify-content: space-between; }
.topbar h1 { margin: 0; font-size: 32px; letter-spacing: -0.5px; }
.view { padding: 8px 16px; display: none; }
.view.active { display: block; }
.empty { background: var(--card); border-radius: 14px; padding: 24px 16px; text-align: center; }
.empty h2 { margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0; color: var(--muted); line-height: 1.4; }
.card { background: var(--card); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  transform: translateZ(0);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 48px; border: 0; background: transparent; color: var(--muted); font-size: 12px;
  user-select: none; -webkit-user-select: none;
}
.tab.active { color: var(--accent); font-weight: 600; }
@media (min-width: 800px) {
  .shell { max-width: 900px; margin: 0 auto; }
}
