:root {
  --bg: #f3f7fd;
  --card: #ffffff;
  --ink: #122033;
  --muted: #5d6f86;
  --line: #d7e3f2;
  --blue: #1f6feb;
  --blue-deep: #1449b8;
  --blue-soft: #e8f1ff;
  --ok: #137a45;
  --ok-bg: #e7f7ee;
  --bad: #b42318;
  --bad-bg: #fdeceb;
  --shadow: 0 18px 50px rgba(28, 74, 140, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(31, 111, 235, 0.16), transparent 60%),
    radial-gradient(700px 380px at -10% 20%, rgba(96, 165, 250, 0.18), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
}

body { min-height: 100dvh; }

button, input, select {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

.hidden { display: none !important; }

.boot, .fatal {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  line-height: 1.5;
}

.fatal {
  max-width: 28rem;
  margin: 0 auto;
}

.boot .mark { animation: pulse 1.4s ease-in-out infinite; }

.shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
  animation: rise 0.45s ease both;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 30%, #d7e8ff, transparent 46%),
    linear-gradient(145deg, #3b8bff, #1449b8);
  box-shadow: 0 10px 24px rgba(20, 73, 184, 0.28);
  flex: none;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin: 0; }

h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.ghost, .solid, .danger, .ok {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ghost:hover, .solid:hover, .danger:hover, .ok:hover {
  transform: translateY(-1px);
}

.ghost:active, .solid:active, .danger:active, .ok:active { transform: translateY(1px); }

.solid {
  background: linear-gradient(180deg, #2b7af0, var(--blue-deep));
  color: #fff;
  border-color: transparent;
  font-weight: 650;
  box-shadow: 0 10px 22px rgba(20, 73, 184, 0.22);
}

.danger {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: transparent;
}

.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: transparent;
  font-weight: 650;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border-radius: 999px;
  padding: 0 16px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tab.active {
  background: var(--blue);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(31, 111, 235, 0.25);
}

.tab .count {
  margin-left: 6px;
  color: inherit;
  font-weight: 700;
}

.lead, .note {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.toolbar input, .field input, .field select {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.toolbar input:focus, .field input:focus, .field select:focus {
  border-color: #8eb6f5;
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.12);
}

.list { display: grid; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid rgba(215, 227, 242, 0.9);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.12s; }

.card-top, .row, .actions, .check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.muted { color: var(--muted); font-size: 14px; line-height: 1.45; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 700;
}

.pill.quiet { color: var(--muted); background: #eef3f9; }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.pill.good { color: var(--ok); background: var(--ok-bg); }

.meter {
  height: 8px;
  border-radius: 999px;
  background: #e7eef8;
  overflow: hidden;
  margin: 14px 0 8px;
}

.meter > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #7eb0ff, var(--blue));
  animation: fill 0.7s ease both;
}

.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 14px;
}

.actions button { flex: 1 1 120px; }

.empty {
  padding: 36px 12px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--line);
  border-radius: 22px;
}

.form { display: grid; gap: 12px; }

.field { display: grid; gap: 6px; }
.field span { color: var(--muted); font-size: 13px; }

.check {
  justify-content: flex-start;
  min-height: 48px;
  padding: 0 4px;
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--blue);
}

.link-box {
  word-break: break-all;
  background: #f8fbff;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  margin-top: 12px;
  color: var(--ink);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  align-items: end;
}

.backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(18, 32, 51, 0.38);
}

.sheet-card {
  position: relative;
  width: min(640px, 100%);
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: min(88dvh, 760px);
  overflow: auto;
  box-shadow: 0 -16px 50px rgba(28, 74, 140, 0.12);
  animation: sheet-in 0.28s ease both;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet-head h2 {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  z-index: 6;
  max-width: calc(100% - 32px);
  box-shadow: 0 12px 30px rgba(18, 32, 51, 0.2);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes fill { from { width: 0; } }

@keyframes pulse {
  50% { transform: scale(0.94); opacity: 0.75; }
}

@keyframes sheet-in {
  from { transform: translateY(16px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .top { align-items: flex-start; }
  .toolbar { flex-direction: column; }
  .toolbar .solid { width: 100%; }
  .card-top { align-items: flex-start; }
  .pills { justify-content: flex-start; }
}

@media (min-width: 800px) {
  .sheet { align-items: center; }
  .sheet-card {
    border-bottom: 1px solid var(--line);
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
