:root {
  --ink: #0c1222;
  --ink-soft: #1a2336;
  --slate: #334155;
  --muted: #64748b;
  --line: #d8dee8;
  --line-soft: #e8edf4;
  --surface: #f4f6f9;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: rgba(15, 118, 110, 0.10);
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #047857;
  --sidebar: #0b1220;
  --sidebar-edge: #151f33;
  --sidebar-top: #10192c;
  --sidebar-bottom: #070b14;
  --sidebar-fg: #e8eef8;
  --sidebar-muted: #8b9bb5;
  --sidebar-link: #c5d0e2;
  --sidebar-section: #6b7c96;
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-glow: rgba(15, 118, 110, 0.22);
  --brand-mark: #5eead4;
  --nav-active-bg: linear-gradient(90deg, rgba(15, 118, 110, 0.35), rgba(15, 118, 110, 0.12));
  --nav-active-bar: #2dd4bf;
  --table-hover: #f1f5f9;
  --panel-hover-border: #cfd8e6;
  --input-border: #d0d7e2;
  --ghost-bg: #fff;
  --ghost-border: #d0d7e2;
  --ghost-hover: #f8fafc;
  --page-bg: linear-gradient(180deg, #eef2f7 0%, #f4f6f9 42%, #e9eef5 100%);
  --gold: #c9a227;
  --money-out: #b45309;
  --skeleton-a: #e8edf3;
  --skeleton-b: #f4f7fb;
  --chip-checked: #f0fdfa;
  --shadow: 0 1px 2px rgba(12, 18, 34, 0.04), 0 8px 24px rgba(12, 18, 34, 0.06);
  --shadow-lg: 0 4px 6px rgba(12, 18, 34, 0.04), 0 16px 36px rgba(12, 18, 34, 0.08);
  --radius: 12px;
  --radius-control: 12px;
  --control-bg: #f8fafc;
  --control-bg-hover: #fff;
  --focus-ring: 0 0 0 4px rgba(15, 118, 110, 0.28);
  --hover-ring: 0 0 0 3px rgba(15, 118, 110, 0.14);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--page-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ===== App shell ===== */
.app-shell {
  display: block;
  min-height: 100vh;
  padding-left: 260px;
}
.sidebar {
  background:
    radial-gradient(700px 280px at 0% 0%, var(--sidebar-glow), transparent 55%),
    linear-gradient(185deg, var(--sidebar-top) 0%, var(--sidebar) 55%, var(--sidebar-bottom) 100%);
  color: var(--sidebar-fg);
  padding: 1.35rem 1rem 1.1rem;
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  overflow: hidden;
  z-index: 40;
}
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.22) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.15rem 0.35rem 1.35rem;
}
.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  flex-shrink: 0;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.1;
}
.brand span { color: var(--brand-mark); font-style: italic; }
.brand-sub {
  color: var(--sidebar-muted);
  font-size: 0.58rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.28rem 0 0;
  line-height: 1.35;
}
.nav-section {
  color: var(--sidebar-section);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.85rem 0.55rem 0.35rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--sidebar-link);
  padding: 0.62rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.15rem;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav-link svg { width: 16px; height: 16px; opacity: 0.75; flex-shrink: 0; }
.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-decoration: none;
}
.nav-link.active {
  background: var(--nav-active-bg);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--nav-active-bar);
  text-decoration: none;
  transform: translateX(2px);
}
.nav-link.active svg { opacity: 1; }
.sidebar-foot {
  flex: 0 0 auto;
  margin-top: 0.75rem;
  padding: 0.85rem 0.55rem 0.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: transparent;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.35rem;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, #0f766e, #134e4a);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #ecfdf5;
}
.user-meta { min-width: 0; }
.user-name { font-size: 0.86rem; font-weight: 600; color: var(--sidebar-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--sidebar-muted); }
.btn-logout {
  margin-top: 0.45rem;
  width: 100%;
  background: transparent;
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-link);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}
.btn-logout:hover { background: rgba(255,255,255,0.06); color: #fff; }

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 1.35rem 1.75rem 0.95rem;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.topbar > div,
.topbar-text { min-width: 0; flex: 1; }
.nav-toggle {
  display: none;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  margin-top: 0.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ghost-bg);
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.nav-backdrop {
  display: none;
}
.topbar-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.15;
}
.page-sub {
  color: var(--muted);
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-style: italic;
  max-width: 54rem;
  line-height: 1.45;
}
.content {
  padding: 1.25rem 1.75rem 2.5rem;
  position: relative;
  z-index: 0;
}
.content-enter {
  animation: content-enter 0.32s var(--ease-out) both;
}
@keyframes content-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cards / panels ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem 0.8rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s var(--ease-out), border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
a.stat-card.drill {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.stat-card.drill:hover {
  border-color: var(--accent);
}
.period-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, rgba(15,118,110,.08), rgba(15,118,110,.02));
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.85;
}
.stat-card .label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.stat-card .value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-top: 0.28rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.stat-card .hint { color: var(--muted); font-size: 0.78rem; margin-top: 0.3rem; }

/* Money at hand & till — latest evening availability */
.money-available {
  margin: 0 0 1rem;
}
.money-available-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1.25rem 1.35rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid rgba(15, 118, 110, 0.22);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12) 0%, rgba(255, 255, 255, 0.95) 45%, #fff 100%);
  box-shadow: var(--shadow);
}
a.money-available-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}
.money-available-kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.money-available-label {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--slate);
}
.money-available-value {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.65rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
}
.money-available-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  margin-top: 0.85rem;
  color: var(--slate);
  font-size: 0.9rem;
}
.money-available-breakdown strong {
  color: var(--ink);
  font-weight: 700;
}
.money-available-hint {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ===== Loading skeletons ===== */
@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--skeleton-a) 0%, var(--skeleton-b) 45%, var(--skeleton-a) 90%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.15s ease-in-out infinite;
}
.skeleton-line { height: 0.75rem; margin: 0.55rem 0; }
.skeleton-line.lg { height: 1.35rem; }
.skeleton-line.sm { height: 0.55rem; width: 55%; }
.skeleton-chart {
  height: 180px;
  width: 100%;
  border-radius: 10px;
  margin-top: 0.5rem;
}
.skeleton-stat .skeleton-line.lg { margin-top: 0.65rem; width: 70%; }
.skeleton-stat .skeleton-line.sm { width: 40%; }
.panel-loading-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 0.65rem;
  font-weight: 500;
}
.panel-loading-label .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  animation: busy-spin 0.9s linear infinite;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  transition: box-shadow 0.25s var(--ease-out), border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.panel:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--panel-hover-border);
}
.panel h2, .panel h3 {
  font-family: var(--font-body);
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.panel {
  overflow: visible;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-inline: -0.15rem;
  padding-inline: 0.15rem;
  padding-block: 0.15rem;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.table th, .table td {
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
  transition: background 0.18s var(--ease-out);
}
.table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.table tbody tr {
  transition: transform 0.18s var(--ease-out);
}
.table tr:hover td { background: var(--table-hover); }
.amount { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; color: var(--ink); }
.badge {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform 0.18s var(--ease-spring), background 0.18s ease;
}
.badge:hover { transform: translateY(-1px); }
.badge.warn { background: #fff7ed; color: var(--warn); }
.badge.info { background: #eff6ff; color: #1d4ed8; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 1.15rem;
  max-width: 760px;
  isolation: isolate;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--slate);
  letter-spacing: 0.01em;
  position: relative;
  z-index: 0;
  transition: z-index 0s;
}
.form-grid label:hover,
.form-grid label:focus-within {
  z-index: 6;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  font-weight: 500;
  color: var(--ink);
}
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.35rem;
}
.rights-span { grid-column: 1 / -1; }
.rights-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
}
.right-chip {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--control-bg);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.right-chip:hover {
  border-color: var(--accent);
  background: var(--control-bg-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.right-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--chip-checked);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.right-chip input { margin-top: 0.2rem; accent-color: var(--accent); }
.right-chip strong { display: block; color: var(--ink); font-size: 0.9rem; }
.right-chip small { display: block; color: var(--muted); font-weight: 500; margin-top: 0.15rem; line-height: 1.35; }
.rights-cell .badge { margin: 0.1rem 0.15rem 0.1rem 0; text-transform: capitalize; }
.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

/* ===== Modern controls ===== */
.filters input,
.filters select,
.btn,
.form-control,
input:not([type]),
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="month"],
select,
textarea {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-control);
  padding: 0.7rem 0.9rem;
  background: var(--control-bg);
  background-image: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition:
    border-color 0.2s var(--ease-out),
    background 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}
select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--slate) 50%),
    linear-gradient(135deg, var(--slate) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.1rem;
  cursor: pointer;
}
textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.5;
}
input[type="file"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1.5px dashed #b8c4d4;
  border-radius: var(--radius-control);
  background: var(--control-bg);
  font: inherit;
  font-size: 0.9rem;
  color: var(--slate);
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
input[type="file"]:hover {
  border-color: var(--accent);
  background: #f0fdfa;
}
input[type="file"]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
input[type="checkbox"],
input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  transform: scale(1);
  transition: transform 0.15s var(--ease-spring);
}
input[type="checkbox"]:active,
input[type="radio"]:active {
  transform: scale(0.9);
}

.filters input:hover,
.filters select:hover,
.form-control:hover,
input:not([type]):hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
input[type="time"]:hover,
input[type="email"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="month"]:hover,
select:hover,
textarea:hover {
  border-color: #5eead4;
  background: #fff;
  box-shadow: var(--hover-ring), 0 2px 8px rgba(15, 118, 110, 0.08);
  position: relative;
  z-index: 2;
}

.filters input:focus,
.filters select:focus,
.form-control:focus,
input:not([type]):focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="month"]:focus,
select:focus,
textarea:focus,
.filters input:focus-visible,
.filters select:focus-visible,
.form-control:focus-visible,
input:not([type]):focus-visible,
input[type="text"]:focus-visible,
input[type="password"]:focus-visible,
input[type="number"]:focus-visible,
input[type="date"]:focus-visible,
input[type="time"]:focus-visible,
input[type="email"]:focus-visible,
input[type="search"]:focus-visible,
input[type="tel"]:focus-visible,
input[type="url"]:focus-visible,
input[type="month"]:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: var(--focus-ring), 0 4px 14px rgba(15, 118, 110, 0.12);
  position: relative;
  z-index: 3;
}

.form-grid label:focus-within,
.login-field:focus-within,
.filters > *:focus-within,
.login-field:hover {
  position: relative;
  z-index: 6;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), 0 6px 16px rgba(15, 118, 110, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
  font-weight: 450;
  opacity: 1;
  transition: opacity 0.2s ease, color 0.2s ease;
}
input:focus::placeholder,
textarea:focus::placeholder {
  opacity: 0.55;
  color: #64748b;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: #eef2f7;
  transform: none;
  box-shadow: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: auto;
  min-height: 2.55rem;
  padding: 0.65rem 1.15rem;
  background: linear-gradient(180deg, #14968c 0%, var(--accent) 100%);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 650;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.25), 0 6px 16px rgba(15, 118, 110, 0.18);
  transition:
    background 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    transform 0.18s var(--ease-spring),
    filter 0.2s ease;
}
.btn:hover {
  background: linear-gradient(180deg, #14b8a6 0%, var(--accent-hover) 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 118, 110, 0.28), 0 10px 22px rgba(15, 118, 110, 0.22);
  filter: brightness(1.02);
}
.btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2);
  filter: brightness(0.98);
}
.btn.secondary {
  background: linear-gradient(180deg, #243047 0%, var(--ink-soft) 100%);
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.2), 0 6px 14px rgba(12, 18, 34, 0.12);
}
.btn.secondary:hover {
  background: linear-gradient(180deg, #2f3f5c 0%, #1e293b 100%);
}
.btn.ghost {
  background: var(--ghost-bg);
  color: var(--ink);
  border: 1.5px solid var(--ghost-border);
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.04);
}
.btn.ghost:hover {
  background: var(--ghost-hover);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow);
  filter: none;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
  filter: grayscale(0.2);
}

/* Interactive chips / tabs */
.suggest-chip,
.granularity-tabs .gran-btn,
.cash-mode-btn {
  transition:
    background 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out),
    color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    transform 0.18s var(--ease-spring) !important;
}
.suggest-chip:hover,
.granularity-tabs .gran-btn:hover,
.cash-mode-btn:hover {
  transform: translateY(-1px);
}
.suggest-chip:active,
.granularity-tabs .gran-btn:active,
.cash-mode-btn:active {
  transform: translateY(1px) scale(0.98);
}

.nav-toggle {
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), transform 0.18s var(--ease-spring);
}
.nav-toggle:hover {
  border-color: var(--accent);
  background: #f0fdfa;
  box-shadow: var(--shadow);
}
.nav-toggle:active {
  transform: scale(0.96);
}

.pager button,
.pager .btn {
  transition: transform 0.18s var(--ease-spring), box-shadow 0.2s ease, background 0.2s ease;
}
.export-btn:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.insight {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line-soft));
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--ink);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.7rem;
}
.insight.warn {
  border-color: color-mix(in srgb, var(--warn) 35%, var(--line-soft));
  border-left-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, var(--panel));
}
.insight .title { font-weight: 700; margin-bottom: 0.25rem; color: var(--ink); }
.insight .meta { color: var(--muted); font-size: 0.82rem; margin-top: 0.35rem; }

.review-record { max-width: 28rem; line-height: 1.4; }
.review-record .review-desc {
  margin-top: 0.35rem;
  font-size: 0.84rem;
  color: var(--ink-soft);
  word-break: break-word;
}
.review-record code {
  font-size: 0.8rem;
  background: #f1f5f9;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

.muted { color: var(--muted); }
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 360px; }
.granularity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.granularity-tabs .gran-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  width: auto;
}
.granularity-tabs .gran-btn.active {
  background: var(--teal, #0f766e);
  color: #fff;
  border-color: transparent;
}
.sales-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(15,118,110,.08), rgba(15,118,110,.02));
  border: 1px solid rgba(15, 118, 110, 0.12);
}
.sales-toolbar-label {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}
.sales-toolbar-label .muted {
  font-size: 0.82rem;
}
.sales-growth-hint {
  margin: 0.45rem 0 0.55rem;
  font-size: 0.84rem;
  line-height: 1.35;
}
.sales-drill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.16);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink, #0f172a);
}
.sales-drill-bar[hidden] { display: none !important; }
.chart-wrap.chart-drillable {
  cursor: pointer;
}
.chart-wrap.chart-drillable canvas {
  cursor: pointer;
}
.sales-month-picker {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.sales-month-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
}
.sales-month-field select {
  min-width: 7.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink, #0f172a);
}
.compact-stats {
  gap: 0.55rem;
}
.compact-stats .stat-card {
  padding: 0.7rem 0.85rem;
}
.compact-stats .stat-card .value {
  font-size: 1.25rem;
}
.compact-panel {
  padding: 0.85rem 1rem;
}
.compact-panel h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}
.day-detail p {
  margin: 0.28rem 0;
  font-size: 0.9rem;
}
.sales-growth-panel .chart-wrap.tall {
  height: 300px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.section-head h2 {
  margin: 0;
}
.section-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.export-wrap {
  position: relative;
  display: inline-block;
}
.export-wrap .export-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% - 2px);
  z-index: 40;
  min-width: 10.5rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}
.export-wrap:hover .export-menu,
.export-wrap:focus-within .export-menu {
  display: grid;
  gap: 0.15rem;
}
.export-menu button {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  color: #0f172a;
  cursor: pointer;
}
.export-menu button:hover {
  background: #f1f5f9;
}
@media print {
  .sidebar, .topbar, .sa-fab, .sa-panel, .pager, .export-wrap, .granularity-tabs, .sales-toolbar {
    display: none !important;
  }
}
.alert {
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
}
.alert-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }

.import-progress { display: none !important; }
.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 18, 34, 0.42);
  backdrop-filter: blur(2px);
}
.busy-overlay[hidden] { display: none !important; }
.busy-card {
  min-width: 260px;
  max-width: min(400px, 90vw);
  padding: 1.5rem 1.6rem 1.35rem;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(12, 18, 34, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-align: center;
}
.busy-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #d8dee8;
  border-top-color: var(--accent);
  animation: busy-spin 0.75s linear infinite;
  flex-shrink: 0;
}
.busy-pct {
  font-family: var(--font-body);
  font-size: 1.55rem;
  font-weight: 700;
  color: #0c1222;
  letter-spacing: -0.02em;
  line-height: 1;
  min-height: 1.2em;
}
.busy-pct[hidden] { display: none !important; }
.busy-label {
  font-size: 1rem;
  font-weight: 650;
  color: #1a2336;
  line-height: 1.4;
  max-width: 18rem;
}
.busy-elapsed {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}
.busy-hint {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
  max-width: 18rem;
}
@keyframes busy-spin {
  to { transform: rotate(360deg); }
}
body.busy-open { overflow: hidden; }

.period-box {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: #f8fafc;
}
.period-title { font-weight: 700; margin-bottom: 0.35rem; }
.period-all { display: block; margin: 0.28rem 0; }
.period-controls { margin-top: 0.75rem; }
.period-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.period-row label, .period-controls > label { display: grid; gap: 0.3rem; font-size: 0.9rem; }
.period-row select, .period-controls select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  background: #fff;
  margin-right: 0.35rem;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.month-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  background: #fff;
  font-size: 0.88rem;
}

/* ===== Login (cinematic stage + right rail) ===== */
body.login-body {
  margin: 0;
  min-height: 100dvh;
  background: #071018;
  color: #fff;
}
.login-page {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  overflow: hidden;
}
.login-stage {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}
.login-bg {
  position: absolute;
  inset: -8%;
  background: url("/brand/login-bg-shop.jpg") center / cover no-repeat;
  transform-origin: 42% 48%;
  animation: login-kenburns 28s ease-in-out infinite alternate;
}
.login-stage-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 70% at 28% 42%, rgba(7, 16, 24, 0.12), transparent 55%),
    linear-gradient(90deg, rgba(7, 16, 24, 0.18) 0%, rgba(7, 16, 24, 0.28) 62%, rgba(7, 16, 24, 0.72) 100%),
    linear-gradient(180deg, rgba(8, 20, 28, 0.28) 0%, rgba(8, 20, 28, 0.12) 40%, rgba(8, 20, 28, 0.55) 100%);
  pointer-events: none;
}
.login-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 32%, rgba(246, 226, 122, 0.08) 48%, transparent 64%);
  background-size: 220% 100%;
  animation: login-sheen 9s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}
.login-orbs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  pointer-events: none;
  animation: login-orb 16s ease-in-out infinite;
}
.login-orbs span:nth-child(1) {
  width: 280px; height: 280px; left: 8%; top: 12%;
  background: rgba(246, 226, 122, 0.18);
}
.login-orbs span:nth-child(2) {
  width: 340px; height: 340px; right: 10%; bottom: 6%;
  background: rgba(45, 212, 191, 0.16);
  animation-duration: 22s;
  animation-delay: -4s;
}
.login-orbs span:nth-child(3) {
  width: 160px; height: 160px; left: 42%; top: 58%;
  background: rgba(15, 118, 110, 0.22);
  animation-duration: 14s;
  animation-delay: -8s;
}
.login-orbs span:nth-child(4) {
  width: 90px; height: 90px; left: 18%; bottom: 18%;
  background: rgba(246, 226, 122, 0.28);
  animation-duration: 11s;
  animation-delay: -2s;
}
.login-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.login-spark {
  position: absolute;
  left: -4%;
  right: 8%;
  bottom: 16%;
  height: 28%;
  width: 92%;
  z-index: 2;
  opacity: 0.85;
  pointer-events: none;
}
.login-spark path {
  stroke-dasharray: 280 920;
  animation: login-spark 7.5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(246, 226, 122, 0.45));
}
.login-stage-copy {
  position: absolute;
  z-index: 3;
  left: max(2.2rem, env(safe-area-inset-left));
  bottom: max(2.2rem, env(safe-area-inset-bottom));
  max-width: 28rem;
  color: #fff;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.login-kicker {
  margin: 0 0 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f6e27a;
}
.login-stage-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 3.15rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.login-clock {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.78);
}
.login-rail {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(2rem, env(safe-area-inset-top)) 2.15rem max(2rem, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(10, 18, 26, 0.82) 0%, rgba(8, 16, 24, 0.92) 100%);
  border-left: 1px solid rgba(246, 226, 122, 0.22);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  backdrop-filter: blur(28px) saturate(1.2);
}
.login-rail::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, #f6e27a 18%, #2dd4bf 82%, transparent);
  opacity: 0.85;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
}
.login-brand-block {
  text-align: left;
  margin-bottom: 2.1rem;
}
.login-brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 4vw, 3.1rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
}
.login-brand-sub {
  margin: 0.55rem 0 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: #2dd4bf;
}
.login-tagline {
  margin: 1.05rem 0 0;
  font-size: 0.82rem;
  font-weight: 400;
  font-style: italic;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.01em;
  line-height: 1.45;
}
.login-field {
  margin-bottom: 1.35rem;
}
.login-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 0.45rem;
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 0.55rem 0 0.7rem;
  border: 0;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  box-shadow: none;
  outline: none;
  transition: border-color 0.15s ease;
}
.login-card input[type="text"]::placeholder,
.login-card input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  border-bottom-color: #f6e27a;
  box-shadow: none;
  background: transparent;
}
.login-card .login-submit {
  width: 100%;
  margin-top: 0.95rem;
  padding: 0.95rem 1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #14958b 0%, #0f766e 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  box-shadow: 0 14px 32px rgba(15, 118, 110, 0.38);
}
.login-card .login-submit:hover {
  background: linear-gradient(180deg, #16a394 0%, #0d9488 100%);
}
.login-card .login-submit:disabled {
  opacity: 0.7;
}
.login-error {
  display: none;
  margin: 0 0 1rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.55);
  border: 1px solid rgba(252, 165, 165, 0.45);
  color: #fecaca;
  font-size: 0.9rem;
}
.login-error.show { display: block; }

.login-card input[type="text"]:-webkit-autofill,
.login-card input[type="password"]:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  transition: background-color 99999s ease-out;
  box-shadow: 0 0 0 1000px rgba(255,255,255,0.06) inset;
}

@keyframes login-kenburns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.14) translate3d(-2.4%, 1.6%, 0); }
}
@keyframes login-orb {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.7; }
  50% { transform: translate3d(18px, -22px, 0) scale(1.12); opacity: 1; }
}
@keyframes login-sheen {
  0% { background-position: 120% 0; }
  100% { background-position: -40% 0; }
}
@keyframes login-spark {
  0% { stroke-dashoffset: 0; opacity: 0.35; }
  45% { opacity: 1; }
  100% { stroke-dashoffset: -1200; opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .login-bg, .login-orbs span, .login-sheen, .login-spark path {
    animation: none !important;
  }
}


.upload-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 118, 110, 0.04);
  transition: border-color .15s ease, background .15s ease;
}
.upload-drop:hover, .upload-drop.drag, .upload-drop:focus-visible {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
  outline: none;
}
.upload-drop-inner strong { display: block; margin-bottom: 0.35rem; }
.upload-drop .btn { cursor: pointer; }

.cash-entry-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.cash-mode-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 48px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cash-mode-btn:hover {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.06);
}
.cash-mode-btn.active {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.25);
}
.cash-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.cash-photo {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  object-fit: contain;
  background: #fff;
}
.cash-sheet input.unclear {
  border-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, var(--panel));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent);
}

.cash-sheet .cash-date { max-width: 220px; display: block; margin-bottom: 1rem; }
.cash-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cash-block {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 1rem;
  background: rgba(15, 118, 110, 0.03);
}
.cash-block legend {
  font-weight: 650;
  padding: 0 0.35rem;
  color: var(--ink);
}
.cash-block label {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 140px);
  gap: 0.5rem;
  align-items: center;
  margin: 0.4rem 0;
  font-size: 0.9rem;
}
.cash-subtotal {
  display: flex;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line-soft);
  font-size: 0.92rem;
}
.cash-derived {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15,118,110,.1), rgba(15,118,110,.02));
  border: 1px solid var(--line-soft);
}
.cash-derived .label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.cash-derived .value {
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.purch-row {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 140px) auto;
  gap: 0.5rem;
  margin: 0.35rem 0;
}
.manual-pay-row {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.9fr 0.9fr;
  gap: 0.55rem;
  align-items: end;
  margin: 0 0 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line, #d6d3d1) 80%, transparent);
}
.manual-pay-row .pay-notes-label { grid-column: 1 / -2; }
.manual-pay-row .pay-remove-wrap {
  display: flex;
  align-items: end;
  justify-content: flex-end;
}
button.linkish,
a.linkish {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
@media (max-width: 700px) {
  .cash-cols { grid-template-columns: 1fr; }
  .cash-block label { grid-template-columns: 1fr; }
  .purch-row { grid-template-columns: 1fr; }
  .manual-pay-row { grid-template-columns: 1fr; }
  .manual-pay-row .pay-notes-label { grid-column: auto; }
  .manual-pay-row .pay-remove-wrap { justify-content: flex-start; }
}

@media (max-width: 1100px) {
  .app-shell { padding-left: 0; }
  .nav-toggle { display: inline-flex; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(12, 18, 34, 0.45);
    border: 0;
    padding: 0;
    cursor: pointer;
  }
  .nav-backdrop[hidden] { display: none !important; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 280px);
    height: 100vh;
    height: 100dvh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 28px rgba(0,0,0,0.28);
    padding-top: max(1.1rem, env(safe-area-inset-top));
    padding-bottom: max(1.1rem, env(safe-area-inset-bottom));
  }
  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }
  body.nav-open { overflow: hidden; }
  .sidebar-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
  }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  html, body { overflow-x: hidden; }
  .stat-grid, .grid-2, .grid-3, .filters, .month-grid, .form-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 1rem 1.05rem; }
  .stat-card .value { font-size: 1.65rem; margin-top: 0.4rem; }
  .content, .topbar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .topbar { padding-top: max(0.85rem, env(safe-area-inset-top)); }
  .content { padding-bottom: max(5.5rem, calc(env(safe-area-inset-bottom) + 4.5rem)); }
  .page-title { font-size: 1.45rem; }
  .period-row { grid-template-columns: 1fr; flex-direction: column; }
  .upload-drop { padding: 1rem; }
  .cash-entry-modes { gap: 0.4rem; }
  .cash-mode-btn { font-size: 0.9rem; padding: 0.7rem 0.55rem; }
  .cash-photo-actions { flex-direction: column; align-items: stretch; }
  .cash-photo-actions .btn { width: 100%; }
  .chart-wrap { height: 210px; }
  .nav-toggle { width: 44px; height: 44px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .login-card .btn { width: 100%; }
  .table { min-width: 460px; font-size: 0.84rem; }
  .table th, .table td { padding: 0.55rem 0.4rem; }
  .amount { white-space: nowrap; }
  input[type="text"], input[type="password"], input[type="number"],
  input[type="date"], input[type="file"], select, textarea {
    font-size: 16px;
  }
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 34vh) 1fr;
  }
  .login-stage { min-height: 0; }
  .login-stage-copy {
    left: 1.25rem;
    bottom: 1.1rem;
    max-width: 90%;
  }
  .login-stage-copy h2 { font-size: 1.55rem; }
  .login-rail {
    border-left: 0;
    border-top: 1px solid rgba(246, 226, 122, 0.22);
    padding: 1.7rem 1.35rem 2rem;
    align-items: flex-start;
    box-shadow: none;
  }
  .login-rail::before {
    inset: 0 0 auto 0;
    width: auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, #f6e27a 18%, #2dd4bf 82%, transparent);
  }
  .login-brand-name { font-size: 2.2rem; }
  .login-brand-sub { letter-spacing: 0.32em; font-size: 0.82rem; }
}

/* ===== AI Reports ===== */
.report-ask-form textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  font: inherit;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.report-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}
.report-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 400;
  margin: 0 0 0.5rem;
  line-height: 1.15;
  color: var(--ink);
}
.report-brand-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.35rem;
}
.report-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line-soft);
}
.report-brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.2;
}
.logo-sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}
.logo-sample {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  text-align: left;
  padding: 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.logo-sample:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.logo-sample.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.logo-sample img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
}
.logo-sample strong { font-size: 0.92rem; }
.logo-sample .muted { font-size: 0.78rem; line-height: 1.35; }
.identity-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
}
.identity-preview img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: #fff;
}
.report-summary {
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--slate);
  margin: 0;
  max-width: 52rem;
}
.report-kpis { margin: 1rem 0; }
.report-block { margin-top: 1rem; }
.report-insights .insight + .insight { margin-top: 0.85rem; }
.report-section + .report-section { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line-soft); }
.report-section h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.report-section p {
  margin: 0;
  line-height: 1.55;
  color: var(--slate);
}
.report-recs {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.55;
}
.report-meta { margin: 0.75rem 0 0; font-size: 0.85rem; }

/* ===== Shop assistant ===== */
#shopAssistant {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 80;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.7rem;
  width: auto;
  height: auto;
}
.sa-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: 12px;
  background:
    linear-gradient(165deg, #14968c 0%, var(--accent) 55%, #0b5f59 100%);
  color: #f0fdfa;
  font: inherit;
  font-weight: 650;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  padding: 0.7rem 0.95rem 0.7rem 0.75rem;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(12, 18, 34, 0.14);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.sa-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(12, 18, 34, 0.18);
}
.sa-fab:active { transform: translateY(0); }
.sa-fab.open {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  bottom: 0;
  transform: translateY(8px) scale(0.96);
}
.sa-fab-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255,255,255,0.14);
}
.sa-panel[hidden] { display: none !important; }
.sa-panel {
  width: min(400px, calc(100vw - 1.5rem));
  height: min(620px, calc(100vh - 4.5rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 24px 48px rgba(12, 18, 34, 0.16);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity .2s ease, transform .22s ease;
  pointer-events: none;
}
.sa-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.sa-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.95rem 0.95rem 0.9rem;
  background:
    radial-gradient(420px 120px at 0% 0%, rgba(15, 118, 110, 0.28), transparent 60%),
    linear-gradient(185deg, #121b30 0%, #0b1220 100%);
  color: #e8eef8;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sa-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #ecfdf5;
  background: linear-gradient(145deg, #0f766e, #134e4a);
}
.sa-head-text { min-width: 0; }
.sa-title {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.sa-sub {
  font-size: 0.75rem;
  color: #8b9bb5;
  margin-top: 0.18rem;
  letter-spacing: 0.02em;
}
.sa-icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: #c5d0e2;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background .15s ease, color .15s ease;
}
.sa-icon-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.sa-messages {
  flex: 1;
  overflow: auto;
  padding: 1rem 0.95rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background:
    linear-gradient(180deg, rgba(244,246,249,0.9), #eef2f7 40%, #e9eef5);
  scrollbar-width: thin;
}
.sa-welcome {
  margin: auto 0;
  padding: 0.35rem 0.15rem 1rem;
  animation: saFadeIn .35s ease;
}
.sa-welcome-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0 0 0.35rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.sa-welcome-copy {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 28ch;
}
.sa-prompts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sa-prompt {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.sa-prompt:hover {
  border-color: rgba(15, 118, 110, 0.45);
  background: #fff;
  transform: translateX(2px);
}
.sa-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  max-width: 100%;
  animation: saFadeIn .25s ease;
}
.sa-row.is-user { justify-content: flex-end; }
.sa-row.is-bot { justify-content: flex-start; }
.sa-avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ecfdf5;
  background: linear-gradient(145deg, #0f766e, #134e4a);
  margin-bottom: 0.15rem;
}
.sa-bubble {
  max-width: min(92%, 320px);
  padding: 0.72rem 0.85rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.sa-bubble ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.sa-bubble strong { font-weight: 650; }
.sa-user {
  background: linear-gradient(165deg, #12857c, #0f766e);
  color: #f0fdfa;
  border-bottom-right-radius: 5px;
}
.sa-bot {
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.04);
}
.sa-thinking {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.sa-dots {
  display: inline-flex;
  gap: 3px;
}
.sa-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: saDot 1s ease infinite;
}
.sa-dots i:nth-child(2) { animation-delay: .15s; }
.sa-dots i:nth-child(3) { animation-delay: .3s; }
.sa-form {
  padding: 0.7rem 0.85rem 0.85rem;
  background: #fff;
  border-top: 1px solid var(--line-soft);
}
.sa-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.4rem 0.4rem 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color .15s ease, background .15s ease;
}
.sa-composer:focus-within {
  border-color: rgba(15, 118, 110, 0.45);
  background: #fff;
}
.sa-composer textarea {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  padding: 0.45rem 0;
  max-height: 120px;
  color: var(--ink);
}
.sa-composer textarea::placeholder { color: #94a3b8; }
.sa-send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.sa-send:hover { background: var(--accent-hover); }
.sa-send:disabled {
  opacity: 0.55;
  cursor: default;
}
.sa-foot {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}
.sa-foot a { font-weight: 600; }

@keyframes saFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes saDot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 700px) {
  #shopAssistant {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
  #shopAssistant:has(.sa-panel.is-open) {
    inset: 0;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
  }
  .sa-panel {
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    border-radius: 0;
  }
  .sa-fab { padding: 0.75rem 1rem; }
}

@media print {
  .sidebar, .topbar, .report-ask, #shopAssistant, #appBusy, .sa-fab,
  .page-tabs, .list-toolbar, .form-actions, .report-suggestions,
  .btn, button, .busy-overlay { display: none !important; }
  .app-shell { padding: 0; background: #fff !important; }
  .workspace, .content { padding: 0; margin: 0; max-width: none; background: #fff !important; }
  .panel { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .report-sheet { background: #fff !important; color: #0f172a !important; }
  .report-logo {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
  }
  .report-header.panel { border: 0; border-bottom: 2.5px solid #0f766e; border-radius: 0; padding: 0 0 12px; margin: 0 0 14px; }
  .report-title { font-size: 1.45rem !important; }
  .report-summary {
    max-width: none;
    padding: 10px 12px;
    background: #f0fdfa !important;
    border: 1px solid #99f6e4;
    border-left: 4px solid #0f766e;
    border-radius: 8px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .stat-grid.report-kpis {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .stat-card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .chart-wrap { height: 180px !important; break-inside: avoid; }
  .insight { break-inside: avoid; }
  .tab-panel[hidden] { display: none !important; }
  body { background: #fff !important; }
}

/* Keep table horizontal scroll without clipping control focus rings */
.panel:has(> table.table) {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
}
.panel:has(.form-grid),
.panel:has(input[type="text"]),
.panel:has(textarea) {
  overflow: visible;
}

/* ===== Live payout modal ===== */
.pay-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1.35rem 1.5rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid rgba(15, 118, 110, 0.18);
  background:
    radial-gradient(520px 180px at 100% 0%, rgba(94, 234, 212, 0.22), transparent 60%),
    linear-gradient(135deg, #0f766e 0%, #115e59 55%, #0b3f3c 100%);
  color: #ecfdf5;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1rem;
}
.pay-hero-copy { flex: 1 1 220px; min-width: 0; }
.pay-hero-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(204, 251, 241, 0.78);
}
.pay-hero h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.4vw, 1.9rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.15;
}
.pay-hero p {
  margin: 0.45rem 0 0;
  color: rgba(236, 253, 245, 0.82);
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 38rem;
}
.pay-hero .btn {
  width: auto;
  flex-shrink: 0;
  background: #fff;
  color: #0f766e;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  font-weight: 700;
}
.pay-hero .btn:hover {
  background: #f0fdfa;
  color: #115e59;
  transform: translateY(-1px);
}

.mf-modal {
  position: fixed;
  inset: 0;
  z-index: 3500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.mf-modal[hidden] { display: none !important; }
.mf-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(8, 14, 28, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  animation: mf-fade-in 0.22s var(--ease-out);
}
.mf-modal-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(92vh, 720px);
  overflow: auto;
  border-radius: 20px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(216, 222, 232, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 24px 64px rgba(8, 14, 28, 0.28);
  padding: 0;
  animation: mf-pop-in 0.32s var(--ease-spring);
}
.mf-modal-head {
  padding: 1.35rem 1.4rem 1.1rem;
  border-bottom: 1px solid var(--line-soft);
  background:
    radial-gradient(280px 120px at 0% 0%, rgba(15, 118, 110, 0.12), transparent 70%),
    #fff;
}
.mf-modal-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}
.mf-modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}
.mf-modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #fff;
  color: var(--slate);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease-spring);
}
.mf-modal-close:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--ink);
  transform: scale(1.04);
}
.mf-modal-body { padding: 1.2rem 1.4rem 0.4rem; }
.mf-pay-supplier {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: #fff;
  margin-bottom: 1rem;
}
.mf-pay-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: #0f766e;
  background: linear-gradient(145deg, #ccfbf1, #99f6e4);
  flex-shrink: 0;
}
.mf-pay-supplier strong {
  display: block;
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.25;
}
.mf-pay-supplier span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.mf-pay-route {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.mf-modal-fields {
  display: grid;
  gap: 0.9rem;
}
.mf-modal-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--slate);
}
.mf-modal-fields .mf-amount {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.mf-modal-foot {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 1rem 1.4rem 1.35rem;
  border-top: 1px solid var(--line-soft);
  margin-top: 1.1rem;
  background: rgba(248, 250, 252, 0.85);
}
.mf-modal-foot .btn { width: auto; min-width: 7.5rem; }
.mf-modal-msg {
  margin: 0.85rem 1.4rem 0;
  font-size: 0.88rem;
  min-height: 1.2em;
}
.mf-modal-msg.is-error { color: var(--danger); }
.mf-modal-msg.is-ok { color: var(--ok); }
body.mf-modal-open { overflow: hidden; }

@keyframes mf-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes mf-pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 560px) {
  .pay-hero { padding: 1.15rem 1.15rem; }
  .pay-hero .btn { width: 100%; }
  .mf-modal { align-items: flex-end; padding: 0; }
  .mf-modal-card {
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    animation-name: mf-sheet-in;
  }
  .mf-modal-foot .btn { flex: 1 1 auto; }
}
@keyframes mf-sheet-in {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn.pay-btn {
  width: auto;
  padding: 0.4rem 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ===== Page section tabs (Suppliers) ===== */
.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.35rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
}
.page-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--slate);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.25;
  transition:
    background 0.18s var(--ease-out),
    color 0.18s var(--ease-out),
    border-color 0.18s var(--ease-out),
    box-shadow 0.18s var(--ease-out);
}
.page-tab:hover {
  background: #f0fdfa;
  color: var(--accent);
}
.page-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.22);
}
.page-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.page-tab[hidden],
.tab-panel[hidden] { display: none !important; }
.tab-panel > .pay-hero { margin-bottom: 1rem; }
.list-toolbar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.list-toolbar input[type="search"] {
  max-width: 320px;
}
@media (max-width: 700px) {
  .page-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
  }
  .page-tab {
    text-align: center;
    padding: 0.6rem 0.55rem;
    font-size: 0.82rem;
  }
  .list-toolbar input[type="search"] {
    max-width: none;
    flex: 1 1 100%;
  }
}

/* ===== Site themes (Site identity) ===== */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  text-align: left;
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--panel);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.theme-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.theme-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.theme-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: var(--control-bg);
  border: 1px solid var(--line-soft);
}
.theme-card strong { font-size: 0.95rem; }
.theme-card .muted { font-size: 0.78rem; line-height: 1.4; }

html[data-theme="dark-luxury"] {
  color-scheme: dark;
  --ink: #eef3fb;
  --ink-soft: #d7e0ec;
  --slate: #b7c3d4;
  --muted: #8b9bb5;
  --line: #2a3548;
  --line-soft: #1e2838;
  --surface: #0b1018;
  --panel: rgba(18, 26, 38, 0.88);
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --sidebar: #070b12;
  --sidebar-top: #10141c;
  --sidebar-bottom: #05070c;
  --sidebar-fg: #f4efe4;
  --sidebar-muted: #b7a57a;
  --sidebar-link: #d7c9a3;
  --sidebar-section: #8a7a52;
  --sidebar-border: rgba(246, 226, 122, 0.18);
  --sidebar-glow: rgba(246, 226, 122, 0.12);
  --brand-mark: #f6e27a;
  --nav-active-bg: linear-gradient(90deg, rgba(246, 226, 122, 0.18), rgba(15, 118, 110, 0.12));
  --nav-active-bar: #f6e27a;
  --table-hover: rgba(246, 226, 122, 0.06);
  --panel-hover-border: rgba(246, 226, 122, 0.28);
  --input-border: #334155;
  --ghost-bg: rgba(255,255,255,0.04);
  --ghost-border: #334155;
  --ghost-hover: rgba(255,255,255,0.08);
  --page-bg: radial-gradient(900px 420px at 80% -10%, rgba(15, 118, 110, 0.18), transparent 50%), #071018;
  --gold: #f6e27a;
  --control-bg: #0e1622;
  --control-bg-hover: #152030;
  --chip-checked: rgba(15, 118, 110, 0.18);
  --skeleton-a: #152030;
  --skeleton-b: #1c2a3c;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --focus-ring: 0 0 0 4px rgba(246, 226, 122, 0.28);
}
html[data-theme="editorial-light"] {
  --ink: #2a2218;
  --ink-soft: #3a3126;
  --slate: #5c5348;
  --muted: #8a7f70;
  --line: #e6dcc8;
  --line-soft: #eee6d6;
  --surface: #f7f4ee;
  --panel: #fffef9;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: rgba(201, 162, 39, 0.12);
  --sidebar: #2a2218;
  --sidebar-top: #3a3126;
  --sidebar-bottom: #1c1712;
  --sidebar-fg: #f7f1e4;
  --sidebar-muted: #d4c4a0;
  --sidebar-link: #ead9b6;
  --sidebar-section: #b7a57a;
  --sidebar-border: rgba(201, 162, 39, 0.22);
  --sidebar-glow: rgba(201, 162, 39, 0.16);
  --brand-mark: #e8c547;
  --nav-active-bg: linear-gradient(90deg, rgba(201, 162, 39, 0.28), rgba(15, 118, 110, 0.12));
  --nav-active-bar: #e8c547;
  --table-hover: #f3eee4;
  --panel-hover-border: #d9cba8;
  --input-border: #e0d5c0;
  --ghost-bg: #fffef9;
  --ghost-border: #e0d5c0;
  --ghost-hover: #f7f1e4;
  --page-bg: linear-gradient(180deg, #faf7f1 0%, #f7f4ee 50%, #f3eee4 100%);
  --gold: #c9a227;
  --control-bg: #faf7f1;
  --control-bg-hover: #fff;
  --chip-checked: #f7f1e4;
  --skeleton-a: #eee6d6;
  --skeleton-b: #f7f4ee;
  --radius: 10px;
  --focus-ring: 0 0 0 4px rgba(201, 162, 39, 0.28);
}
html[data-theme="soft-glass"] {
  --ink: #0f1c2e;
  --ink-soft: #1a2b44;
  --slate: #3d5168;
  --muted: #6b7c90;
  --line: #d5e0ea;
  --line-soft: rgba(255,255,255,0.7);
  --surface: #e8eef4;
  --panel: rgba(255, 255, 255, 0.72);
  --accent: #0f766e;
  --accent-hover: #14b8a6;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --sidebar: #0e3d3a;
  --sidebar-top: #12524c;
  --sidebar-bottom: #0a2c2a;
  --sidebar-fg: #ecfdf8;
  --sidebar-muted: #99f6e4;
  --sidebar-link: #ccfbf1;
  --sidebar-section: #5eead4;
  --sidebar-border: rgba(255,255,255,0.08);
  --sidebar-glow: rgba(45, 212, 191, 0.28);
  --brand-mark: #5eead4;
  --nav-active-bg: linear-gradient(90deg, rgba(255,255,255,0.16), rgba(15, 118, 110, 0.2));
  --nav-active-bar: #5eead4;
  --table-hover: rgba(255,255,255,0.55);
  --panel-hover-border: rgba(15, 118, 110, 0.28);
  --input-border: #cdd9e4;
  --ghost-bg: rgba(255,255,255,0.7);
  --ghost-border: #cdd9e4;
  --ghost-hover: #fff;
  --page-bg: linear-gradient(180deg, #eef3f8 0%, #e4ebf2 100%);
  --control-bg: rgba(255,255,255,0.7);
  --control-bg-hover: #fff;
  --chip-checked: rgba(240, 253, 250, 0.9);
  --skeleton-a: #dbe4ee;
  --skeleton-b: #eef3f8;
  --shadow: 0 10px 30px rgba(15, 28, 46, 0.08);
  --shadow-lg: 0 18px 40px rgba(15, 28, 46, 0.12);
  --radius: 20px;
  --radius-control: 14px;
}
html[data-theme="precision-terminal"] {
  color-scheme: dark;
  --ink: #e6edf7;
  --ink-soft: #c9d6e8;
  --slate: #9fb0c8;
  --muted: #7d8ea3;
  --line: #243044;
  --line-soft: #1b2536;
  --surface: #0b1220;
  --panel: #111a2b;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --danger: #fb7185;
  --warn: #fbbf24;
  --ok: #34d399;
  --sidebar: #080d16;
  --sidebar-top: #0e1624;
  --sidebar-bottom: #05080e;
  --sidebar-fg: #e6edf7;
  --sidebar-muted: #7d8ea3;
  --sidebar-link: #c9d6e8;
  --sidebar-section: #5b6b82;
  --sidebar-border: rgba(45, 212, 191, 0.14);
  --sidebar-glow: rgba(45, 212, 191, 0.16);
  --brand-mark: #2dd4bf;
  --nav-active-bg: linear-gradient(90deg, rgba(45, 212, 191, 0.22), rgba(45, 212, 191, 0.06));
  --nav-active-bar: #2dd4bf;
  --table-hover: rgba(45, 212, 191, 0.06);
  --panel-hover-border: #2a3d58;
  --input-border: #2a3d58;
  --ghost-bg: transparent;
  --ghost-border: #2a3d58;
  --ghost-hover: rgba(45, 212, 191, 0.08);
  --page-bg: radial-gradient(800px 360px at 100% 0%, rgba(45, 212, 191, 0.08), transparent 45%), #0b1220;
  --gold: #f6e27a;
  --money-out: #fb7185;
  --control-bg: #0d1524;
  --control-bg-hover: #152033;
  --chip-checked: rgba(45, 212, 191, 0.12);
  --skeleton-a: #152033;
  --skeleton-b: #1b2a40;
  --shadow: 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.35);
  --radius: 8px;
  --radius-control: 8px;
  --focus-ring: 0 0 0 4px rgba(45, 212, 191, 0.28);
}
html[data-theme="shop-atelier"] {
  --ink: #3b2f24;
  --ink-soft: #4a3c2e;
  --slate: #6b5b4a;
  --muted: #8d7b66;
  --line: #e4d5c2;
  --line-soft: #efe4d4;
  --surface: #f6f1e8;
  --panel: #fffaf2;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: rgba(184, 134, 11, 0.12);
  --sidebar: #3b2f24;
  --sidebar-top: #4a3c2e;
  --sidebar-bottom: #2a2118;
  --sidebar-fg: #f8f0e3;
  --sidebar-muted: #e0cda8;
  --sidebar-link: #f0e0c2;
  --sidebar-section: #c4ae84;
  --sidebar-border: rgba(184, 134, 11, 0.25);
  --sidebar-glow: rgba(184, 134, 11, 0.2);
  --brand-mark: #e8c547;
  --nav-active-bg: linear-gradient(90deg, rgba(184, 134, 11, 0.32), rgba(15, 118, 110, 0.14));
  --nav-active-bar: #e8c547;
  --table-hover: #f3e9d8;
  --panel-hover-border: #d9c5a5;
  --input-border: #e0d0b8;
  --ghost-bg: #fffaf2;
  --ghost-border: #e0d0b8;
  --ghost-hover: #f6f1e8;
  --page-bg: linear-gradient(180deg, #faf6ef 0%, #f6f1e8 55%, #efe6d8 100%);
  --gold: #b8860b;
  --control-bg: #faf6ef;
  --control-bg-hover: #fff;
  --chip-checked: #f3e9d8;
  --skeleton-a: #efe4d4;
  --skeleton-b: #f6f1e8;
  --shadow: 0 8px 28px rgba(59, 47, 36, 0.08);
  --shadow-lg: 0 16px 36px rgba(59, 47, 36, 0.12);
  --radius: 16px;
  --focus-ring: 0 0 0 4px rgba(184, 134, 11, 0.25);
}

html[data-theme="dark-luxury"] .money-available-card,
html[data-theme="precision-terminal"] .money-available-card {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.22) 0%, rgba(18, 26, 38, 0.95) 55%);
  border-color: rgba(45, 212, 191, 0.28);
}
html[data-theme="dark-luxury"] .panel,
html[data-theme="precision-terminal"] .panel,
html[data-theme="dark-luxury"] .stat-card,
html[data-theme="precision-terminal"] .stat-card {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
html[data-theme="soft-glass"] .panel,
html[data-theme="soft-glass"] .stat-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
html[data-theme="precision-terminal"] .stat-card::before { width: 2px; }
html[data-theme="editorial-light"] .stat-card::before,
html[data-theme="shop-atelier"] .stat-card::before {
  background: var(--gold);
}
html[data-theme="dark-luxury"] .stat-card::before {
  background: var(--gold);
}
html[data-theme="dark-luxury"] input:disabled,
html[data-theme="precision-terminal"] input:disabled,
html[data-theme="dark-luxury"] select:disabled,
html[data-theme="precision-terminal"] select:disabled,
html[data-theme="dark-luxury"] textarea:disabled,
html[data-theme="precision-terminal"] textarea:disabled {
  background: #152033;
}
html[data-theme="dark-luxury"] .busy-card,
html[data-theme="precision-terminal"] .busy-card {
  background: #121a26;
  color: var(--ink);
}
html[data-theme="dark-luxury"] .badge.warn,
html[data-theme="precision-terminal"] .badge.warn {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}
html[data-theme="dark-luxury"] .badge.info,
html[data-theme="precision-terminal"] .badge.info {
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
}
html[data-theme="dark-luxury"] .sa-panel,
html[data-theme="precision-terminal"] .sa-panel {
  background: #121a26;
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark-luxury"] .topbar,
html[data-theme="precision-terminal"] .topbar {
  border-bottom-color: var(--line-soft);
}
