:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #14b8a6;
  --primary-soft: #ccfbf1;
  --primary-ghost: rgba(13, 148, 136, 0.08);

  --bg: #edf7f5;
  --bg-deep: #d8efe9;
  --card: #ffffff;
  --border: #e2efec;
  --border-strong: #cbddd8;
  --text: #0b1f1c;
  --muted: #5b746f;

  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --info: #0284c7;

  --shadow-sm: 0 1px 2px rgba(11, 31, 28, 0.04);
  --shadow-md: 0 8px 24px rgba(11, 31, 28, 0.06);
  --shadow-lg: 0 20px 50px rgba(11, 31, 28, 0.1);

  --radius: 22px;
  --radius-sm: 16px;
  --sidebar-w: 260px;

  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 0% -10%, rgba(13, 148, 136, 0.14), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(20, 184, 166, 0.1), transparent 50%),
    linear-gradient(180deg, #f4fbf9 0%, var(--bg) 40%, #e8f4f1 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }

/* ——— App shell ——— */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem 0.85rem;
  transition: transform 0.28s var(--ease);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem 0.85rem;
  flex-shrink: 0;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 0.85rem;
  background: linear-gradient(145deg, var(--primary-light), var(--primary-dark));
  box-shadow: 0 8px 18px rgba(13, 148, 136, 0.28);
}
.brand-name { font-weight: 800; letter-spacing: -0.03em; font-size: 0.98rem; }
.brand-sub { font-size: 0.72rem; color: var(--muted); font-weight: 500; }

.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 0.5rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Hide ugly scrollbar, keep scroll */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav::-webkit-scrollbar { width: 0; height: 0; display: none; }

.nav-section {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
  padding: 0.7rem 0.65rem 0.25rem;
}
.nav-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.52rem 0.7rem; border-radius: 12px;
  color: #3d5550; font-weight: 600; font-size: 0.84rem;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-link svg { width: 17px; height: 17px; opacity: 0.7; flex-shrink: 0; }
.nav-link:hover { background: var(--primary-ghost); color: var(--primary-dark); }
.nav-link:hover svg { opacity: 1; }
.nav-link.active {
  background: linear-gradient(90deg, var(--primary-soft), rgba(204, 251, 241, 0.35));
  color: var(--primary-dark);
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-link.active svg { opacity: 1; }
.nav-link.logout {
  flex-shrink: 0;
  margin-top: 0.35rem;
  color: #b91c1c;
  background: #fff5f5;
  border: 1px solid #fecaca;
}
.nav-link.logout:hover { background: #fee2e2; color: #991b1b; }

body.sidebar-open { overflow: hidden; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.85rem 1.6rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  border: 1px solid var(--border); background: #fff;
  display: none; place-items: center; cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* Mobile page title in topbar — hidden on desktop */
.topbar-title {
  display: none;
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  text-align: left;
}

.top-search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 0.5rem;
  background: #f3faf8; border: 1px solid var(--border);
  border-radius: 14px; padding: 0.55rem 0.85rem; color: var(--muted);
}
.top-search input {
  border: 0; background: transparent; outline: none;
  width: 100%; font: inherit; color: var(--text);
}
.top-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}
.topbar-right { margin-left: auto; flex-shrink: 0; position: relative; }
.user-menu { position: relative; }
.user-pill {
  display: flex; align-items: center; gap: 0.55rem;
  background: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 0.3rem 0.55rem 0.3rem 0.3rem;
  color: inherit; text-decoration: none;
  font: inherit; cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.user-pill:hover,
.user-menu.open .user-pill {
  color: inherit; border-color: #b6e4de;
  box-shadow: var(--shadow-sm);
}
.user-caret {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.18s var(--ease);
}
.user-menu.open .user-caret { transform: rotate(180deg); color: var(--primary-dark); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.8rem;
  background: linear-gradient(145deg, var(--primary-light), var(--primary-dark));
  flex-shrink: 0;
}
.user-name { font-size: 0.82rem; font-weight: 700; line-height: 1.1; text-align: left; }
.user-role { font-size: 0.68rem; color: var(--muted); text-align: left; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.35rem;
  box-shadow: var(--shadow-md);
  z-index: 50;
  animation: fadeUp 0.18s var(--ease) both;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  color: #3d5550;
  font-size: 0.875rem;
  font-weight: 650;
  text-decoration: none;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.user-dropdown-item:hover {
  background: var(--primary-ghost);
  color: var(--primary-dark);
}
.user-dropdown-item.danger { color: #b91c1c; }
.user-dropdown-item.danger:hover {
  background: #fff5f5;
  color: #991b1b;
}
.user-dropdown-item svg { opacity: 0.8; flex-shrink: 0; }

.content { padding: 1.6rem; animation: fadeUp 0.35s var(--ease) both; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.15rem;
}
.page-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 1.85rem);
  font-weight: 800; letter-spacing: -0.035em;
}
.page-sub { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; font-weight: 500; }
.page-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; }

/* Soft page scrollbars */
.main, .content, .table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #b7d4ce transparent;
}
.main::-webkit-scrollbar,
.content::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar { height: 6px; width: 6px; }
.main::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: #b7d4ce;
  border-radius: 999px;
}
.main::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track { background: transparent; }

/* ——— Components ——— */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 1rem; }
.card-title {
  margin: 0 0 1rem;
  font-size: 1rem; font-weight: 800; letter-spacing: -0.02em;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.card-head .card-title { margin: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}
.stat-grid.dense {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1.05rem 1.15rem 1.05rem 1.3rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
  animation: fadeUp 0.35s var(--ease) both;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 8px 8px 0;
  background: linear-gradient(180deg, var(--primary-light), var(--primary-dark));
}
.stat-card:nth-child(1) { animation-delay: 0.02s; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.14s; }
.stat-card:nth-child(5) { animation-delay: 0.18s; }
.stat-card:nth-child(6) { animation-delay: 0.22s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.35rem;
}
.stat-value {
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 800; letter-spacing: -0.03em;
}
.stat-hint { margin-top: 0.35rem; font-size: 0.75rem; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 0; border-radius: 14px; padding: 0.6rem 1.05rem;
  font-family: inherit; font-size: 0.875rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: transform 0.12s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--primary-light), var(--primary));
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.28);
}
.btn-primary:hover { color: #fff; box-shadow: 0 8px 20px rgba(13, 148, 136, 0.34); }
.btn-outline {
  background: #fff; color: var(--text); border: 1px solid var(--border-strong);
}
.btn-outline:hover { background: var(--primary-ghost); color: var(--primary-dark); border-color: #9fd5cd; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; color: #991b1b; }
.btn-sm { padding: 0.4rem 0.75rem; border-radius: 12px; font-size: 0.8rem; }

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
label {
  display: block; margin-bottom: 0.35rem;
  font-size: 0.78rem; font-weight: 700; color: #3d5550;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 0.65rem 0.8rem;
  font: inherit; font-size: 0.9rem; color: var(--text);
  background: #fff;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}
.form-actions {
  display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.35rem; flex-wrap: wrap;
}
.highlight-box {
  background: #f0fdf4; border: 1px solid #86efac;
  border-radius: 16px; padding: 0.85rem 1rem;
}

table.data {
  width: 100%; border-collapse: collapse; font-size: 0.875rem;
}
table.data th {
  text-align: left; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  background: #f7fcfb; padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
table.data td {
  padding: 0.75rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:hover td { background: #f4fbf9; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
table.data .actions { white-space: nowrap; text-align: right; }

.chip {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
}
.chip-warning { background: #fef3c7; color: #b45309; }
.chip-success { background: #d1fae5; color: #047857; }
.chip-danger { background: #fee2e2; color: #b91c1c; }
.chip-info { background: #e0f2fe; color: #0369a1; }
.chip-primary { background: var(--primary-soft); color: var(--primary-dark); }

.tabs {
  display: inline-flex; flex-wrap: wrap; gap: 0.25rem;
  background: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 0.25rem; margin-bottom: 1rem;
}
.tabs a, .tabs button {
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 0.82rem; font-weight: 700;
  color: var(--muted); padding: 0.45rem 0.9rem; border-radius: 999px;
  text-decoration: none;
}
.tabs a.active, .tabs button.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.alert {
  border-radius: 16px; padding: 0.85rem 1rem;
  font-weight: 700; font-size: 0.9rem; margin-bottom: 1rem;
}
.alert-success { background: #d1fae5; border: 1px solid #6ee7b7; color: #047857; }
.alert-error { background: #fee2e2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-info { background: #e0f2fe; border: 1px solid #bae6fd; color: #0369a1; }

.empty {
  text-align: center; padding: 2.2rem 1rem;
  background: #f3faf8; border-radius: 18px; color: var(--primary-dark);
}
.empty p { margin: 0.4rem 0 0; color: var(--muted); font-weight: 500; }

.company-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.company-card {
  display: block; color: inherit;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
.company-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: #b6e4de; color: inherit;
}
.company-card .kicker {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--primary-dark);
}
.company-card h3 {
  margin: 0.35rem 0 0.5rem; font-size: 1.05rem;
  font-weight: 800; letter-spacing: -0.02em;
}
.company-card .meta { font-size: 0.8rem; color: var(--muted); }

.ledger-block { margin-bottom: 1.25rem; }
.ledger-block h3 {
  margin: 0 0 0.65rem; font-size: 0.85rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ledger-block.credit h3 { color: var(--success); }
.ledger-block.debit h3 { color: var(--danger); }
.ledger-block.expense h3 { color: var(--warning); }
.ledger-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px dashed var(--border-strong);
  font-weight: 800;
}
.profit-row {
  background: linear-gradient(90deg, var(--primary-soft), #fff);
  border: 1px solid #99e6d8; border-radius: 16px;
  padding: 0.9rem 1rem; margin-top: 1rem;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800;
}
.muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.15rem;
  padding-bottom: 2px;
}
.table-wrap table.data { min-width: 640px; }

.filters {
  display: flex; gap: 0.65rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: end;
}
.filters .field { min-width: 140px; flex: 1 1 140px; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 35;
  background: rgba(11, 31, 28, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ——— Login ——— */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr;
  position: relative; overflow: hidden;
}
.login-hero {
  padding: clamp(2rem, 5vw, 4rem);
  display: flex; flex-direction: column; justify-content: center;
  position: relative; z-index: 1;
}
.login-kicker {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--primary-dark); margin-bottom: 0.85rem;
}
.login-brand {
  font-family: "Sora", var(--font);
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 800; letter-spacing: -0.05em; line-height: 0.95;
  margin: 0 0 1rem; animation: fadeUp 0.55s var(--ease) both;
}
.login-tagline {
  font-size: 1.05rem; color: var(--muted); max-width: 28rem;
  font-weight: 500; margin: 0 0 1.6rem; animation: fadeUp 0.65s var(--ease) both;
}
.login-features { list-style: none; padding: 0; margin: 0; }
.login-features li {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 0.7rem; font-weight: 600; color: #3d5550;
  animation: fadeUp 0.7s var(--ease) both;
}
.login-features li::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px;
  background: var(--primary); flex-shrink: 0;
}
.login-panel-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; position: relative; z-index: 1;
}
.login-panel {
  width: 100%; max-width: 420px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 26px; padding: 1.8rem;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.6s var(--ease) both;
}
.login-panel h2 {
  font-family: "Sora", var(--font);
  margin: 0 0 0.35rem; font-size: 1.55rem; letter-spacing: -0.03em;
}
.login-panel p { margin: 0 0 1.3rem; color: var(--muted); font-size: 0.92rem; }
.login-panel .field { margin-bottom: 0.95rem; }
.login-panel .btn-primary { width: 100%; padding: 0.8rem; margin-top: 0.4rem; }
.login-hint {
  margin-top: 1rem; font-size: 0.78rem; color: var(--muted); text-align: center;
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(40px); pointer-events: none;
  animation: drift 12s ease-in-out infinite alternate;
}
.orb-1 { width: 280px; height: 280px; background: rgba(13, 148, 136, 0.22); top: -40px; left: 10%; }
.orb-2 { width: 220px; height: 220px; background: rgba(20, 184, 166, 0.18); bottom: 10%; right: 8%; animation-delay: -4s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(18px, 12px); }
}

/* ——— Responsive ——— */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid.dense { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .company-grid, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-105%);
    width: min(var(--sidebar-w), 86vw);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .icon-btn { display: grid; }
  .main { margin-left: 0; width: 100%; }

  /* Title lives in topbar on mobile/tablet */
  .topbar {
    padding: 0.65rem clamp(0.75rem, 3vw, 1rem);
    gap: 0.55rem;
    min-height: 60px;
  }
  .topbar-title { display: block; }
  .top-search { display: none; }

  .page-title { display: none; } /* avoid duplicate heading */
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 0.95rem;
  }
  .page-head-desktop-only {
    display: none;
  }
  .page-sub {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.4;
  }
  .page-actions {
    width: 100%;
  }
  .page-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content {
    padding: 0.95rem clamp(0.85rem, 3vw, 1.1rem) 1.5rem;
  }
  .login-page { grid-template-columns: 1fr; min-height: 100dvh; }
  .login-hero { padding: 2rem 1.25rem 0.75rem; }
  .login-panel-wrap { padding: 0.75rem 1.15rem 2rem; align-items: flex-start; }
  .login-brand { font-size: clamp(2.2rem, 10vw, 3.2rem); }
  .filters .field { min-width: 100%; flex: 1 1 100%; }
  .card { padding: 1.05rem; }
  .card[style*="max-width"] { max-width: 100% !important; }
  .profit-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .user-meta { display: none; }
  .user-pill { padding: 0.2rem; }
  .user-caret { display: none; }
  .user-dropdown { min-width: 168px; }
}

@media (max-width: 640px) {
  .stat-grid,
  .stat-grid.dense,
  .company-grid,
  .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; gap: 0.85rem; }
  .topbar-title { font-size: 1rem; }
  .icon-btn { width: 40px; height: 40px; border-radius: 12px; }
  .avatar { width: 36px; height: 36px; }
  .table-wrap {
    margin: 0 -0.35rem;
    padding: 0 0.15rem 2px;
  }
  .table-wrap table.data { min-width: 560px; font-size: 0.82rem; }
  table.data th, table.data td { padding: 0.6rem 0.55rem; }
  .btn, button.btn, a.btn { padding: 0.55rem 0.9rem; }
  .page-actions { gap: 0.45rem; }
  .stat-value { font-size: 1.15rem; }
  .company-card h3 { font-size: 1rem; }
  .tabs {
    width: 100%;
    border-radius: 14px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .ledger-total, .profit-row { font-size: 0.92rem; }
  .alert { font-size: 0.85rem; padding: 0.75rem 0.9rem; }
}

@media (max-width: 420px) {
  .brand-sub { display: none; }
  .content { padding: 0.8rem 0.7rem 1.35rem; }
  .stat-card { padding: 0.9rem 1rem; }
  .login-panel { padding: 1.35rem; border-radius: 18px; }
  .topbar-title { font-size: 0.95rem; }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
