:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --panel: #FFFFFF;
  --border: #E2E8F0;
  --line: #E2E8F0;
  --text: #0F172A;
  --ink: #0F172A;
  --muted: #64748B;
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-soft: #EEF2FF;
  --success: #059669;
  --success-soft: #ECFDF5;
  --warning: #D97706;
  --warning-soft: #FFFBEB;
  --danger: #E11D48;
  --danger-soft: #FFF1F2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 20px 45px rgba(15, 23, 42, 0.10);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.fab-open { overflow: hidden; }

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

button, input, select, textarea { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--text);
  padding: 20px;
  border-right: 1px solid rgba(226, 232, 240, 0.8);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 24px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #E0E7FF;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  color: #475569;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-weight: 700;
  font-size: 12px;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sidebar a.active,
.sidebar a:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.18), 0 8px 18px rgba(79, 70, 229, 0.10);
}

.store-logo-thumb,
.store-logo-preview img {
  display: inline-block;
  border: 1px solid #E2E8F0;
  background: #fff;
  object-fit: cover;
}

.store-logo-empty {
  display: inline-grid;
  place-items: center;
  border: 1px solid #E2E8F0;
  background: #fff;
}

.store-logo-thumb,
.store-logo-empty {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #64748B;
}

.store-logo-preview {
  display: flex;
  align-items: center;
  min-height: 72px;
}

.store-logo-preview img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
}

.nav-icon {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  color: currentColor;
  opacity: 0.86;
}

.main {
  min-width: 0;
  padding-bottom: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
  min-height: 64px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar-actions,
.topbar form {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.topbar-actions {
  min-width: 0;
  margin-left: auto;
}

.store-switcher {
  min-width: 0;
}

.store-switcher label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748B;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.store-switcher select {
  width: auto;
  min-width: 180px;
  min-height: 38px;
  background: #F8FAFC;
  color: #0F172A;
  font-size: 12px;
  text-transform: none;
}

.topbar-spacer { flex: 1; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: #EEF2FF;
  border-radius: var(--radius);
  padding: 8px 12px;
  color: #312E81;
  font-weight: 700;
  font-size: 12px;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  cursor: pointer;
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-chevron {
  color: #6366F1;
  font-size: 10px;
  transition: transform 0.15s ease;
}

.user-menu[open] .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 4px;
  width: 190px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.user-menu-panel a,
.user-menu-panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: #334155;
  padding: 9px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: #EEF2FF;
  color: #312E81;
}

.user-menu-panel i {
  width: 16px;
  color: currentColor;
  text-align: center;
}

.user-menu-panel form {
  display: block;
  margin: 0;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.content {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 32px;
  display: grid;
  gap: 24px;
}

.card,
.panel,
.form-card,
.kpi-card,
.login-card,
.metric-grid article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel,
.card,
.form-card {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-title {
  display: grid;
  gap: 2px;
}

h2, h3 {
  margin: 0 0 12px;
  letter-spacing: 0;
  line-height: 1.25;
}

h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; color: var(--muted); }

.muted { color: var(--muted); }
.desktop-only { display: block; }
.mobile-only { display: none; }

.metric-grid,
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.metric-grid article,
.kpi-card {
  padding: 16px;
  min-height: 106px;
  display: grid;
  gap: 8px;
}

.metric-grid span,
.kpi-card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.metric-grid strong,
.kpi-card strong {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.kpi-card .trend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.amount-positive { color: var(--success); }
.amount-negative { color: var(--danger); }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: #64748B;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: #334155;
  font-size: 12px;
}

tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-menu { position: relative; }
.import-menu summary { list-style: none; cursor: pointer; }
.import-menu summary::-webkit-details-marker { display: none; }
.import-menu-items {
  position: absolute;
  z-index: 30;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.import-menu-items a { display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: 7px; color: #334155; }
.import-menu-items a:hover { background: #f1f5f9; color: var(--primary); }

.import-options { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(360px, 1.4fr); gap: 16px; }
.import-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #334155;
}
.import-option > i { font-size: 25px; color: var(--primary); }
.import-option span { display: grid; flex: 1; gap: 5px; }
.import-option small { color: var(--muted); }
.import-upload { flex-wrap: wrap; }
.import-upload input { width: 100%; margin-top: 7px; }
.import-preview { margin-top: 18px; }
.import-blocked-message { margin-bottom: 14px; padding: 12px 14px; border-radius: 9px; background: #fff1f2; color: #b42318; font-weight: 700; }
.import-error-text, .import-status-icon.error { color: #dc2626; }
.import-warning-text, .import-status-icon.warning { color: #d97706; }
.import-status-icon.valid { color: #16a34a; }
.import-status-cell { white-space: nowrap; }
.import-status-icon { display: inline-block; margin-right: 5px; font-size: 17px; cursor: help; }
.import-row-error td { background: #fff7f7; }
.import-row-warning td { background: #fffbeb; }
.import-table { min-width: 1100px; }
.import-note { min-width: 180px; max-width: 320px; white-space: normal; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

@media (max-width: 760px) {
  .panel-actions { width: 100%; justify-content: flex-end; }
  .import-options { grid-template-columns: 1fr; }
  .import-upload .btn { width: 100%; }
}

.expense-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  white-space: nowrap;
}

.note-popover {
  position: relative;
  display: inline-flex;
}

.note-popover-trigger {
  display: inline-grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: #64748b;
  cursor: pointer;
}

.note-popover-trigger:hover,
.note-popover-trigger:focus-visible,
.note-popover.is-open .note-popover-trigger {
  border-color: var(--primary);
  color: var(--primary);
}

.note-popover-content {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: calc(100% + 8px);
  display: none;
  width: max-content;
  min-width: 180px;
  max-width: min(320px, 70vw);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: #334155;
  white-space: normal;
  overflow-wrap: anywhere;
}

.note-popover-content strong,
.note-popover-content span {
  display: block;
}

.note-popover-content strong {
  margin-bottom: 4px;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
}

.note-popover:hover .note-popover-content,
.note-popover:focus-within .note-popover-content,
.note-popover.is-open .note-popover-content {
  display: block;
}

.filters,
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.list-filters {
  margin: 0 0 18px;
}

.filter-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -4px 0 18px;
  padding: 12px 16px;
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.filter-total span {
  color: #64748B;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.filter-total strong {
  font-size: 18px;
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.mobile-filter-toggle,
.filter-drawer-head,
.filter-backdrop {
  display: none;
}

.dashboard-page {
  display: grid;
  gap: 28px;
}

.dashboard-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.dashboard-title-row h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
}

.dashboard-tools {
  display: flex;
  align-items: center;
  gap: 28px;
}

.dashboard-tools .btn {
  min-width: 148px;
  font-size: 12px;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  min-height: 50px;
  border: 1px solid #AEBBE1;
  border-radius: 999px;
  color: var(--primary);
  font-size: 28px;
  font-weight: 800;
}

.wave-filters {
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  box-shadow: none;
  background: #FBFDFF;
}

.report-panel h2 {
  margin: 0 0 18px;
  font-size: 27px;
  line-height: 1.2;
  color: #1B2533;
}

.dashboard-reports {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.report-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.report-head p {
  margin: 0;
  color: #1B2533;
  font-size: 17px;
}

.report-head > a {
  white-space: nowrap;
  font-size: 17px;
}

.legend-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  color: #263141;
  font-weight: 800;
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.legend-row strong {
  margin-left: auto;
  color: #1B2533;
}

.legend-dot {
  width: 14px;
  height: 14px;
  background: #90A5B5;
}

.legend-dot.income { background: var(--success); }
.legend-line {
  width: 22px;
  height: 2px;
  background: #1F2937;
  position: relative;
}

.legend-line::before,
.legend-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 8px;
  height: 8px;
  border: 2px solid #1F2937;
  border-radius: 999px;
  background: #fff;
}

.legend-line::before { left: -2px; }
.legend-line::after { right: -2px; }

.chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(18px, 1fr));
  align-items: end;
  gap: clamp(6px, 1.2vw, 18px);
  min-height: 300px;
  padding: 18px 10px 28px 46px;
  border-bottom: 1px solid var(--line);
  background:
    repeating-linear-gradient(to top, transparent 0, transparent 56px, var(--line) 57px, transparent 58px);
}

.chart::before {
  content: "100%\A75%\A50%\A25%\A0";
  white-space: pre;
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 0;
  display: flex;
  align-items: stretch;
  color: #586578;
  font-size: 12px;
  line-height: 58px;
}

.chart-month {
  display: grid;
  align-items: end;
  gap: 8px;
  height: 100%;
  min-width: 0;
}

.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  height: 100%;
  min-height: 220px;
}

.bar {
  width: clamp(8px, 1.1vw, 16px);
  height: var(--h);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
}

.income-bar,
.profit-month.positive .profit-bar {
  background: var(--success);
}

.expense-bar,
.profit-month.negative .profit-bar {
  background: var(--danger);
}

.chart-month small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.profit-chart {
  align-items: stretch;
}

.profit-chart::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: calc(28px + 50%);
  left: 46px;
  border-top: 1px solid #94A3B8;
}

.profit-month {
  align-items: stretch;
}

.profit-axis {
  position: relative;
  display: grid;
  height: 100%;
  min-height: 220px;
}

.profit-axis .profit-bar {
  position: absolute;
  left: 50%;
  width: clamp(10px, 1.4vw, 18px);
  transform: translateX(-50%);
}

.profit-month.positive .profit-bar {
  bottom: 50%;
  border-radius: 4px 4px 0 0;
}

.profit-month.negative .profit-bar {
  top: 50%;
  border-radius: 0 0 4px 4px;
}

.dashboard-table-panel {
  margin-top: 6px;
}

.form,
.mobile-step-form {
  display: grid;
  gap: 14px;
  max-width: 780px;
}

.split .form { max-width: none; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field,
label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.field span,
label span {
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.7);
  color: var(--text);
  outline: none;
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.amount-input {
  min-height: 54px;
  font-size: 22px;
  font-weight: 800;
}

.quick-amounts,
.chip-grid,
.payment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-amount,
.select-chip {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.quick-amount:hover,
.select-chip:hover,
.select-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.category-chip-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.category-chip {
  min-height: 52px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.category-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

legend { font-weight: 700; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; min-height: auto; }

.btn,
.button {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: #334155;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn:hover,
.button:hover {
  background: #F8FAFC;
}

.btn-primary,
.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.18), 0 8px 18px rgba(79, 70, 229, 0.10);
}

.btn-primary:hover,
.button.primary:hover { background: var(--primary-dark); }

.btn-secondary,
.button.ghost {
  background: #fff;
  color: #334155;
}

.btn-danger,
.button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-block { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #F3F4F6;
  color: #374151;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: #B45309; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #F3F4F6; color: var(--muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.flash {
  margin: 16px 28px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 700;
}

.flash.success { background: var(--success-soft); color: var(--success); }
.flash.error { background: var(--danger-soft); color: var(--danger); }

.actions,
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input { min-width: 180px; }

.list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.category-group {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}

.category-group-head,
.category-admin-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-group-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.category-admin-list {
  display: grid;
  gap: 8px;
}

.category-child-create {
  margin-bottom: 14px;
}

.category-admin-form {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.category-admin-form input,
.category-admin-form select {
  min-width: 0;
}

.category-admin-form input[name="displayOrder"] {
  flex: 0 0 96px;
}

.settlement-transfer-actions {
  display: grid;
  gap: 8px;
  min-width: 240px;
}

.settlement-transfer-form {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.settlement-transfer-form input[name="amount"] {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
}

.settlement-transfer-form .btn {
  min-height: 36px;
  padding: 8px 10px;
}

.empty-state {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.app-dialog,
.reject-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-md);
}

.app-dialog {
  width: min(520px, calc(100vw - 32px));
}

.app-dialog .form {
  max-width: none;
}

.app-dialog input:disabled {
  background: #F8FAFC;
  color: var(--muted);
}

.app-dialog::backdrop,
.reject-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.mobile-card-list {
  display: none;
  gap: 12px;
}

.transaction-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.transaction-card:hover { box-shadow: var(--shadow-md); }

.transaction-card-head,
.transaction-card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.transaction-card .amount {
  font-size: 20px;
  font-weight: 700;
}

.note-preview {
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bottom-nav {
  display: none;
}

.mobile-fab {
  display: none;
}

.fab-menu {
  display: none;
}

.settlement-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #FFFFFF 0%, #EFF6FF 100%);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.settlement-hero strong {
  display: block;
  margin: 6px 0;
  font-size: 30px;
  line-height: 1.1;
}

.settings-page {
  display: grid;
  gap: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.settings-card {
  display: grid;
  gap: 10px;
  min-height: 170px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.settings-card:hover {
  border-color: #C7D2FE;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.settings-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
}

.settings-card strong {
  color: var(--text);
  font-size: 14px;
}

.settings-card p {
  margin: 0;
  font-size: 12px;
}

.manual-page {
  display: grid;
  gap: 20px;
}

.manual-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.manual-head h2 {
  margin: 6px 0;
  font-size: 28px;
}

.manual-head p:last-child {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.manual-card {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.manual-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.manual-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 17px;
}

.manual-card-head small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.manual-card-head h3 {
  margin: 2px 0 0;
  font-size: 15px;
}

.manual-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  color: #334155;
}

.manual-steps li::marker {
  color: var(--primary);
  font-weight: 800;
}

.manual-tips ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.manual-tips li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #334155;
}

.manual-tips li i {
  margin-top: 3px;
  color: var(--success);
}

.profile-page {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-summary strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.profile-summary p {
  margin: 4px 0 0;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  font-size: 16px;
}

.profile-password-form {
  max-width: none;
}

.direction-banner {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(79, 70, 229, 0.07), rgba(79, 70, 229, 0) 260px),
    var(--bg);
  position: relative;
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.10) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.login-card {
  width: 100%;
  padding: 28px;
  display: grid;
  gap: 16px;
  align-content: center;
}

.login-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.login-avatar {
  background: var(--primary-soft);
  color: var(--primary);
}

.login-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
}

.login-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.login-card .flash { margin: 0; }

.login-card label {
  color: var(--text);
  font-size: 12px;
}

.login-card input {
  min-height: 46px;
  background: #F8FAFC;
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10);
}

.login-card .login-remember {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.login-card .login-remember input {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.login-card .login-remember input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: none;
}

.login-card .btn-primary {
  min-height: 46px;
  margin-top: 4px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.btn-google {
  min-height: 46px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-google:hover {
  border-color: #CBD5E1;
  background: #F8FAFC;
}

.btn-google i {
  color: #EA4335;
}

.login-domain {
  text-align: center;
}

.store-select-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: var(--bg);
}

.store-select-shell {
  width: min(900px, 100%);
  display: grid;
  gap: 20px;
}

.store-select-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.store-select-head h1 {
  margin: 0;
  color: var(--text);
  font-size: 32px;
  line-height: 1.1;
}

.store-select-head p {
  margin: 4px 0 0;
}

.store-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.store-select-card button {
  width: 100%;
  min-height: 180px;
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.store-select-card button:hover {
  border-color: #C7D2FE;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.store-select-card strong {
  font-size: 16px;
}

.store-select-card small {
  color: var(--muted);
  font-size: 12px;
}

.store-select-card em {
  align-self: end;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 9px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .metric-grid,
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .content {
    padding-inline: 28px;
  }

  .dashboard-reports {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .wave-filters {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 768px) {
  body { padding-bottom: 88px; }
  body.login-page,
  body.store-select-page { padding-bottom: 0; }

  .login-page {
    align-items: flex-start;
    padding: 18px;
  }

  .login-shell {
    width: 100%;
  }

  .login-card {
    padding: 20px;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .desktop-only { display: none !important; }
  .mobile-only { display: block; }

  .sidebar { display: none; }

  .topbar {
    position: sticky;
    gap: 8px;
    padding: 12px 16px;
    align-items: center;
  }

  .topbar h1 { font-size: 20px; }
  .topbar-spacer { display: none; }
  .topbar-actions {
    width: 100%;
    gap: 8px;
    justify-content: flex-end;
  }
  .store-switcher { flex: 1 1 auto; }
  .store-switcher label { width: 100%; }
  .store-switcher label > span { display: none; }
  .store-switcher select {
    width: 100%;
    min-width: 0;
    max-width: 260px;
    margin-left: auto;
  }
  .user-menu { flex: 0 0 auto; }
  .user-menu-name { display: none; }
  .user-chip { padding: 7px 9px; }
  .topbar .button { min-height: 38px; padding: 8px 10px; }

  .content {
    padding: 16px;
    gap: 16px;
  }

  .flash { margin: 12px 16px 0; }

  .mobile-filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    width: fit-content;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-weight: 800;
    box-shadow: var(--shadow-sm);
  }

  .mobile-filter-toggle i {
    color: var(--primary);
  }

  .mobile-filter-toggle strong {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
  }

  .filter-drawer {
    display: none;
  }

  .filter-drawer.filter-open {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 14px;
    width: min(390px, 92vw);
    max-height: 100vh;
    margin: 0;
    padding: 18px;
    overflow-y: auto;
    border: 0;
    border-left: 1px solid var(--border);
    border-radius: 16px 0 0 16px;
    box-shadow: -24px 0 60px rgba(15, 23, 42, 0.18);
  }

  .filter-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 4px;
  }

  .filter-drawer-head strong {
    color: var(--text);
    font-size: 18px;
  }

  .filter-drawer-head button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
  }

  .filter-drawer .field,
  .filter-drawer input,
  .filter-drawer select,
  .filter-drawer .btn,
  .filter-drawer .button,
  .filter-actions {
    width: 100%;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2px);
  }

  body.filter-drawer-open {
    overflow: hidden;
  }

  body.filter-drawer-open .filter-backdrop {
    display: block;
  }

  .metric-grid,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-grid article,
  .kpi-card {
    min-height: 92px;
    padding: 14px;
  }

  .metric-grid strong,
  .kpi-card strong { font-size: 19px; }

  .panel,
  .card,
  .form-card { padding: 14px; }

  .dashboard-page {
    gap: 18px;
  }

  .dashboard-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-title-row h1 {
    font-size: 30px;
  }

  .dashboard-tools {
    width: 100%;
    gap: 12px;
  }

  .dashboard-tools .btn {
    min-width: 0;
    flex: 1;
  }

  .icon-pill {
    min-width: 62px;
    min-height: 44px;
    font-size: 22px;
  }

  .report-panel h2 {
    font-size: 21px;
  }

  .report-head p,
  .report-head > a {
    font-size: 15px;
  }

  .report-head {
    flex-direction: column;
  }

  .report-head > a {
    margin-top: 0;
  }

  .legend-row {
    gap: 12px;
    font-size: 12px;
  }

  .legend-row strong {
    margin-left: 0;
  }

  .chart,
  .cash-chart {
    min-height: 260px;
    gap: 10px;
    padding-left: 44px;
  }

  .chart::before {
    line-height: 52px;
  }

  .cash-chart::before {
    line-height: 44px;
  }

  .chart-bars,
  .profit-axis {
    min-height: 180px;
  }

  .profit-chart::after {
    left: 44px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .form,
  .mobile-step-form { max-width: none; }

  .amount-input {
    min-height: 64px;
    font-size: 28px;
  }

  .category-chip-list {
    grid-template-columns: 1fr;
  }

  .table-wrap,
  table.desktop-table {
    display: none;
  }

  .mobile-card-list {
    display: grid;
  }

  .actions,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form input { min-width: 0; }

  .category-group-head,
  .category-admin-row,
  .category-admin-form {
    align-items: stretch;
    flex-direction: column;
  }

  .category-admin-form input[name="displayOrder"] {
    flex-basis: auto;
  }

  .settlement-transfer-actions,
  .settlement-transfer-form {
    min-width: 0;
  }

  .settlement-transfer-form {
    grid-template-columns: 1fr;
  }

  .settlement-hero {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .settlement-hero strong { font-size: 28px; }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(16px);
  }

  .bottom-nav a,
  .bottom-nav button {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 52px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .bottom-nav a.active,
  .bottom-nav button.active {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .mobile-fab {
    position: fixed;
    right: 18px;
    bottom: 92px;
    z-index: 50;
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 30px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
  }

  .fab-menu {
    position: fixed;
    right: 18px;
    bottom: 156px;
    z-index: 49;
    display: none;
    min-width: 230px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
  }

  body.fab-open .fab-menu {
    display: grid;
    gap: 4px;
  }

  .fab-menu a {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 700;
  }

  .fab-menu a:hover {
    background: var(--primary-soft);
    color: var(--primary);
  }
}

@media (max-width: 420px) {
  .topbar { padding-inline: 12px; }

  .store-switcher select { max-width: none; }

  .filters,
  .metric-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .transaction-card-head {
    align-items: flex-start;
  }
}
