@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&family=Syne:wght@600;700;800&display=swap');

:root {
  --bg: #0b0b0d;
  --surf: #141416;
  --surf2: #1a1a1d;
  --bdr: #252529;
  --acc: #f0a500;
  --acc-d: #c98700;
  --txt: #eeebe6;
  --mut: #656570;
  --grn: #3ecf8e;
  --red: #e05454;
  --blu: #4e9eff;
  --yel: #f0c000;

  --acc-soft: rgba(240, 165, 0, 0.12);
  --grn-soft: rgba(62, 207, 142, 0.14);
  --red-soft: rgba(224, 84, 84, 0.14);
  --blu-soft: rgba(78, 158, 255, 0.14);
  --yel-soft: rgba(240, 192, 0, 0.14);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --sp: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);

  --nav-w: 240px;

  --ff-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --ff-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', monospace;
  --ff-head: 'Syne', var(--ff-sans);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--ff-sans);
  background: var(--bg);
  color: var(--txt);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--acc-soft);
  color: var(--txt);
}

h1, h2, h3, h4 {
  font-family: var(--ff-head);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--txt);
}

h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.92rem; }

a {
  color: var(--acc);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--acc-d); }

code, kbd, .mono {
  font-family: var(--ff-mono);
  font-size: 0.86em;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bdr) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--bdr);
  border-radius: 20px;
  border: 2px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: #34343a; }

/* ============ LAYOUT ============ */
.app {
  display: flex;
  min-height: 100vh;
}

.nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--surf);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--bdr);
}
.nav-brand .logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--acc), var(--acc-d));
  display: grid;
  place-items: center;
  font-family: var(--ff-head);
  font-weight: 800;
  color: #1a1100;
  font-size: 1rem;
  flex: 0 0 auto;
}
.nav-brand .name {
  font-family: var(--ff-head);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.nav-brand .name small {
  display: block;
  font-family: var(--ff-mono);
  font-weight: 400;
  font-size: 0.62rem;
  color: var(--mut);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
}

.nav-links {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--mut);
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.nav-link:hover {
  background: var(--surf2);
  color: var(--txt);
}
.nav-link.active {
  background: var(--acc-soft);
  color: var(--acc);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--acc);
}
.nav-link .ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 1rem;
}
.nav-link .nav-badge {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  background: var(--red);
  color: #fff;
  padding: 1px 7px;
  border-radius: 20px;
  line-height: 1.4;
}

.nav-foot {
  padding: 14px;
  border-top: 1px solid var(--bdr);
  font-size: 0.74rem;
  color: var(--mut);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--bdr);
  background: rgba(11, 11, 13, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar .nav-toggle {
  display: none;
}
.topbar h1 {
  font-size: 1.4rem;
}
.topbar .topbar-sub {
  color: var(--mut);
  font-size: 0.85rem;
}
.topbar .spacer { flex: 1; }

.content {
  padding: 28px;
  max-width: 1320px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .desc {
  color: var(--mut);
  font-size: 0.9rem;
  margin-top: 4px;
}
.page-head .actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============ GRID ============ */
.grid {
  display: grid;
  gap: var(--sp);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ============ CARD ============ */
.card {
  background: var(--surf);
  border: 1px solid var(--bdr);
  border-radius: var(--r);
  padding: 20px;
}
.card.pad-0 { padding: 0; }
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--bdr);
}
.card-head h3 { font-size: 1rem; }
.card-head .actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.card-title {
  font-family: var(--ff-head);
  font-weight: 700;
  font-size: 1rem;
}

/* Stat card */
.stat {
  background: var(--surf);
  border: 1px solid var(--bdr);
  border-radius: var(--r);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat .label {
  font-size: 0.78rem;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.stat .value {
  font-family: var(--ff-head);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 8px;
  letter-spacing: -0.02em;
}
.stat .value small {
  font-family: var(--ff-sans);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--mut);
}
.stat .sub {
  font-size: 0.8rem;
  color: var(--mut);
  margin-top: 4px;
}
.stat .ico {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.4rem;
  opacity: 0.5;
}
.stat.acc .value { color: var(--acc); }
.stat.grn .value { color: var(--grn); }
.stat.red .value { color: var(--red); }
.stat.blu .value { color: var(--blu); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--ff-sans);
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--bdr);
  background: var(--surf2);
  color: var(--txt);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:hover {
  background: #232328;
  border-color: #33333a;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn .ico { font-size: 1rem; }

.btn-acc {
  background: var(--acc);
  border-color: var(--acc);
  color: #1a1100;
}
.btn-acc:hover {
  background: var(--acc-d);
  border-color: var(--acc-d);
}

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(224, 84, 84, 0.4);
  color: var(--red);
}
.btn-danger:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--mut);
}
.btn-ghost:hover {
  background: var(--surf2);
  color: var(--txt);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
  border-radius: var(--r-sm);
}
.btn-lg {
  padding: 13px 22px;
  font-size: 0.95rem;
}
.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}
.btn-block { width: 100%; }

.btn-group {
  display: inline-flex;
  gap: 6px;
}

/* ============ FORM FIELDS ============ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label,
.label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mut);
}
.field .hint {
  font-size: 0.74rem;
  color: var(--mut);
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="date"],
input[type="password"],
input:not([type]),
select,
textarea {
  font-family: var(--ff-sans);
  font-size: 0.9rem;
  color: var(--txt);
  background: var(--surf2);
  border: 1px solid var(--bdr);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  appearance: none;
}
input::placeholder,
textarea::placeholder { color: var(--mut); }

input:hover,
select:hover,
textarea:hover { border-color: #33333a; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
  background: var(--surf);
}

input[type="number"] {
  font-family: var(--ff-mono);
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23656570' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
select option {
  background: var(--surf2);
  color: var(--txt);
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--acc);
  cursor: pointer;
  flex: 0 0 auto;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
}

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surf);
  border: 1px solid var(--bdr);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  color: var(--mut);
}

.search {
  position: relative;
}
.search input { padding-left: 38px; }
.search::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  opacity: 0.6;
  pointer-events: none;
}

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

/* ============ TABLE ============ */
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--bdr);
  border-radius: var(--r);
  background: var(--surf);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.tbl thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mut);
  padding: 12px 14px;
  background: var(--surf2);
  border-bottom: 1px solid var(--bdr);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bdr);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr {
  transition: background 0.1s ease;
}
.tbl tbody tr:hover { background: var(--surf2); }
.tbl .num {
  font-family: var(--ff-mono);
  text-align: right;
  white-space: nowrap;
}
.tbl .ttl {
  font-weight: 600;
  color: var(--txt);
}
.tbl .sub {
  color: var(--mut);
  font-size: 0.78rem;
}
.tbl .col-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}
.tbl td.center,
.tbl th.center { text-align: center; }
.tbl-clickable tbody tr { cursor: pointer; }

/* ============ BADGE ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--ff-mono);
  padding: 3px 9px;
  border-radius: 20px;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.badge.no-dot::before { display: none; }

.badge-grn {
  background: var(--grn-soft);
  color: var(--grn);
  border-color: rgba(62, 207, 142, 0.3);
}
.badge-red {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(224, 84, 84, 0.3);
}
.badge-yel {
  background: var(--yel-soft);
  color: var(--yel);
  border-color: rgba(240, 192, 0, 0.3);
}
.badge-blu {
  background: var(--blu-soft);
  color: var(--blu);
  border-color: rgba(78, 158, 255, 0.3);
}
.badge-acc {
  background: var(--acc-soft);
  color: var(--acc);
  border-color: rgba(240, 165, 0, 0.3);
}
.badge-mut {
  background: var(--surf2);
  color: var(--mut);
  border-color: var(--bdr);
}

/* Stock availability dot */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.dot-grn { background: var(--grn); box-shadow: 0 0 8px rgba(62, 207, 142, 0.5); }
.dot-red { background: var(--red); box-shadow: 0 0 8px rgba(224, 84, 84, 0.5); }
.dot-yel { background: var(--yel); box-shadow: 0 0 8px rgba(240, 192, 0, 0.5); }
.dot-mut { background: var(--mut); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  background: var(--surf2);
  border: 1px solid var(--bdr);
  color: var(--mut);
  font-family: var(--ff-mono);
}

.pill {
  font-family: var(--ff-mono);
  font-size: 0.76rem;
  color: var(--mut);
  background: var(--surf2);
  border: 1px solid var(--bdr);
  padding: 2px 8px;
  border-radius: var(--r-sm);
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 7, 0.78);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  animation: fadeIn 0.18s ease forwards;
}
.modal-overlay.fullscreen {
  align-items: stretch;
  padding: 0;
}

.modal {
  background: var(--surf);
  border: 1px solid var(--bdr);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(8px);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modal.modal-lg { max-width: 820px; }
.modal.modal-xl { max-width: 1080px; }

.modal-overlay.fullscreen .modal {
  max-width: none;
  max-height: none;
  height: 100vh;
  width: 100vw;
  border-radius: 0;
  border: none;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--bdr);
  flex: 0 0 auto;
}
.modal-head h2,
.modal-head h3 { font-size: 1.15rem; }
.modal-head .sub {
  color: var(--mut);
  font-size: 0.84rem;
}
.modal-head .spacer { flex: 1; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--surf2);
  border: 1px solid var(--bdr);
  color: var(--mut);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-close:hover {
  background: var(--red-soft);
  color: var(--red);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--bdr);
  flex: 0 0 auto;
}
.modal-foot .spacer { flex: 1; }

/* Picker (fullscreen variant content) */
.picker-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--bdr);
  flex-wrap: wrap;
}
.picker-toolbar .search { flex: 1; min-width: 220px; }
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.picker-item {
  background: var(--surf2);
  border: 1px solid var(--bdr);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.picker-item:hover {
  border-color: #3a3a42;
  transform: translateY(-2px);
}
.picker-item .pi-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.picker-item .pi-ref {
  font-family: var(--ff-mono);
  font-size: 0.74rem;
  color: var(--mut);
}
.picker-item .pi-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
}
.picker-item .pi-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--mut);
}
.picker-item .pi-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--bdr);
}
.picker-item .pi-price {
  font-family: var(--ff-mono);
  font-weight: 600;
  color: var(--acc);
}
.picker-item .pi-foot .btn { margin-left: auto; }

/* ============ TOAST ============ */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 48px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  max-width: 380px;
  background: var(--surf2);
  border: 1px solid var(--bdr);
  border-left: 3px solid var(--mut);
  border-radius: var(--r);
  padding: 13px 16px;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  color: var(--txt);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.out { animation: toastOut 0.25s ease forwards; }
.toast.ok { border-left-color: var(--grn); }
.toast.ok .toast-ico { color: var(--grn); }
.toast.err { border-left-color: var(--red); }
.toast.err .toast-ico { color: var(--red); }
.toast.info { border-left-color: var(--blu); }
.toast.info .toast-ico { color: var(--blu); }
.toast-ico {
  font-size: 1.1rem;
  flex: 0 0 auto;
}
.toast-msg { flex: 1; line-height: 1.35; }

/* ============ EMPTY / LOADING ============ */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--mut);
}
.empty .empty-ico {
  font-size: 2.6rem;
  opacity: 0.5;
  margin-bottom: 12px;
}
.empty .empty-title {
  font-family: var(--ff-head);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--txt);
  margin-bottom: 6px;
}
.empty p { font-size: 0.9rem; max-width: 360px; margin: 0 auto 16px; }

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--bdr);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--mut);
  font-size: 0.9rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--surf2) 25%, #232328 50%, var(--surf2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--r-sm);
}

/* ============ MISC HELPERS ============ */
.divider {
  height: 1px;
  background: var(--bdr);
  border: none;
  margin: 18px 0;
}
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.gap-lg { gap: 18px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.ml-auto { margin-left: auto; }
.flex-1 { flex: 1; }
.txt-mut { color: var(--mut); }
.txt-acc { color: var(--acc); }
.txt-grn { color: var(--grn); }
.txt-red { color: var(--red); }
.txt-c { text-align: center; }
.txt-r { text-align: right; }
.mono { font-family: var(--ff-mono); }
.nowrap { white-space: nowrap; }
.small { font-size: 0.82rem; }
.muted-box {
  background: var(--surf2);
  border: 1px dashed var(--bdr);
  border-radius: var(--r);
  padding: 14px;
  color: var(--mut);
  font-size: 0.86rem;
}

.money {
  font-family: var(--ff-mono);
  font-weight: 500;
}
.money::after {
  content: ' CHF';
  font-size: 0.78em;
  color: var(--mut);
}
.money.bare::after { content: none; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--bdr);
  margin-bottom: 18px;
}
.tab {
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--mut);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { color: var(--txt); }
.tab.active {
  color: var(--acc);
  border-bottom-color: var(--acc);
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn { to { opacity: 1; } }
@keyframes modalIn {
  to { transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  html { font-size: 14px; }

  .nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
  }
  .nav.open { transform: translateX(0); }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 39;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .nav-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar .nav-toggle {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    background: var(--surf2);
    border: 1px solid var(--bdr);
    color: var(--txt);
    cursor: pointer;
    font-size: 1.2rem;
    flex: 0 0 auto;
  }

  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

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

  .page-head .actions {
    width: 100%;
    margin-left: 0;
  }
  .page-head .actions .btn { flex: 1; }

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

  .toast-wrap {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
  .toast { max-width: none; }

  .modal-overlay { padding: 0; align-items: stretch; }
  .modal {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    width: 100vw;
    border-radius: 0;
    border: none;
  }
}

@media (max-width: 480px) {
  .stat .value { font-size: 1.6rem; }
  .tbl thead th, .tbl tbody td { padding: 10px 10px; }
}
