:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #e2e8f1;
  --border-strong: #cdd7e5;
  --text: #16213a;
  --muted: #6b7a90;
  --primary: #1d4ed8;
  --primary-dark: #1738a8;
  --primary-soft: #eaf0ff;
  --pos: #0f766e;
  --pos-soft: #e5f5f2;
  --neg: #c2410c;
  --neg-soft: #fff0e7;
  --capital: #6d4bd8;
  --capital-soft: #f1ecff;
  --warn: #b45309;
  --warn-soft: #fff6e6;
  --shadow: 0 1px 2px rgba(16, 32, 64, .04), 0 8px 24px rgba(16, 32, 64, .06);
  --shadow-lg: 0 24px 64px rgba(12, 26, 54, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 9px 15px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 550;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #aebbd0; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 7px 10px; }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover { background: #92400e; border-color: #92400e; }
.btn-danger { color: var(--neg); border-color: #f0c9b3; }
.btn-danger:hover { background: var(--neg-soft); border-color: var(--neg); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 11px; }
.btn-link { border: none; background: none; color: var(--primary); padding: 2px 4px; cursor: pointer; font-weight: 550; }
.btn-link:hover { text-decoration: underline; background: none; }

/* ------------------------------------------------------------- login */
.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-brand {
  background: linear-gradient(150deg, #0e2559 0%, #1b47b8 55%, #2f6ae0 100%);
  color: #fff; padding: 8vh 7vw; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -190px; bottom: -240px;
  border-radius: 50%; border: 60px solid rgba(255,255,255,.055);
}
.brand-mark { width: 76px; height: 76px; border-radius: 20px; background: rgba(255,255,255,.13); display: grid; place-items: center; margin-bottom: 30px; }
.login-brand h1 { font-size: 38px; letter-spacing: .02em; }
.brand-sub { font-size: 17px; opacity: .85; margin-top: 8px; }
.brand-tag { margin-top: 26px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; opacity: .7; }
.brand-points { list-style: none; padding: 0; margin: 34px 0 0; display: grid; gap: 14px; font-size: 14.5px; opacity: .92; }
.brand-points li { display: flex; align-items: center; gap: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #7dd3fc; flex: none; box-shadow: 0 0 0 4px rgba(125,211,252,.18); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; position: relative; background: var(--bg); }
.login-lang { position: absolute; top: 24px; right: 26px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 34px 32px 28px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 24px; }
.login-card > .muted { margin: 6px 0 26px; font-size: 13.5px; }
.field { display: block; margin-bottom: 17px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: #3d4b61; margin-bottom: 7px; }
.field input, .field select, .field textarea, .filter-input, .filter-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .filter-input:focus, .filter-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.field textarea { min-height: 82px; resize: vertical; }
.field-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.form-error { background: var(--neg-soft); color: var(--neg); border: 1px solid #f3cdb8; border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13px; margin-bottom: 14px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 20px; }

.lang-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang-btn { border: none; background: transparent; padding: 5px 13px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.lang-btn.active { background: var(--primary); color: #fff; }

/* ------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 26px; min-height: 62px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.role-pill { font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 700; }
.role-investor { background: var(--capital-soft); color: var(--capital); }
.role-employee { background: var(--pos-soft); color: var(--pos); }
.security-banner { background: var(--warn-soft); border-bottom: 1px solid #f5d9a8; color: #7c3f04; padding: 10px 26px; display: flex; align-items: center; gap: 14px; font-size: 13.5px; font-weight: 550; }

.tabs { display: flex; gap: 4px; padding: 12px 26px 0; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); }
.tab { border: none; background: transparent; padding: 11px 16px 13px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.content { padding: 24px 26px 40px; max-width: 1520px; margin: 0 auto; }
.app-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

/* -------------------------------------------------------------- blocks */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 21px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px 20px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 10px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.stat-ccy { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin-right: 8px; vertical-align: 2px; }
.stat-extra { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); display: grid; gap: 4px; }
.stat-extra-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.stat-extra-row .money-num { font-size: 11.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.stat.capital .stat-icon { background: var(--capital-soft); color: var(--capital); }
.stat.received .stat-icon { background: var(--pos-soft); color: var(--pos); }
.stat.paid .stat-icon { background: var(--neg-soft); color: var(--neg); }
.stat.profit .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat.profit .stat-value.pos { color: var(--pos); }
.stat.profit .stat-value.neg { color: var(--neg); }

.two-col { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; margin-bottom: 18px; }
.full-col { margin-bottom: 18px; }

/* money cell: one line per currency */
.money-rows { display: grid; gap: 3px; }
.money-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; white-space: nowrap; }
.ccy { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; letter-spacing: .04em; }
.money-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-num.pos { color: var(--pos); }
.money-num.neg { color: var(--neg); }
.money-num.zero { color: var(--muted); }
.empty-cell { color: #adb8c8; }

/* -------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
thead th { text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcff; }
td.right, th.right { text-align: right; }
td.nowrap { white-space: nowrap; }
.person-name { font-weight: 650; }
.person-sub { font-size: 11.5px; color: var(--muted); }
.note-cell { max-width: 260px; color: #43536b; word-break: break-word; }
.amt-line { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-state .big { font-size: 30px; opacity: .35; margin-bottom: 8px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.badge-capital { background: var(--capital-soft); color: var(--capital); }
.badge-receive { background: var(--pos-soft); color: var(--pos); }
.badge-pay { background: var(--neg-soft); color: var(--neg); }
.badge-active { background: var(--pos-soft); color: var(--pos); }
.badge-off { background: #eef1f5; color: var(--muted); }
.badge-investor { background: var(--capital-soft); color: var(--capital); }
.badge-employee { background: var(--primary-soft); color: var(--primary); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.filter-item { display: grid; gap: 5px; min-width: 150px; }
.filter-item > label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filter-input, .filter-select { padding: 8px 10px; }
.filter-grow { flex: 1 1 220px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }

/* bar chart */
.bar-list { display: grid; gap: 13px; padding: 4px 0; }
.bar-item { display: grid; gap: 6px; }
.bar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.bar-top .lbl { font-weight: 600; }
.bar-track { height: 9px; border-radius: 999px; background: #edf1f7; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b6fe6, #1d4ed8); min-width: 2px; }
.bar-fill.staff { background: linear-gradient(90deg, #2fb3a3, #0f766e); }

.notice { display: flex; gap: 11px; align-items: flex-start; background: var(--primary-soft); border: 1px solid #d3e0ff; color: #1c3f9e; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; margin-bottom: 18px; }
.notice .ico { font-weight: 800; }
.info-strip { display: flex; gap: 22px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); padding: 0 2px 14px; }
.info-strip b { color: var(--text); }
.info-strip .strip-note { color: var(--primary); font-weight: 650; }

/* --------------------------------------------- joint decisions / proposals */
.tab-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--neg); color: #fff; font-size: 11px; font-weight: 700; vertical-align: middle; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 22px 2px 12px; }
.section-head h3 { font-size: 16px; }
.section-head span { font-size: 12.5px; color: var(--muted); }
.prop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.prop-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 13px; }
.prop-card.todo { border-color: #bcd0ff; box-shadow: 0 0 0 3px rgba(29,78,216,.07), var(--shadow); }
.prop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.prop-head-txt { min-width: 0; }
.prop-title { font-size: 16px; font-weight: 700; word-break: break-word; }
.prop-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.prop-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.prop-desc { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; color: #43536b; white-space: pre-wrap; word-break: break-word; }
.prop-progress { display: grid; gap: 6px; }
.prop-progress .bar-top { font-size: 12px; }
.prop-progress .bar-top span:last-child { color: var(--muted); }
.bar-fill.done { background: linear-gradient(90deg, #2fb3a3, #0f766e); }
.prop-amount { font-size: 15px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.prop-amount small { color: var(--muted); font-weight: 600; }
.prop-amount .prop-total { font-size: 12.5px; color: var(--primary); font-weight: 650; }
.prop-amount.muted { font-size: 12.5px; font-weight: 500; }
.vote-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.vote-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; background: var(--surface-2); }
.vote-chip b { font-size: 12px; }
.vote-chip small { font-size: 10.5px; font-weight: 600; opacity: .75; }
.vote-chip.ok { background: var(--pos-soft); border-color: #b9e3dc; color: var(--pos); }
.vote-chip.no { background: var(--neg-soft); border-color: #f3cdb8; color: var(--neg); }
.vote-chip.wait { color: var(--muted); }
.vote-note { display: block; flex: 1 1 100%; font-size: 11px; font-weight: 500; color: #43536b; opacity: .9; }
.prop-vote { border-top: 1px dashed var(--border); padding-top: 12px; }
.prop-vote .field { margin-bottom: 10px; }
.vote-note-input { min-height: 60px; }
.prop-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.prop-booked { font-size: 12px; color: var(--pos); font-weight: 600; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--surface-2); }
.check-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer; }
.check-item input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check-item small { color: var(--muted); font-size: 11px; margin-left: auto; }
.check-item.fixed { opacity: .8; cursor: default; }

/* -------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 24, 48, .5); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 18px; }
.modal { background: var(--surface); border-radius: 16px; width: min(520px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(680px, 100%); }
.modal-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px 24px; display: grid; gap: 15px; }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.icon-btn { border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.icon-btn:hover { color: var(--text); }
.confirm-text { font-size: 14px; line-height: 1.6; }

/* toast */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 9px; justify-items: end; }
.toast { background: #14213d; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .22s ease-out; max-width: 340px; }
.toast.error { background: var(--neg); }
.toast.ok { background: #12665e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { padding: 44px 30px; }
  .login-brand h1 { font-size: 30px; }
  .brand-points { margin-top: 22px; }
  .login-panel { padding: 40px 20px 64px; }
  .topbar { padding: 9px 14px; }
  .tabs { padding: 10px 14px 0; }
  .content { padding: 18px 14px 32px; }
  .security-banner { padding: 10px 14px; }
  .prop-grid { grid-template-columns: 1fr; }
}
/* ------------------------------------------------- phones: no sideways scroll */
@media (max-width: 720px) {
  .stat-value { font-size: clamp(16px, 4.6vw, 24px); letter-spacing: -.03em; }
  .stat-ccy { display: block; margin: 0 0 2px; vertical-align: baseline; }
  .stat-extra-row .money-num { font-size: 11px; }
  .stat { padding: 15px; }
  .card-head, .pager, .security-banner { flex-wrap: wrap; }
  .card-head .sub { flex: 1 1 100%; }
  .note-cell { max-width: none; }

  /* Wide tables become stacked cards. Column names are injected by app.js
     as data-label so every value still has a visible label. */
  #content .table-wrap { overflow-x: visible; }
  #content table, #content tbody, #content tr { display: block; width: 100%; }
  #content thead { display: none; }
  #content tbody tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 0 12px 12px;
    padding: 6px 14px 10px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(16, 32, 64, .03);
  }
  #content tbody tr:hover { background: var(--surface); }
  #content tbody td {
    display: grid;
    grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 2px;
    align-items: baseline;
    border: none;
    border-bottom: 1px dashed #eef2f7;
    padding: 7px 0;
    text-align: right;
    white-space: normal;
  }
  #content tbody tr td:last-child { border-bottom: none; }
  #content tbody td::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1 / span 20;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--muted);
    text-transform: uppercase;
  }
  #content tbody td:not([data-label])::before { display: none; }
  #content tbody td > * {
    grid-column: 2;
    justify-self: end;
    text-align: right;
    max-width: 100%;
    min-width: 0;
  }
  #content tbody td[colspan] { display: block; text-align: center; border-bottom: none; }
  #content tbody td[colspan]::before { display: none; }
  #content tbody td .money-rows,
  #content tbody td.note-cell,
  #content tbody td .note-cell { width: 100%; max-width: none; }
  #content tbody td .row-actions { justify-content: flex-end; }
  #content tbody td .empty-state { width: 100%; padding: 18px 0; }
  .prop-card { padding: 15px 14px; }
  .prop-head { flex-wrap: wrap; }
  .prop-badges { justify-content: flex-start; }
  .prop-actions .btn { flex: 1 1 130px; }
  .check-list { grid-template-columns: 1fr; }
  .filter-bar > .btn { flex: 0 0 auto; }
  .modal-foot {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; min-height: 0; }
  .topbar-brand { flex: 1 1 auto; }
  .topbar-actions { flex: 1 1 100%; justify-content: space-between; flex-wrap: nowrap; gap: 4px; }
  .topbar-actions .btn-ghost { font-size: 12px; padding: 6px 8px; }
  .lang-btn { padding: 5px 10px; }
  .tabs { padding: 8px 10px 0; }
  .tab { padding: 9px 12px 11px; font-size: 13px; }
  .content { padding: 14px 10px 32px; }
  .card-pad { padding: 14px; }
  .card-head { padding: 13px 14px; }
  .filter-bar { padding: 12px 14px; }
  .filter-item { min-width: 120px; flex: 1 1 120px; }
  .page-head h2 { font-size: 18px; }

  .login-brand { padding: 22px 20px 18px; }
  .login-brand .brand-mark { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 12px; }
  .login-brand h1 { font-size: 24px; }
  .brand-sub, .brand-points { display: none; }
  .brand-tag { margin-top: 8px; font-size: 11px; }
  .login-lang { top: 12px; right: 12px; }
  .login-panel { padding: 18px 14px 40px; }
  .login-card { padding: 24px 20px 20px; }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
  .toast { max-width: none; }
  .app-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .grid-2 { grid-template-columns: 1fr; }
  .user-chip { display: none; }
}
