:root {
  --bg: #f7f9fe;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --surface-blue: #f2f6ff;
  --text: #172039;
  --muted: #71809a;
  --line: #e5eaf4;
  --primary: #4f6ff7;
  --primary-2: #7d64f7;
  --primary-soft: #edf2ff;
  --green: #16a66f;
  --green-soft: #e8f8f1;
  --red: #ef5360;
  --red-soft: #fff0f1;
  --orange: #e99a32;
  --orange-soft: #fff5e5;
  --purple: #8265ef;
  --purple-soft: #f1edff;
  --teal: #25b9b3;
  --blue: #469bee;
  --pink: #f2668e;
  --shadow: 0 14px 38px rgba(59, 79, 128, .075);
  --shadow-sm: 0 7px 22px rgba(59, 79, 128, .055);
  --radius: 18px;
}

[data-theme="dark"] {
  --bg: #101522;
  --surface: #171e2e;
  --surface-2: #1d2638;
  --surface-blue: #202a40;
  --text: #f4f7ff;
  --muted: #9eabc0;
  --line: #293449;
  --primary-soft: #253258;
  --green-soft: #17382f;
  --red-soft: #3b2229;
  --orange-soft: #3e2e1f;
  --purple-soft: #30294a;
  --shadow: 0 16px 38px rgba(0, 0, 0, .24);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 70% -10%, rgba(102, 124, 255, .07), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans Thai", "Leelawadee UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(79,111,247,.22); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 224px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 30;
  box-shadow: 8px 0 30px rgba(67, 83, 123, .025);
}
.brand { min-height: 83px; display: flex; align-items: center; gap: 10px; padding: 15px 17px; }
.brand-mark { width: 38px; height: 38px; color: #234dbd; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 36px; height: 36px; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 16px; line-height: 1.2; white-space: nowrap; }
.brand-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 650; }
.version-pill { margin-left: auto; border-radius: 999px; background: var(--primary-soft); color: var(--primary); padding: 4px 7px; font-size: 9px; font-weight: 800; white-space: nowrap; }

.nav-list { padding: 12px 13px; display: grid; gap: 7px; }
.nav-item { width: 100%; border: 0; border-radius: 11px; padding: 11px 12px; display: flex; align-items: center; gap: 12px; background: transparent; color: #31415f; text-align: left; transition: .18s ease; }
[data-theme="dark"] .nav-item { color: var(--muted); }
.nav-icon { width: 22px; color: currentColor; font-size: 17px; text-align: center; }
.nav-item b { font-weight: 720; }
.nav-item:hover { background: var(--surface-2); color: var(--primary); transform: translateX(2px); }
.nav-item.active { background: linear-gradient(90deg, #edf2ff, #f4f6ff); color: #3159d7; }
[data-theme="dark"] .nav-item.active { background: var(--primary-soft); color: #9bb0ff; }

.sidebar-profile { margin-top: 8px; padding: 0 14px; }
.sidebar-section-label { font-size: 10px; font-weight: 800; color: var(--muted); margin: 0 4px 8px; }
.profile-card { position: relative; min-height: 68px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; padding: 10px; overflow: hidden; }
.profile-avatar { width: 39px; height: 39px; border-radius: 13px; background: linear-gradient(135deg,#f0c4a6,#7a92ec); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 850; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); flex: none; }
.profile-copy { min-width: 0; }
.profile-copy strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.profile-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.profile-native-select { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.profile-chevron { margin-left: auto; color: var(--muted); }
.sidebar-footer { margin-top: auto; padding: 14px; display: grid; gap: 9px; }
.device-box, .theme-toggle { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 9px 11px; color: var(--muted); overflow: hidden; }
.device-box span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.theme-toggle { cursor: pointer; width: 100%; }
.theme-toggle b { font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); flex: none; }

.main-area { width: calc(100% - 224px); margin-left: 224px; min-height: 100vh; }
.topbar { min-height: 82px; padding: 13px 24px; display: flex; align-items: center; gap: 18px; position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
.page-heading { min-width: 275px; }
.page-heading h1 { font-size: 24px; margin: 0; letter-spacing: -.55px; line-height: 1.2; }
.page-heading p { color: var(--muted); margin: 5px 0 0; font-size: 12px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-box, .select-shell { height: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); box-shadow: 0 4px 14px rgba(49,70,115,.025); }
.search-box { width: min(260px, 24vw); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.select-shell { padding-right: 5px; }
.select-control { height: 38px; border: 0; background: transparent; color: var(--text); padding: 0 22px 0 0; outline: 0; max-width: 170px; font-size: 12px; font-weight: 700; }
.primary-btn, .secondary-btn, .ghost-btn, .danger-btn { border: 0; border-radius: 11px; min-height: 42px; padding: 0 15px; font-weight: 760; transition: .18s ease; }
.primary-btn { background: linear-gradient(135deg, #5577fb, #4166ef); color: white; box-shadow: 0 9px 20px rgba(72,104,242,.23); }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 23px rgba(72,104,242,.28); }
.secondary-btn { background: var(--primary-soft); color: var(--primary); }
.ghost-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.danger-btn { background: var(--red-soft); color: var(--red); }
.icon-btn { border: 0; width: 36px; height: 36px; border-radius: 11px; background: var(--surface-2); color: var(--text); font-size: 19px; }
.menu-button, .mobile-only { display: none; }
.content { padding: 5px 24px 40px; max-width: 1500px; margin: 0 auto; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; min-height: 126px; box-shadow: var(--shadow-sm); overflow: hidden; display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto 1fr; column-gap: 13px; }
.metric-card::after { content: ""; position: absolute; width: 95px; height: 95px; border-radius: 999px; right: -42px; bottom: -48px; background: var(--accent-soft, var(--primary-soft)); opacity: .7; }
.metric-icon { grid-row: 1 / span 2; width: 42px; height: 42px; border-radius: 13px; background: var(--accent-soft, var(--primary-soft)); color: var(--accent, var(--primary)); display: grid; place-items: center; font-size: 19px; position: relative; z-index: 1; }
.metric-label { margin-top: 2px; color: #475472; font-weight: 720; font-size: 12px; position: relative; z-index: 1; }
[data-theme="dark"] .metric-label { color: var(--muted); }
.metric-value { margin-top: 6px; font-size: clamp(23px, 2vw, 31px); font-weight: 880; letter-spacing: -.7px; position: relative; z-index: 1; }
.metric-note { grid-column: 2; margin-top: 3px; color: var(--muted); font-size: 10px; position: relative; z-index: 1; }

.dashboard-upper { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(380px, .98fr); gap: 14px; margin-bottom: 14px; }
.dashboard-lower { display: grid; grid-template-columns: minmax(0, .98fr) minmax(420px, 1.02fr); gap: 14px; align-items: stretch; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 14px; margin-bottom: 14px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { min-height: 58px; padding: 15px 17px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.card-header .header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 15px 17px; }
.card-empty { padding: 48px 22px; text-align: center; color: var(--muted); }
.link-button { border: 0; background: transparent; color: var(--primary); font-weight: 750; font-size: 11px; }

.credit-list { display: grid; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.credit-row { min-height: 54px; display: grid; grid-template-columns: 31px minmax(0,1fr) auto auto; gap: 9px; align-items: center; padding: 8px 10px; background: var(--surface-2); }
.credit-row + .credit-row { border-top: 1px solid var(--line); }
.credit-name { font-weight: 760; font-size: 12px; }
.credit-status { border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 800; }
.credit-amount { min-width: 98px; text-align: right; font-weight: 820; font-size: 12px; }

.donut-layout { min-height: 234px; display: grid; grid-template-columns: minmax(190px,.9fr) minmax(190px,1.1fr); align-items: center; gap: 10px; }
.donut-wrap { height: 214px; position: relative; }
.donut-canvas { width: 100%; height: 100%; }
.donut-legend { display: grid; gap: 10px; }
.donut-legend-row { display: grid; grid-template-columns: 10px minmax(0,1fr) 42px auto; gap: 8px; align-items: center; font-size: 11px; }
.donut-legend-row strong { font-size: 11px; }
.donut-dot { width: 8px; height: 8px; border-radius: 99px; }
.donut-percent { color: var(--muted); text-align: right; }
.donut-amount { min-width: 78px; text-align: right; font-weight: 760; }

.overview-bills-card, .overview-detail-card { min-height: 620px; }
.overview-bills-card .card-body { padding-top: 10px; }
.overview-filter-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.overview-bill-list { display: grid; gap: 8px; }
.overview-bill-row { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 13px; padding: 9px 10px; display: grid; grid-template-columns: 56px minmax(0,1fr) auto; gap: 10px; align-items: center; text-align: left; transition: .18s ease; }
.overview-bill-row:hover { border-color: #cbd6ff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.overview-bill-row.active { border-color: #b8c8ff; background: linear-gradient(100deg, #f4f7ff, var(--surface)); box-shadow: 0 0 0 2px rgba(79,111,247,.06); }
.mini-date-tile { min-height: 55px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; text-align: center; padding: 5px; }
.mini-date-tile strong { display: block; font-size: 16px; line-height: 1; }
.mini-date-tile span { display: block; color: var(--muted); font-size: 9px; line-height: 1.2; margin-top: 4px; }
.overview-bill-main { min-width: 0; }
.overview-bill-main strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overview-bill-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overview-bill-side { text-align: right; }
.overview-bill-side strong { display: block; margin-top: 5px; font-size: 11px; }

.overview-detail-card { overflow: hidden; }
.detail-panel-head { min-height: 76px; padding: 15px 17px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.detail-panel-head h2 { margin: 0; font-size: 18px; }
.detail-panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.detail-panel-head .panel-total { margin-left: auto; text-align: right; }
.detail-panel-head .panel-total strong { display: block; margin-top: 5px; font-size: 16px; }
.detail-close { margin-left: 4px; }
.detail-tabs { display: flex; gap: 7px; padding: 10px 17px 0; }
.detail-tab { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 9px; padding: 7px 11px; font-size: 10px; font-weight: 760; }
.detail-tab.active { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.detail-participants { padding: 10px 17px 2px; }
.detail-participants label { color: var(--muted); font-size: 9px; display: block; margin-bottom: 7px; }
.avatar-stack { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-expenses { padding: 10px 15px 15px; display: grid; gap: 10px; max-height: 490px; overflow: auto; }
.overview-expense { border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); padding: 12px; }
.overview-expense-head { display: flex; gap: 8px; align-items: start; }
.overview-expense-head h3 { margin: 0; font-size: 12px; }
.overview-expense-head strong { margin-left: auto; font-size: 12px; }
.overview-expense-tags { display: flex; gap: 5px; flex-wrap: wrap; margin: 7px 0 9px; }
.overview-expense-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(130px,.85fr); gap: 10px; }
.overview-expense-section label { color: var(--muted); display: block; font-size: 9px; margin-bottom: 5px; }
.compact-row { min-height: 29px; display: flex; align-items: center; gap: 7px; font-size: 10px; }
.compact-row + .compact-row { border-top: 1px dashed var(--line); }
.compact-row .compact-amount { margin-left: auto; font-weight: 760; }
.settlement-lines { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 7px; }
.settlement-line { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; min-height: 27px; font-size: 9px; }
.settlement-line .paid-date { color: var(--green); white-space: nowrap; }

.chart-wrap { height: 280px; position: relative; }
.chart-canvas { width: 100%; height: 100%; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; border-radius: 99px; margin-right: 5px; }

.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.segmented button { border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 8px 11px; font-size: 11px; }
.segmented button.active { color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.filter-count { margin-left: auto; color: var(--muted); font-size: 11px; }

.bill-list { display: grid; gap: 10px; }
.bill-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; box-shadow: var(--shadow-sm); }
.bill-summary { width: 100%; min-height: 82px; border: 0; background: transparent; color: var(--text); padding: 12px 15px; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 23px; gap: 12px; align-items: center; text-align: left; }
.date-tile { border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 7px; text-align: center; }
.date-tile strong { font-size: 18px; display: block; }
.date-tile span { color: var(--muted); font-size: 10px; line-height: 1.25; }
.bill-title { font-size: 14px; font-weight: 820; }
.bill-meta { color: var(--muted); margin-top: 5px; font-size: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bill-total { text-align: right; }
.bill-total strong { display: block; font-size: 15px; }
.bill-total span { color: var(--muted); font-size: 9px; }
.bill-chevron { color: var(--muted); transition: transform .2s ease; }
.bill-card.open .bill-chevron { transform: rotate(180deg); }
.bill-details { display: none; border-top: 1px solid var(--line); padding: 14px; background: var(--surface-2); }
.bill-card.open .bill-details { display: grid; gap: 10px; }
.expense-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 13px; }
.expense-head { display: flex; gap: 10px; align-items: flex-start; }
.expense-head h4 { margin: 0; font-size: 13px; }
.expense-amount { margin-left: auto; font-size: 14px; font-weight: 850; }
.expense-note { margin-top: 4px; color: var(--muted); font-size: 10px; }
.detail-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.detail-box { background: var(--surface-2); border-radius: 11px; padding: 10px; }
.detail-box label { color: var(--muted); display: block; font-size: 9px; margin-bottom: 6px; }
.person-row, .payment-row { display: flex; gap: 7px; align-items: center; padding: 5px 0; font-size: 10px; }
.person-row + .person-row, .payment-row + .payment-row { border-top: 1px dashed var(--line); }
.person-row span:last-child, .payment-row .row-amount { margin-left: auto; font-weight: 750; }
.avatar { width: 27px; height: 27px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 9px; font-weight: 850; flex: none; }
.avatar.large { width: 43px; height: 43px; font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.person-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 8px; font-size: 9px; }
.status-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 780; white-space: nowrap; }
.status-paid { color: var(--green); background: var(--green-soft); }
.status-pending { color: var(--orange); background: var(--orange-soft); }
.status-partial { color: var(--primary); background: var(--primary-soft); }
.status-deleted { color: var(--red); background: var(--red-soft); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 10px; font-weight: 680; padding: 10px 11px; border-bottom: 1px solid var(--line); }
td { padding: 11px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 11px; }
tr:last-child td { border-bottom: 0; }
.amount-positive { color: var(--green); font-weight: 820; }
.amount-negative { color: var(--red); font-weight: 820; }
.amount-neutral { color: var(--muted); font-weight: 700; }

.balance-list { display: grid; gap: 8px; }
.balance-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; align-items: center; gap: 9px; }
.balance-main { min-width: 0; flex: 1; }
.balance-main strong { display: block; font-size: 11px; }
.balance-main span { color: var(--muted); font-size: 9px; }
.balance-amount { margin-left: auto; text-align: right; }
.progress-track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--purple)); }

.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 32px; height: 32px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 850; }
.activity-main strong { display: block; font-size: 11px; }
.activity-main p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.activity-time { color: var(--muted); font-size: 9px; white-space: nowrap; }

.member-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.member-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 14px; box-shadow: var(--shadow-sm); }
.member-head { display: flex; gap: 10px; align-items: center; }
.member-head h3 { margin: 0; font-size: 14px; }
.member-head p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.member-balance { margin: 12px 0 9px; font-size: 20px; font-weight: 850; }
.member-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; }
.mini-stat { background: var(--surface-2); border-radius: 10px; padding: 9px; }
.mini-stat span { display: block; color: var(--muted); font-size: 9px; }
.mini-stat strong { display: block; margin-top: 3px; font-size: 11px; }

.stock-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.stock-card, .rotation-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 15px; box-shadow: var(--shadow-sm); }
.stock-card h3, .rotation-card h3 { margin: 0; }
.stock-meta { color: var(--muted); font-size: 10px; margin-top: 4px; }
.stock-numbers { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-top: 12px; }
.stock-number { padding: 9px; border-radius: 10px; background: var(--surface-2); }
.stock-number span { display: block; color: var(--muted); font-size: 9px; }
.stock-number strong { display: block; margin-top: 3px; }
.counter-list { display: grid; gap: 7px; margin-top: 11px; }
.counter-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.counter-value { margin-left: auto; font-size: 15px; font-weight: 850; }

.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.info-list { display: grid; }
.info-row { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.drop-zone { padding: 27px 18px; border: 2px dashed var(--line); border-radius: 14px; background: var(--surface-2); text-align: center; }
.drop-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.action-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 13px; }
.notice { border-radius: 12px; padding: 11px 13px; color: var(--muted); background: var(--surface-2); font-size: 10px; line-height: 1.6; }

.toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 9px; }
.toast { width: min(350px, calc(100vw - 36px)); background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; gap: 9px; align-items: flex-start; animation: toastIn .25s ease; }
.toast strong { display: block; }
.toast p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

.sidebar-overlay { display: none; }
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar { flex-wrap: wrap; }
  .page-heading { flex: 1; }
  .top-actions { width: 100%; margin: 0; }
  .search-box { flex: 1; width: auto; }
  .member-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-lower { grid-template-columns: 1fr; }
  .overview-bills-card, .overview-detail-card { min-height: auto; }
}
@media (max-width: 930px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(8,13,25,.42); z-index: 25; }
  .main-area { width: 100%; margin-left: 0; }
  .menu-button, .mobile-only { display: grid; place-items: center; }
  .brand .mobile-only { margin-left: auto; }
  .version-pill { margin-left: auto; }
  .dashboard-upper, .grid-2, .grid-equal, .data-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stock-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { padding: 12px 13px; gap: 9px; }
  .content { padding: 5px 12px 30px; }
  .page-heading { min-width: 0; }
  .page-heading h1 { font-size: 19px; }
  .page-heading p { display: none; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
  .primary-btn { grid-column: 1 / -1; }
  .select-shell { width: 100%; }
  .select-control { max-width: none; width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 112px; padding: 13px; grid-template-columns: 38px 1fr; column-gap: 8px; }
  .metric-icon { width: 36px; height: 36px; }
  .metric-value { font-size: 19px; }
  .donut-layout { grid-template-columns: 1fr; }
  .donut-wrap { height: 190px; }
  .overview-expense-grid { grid-template-columns: 1fr; }
  .bill-summary { grid-template-columns: 54px minmax(0,1fr) 20px; gap: 9px; }
  .bill-total { grid-column: 2; text-align: left; }
  .bill-chevron { grid-column: 3; grid-row: 1 / span 2; }
  .member-grid { grid-template-columns: 1fr; }
  .filter-count { width: 100%; margin-left: 0; }
  .stock-numbers { grid-template-columns: 1fr; }
  .credit-row { grid-template-columns: 28px minmax(0,1fr) auto; }
  .credit-status { display: none; }
  .credit-amount { min-width: 80px; }
}
