:root {
  color-scheme: light;
  --bg:#f1f4f8; --surface:#fff; --subtle:#f3f6f9; --text:#15263a;
  --muted:#506175; --line:#e1e8ef; --brand:#076458; --brand-bg:#e0f3ee;
  --urgent:#aa3829; --urgent-bg:#fff0ea; --amber:#8c5819; --amber-bg:#fff2d9;
  --blue:#315a91; --blue-bg:#eaf1fb; --nav:#ffffffee; --shadow:0 12px 32px #233d5510;
  --app-inset-top:max(env(safe-area-inset-top, 0px),var(--mini-inset-top,0px));
  --app-inset-right:max(env(safe-area-inset-right, 0px),var(--mini-inset-right,0px));
  --app-inset-bottom:max(env(safe-area-inset-bottom, 0px),var(--mini-inset-bottom,0px));
  --app-inset-left:max(env(safe-area-inset-left, 0px),var(--mini-inset-left,0px));
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme:dark;
  --bg:#101923; --surface:#192532; --subtle:#233140; --text:#edf3fa;
  --muted:#adbdcd; --line:#314253; --brand:#83ead2; --brand-bg:#153e39;
  --urgent:#ffb5a2; --urgent-bg:#432b2b; --amber:#ffd698; --amber-bg:#41341f;
  --blue:#b3d2ff; --blue-bg:#283a54; --nav:#192532f0; --shadow:0 12px 32px #0003;
}
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--text); min-width:300px; }
button,input,select,textarea { font:inherit; }
button { color:inherit; cursor:pointer; touch-action:manipulation; }
button:disabled { opacity:.5; cursor:default; }
a { color:var(--brand); }
img { width:100%; display:block; object-fit:cover; }
h1,h2,h3,p { margin:0; }
h1 { font-size:clamp(1.9rem,6vw,2.35rem); line-height:1.08; letter-spacing:-.055em; }
h2 { font-size:1.22rem; letter-spacing:-.029em; line-height:1.25; }
h3 { font-size:1.04rem; line-height:1.25; letter-spacing:-.025em; }
p { line-height:1.48; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline:2px solid var(--brand); outline-offset:3px; }
svg { width:22px; height:22px; flex:none; vertical-align:middle; }
[hidden] { display:none !important; }
.app { max-width:600px; margin:auto; min-height:100dvh; }
:root[data-telegram="true"] .app { min-height:var(--tg-viewport-stable-height, 100dvh); }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:calc(14px + var(--app-inset-top)) calc(20px + var(--app-inset-right)) 12px calc(20px + var(--app-inset-left)); }
.brand { display:flex; align-items:center; gap:10px; border:0; background:none; text-align:left; padding:0; }
.brand-icon { width:39px; height:39px; display:grid; place-items:center; background:#13334a; color:#9bf0d3; border-radius:13px; }
.brand strong { display:block; font-size:1.02rem; letter-spacing:-.04em; line-height:1.18; }
.brand small { color:var(--muted); font-size:.78rem; }
.workspace { background:var(--surface); border:1px solid var(--line); border-radius:999px; display:flex; align-items:center; gap:6px; padding:0 11px; height:44px; font-weight:650; font-size:.86rem; white-space:nowrap; }
.workspace svg { width:16px; height:16px; color:var(--brand); }
main { padding:0 calc(20px + var(--app-inset-right)) calc(100px + var(--app-inset-bottom)) calc(20px + var(--app-inset-left)); display:grid; gap:19px; outline:none; }
.hero { min-height:215px; padding:23px 19px 17px; border-radius:24px; color:#fff; position:relative; overflow:hidden; isolation:isolate;
  background:linear-gradient(127deg,#142b43 10%,#173b50 67%,#176b66); box-shadow:0 12px 26px #132f442b; }
.hero::before { content:""; position:absolute; z-index:-1; inset:-80px -125px auto auto; width:300px; height:300px;
  border:1px solid #a0f1da3a; border-radius:50%; box-shadow:0 0 0 24px #8bead812,0 0 0 50px #8bead811,0 0 0 76px #8bead810; }
.hero .eyebrow { display:flex; align-items:center; gap:7px; color:#bde7e3; font-size:.86rem; margin-bottom:12px; }
.hero .eyebrow svg { width:16px; height:16px; }
.hero .intro { font-size:.91rem; color:#e0eaed; margin-top:8px; }
.metrics { display:grid; grid-template-columns:repeat(3,1fr); margin-top:19px; border:1px solid #e1f7f428; border-radius:14px; background:#0c263648; }
.metric { min-width:0; display:grid; gap:3px; text-align:left; padding:10px 9px; background:none; border:0; color:#fff; }
.metric + .metric { border-left:1px solid #e1f7f428; }
.metric b { font-size:1.24rem; line-height:1; font-variant-numeric:tabular-nums; }
.metric span { color:#d9ecee; font-size:.78rem; line-height:1.2; }
.section { display:grid; gap:10px; }
.section-title,.heading,.split { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.heading { align-items:flex-start; margin:8px 0 2px; }
.heading p,.caption { font-size:.9rem; color:var(--muted); margin-top:5px; }
.count { font-size:.75rem; min-width:22px; height:22px; padding:0 6px; display:inline-grid; place-items:center; border-radius:99px; background:var(--brand-bg); color:var(--brand); font-weight:750; }
.section-title h2 { display:flex; align-items:center; gap:8px; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:17px; box-shadow:var(--shadow); overflow:hidden; }
.card-pad { padding:15px; }
.row { width:100%; border:0; background:none; padding:13px; display:flex; gap:11px; align-items:center; text-align:left; min-height:62px; }
.row + .row,.row + .actions { border-top:1px solid var(--line); }
.row .copy { flex:1; min-width:0; }
.copy p { overflow-wrap:anywhere; }
.row .chev { width:18px; height:18px; color:var(--muted); }
.icon-tile { width:43px; height:43px; border-radius:12px; display:grid; place-items:center; flex:none; background:var(--brand-bg); color:var(--brand); }
.icon-tile svg { width:21px; height:21px; }
.icon-tile.urgent,.pill.urgent { background:var(--urgent-bg); color:var(--urgent); }
.icon-tile.amber,.pill.amber { background:var(--amber-bg); color:var(--amber); }
.icon-tile.blue,.pill.blue { background:var(--blue-bg); color:var(--blue); }
.urgent-card { border-color:color-mix(in srgb,var(--urgent) 27%,var(--line)); }
.mini { color:var(--muted); font-size:.82rem; margin-top:4px; }
.pill { border-radius:999px; color:var(--brand); background:var(--brand-bg); padding:4px 8px; font-size:.76rem; font-weight:700; display:inline-block; line-height:1.3; }
.draft-cover { height:69px; width:67px; border-radius:12px; flex:none; }
.link-btn { border:0; background:none; color:var(--brand); font-weight:700; font-size:.89rem; padding:8px 0; min-height:44px; }
.primary,.secondary,.danger { border-radius:12px; border:1px solid transparent; font-weight:700; min-height:44px; padding:10px 14px; display:inline-flex; align-items:center; justify-content:center; gap:7px; }
.primary { background:#09685b; color:#fff; }
.secondary { background:var(--subtle); color:var(--text); border-color:var(--line); }
.danger { background:var(--urgent-bg); color:var(--urgent); }
.primary svg,.secondary svg,.danger svg { width:18px; height:18px; }
.small { font-size:.86rem; padding:8px 11px; }
.actions { display:flex; flex-wrap:wrap; gap:8px; padding:11px 13px; }
.card-pad .actions { padding:14px 0 0; }
.actions .grow { flex:1; }
.back { justify-self:start; padding:3px 5px 3px 0; }
.back svg { width:18px; height:18px; }
.tabbar { position:fixed; z-index:5; bottom:0; left:50%; transform:translateX(-50%); width:min(100%,600px);
  display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:2px; background:var(--nav); backdrop-filter:blur(18px); border-top:1px solid var(--line);
  padding:6px calc(9px + var(--app-inset-right)) calc(6px + var(--app-inset-bottom)) calc(9px + var(--app-inset-left)); }
.tab { display:grid; place-items:center; gap:3px; font-size:.76rem; font-weight:660; color:var(--muted); padding:5px 1px; border:0; background:none; min-height:53px; }
.tab .tab-icon { display:grid; place-items:center; width:42px; height:28px; border-radius:9px; }
.tab svg { width:20px; height:20px; }
.tab[aria-current="page"] { color:var(--brand); }
.tab[aria-current="page"] .tab-icon { background:var(--brand-bg); }
.segments { display:flex; padding:4px; gap:4px; border:1px solid var(--line); background:var(--subtle); border-radius:13px; }
.segments button { flex:1; min-height:39px; padding:4px 6px; border:0; border-radius:9px; background:none; font-weight:680; font-size:.88rem; color:var(--muted); }
.segments button[aria-pressed="true"] { background:var(--surface); color:var(--text); box-shadow:0 2px 6px #172c4815; }
.field { display:grid; gap:6px; font-size:.87rem; font-weight:680; }
input,textarea,select { width:100%; color:var(--text); background:var(--subtle); border:1px solid var(--line); border-radius:11px; padding:10px 11px; min-height:44px; font-size:1rem; }
textarea { min-height:132px; resize:vertical; }
.form { display:grid; gap:13px; }
.photo-grid,.gallery { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.photo { position:relative; min-width:0; }
.photo img,.gallery img { width:100%; aspect-ratio:1.17; border-radius:10px; background:var(--subtle); }
.remove-photo { position:absolute; top:3px; right:3px; width:44px; height:44px; padding:0; background:#102238dc; color:#fff; border:0; border-radius:10px; }
.photo:first-child { grid-column:span 2; }
.photo:first-child img { aspect-ratio:2.45; }
.gallery label { display:grid; position:relative; gap:5px; min-width:0; border:2px solid transparent; border-radius:13px; padding:2px; cursor:pointer; font-size:.82rem; }
.gallery label:has(:checked) { border-color:var(--brand); background:var(--brand-bg); }
.gallery input { width:20px; height:20px; min-height:0; position:absolute; top:6px; right:6px; accent-color:#08786a; }
.news-cover { max-height:230px; aspect-ratio:2; }
.article { white-space:pre-wrap; overflow-wrap:anywhere; }
.muted-banner { margin:0; border-radius:12px; font-size:.87rem; padding:12px; color:var(--muted); background:var(--subtle); line-height:1.45; }
.empty { padding:21px; text-align:center; color:var(--muted); }
.grow { flex:1; }
.timeline { list-style:none; margin:0; padding:0; display:grid; gap:12px; }
.timeline li { padding-left:13px; border-left:3px solid var(--line); }
.progress { background:var(--subtle); height:8px; border-radius:999px; overflow:hidden; }
.progress span { display:block; height:100%; background:var(--brand); }
.stack { display:grid; gap:12px; }
.sheet-form { display:grid; gap:13px; }
dialog { margin:auto auto 0; max-width:min(100%,600px); width:100%; max-height:85dvh; overflow:auto; padding:17px calc(20px + var(--app-inset-right)) calc(18px + var(--app-inset-bottom)) calc(20px + var(--app-inset-left)); border:1px solid var(--line); border-bottom:0; border-radius:22px 22px 0 0; background:var(--surface); color:var(--text); }
dialog::backdrop { background:#08182490; }
.sheet-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:11px; }
.x { min-width:44px; min-height:44px; border:0; border-radius:10px; color:var(--muted); background:var(--subtle); }
.toast { pointer-events:none; position:fixed; z-index:8; left:50%; transform:translateX(-50%); bottom:calc(79px + var(--app-inset-bottom)); width:max-content;
  max-width:calc(100% - 32px); padding:11px 15px; border-radius:12px; background:#16374b; color:white; font-size:.89rem; box-shadow:var(--shadow); }
.toast:empty { display:none; }
.storage-warning { padding:10px; background:var(--amber-bg); color:var(--amber); border-radius:9px; font-size:.85rem; }
.row-detail { display:block; }
.photo-actions { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }
.photo-actions .small { min-height:36px; padding:4px 6px; }
#upload { width:100%; }
@media (min-width:630px) {
  .topbar { padding:calc(20px + var(--app-inset-top)) calc(26px + var(--app-inset-right)) 15px calc(26px + var(--app-inset-left)); }
  main { padding-inline:calc(26px + var(--app-inset-left)) calc(26px + var(--app-inset-right)); }
  .hero { padding-inline:24px; }
  .metric { padding-inline:13px; }
  .tabbar { border:1px solid var(--line); border-bottom:0; border-radius:16px 16px 0 0; }
}
@media (min-width:900px) {
  .app { max-width:1120px; }
  .app:has(.desktop-detail) .tabbar { width:min(100%,760px); }
  .desktop-detail { display:grid; grid-template-columns:minmax(260px,.82fr) minmax(0,1.5fr); gap:24px; align-items:start; }
  .desktop-detail > aside,.work-detail { display:grid; gap:12px; min-width:0; }
  .hero { max-width:100%; }
}
