@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/jakarta.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}

:root {
  --ink: #0e1117; --ink-2: #3b4352; --muted: #6b7483; --line: #e5e9f0;
  --surface: #ffffff; --soft: #f4f6fa; --glass: rgba(255,255,255,.58); --glass-line: rgba(255,255,255,.8);
  --btn: #0e1117; --btn-ink: #ffffff;
  --accent: #f0806c; --blue: #6c8ee0;
  --ok: #17845a; --ok-bg: #e4f5ec; --soon: #b86a00; --soon-bg: #fff1d9;
  --urgent: #cf3d3d; --urgent-bg: #fde9e7; --info: #3f62c4; --info-bg: #e8eefc;
  --closed: #6b7483; --closed-bg: #eceff4; --warn-bg: #fff3d6; --warn-ink: #6b4a00;
  --shadow-sheet: 0 -18px 40px -26px rgba(40,60,110,.35);
  --bg-a: #dde8f7; --bg-b: #ece8f6; --bg-c: #f8e8e3; --page: #eef2f8;
  --radius: 22px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef1f6; --ink-2: #c3cad6; --muted: #98a2b3; --line: #262f40;
    --surface: #131925; --soft: #1a2130; --glass: rgba(24,31,46,.62); --glass-line: rgba(255,255,255,.09);
    --btn: #f2f4f8; --btn-ink: #0e1117;
    --accent: #ff9a86; --blue: #8aa6ee;
    --ok: #62d09b; --ok-bg: #11332a; --soon: #f2b955; --soon-bg: #3a2b0d;
    --urgent: #ff9a91; --urgent-bg: #402020; --info: #9db6f5; --info-bg: #1c2845;
    --closed: #98a2b3; --closed-bg: #202839; --warn-bg: #3a2f10; --warn-ink: #f3d890;
    --shadow-sheet: 0 -18px 40px -26px rgba(0,0,0,.8);
    --bg-a: #0b0e14; --bg-b: #0d121b; --bg-c: #120f14; --page: #0b0e14; color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { font-size: 100%; }
html.large { font-size: 118%; }
body {
  background: var(--page); color: var(--ink);
  font: 400 1rem/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: 640px; margin-inline: auto; position: relative; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-block-end: calc(84px + env(safe-area-inset-bottom, 0px));
}
button { font: inherit; cursor: pointer; }
h1, h2, h3 { letter-spacing: -.02em; }

/* Soft sky + petal glow behind the header, like the reference */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 34% at 86% 6%, rgba(255,150,128,.50), transparent 70%),
    radial-gradient(46% 28% at 72% 14%, rgba(247,169,192,.42), transparent 70%),
    radial-gradient(60% 40% at 6% 2%, rgba(150,180,235,.45), transparent 70%),
    linear-gradient(170deg, var(--bg-a), var(--bg-b) 45%, var(--bg-c));
}
@media (prefers-color-scheme: dark) {
  .backdrop {
    background:
      radial-gradient(55% 30% at 88% 4%, rgba(255,154,134,.16), transparent 70%),
      radial-gradient(60% 36% at 4% 0%, rgba(80,120,210,.20), transparent 70%),
      linear-gradient(170deg, var(--bg-a), var(--bg-b) 50%, var(--bg-c));
  }
}

/* Header */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 6px;
}
.brand { display: flex; align-items: center; gap: 12px; -webkit-user-select: none; user-select: none; cursor: default; }
.logo { width: 42px; height: 42px; flex: none; border-radius: 13px; box-shadow: 0 8px 18px -8px rgba(14,17,23,.55); }
.brand h1 { margin: 0; font-size: 1.12rem; font-weight: 750; line-height: 1.15; }
.tagline { margin: 1px 0 0; font-size: .74rem; color: var(--muted); font-weight: 500; }
.top-actions { display: flex; gap: 8px; }
@media (prefers-color-scheme: dark) { .logo { box-shadow: 0 0 0 1px rgba(255,255,255,.16), 0 8px 18px -8px rgba(0,0,0,.8); } }
.icon-btn {
  border: 1px solid var(--glass-line); background: var(--glass); color: var(--ink);
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.icon-btn[hidden] { display: none; }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn.spin .ico { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.offline-banner { background: var(--warn-bg); color: var(--warn-ink); margin: 10px 16px 0; padding: 9px 14px; font-size: .84rem; font-weight: 600; text-align: center; border-radius: 14px; }

/* Overview card (glass) */
#heroSlot { padding: 0 16px; }
.hero {
  margin-block-start: 14px; padding: 18px 20px 18px; border-radius: 28px;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 22px 44px -28px rgba(40,60,120,.45);
  animation: rise .4s ease both;
}
.hero-label { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.hero-label i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(240,128,108,.22); }
.hero-num { display: block; margin-block: 6px 2px; font-size: 3.1rem; font-weight: 750; letter-spacing: -.045em; line-height: 1.05; }
.hero-sub { font-size: .84rem; color: var(--muted); font-weight: 500; }
.hero.calm { display: flex; align-items: center; gap: 14px; }
.hero.calm strong { display: block; font-size: 1.12rem; font-weight: 700; letter-spacing: -.02em; }
.hero-ok { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--btn); color: var(--btn-ink); }
.hero-ok .ico { width: 22px; height: 22px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-block-start: 18px; padding-inline: 4px; }
.page-head h2 { margin: 0; font-size: 1.7rem; font-weight: 750; letter-spacing: -.035em; line-height: 1.15; }
.page-head span { font-size: .84rem; font-weight: 700; color: var(--ink-2); background: var(--glass); border: 1px solid var(--glass-line); padding: 3px 12px; border-radius: 999px; }

/* Search + filters */
.search-row { margin: 16px 16px 0; }
.search {
  display: flex; align-items: center; gap: 10px; height: 50px; padding-inline: 16px;
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 18px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--muted);
}
.search:focus-within { border-color: var(--ink); color: var(--ink); }
.search .ico { width: 20px; height: 20px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: .95rem; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.field { display: block; width: 100%; margin: 6px 0 12px; font: inherit; color: var(--ink); background: var(--soft); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.field:focus { outline: none; border-color: var(--ink); }

.filter-row { display: flex; gap: 8px; margin: 10px 16px 0; }
.filter-row select, .search-row select {
  flex: 1; min-width: 0; font: inherit; font-size: .76rem; font-weight: 600; color: var(--ink-2);
  background-color: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px;
  padding: 9px 26px 9px 12px; appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7483' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}
.filter-row select:focus { outline: none; border-color: var(--ink); }
.filter-row select option { color: #0e1117; }
#regionSelect { flex: 1.15; } #deadlineSelect { flex: 1.4; }

/* White sheet that holds the list */
.sheet {
  margin-block-start: 18px; padding: 8px 16px 20px; min-height: 60vh;
  background: var(--surface); border-radius: 32px 32px 0 0; box-shadow: var(--shadow-sheet);
}
.sheet::before { content: ""; display: block; width: 38px; height: 4px; margin: 6px auto 4px; border-radius: 4px; background: var(--line); }
main { padding: 0; }
.section-title { margin: 20px 4px 2px; font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.empty { color: var(--muted); text-align: center; padding: 44px 28px; font-size: .92rem; }
.empty::before {
  content: ""; display: block; width: 72px; height: 72px; margin: 0 auto 16px;
  background: url("icons/icon.svg") center / contain no-repeat;
}

/* Cards */
.item { background: var(--soft); border-radius: var(--radius); padding: 16px 16px 14px; margin-block: 10px; animation: rise .35s ease both; }
.item.is-closed { opacity: .7; }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-block-end: 10px; }
.cat { display: inline-flex; align-items: center; gap: 7px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cat::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.count { font-size: .78rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; color: var(--info); background: var(--info-bg); white-space: nowrap; }
.count.soon { color: var(--soon); background: var(--soon-bg); }
.count.urgent { color: var(--urgent); background: var(--urgent-bg); }
.count.closed { color: var(--closed); background: var(--closed-bg); }
.count.open { color: var(--ok); background: var(--ok-bg); }
.item h3 { margin: 0 0 4px; font-size: 1.04rem; font-weight: 700; line-height: 1.35; }
.summary { margin: 0 0 10px; color: var(--muted); font-size: .88rem; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--ink-2); font-weight: 500; }
.facts span { display: inline-flex; align-items: center; gap: 6px; }
.facts .ico { width: 15px; height: 15px; color: var(--muted); }
.meter { height: 4px; border-radius: 99px; background: var(--line); margin-block: 12px 4px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--blue); }
.meter.soon i { background: #e6a23c; } .meter.urgent i { background: var(--accent); }
.meta { color: var(--muted); font-size: .78rem; margin-block-start: 6px; }
.meta.extended { color: var(--soon); font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 10px 2px; }
.badge { font-size: .72rem; padding: 3px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 600; border: 1px solid var(--line); }
.badge.verified { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.unverified { background: var(--soon-bg); color: var(--soon); border-color: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; font-size: .86rem; font-weight: 650; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.btn.on { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.btn:active, .chip:active, .tabbar button:active { transform: scale(.97); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.disclaimer { margin: 22px 8px 4px; font-size: .76rem; color: var(--muted); }
.updated { margin: 0 8px; font-size: .76rem; color: var(--muted); }

/* Bottom bar */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; max-width: 640px; margin-inline: auto;
  display: grid; grid-template-columns: repeat(6, 1fr); padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0;
  box-shadow: 0 -14px 34px -22px rgba(40,60,110,.4); z-index: 5;
}
.tabbar button {
  position: relative; min-width: 0; border: 0; background: transparent; color: var(--muted);
  font-size: .6rem; font-weight: 600; letter-spacing: -.01em; padding: 8px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabbar button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar button[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar button[aria-current="page"]::before { content: ""; position: absolute; top: -8px; width: 20px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); }
.ico { width: 22px; height: 22px; display: block; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Sheets (settings, details, admin) */
.picker { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(14,17,23,.38); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); overflow-y: auto; }
.picker[hidden] { display: none; }
.picker-box { position: relative; width: 100%; max-width: 640px; background: var(--surface); border-radius: 32px 32px 0 0; padding: 30px 22px calc(24px + env(safe-area-inset-bottom, 0px)); animation: sheet .3s ease both; }
.picker-box::before { content: ""; position: absolute; top: 10px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--line); }
.panel-title { margin: 0 0 2px; font-size: 1.4rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.25; }
.panel-section { margin-block-start: 22px; }
.panel-section h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; }
.hint { margin: 0 0 12px; font-size: .84rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: .9rem; font-weight: 650; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notify-status { margin-block-start: 8px; font-size: .84rem; color: var(--urgent); }
.panel-done { width: 100%; margin-block-start: 24px; font-size: 1rem; padding: 15px; border-radius: 999px; }
.d-list { margin: 14px 0 0; }
.d-row { padding-block: 11px; border-top: 1px solid var(--line); }
.d-row dt { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.d-row dd { margin: 3px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.trust-note { margin-block: 12px 0; }
.disclaimer-inline { margin: 14px 0 0; font-size: .76rem; color: var(--muted); }
#detailPanel .picker-box { max-height: 90vh; overflow-y: auto; }
#detailPanel .panel-done { margin-block-start: 14px; padding: 13px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.toast {
  position: fixed; inset-inline: 16px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); max-width: 420px; margin-inline: auto;
  background: var(--btn); color: var(--btn-ink); padding: 12px 18px; border-radius: 999px; font-size: .86rem; font-weight: 600; text-align: center;
  z-index: 30; box-shadow: 0 14px 30px -12px rgba(14,17,23,.5); animation: rise .25s ease both;
}
.toast[hidden] { display: none; }

/* Loading skeleton */
.skeleton { display: grid; gap: 10px; }
.sk { display: block; height: 12px; border-radius: 8px; background: linear-gradient(90deg, var(--closed-bg) 25%, var(--line) 50%, var(--closed-bg) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk.tall { height: 20px; }
.w30 { width: 30%; } .w40 { width: 40%; } .w60 { width: 60%; } .w80 { width: 80%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes shimmer { to { background-position: -200% 0; } }