:root {
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
  --bg: #ebe8e1;
  --mesh-a: #f2d3bd;
  --mesh-b: #cfdfcd;
  --mesh-c: #f1e4bf;
  --glass: #ffffff75;
  --float: #fdfcf9;
  --well: #17191a0f;
  --line: #17191a17;
  --line-2: #17191a29;
  --shadow: 0 1px 0 #ffffffb3 inset, 0 24px 48px -30px #46321e47;
  --shadow-pop: 0 24px 60px -18px #281e1452, 0 2px 6px #281e1414;
  --text: #17191a;
  --muted: #676a66;
  --faint: #8e918c;
  --butter: #f2c94c;
  --pine: #2f5c50;
  --on-pine: #fbf8f2;
  --tomato: #c8431f;
  --ink: #17191a;
  --on-ink: #fbf8f2;
  --good: #2f7a52;
  --radius: 26px;
  --radius-sm: 16px;
  --gutter: clamp(16px, 1.6vw, 28px);
  --app-max: 1360px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font); }
body { -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.mesh { z-index: -1; pointer-events: none; position: fixed; inset: 0; overflow: hidden; }
.mesh i { filter: blur(60px); opacity: .95; border-radius: 50%; position: absolute; }
.mesh__a { background: radial-gradient(closest-side, var(--mesh-a), transparent); width: 62vmax; height: 62vmax; top: -24vmax; left: -18vmax; }
.mesh__b { background: radial-gradient(closest-side, var(--mesh-b), transparent); width: 70vmax; height: 70vmax; bottom: -30vmax; right: -24vmax; }
.mesh__c { background: radial-gradient(closest-side, var(--mesh-c), transparent); width: 46vmax; height: 46vmax; top: -16vmax; right: 8vmax; }

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate[hidden], .app[hidden] { display: none !important; }
.gate-card {
  width: min(420px, 100%);
  padding: 34px;
  text-align: center;
  background: var(--float);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.gate-card h1 { font-size: 28px; font-weight: 800; margin: 12px 0 6px; }
.gate-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.gate-form { display: grid; gap: 12px; text-align: left; }
.gate-form label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); }
.gate-form input {
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 11px 14px; font-size: 14px; outline: none; color: var(--text);
}
.gate-form input:focus { border-color: #17191a59; }
.gate-error { color: var(--tomato); font-size: 13px; font-weight: 600; text-align: center; }

.logo {
  width: 52px; height: 52px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 16px; background: var(--ink); color: var(--on-ink);
  font-weight: 800; letter-spacing: .04em;
}
.logo.sm { width: 36px; height: 36px; margin: 0; border-radius: 12px; font-size: 12px; }

.app { max-width: var(--app-max); margin: 0 auto; padding: 22px var(--gutter) 48px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 13px; font-weight: 600; }
.inbox { position: relative; }
.inbox-btn {
  position: relative;
  width: 40px; height: 40px;
  border: 1px solid var(--line); background: var(--float);
  border-radius: 14px; color: var(--ink);
  display: grid; place-items: center;
}
.inbox-btn[aria-expanded="true"] { border-color: #17191a59; }
.inbox-dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tomato); box-shadow: 0 0 0 2px var(--float);
}
.inbox-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  width: min(360px, 78vw);
  background: var(--float); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-pop);
  padding: 12px;
}
.inbox-pop header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.inbox-pop header b { font-size: 14px; }
.inbox-list { display: grid; gap: 6px; max-height: 360px; overflow: auto; }
.inbox-item {
  display: grid; gap: 2px; text-align: left;
  width: 100%; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: 10px 12px;
}
.inbox-item.unread { border-color: #2f5c5040; background: #2f5c500d; }
.inbox-item b { font-size: 13px; }
.inbox-item span { color: var(--muted); font-size: 12px; }

.btn-ink, .btn-ghost, .btn-pine {
  border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 700;
}
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-pine { background: var(--pine); color: var(--on-pine); }
.btn-ghost { background: var(--well); color: var(--text); }
.btn-ink:disabled { opacity: .45; }

.hero { margin-bottom: 20px; }
.hero h2 { font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
.hero p { color: var(--muted); margin-top: 6px; }
.home-block { margin-bottom: 28px; }
.home-block h3 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.shared-link { margin-left: 12px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  display: grid; gap: 8px; text-align: left;
  padding: 20px 18px; border-radius: 22px;
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
a.card:hover { border-color: #17191a3d; }
.card .tag {
  width: fit-content; font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 999px; background: var(--well);
}
.card .tag.country { background: #2f5c5014; color: var(--pine); }
.card h3 { font-size: 20px; }
.card p { color: var(--muted); font-size: 14px; }

.hub-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; background: var(--well); padding: 4px; border-radius: 999px; }
.pills a {
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted);
}
.pills a.on { background: var(--float); color: var(--ink); box-shadow: var(--shadow); }

.forecast {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.forecast.empty { grid-template-columns: 1fr; }
.forecast.empty p, .forecast-note { color: var(--muted); font-size: 14px; }
.forecast-note { margin: -6px 0 14px; }
.forecast .k { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.forecast .v { font-size: 22px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 2px; }
.forecast .v.good { color: var(--good); }
.forecast .s { color: var(--muted); font-size: 12px; }
@media (max-width: 800px) { .forecast { grid-template-columns: 1fr; } }

.composer {
  display: flex; gap: 8px; margin-bottom: 14px;
}
.composer input, .composer textarea, .page-title, .page-body, .sticky-body {
  border: 1px solid var(--line); background: var(--float); border-radius: 14px;
  padding: 11px 14px; font: inherit; color: var(--text); outline: none; width: 100%;
}
.composer input:focus, .composer textarea:focus, .page-title:focus, .page-body:focus, .sticky-body:focus {
  border-color: #17191a59;
}
.composer input { flex: 1; }
.mention-box { position: relative; flex: 1; }
.mention-box input { width: 100%; }
.mention-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 8;
  background: var(--float); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-pop);
  padding: 6px; display: grid; gap: 4px;
}
.mention-list button {
  text-align: left; border: 0; background: transparent;
  border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.mention-list button:hover, .mention-list button.on { background: var(--well); }
.mention { color: var(--pine); font-weight: 800; }

.kb-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kb-col {
  background: var(--well);
  border-radius: 20px;
  padding: 12px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.kb-col-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 13px; font-weight: 800;
}
.kb-col-head span {
  color: var(--muted); font-size: 12px; font-weight: 700;
  background: var(--float); border-radius: 999px; padding: 2px 8px;
}
.kb-col-body { display: grid; gap: 8px; align-content: start; flex: 1; min-height: 80px; border-radius: 14px; }
.kb-col-body.over { outline: 1px dashed #17191a4d; outline-offset: 3px; background: #ffffff59; }
.kb-empty { color: var(--faint); font-size: 13px; padding: 10px 4px; }
.kb-card {
  background: var(--float); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; cursor: grab; box-shadow: var(--shadow); text-align: left;
}
.kb-card.dragging { opacity: .4; }
.kb-card .id { font-size: 11px; font-weight: 800; color: var(--pine); letter-spacing: .04em; }
.kb-card h4 { font-size: 15px; font-weight: 750; margin: 4px 0 6px; }
.kb-card small { color: var(--muted); font-size: 12px; }
.kb-open { display: block; color: inherit; }
.kb-open:hover h4 { text-decoration: underline; }
.kb-force { margin-top: 8px; font-size: 13px; font-weight: 800; color: var(--pine); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 999px;
  background: #2f5c5014; color: var(--pine);
  font-size: 11px; font-weight: 700;
}
.chip button {
  border: 0; background: none; color: inherit; padding: 0; line-height: 1; font-size: 13px;
}
.kb-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.pages-grid, .sticky-grid {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.page-card, .sticky-card {
  text-align: left; min-height: 140px;
}
.page-card h3, .sticky-card h3 { font-size: 18px; }
.page-editor { display: grid; gap: 10px; }
.page-body, .sticky-body { min-height: 280px; resize: vertical; }
.sticky-body { min-height: 160px; background: #fff6d6; }
.sticky-card { background: #fff6d6; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .card-layout { grid-template-columns: 1fr; } }
.card-main, .card-side { display: grid; gap: 14px; }
.card-form, .side-form, .news, .kids {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-form { display: grid; gap: 10px; }
.side-form { display: grid; gap: 12px; }
.side-form > label, .side-form legend {
  display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted);
}
.side-form .hint { font-size: 12px; font-weight: 600; color: var(--muted); }
.meta-error { color: var(--tomato); font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.side-form select, .side-form input[type="date"], .side-form input[type="number"], .side-form input[type="text"] {
  border: 1px solid var(--line); background: var(--float); border-radius: 12px;
  padding: 10px 12px; font: inherit; color: var(--text);
}
.side-form fieldset { border: 0; display: grid; gap: 8px; padding: 0; min-width: 0; }
.people { display: grid; gap: 6px; }
.check {
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  margin: 0; padding: 9px 12px;
  background: var(--float); border: 1px solid var(--line); border-radius: 12px;
  font-size: 13px; font-weight: 650; color: var(--text);
}
.check input[type="checkbox"] {
  appearance: auto;
  width: 16px; height: 16px; margin: 0; flex: 0 0 16px;
  accent-color: var(--pine);
}
.check:has(input:checked) { border-color: #2f5c5040; background: #2f5c5010; }
.news h3, .kids h3 { font-size: 16px; margin-bottom: 10px; }
.news-list, .kids-list { display: grid; gap: 8px; }
.news-item {
  background: var(--float); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.news-item header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.news-item header span, .news-item.hist span { color: var(--muted); font-size: 12px; }
.news-item.hist { background: var(--well); }
.composer.col { flex-direction: column; margin: 0 0 10px; }
.kid {
  display: block; background: var(--float); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 700;
}
.kid:hover { border-color: #17191a3d; }

.metrics { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .metrics { grid-template-columns: 1fr; } }
.metric { padding: 22px; }
.metric .k { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.metric .v { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 4px; }
.metric .s { color: var(--muted); font-size: 13px; }
.metric .v.good { color: var(--good); }
.metric .v.bad { color: var(--tomato); }
.note { padding: 18px 20px; color: var(--muted); }
.back { color: var(--muted); font-size: 13px; font-weight: 700; }
.back:hover { color: var(--ink); }

@media (max-width: 720px) {
  html { -webkit-text-size-adjust: 100%; }
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .app {
    padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
  }
  .top {
    position: sticky;
    top: 0;
    z-index: 12;
    margin: -14px -14px 16px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(16px);
    gap: 10px;
  }
  .brand b { font-size: 15px; }
  .who { display: none; }
  .top-right { gap: 8px; }
  .inbox-pop {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(58px + env(safe-area-inset-top));
    width: auto;
    max-height: min(70dvh, 520px);
  }
  .inbox-list { max-height: min(56dvh, 420px); }
  .gate { padding: 20px 16px; padding-top: calc(20px + env(safe-area-inset-top)); }
  .gate-card { padding: 24px 18px; border-radius: 22px; }
  .gate-card h1 { font-size: 24px; }
  .hero h2, .hub-head h2 { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .hub-head { align-items: stretch; flex-direction: column; gap: 12px; }
  .pills {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pills::-webkit-scrollbar { display: none; }
  .pills a { flex: 0 0 auto; padding: 10px 16px; }
  .composer { flex-direction: column; }
  .composer .btn-ink { width: 100%; }
  .kb-board {
    grid-auto-columns: min(82vw, 320px);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 0 -14px;
    padding: 0 14px 12px;
  }
  .kb-col {
    scroll-snap-align: start;
    min-height: 360px;
  }
  .kb-card {
    padding: 14px;
    cursor: pointer;
  }
  .kb-card h4 { font-size: 16px; }
  .pages-grid, .sticky-grid { grid-template-columns: 1fr; }
  .metric .v { font-size: 28px; }
  input, select, textarea, button {
    font-size: 16px !important;
  }
}

@media (max-width: 420px) {
  .logo.sm { width: 32px; height: 32px; border-radius: 10px; }
  .btn-ghost, .btn-ink, .btn-pine { padding: 12px 14px; }
}
