:root {
  color-scheme: light;
  --ink: #102a2a;
  --muted: #637776;
  --paper: #f4f7f3;
  --card: #ffffff;
  --accent: #d8f06d;
  --accent-strong: #b8d84d;
  --line: #dfe7e1;
  --danger: #a43d3d;
  --shadow: 0 14px 40px rgba(16, 42, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
.dashboard-notice { padding: 14px; border: 1px solid #cad7a0; border-radius: 14px; background: #f2f8d9; line-height: 1.45; }
.app-shell { width: min(1120px, 100%); margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px 80px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.7rem, 5vw, 2.4rem); letter-spacing: -0.04em; }
.eyebrow { margin-bottom: 4px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; min-height: 190px; padding: 30px; border-radius: 30px; background: var(--ink); color: white; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; inset: auto -40px -70px auto; width: 210px; height: 210px; border-radius: 50%; background: rgba(216, 240, 109, .13); }
.hero-label { color: #b6c5c3; margin-bottom: 12px; }
.hero h2 { margin-bottom: 6px; font-size: clamp(2.35rem, 10vw, 4.3rem); letter-spacing: -.06em; }
.hero-subtitle { color: #c9d4d2; }
.hero-badge { z-index: 1; display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px; background: var(--accent); color: var(--ink); font-size: 1.9rem; font-weight: 900; }
.quick-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 30px; }
.quick-stats article { padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.quick-stats span { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 7px; }
.quick-stats strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-heading { margin-top: 34px; }
.budget-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px; border: 1px solid #cad7a0; border-radius: 20px; background: #f2f8d9; }
.budget-card strong, .budget-card span { display: block; }
.budget-card span { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.inline-form { display: flex; align-items: center; gap: 8px; width: min(390px, 100%); }
.inline-form input { flex: 1; }
.small-button { flex: 0 0 auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink); color: white; font-size: .78rem; font-weight: 800; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.finance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-heading span { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.card-heading h3 { margin: 3px 0 0; }
.compact-list { display: grid; gap: 8px; }
.compact-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.compact-row:first-child { border-top: 0; }
.compact-row strong, .compact-row span { display: block; }
.compact-row span { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.compact-actions { display: flex; align-items: center; gap: 6px; }
.row-button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #f7f9f7; color: var(--ink); font-size: .72rem; font-weight: 750; }
.row-button.pay { border-color: #cad7a0; background: var(--accent); }
.row-button.danger { color: var(--danger); }
.secondary-wide { width: 100%; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9f7; color: var(--ink); font-size: .78rem; font-weight: 800; }
.danger-button { width: 100%; margin-top: 14px; padding: 13px; border: 1px solid #e4bcbc; border-radius: 14px; background: #fff2f2; color: var(--danger); font-weight: 850; }
.debt-balance { color: var(--danger); }
.status-pill { display: inline-block !important; width: fit-content; padding: 4px 7px; border-radius: 999px; background: #edf3e4; color: #486326 !important; font-size: .68rem !important; font-weight: 800; }
.status-pill.pending { background: #fff2dd; color: #8a5715 !important; }
.inline-empty { margin: 14px 0 2px; color: var(--muted); font-size: .82rem; }
.controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.65); }
.controls > label, .form-grid > label { min-width: 0; }
label span { display: block; margin: 0 0 7px 3px; color: var(--muted); font-size: .76rem; font-weight: 700; }
input, select, textarea { width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; background: white; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(184,216,77,.2); }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 30px 2px 12px; }
.section-heading h2 { margin-bottom: 0; font-size: 1.35rem; }
.icon-button, .ghost-button { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.icon-button { width: 42px; height: 42px; border-radius: 13px; font-size: 1.25rem; }
.ghost-button { padding: 10px 14px; border-radius: 13px; font-weight: 700; }
.expense-list { display: grid; gap: 10px; }
.expense-card { display: grid; grid-template-columns: 48px 1fr auto; gap: 13px; align-items: center; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: inherit; text-align: left; box-shadow: 0 4px 16px rgba(16,42,42,.035); }
.expense-card:active { transform: scale(.99); }
.category-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: #edf3e4; font-size: 1.25rem; font-weight: 900; }
.expense-main { min-width: 0; }
.expense-main strong, .expense-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-main span { margin-top: 4px; color: var(--muted); font-size: .82rem; }
.expense-amount { text-align: right; }
.expense-amount strong { display: block; }
.expense-amount span { color: var(--muted); font-size: .72rem; }
.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state > span { display: inline-grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--accent); color: var(--ink); font-weight: 900; }
.overlay { position: fixed; z-index: 20; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; color: var(--ink); display: grid; place-items: center; padding: 20px; overflow-y: auto; background: rgba(16,42,42,.72); backdrop-filter: blur(8px); }
.overlay::backdrop { background: transparent; }
.login-card { width: min(420px, 100%); padding: 30px; border-radius: 28px; background: var(--card); box-shadow: var(--shadow); }
.login-card h2 { margin-bottom: 8px; }
.login-card > p:not(.eyebrow,.form-error) { color: var(--muted); }
.login-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.auth-legal-links { margin: 18px 0 0; text-align: center; font-size: .78rem; }
.auth-legal-links a, .legal-check a, .app-footer a { color: #315a52; }
.offer-card { margin-bottom: 15px; padding: 12px 14px; border: 1px solid #cad7a0; border-radius: 13px; background: #f2f8d9; color: #486326; font-size: .84rem; font-weight: 750; }
.legal-check { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; }
.legal-check input { flex: 0 0 auto; width: auto; margin-top: 3px; }
.legal-check span { margin: 0; line-height: 1.45; }
.legal-overlay { z-index: 21; }
.secondary-button { flex: 1; min-width: 130px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--ink); font-weight: 750; }
.primary-button { width: 100%; margin-top: 14px; padding: 14px; border: 0; border-radius: 14px; background: var(--accent); color: var(--ink); font-weight: 850; }
.form-error { margin: 10px 0 0; color: var(--danger); font-size: .84rem; }
.expense-dialog { width: min(620px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 28px; color: var(--ink); box-shadow: var(--shadow); }
.expense-dialog::backdrop { background: rgba(16,42,42,.6); backdrop-filter: blur(5px); }
.expense-dialog form { padding: 24px; }
.admin-panel { padding: 24px; }
.operations-card { margin: 16px 0 20px; padding: 16px; border-radius: 16px; background: #f5f7f1; }
.operations-card h3 { margin: 2px 0 12px; }
.operations-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.operations-status > div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.operations-status span, .operations-status strong, .operations-status small { display: block; }
.operations-status span { color: var(--muted); font-size: .76rem; }
.operations-status strong { margin: 4px 0; }
.operations-status small { color: var(--muted); line-height: 1.3; }
.service-ok { color: #2f6f3e; }
.service-stale, .service-missing { color: #9b4d29; }
.admin-invite-form { align-items: end; margin: 18px 0; }
.admin-invite-form label { flex: 1; }
.code-result { padding: 13px; border-radius: 13px; background: #edf3e4; overflow-wrap: anywhere; font-size: .82rem; }
.admin-user-list { margin-top: 18px; }
.account-section { padding: 8px 0 22px; }
.account-section p, .danger-zone p { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.telegram-link-intro, .telegram-link-expiry, .telegram-link-help { color: var(--muted); font-size: .86rem; line-height: 1.45; }
.telegram-command { margin: 18px 0 8px; padding: 15px; border: 1px solid #cad7a0; border-radius: 14px; background: #f2f8d9; }
.telegram-command span, .telegram-command code { display: block; }
.telegram-command span { margin-bottom: 6px; color: var(--muted); font-size: .75rem; font-weight: 700; }
.telegram-command code { overflow-wrap: anywhere; color: var(--ink); font-size: 1rem; font-weight: 850; }
.telegram-open-button { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
.telegram-link-help { margin-bottom: 0; }
.clipboard-field { position: fixed; opacity: 0; pointer-events: none; }
.danger-zone { padding-top: 20px; border-top: 1px solid #e4bcbc; }
.danger-zone label { display: block; margin-top: 13px; }
.dialog-handle { display: none; width: 44px; height: 5px; margin: -10px auto 18px; border-radius: 5px; background: var(--line); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; }
.form-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 13px; }
.form-grid .wide { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; gap: 9px; }
.check-field input { width: auto; }
.check-field span { margin: 0; }
textarea { resize: vertical; min-height: 84px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.attachment-list a { padding: 9px 12px; border-radius: 12px; background: #edf3e4; color: var(--ink); font-size: .8rem; font-weight: 700; text-decoration: none; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: white; box-shadow: var(--shadow); }
.app-footer { display: flex; justify-content: center; gap: 18px; margin-top: 42px; color: var(--muted); font-size: .78rem; }
@media (max-width: 680px) {
  .operations-status { grid-template-columns: 1fr; }
  .app-shell { padding-inline: 14px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { max-width: 58%; }
  .ghost-button { padding: 8px 10px; font-size: .76rem; }
  .hero { min-height: 174px; padding: 24px; border-radius: 25px; }
  .hero-badge { width: 52px; height: 52px; border-radius: 16px; }
  .controls, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .controls { padding: 14px; }
  .quick-stats { grid-template-columns: 1fr 1fr; }
  .budget-card { align-items: stretch; flex-direction: column; }
  .inline-form { width: 100%; }
  .plan-grid { grid-template-columns: 1fr; }
  .finance-grid { grid-template-columns: 1fr; }
  .search-field { grid-column: 1 / -1; }
  .expense-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .expense-dialog form { padding: 22px 18px max(24px, env(safe-area-inset-bottom)); }
  .dialog-handle { display: block; }
}
@media (max-width: 420px) {
  .inline-form { align-items: stretch; flex-direction: column; }
  .small-button { min-height: 42px; }
  .compact-row { align-items: start; grid-template-columns: 1fr; }
  .compact-actions { justify-content: flex-start; }
}
