:root {
  --bg: #f5f0e6;
  --surface: #ffffff;
  --surface-2: #faf7f1;
  --ink: #1b2230;
  --ink-2: #4a5263;
  --ink-3: #7b8292;
  --line: #e4ddd0;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --accent-soft: #fde8db;
  --ok: #2b8a3e;
  --ok-soft: #e3f4e6;
  --warn: #b35c00;
  --warn-soft: #fff1d6;
  --bad: #c92a2a;
  --bad-soft: #fde4e4;
  --info: #1864ab;
  --info-soft: #e1eefb;
  --team: #e8590c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(27 34 48 / 0.06), 0 4px 16px rgb(27 34 48 / 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--info);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--ink-3);
}

.small {
  font-size: 0.875rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 0.08s ease, background-color 0.15s ease, opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-ok {
  background: var(--ok);
}

.btn-bad {
  background: var(--bad);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px rgb(27 34 48 / 0.08);
}

.label {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-2);
  margin: 0 0 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

.toast-host {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 100;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.25);
  font-weight: 550;
  animation: toast-in 0.2s ease;
}

.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.center-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.update-bar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 120;
  border: 0;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--accent);
  color: #fff;
  font: 650 0.95rem/1.3 var(--font);
  cursor: pointer;
  box-shadow: 0 4px 18px rgb(0 0 0 / 0.25);
}
