:root {
  --bg: #151515; --card: #1f1f1f; --card2: #262626; --line: #333;
  --text: #f0f0f0; --muted: #9a9a9a; --lime: #cce200; --lime-ink: #151515;
  --red: #ff6b6b; --green: #7ddc8a; --amber: #ffc857; --blue: #7cc4ff;
  --r: 14px; --tabs: 64px; --safe: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: calc(var(--tabs) + var(--safe) + 16px); -webkit-tap-highlight-color: transparent; }
a { color: var(--lime); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 860px; margin: 0 auto; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; background: rgba(21,21,21,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; color: var(--text); text-decoration: none; font-size: 18px; }
.brand b { color: var(--lime); }
.who { color: var(--muted); font-size: 13px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: #101010; border-top: 1px solid var(--line); padding-bottom: var(--safe); }
.tabs a { flex: 1; max-width: 160px; height: var(--tabs); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; }
.tabs a span { font-size: 21px; line-height: 1; }
.tabs a.on { color: var(--lime); }
h1 { font-size: 22px; margin: 18px 16px 6px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 16px 8px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 0 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.space { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card2); cursor: pointer; font-weight: 600;
  text-decoration: none; color: var(--text); font-size: 15px; }
.btn.main { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.btn.ghost { background: none; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px; margin: 10px 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); font-weight: 700; }

.list { margin: 0 16px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--card); }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line);
  color: var(--text); text-decoration: none; cursor: pointer; }
.item:first-child { border-top: 0; }
.item:hover { background: #232323; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 650; overflow-wrap: anywhere; }
.item .s { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.item .r { text-align: right; white-space: nowrap; font-size: 14px; }
.date-badge { flex: none; width: 46px; text-align: center; border-radius: 10px; background: var(--card2); padding: 5px 0; line-height: 1.1; }
.date-badge b { display: block; font-size: 18px; }
.date-badge span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 8px; background: var(--card2); color: var(--muted); }
.tag.ok { background: #183a1f; color: var(--green); }
.tag.warn { background: #3a3200; color: var(--amber); }
.tag.bad { background: #3a1515; color: var(--red); }
.tag.info { background: #13283a; color: var(--blue); }
.task { display: flex; gap: 10px; align-items: flex-start; }
.task .ic { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; }
.ic.overdue { background: var(--red); } .ic.today { background: var(--amber); }
.ic.soon { background: #777; } .ic.info { background: var(--blue); }
.empty { margin: 12px 16px; padding: 18px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); text-align: center; }

.card { margin: 0 16px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }
.pay { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.pay:first-child { border-top: 0; }
.pay .grow { flex: 1; min-width: 0; }
.progress { height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--green); }
.files a { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line);
  color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.files a:first-child { border-top: 0; }

/* календарь */
.cal-head { display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.cal-head b { flex: 1; text-align: center; font-size: 17px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin: 10px 16px; }
.cal .dow { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0; }
.cal .day { min-height: 64px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px;
  cursor: pointer; overflow: hidden; }
.cal .day.out { opacity: .35; }
.cal .day.today { border-color: var(--lime); }
.cal .day.sel { background: #2b2f14; }
.cal .num { font-size: 12px; color: var(--muted); }
.cal .mark { display: block; font-size: 11px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark.ev { color: var(--lime); } .mark.pay { color: var(--amber); } .mark.act { color: var(--blue); }
@media (max-width: 480px) { .cal .day { min-height: 50px; } .cal .mark { font-size: 0; line-height: 0; text-overflow: clip; padding: 6px 0 0; } .cal .mark::before { font-size: 11px; line-height: 1; content: "●"; } }

/* формы и шторка */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 92vh; overflow-y: auto;
  background: #1a1a1a; border-top-left-radius: 20px; border-top-right-radius: 20px; border-top: 1px solid var(--line);
  padding: 16px 16px calc(20px + var(--safe)); max-width: 720px; margin: 0 auto; }
.sheet h3 { margin: 0 0 12px; font-size: 19px; }
.f { display: block; margin-bottom: 12px; }
.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.f input, .f select, .f textarea { width: 100%; padding: 11px 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; outline: none; font-size: 16px; }
.f textarea { min-height: 72px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--lime); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; margin: 6px 0 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--lime); }
.lines .ln { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.lines .ln .grid3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 0 8px; }
.total { font-size: 18px; font-weight: 800; margin: 6px 0 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs) + var(--safe) + 14px); z-index: 60;
  background: #2b2b2b; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; max-width: calc(100% - 32px); }
.toast.err { border-color: var(--red); color: #ffd0d0; }
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.login h1 { margin: 0 0 16px; }
details.more summary { cursor: pointer; color: var(--muted); margin: 6px 0 12px; }
