@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: none; text-size-adjust: none; }
body {
  margin: 0;
  font-family: 'Inter', Arial, sans-serif;
  background: #f0f2f5;
  color: #18202a;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
input, select, textarea {
  width: 100%;
  padding: .85rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #18202a;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #046a70;
  box-shadow: 0 0 0 3px rgba(4,106,112,.12);
}
textarea { min-height: 110px; resize: vertical; }
label span {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .4rem;
  color: #475569;
}
.hidden { display: none !important; }
.hidden-field { display: none !important; }

/* ============================================================
   FORM ROW GRID HELPERS
   ============================================================ */
.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: .75rem;
}
.form-row-end {
  display: flex;
  justify-content: flex-start;
  padding: .25rem 0 .75rem;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding-top: .5rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: .7rem 1.2rem;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  transition: all .2s;
  white-space: nowrap;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-primary {
  background: #046a70;
  color: #fff;
  border-color: #046a70;
}
.btn-primary:hover { background: #035c62; }
.btn-sm { min-height: 34px; padding: .4rem .85rem; font-size: .82rem; border-radius: 8px; }
.btn-danger { background: #fff0f3; color: #be123c; border-color: #fecdd3; }
.btn-danger:hover { background: #ffe4e6; }
.btn-remove-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 8px;
  border: 1.5px solid #fecdd3;
  background: #fff1f2;
  color: #be123c;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  transition: background .15s;
  min-height: unset;
}
.btn-remove-item:hover { background: #ffe4e6; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: .9rem 1.1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: .92rem;
}
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 380px;
  padding: .85rem 1.1rem;
  border-radius: 16px;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(15,23,42,.14), 0 2px 8px rgba(15,23,42,.08);
  pointer-events: all;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1) both;
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.toast-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.toast-success::before { background: #16a34a; }
.toast-error   { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.toast-error::before   { background: #e11d48; }
.toast-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.toast-info::before    { background: #2563eb; }
.toast-icon  { width: 20px; height: 20px; flex-shrink: 0; }
.toast-body  { flex: 1; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  opacity: .5;
  transition: opacity .15s;
  min-height: unset;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  border-radius: 4px;
}
.toast-close:hover { opacity: 1; background: rgba(0,0,0,.06); }
.toast.hide { animation: toastOut .3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(.95); }
  to   { opacity: 1; transform: translateX(0)   scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(40px) scale(.95); }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body, .install-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e8f4f5 0%, #f0f2f5 50%, #e8f0f5 100%);
}
.login-shell, .install-shell {
  width: min(100%, 1180px);
  padding: 24px;
}
.login-card, .install-card {
  background: #fff;
  border: 1.5px solid #e8edf3;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(4,106,112,.1);
  padding: 32px;
  max-width: 440px;
  margin: 0 auto;
}
.install-card.wide { max-width: 1120px; }
.brand-line, .brand-box, .brand-preview-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.5rem;
}
.brand-mark, .sheet-logo {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(145deg, #d6a315, #046a70);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}
.brand-mark.large { width: 72px; height: 72px; font-size: 1.3rem; }
.brand-logo, .brand-logo-lg {
  width: 52px; height: 52px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-logo-lg { width: 72px; height: 72px; }
.login-card h1, .install-header h1 { margin: .2rem 0 0; font-size: 1.6rem; font-weight: 800; }
.login-card p,  .install-header p  { margin: .3rem 0 0; color: #64748b; font-size: .95rem; }

/* ============================================================
   FORMS GRID
   ============================================================ */
.grid-form { display: grid; gap: 1rem; }
.grid-form.compact { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.two, .content-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid .full { grid-column: 1 / -1; }
.actions-row { display: flex; justify-content: flex-end; }

/* ============================================================
   INSTALL CARDS
   ============================================================ */
.card-block {
  padding: 1.1rem;
  border: 1.5px solid #e8edf3;
  border-radius: 16px;
  background: #fafbfd;
}
.card-block h3, .card-block h2 { margin: 0 0 1rem; font-size: 1rem; font-weight: 700; }
.require-list { display: grid; gap: .6rem; }
.require-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  border: 1.5px solid #e8edf3;
  border-radius: 12px;
  background: #fff;
  font-size: .9rem;
}
.status-ok  { color: #16a34a; font-weight: 700; }
.status-bad { color: #dc2626; font-weight: 700; }
.compact-panel { padding: 1rem; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  padding: 20px 16px;
  background: #fff;
  border-right: 1.5px solid #e8edf3;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 20px;
  border-bottom: 1.5px solid #f1f5f9;
  margin-bottom: 8px;
}
.sidebar-brand h2 { margin: 0; font-size: 1rem; font-weight: 800; color: #0f172a; line-height: 1.2; }
.sidebar-brand p  { margin: 2px 0 0; font-size: .75rem; color: #94a3b8; }
.menu { display: grid; gap: 4px; }
.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .75rem 1rem;
  border-radius: 12px;
  color: #64748b;
  font-weight: 600;
  font-size: .9rem;
  transition: all .2s;
}
.menu-link:hover { background: #f1f5f9; color: #0f172a; }
.menu-link.active {
  background: linear-gradient(90deg, #e8f4f5 0%, #f0fafb 100%);
  color: #046a70;
  box-shadow: inset 3px 0 0 #046a70;
}
.menu-link .icon { width: 20px; height: 20px; flex-shrink: 0; opacity: .65; transition: opacity .2s; }
.menu-link:hover .icon  { opacity: .9; }
.menu-link.active .icon { opacity: 1; }
.menu-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}
.menu-icon svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu-section {
  font-size: .72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 10px 4px;
}
.menu-logout {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1.5px solid #f1f5f9;
}
.main-content { padding: 28px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.topbar h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.topbar p  { margin: .2rem 0 0; color: #64748b; font-size: .9rem; }
.topbar > div:first-child h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.topbar > div:first-child p  { margin: .2rem 0 0; color: #64748b; font-size: .9rem; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hamburger { display: none; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: #fff;
  border: 1.5px solid #e8edf3;
  border-radius: 20px;
  padding: 1.2rem 1.2rem 1rem;
  box-shadow: 0 2px 12px rgba(15,23,42,.04);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 20px 20px 0 0;
  background: #e2e8f0;
}
.stat-card.card-teal::before  { background: linear-gradient(90deg, #046a70, #0891b2); }
.stat-card.card-gold::before  { background: linear-gradient(90deg, #d6a315, #f59e0b); }
.stat-card.card-green::before { background: linear-gradient(90deg, #16a34a, #22c55e); }
.stat-card.card-rose::before  { background: linear-gradient(90deg, #e11d48, #f43f5e); }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(15,23,42,.1); }
.stat-card-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: .8rem;
}
.stat-card-icon svg { width: 22px; height: 22px; }
.stat-card-icon.teal  { background: #e8f4f5; color: #046a70; }
.stat-card-icon.gold  { background: #fef9ec; color: #b45309; }
.stat-card-icon.green { background: #f0fdf4; color: #16a34a; }
.stat-card-icon.rose  { background: #fff1f2; color: #e11d48; }
.stat-card span   { display: block; color: #64748b; font-size: .82rem; font-weight: 500; margin-bottom: .3rem; }
.stat-card strong { font-size: 1.5rem; font-weight: 800; color: #0f172a; display: block; line-height: 1.15; }
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .78rem;
  font-weight: 600;
  margin-top: .4rem;
  padding: 2px 8px;
  border-radius: 999px;
}
.stat-trend.up   { background: #f0fdf4; color: #16a34a; }
.stat-trend.down { background: #fff1f2; color: #e11d48; }

/* ============================================================
   STAT MINI — gold widget kadar chips
   ============================================================ */
.stat-mini {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: .65rem .9rem;
  border-radius: 14px;
  border: 1.5px solid #e8edf3;
  background: #fafbfd;
  min-width: 120px;
  font-size: .82rem;
}
.stat-mini strong {
  font-size: .88rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}
.stat-mini span { color: #475569; }
.stat-mini-active {
  background: linear-gradient(135deg, #fef9ec, #fffbf0);
  border-color: #d6a315;
}
.stat-mini-active strong { color: #92400e; }
.stat-mini-empty { opacity: .55; }

/* Row highlight untuk harga aktif di tabel gold */
.row-active-gold td { background: #fffbf0 !important; }
.row-active-gold:hover td { background: #fef9ec !important; }

/* Badge tambahan */
.badge-muted { background: #f1f5f9; color: #94a3b8; }

/* ============================================================
   PANELS & CARDS
   ============================================================ */
.panel {
  background: #fff;
  border: 1.5px solid #e8edf3;
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 2px 12px rgba(15,23,42,.04);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}
.panel-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.content-grid { display: grid; gap: 1rem; }
.content-grid > * { min-width: 0; }
.content-grid.wide-right { grid-template-columns: 1fr 1.3fr; }
.chart-wrap { position: relative; height: 240px; margin-top: .5rem; }
.chart-panel {
  background: #fff;
  border: 1.5px solid #e8edf3;
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 2px 12px rgba(15,23,42,.04);
  margin-bottom: 1.25rem;
}
.chart-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.chart-panel-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; font-weight: 600; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; color: #64748b; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chart-toggle { display: flex; gap: 4px; }
.chart-toggle button {
  padding: 4px 12px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
}
.chart-toggle button.active { background: #046a70; color: #fff; border-color: #046a70; }

/* ============================================================
   GOLD WIDGET — dashboard
   ============================================================ */
.gold-widget-panel { margin-bottom: 1.25rem; }
.gold-widget-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.gold-widget-card {
  flex: 1 1 140px;
  max-width: 200px;
  background: linear-gradient(135deg, #fffbf0, #fef9ec);
  border: 1.5px solid #d6a315;
  border-radius: 16px;
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gold-widget-kadar {
  font-size: .88rem;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 4px;
}
.gold-widget-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
}
.gold-widget-row span { color: #78716c; }
.gold-widget-row .price-buy  { color: #0f172a; font-weight: 600; }
.gold-widget-row .price-sell { color: #046a70; font-weight: 700; }
.gold-widget-updated {
  font-size: .72rem;
  color: #a8a29e;
  margin-top: 4px;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1.5px solid #e8edf3;
}
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  white-space: nowrap;
  font-size: .88rem;
}
th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
}
.badge-sale     { background: #f0fdf4; color: #16a34a; }
.badge-purchase { background: #eff6ff; color: #1d4ed8; }
.badge-role     { background: #f1f5f9; color: #475569; }
.link-inline {
  color: #046a70;
  font-weight: 600;
  font-size: .82rem;
  margin-right: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.link-inline:hover { background: #e8f4f5; }
.danger-link,
.link-danger { color: #dc2626 !important; }
.danger-link:hover,
.link-danger:hover { background: #fff1f2; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  padding: .85rem 1rem;
  background: #f8fafc;
  border: 1.5px solid #e8edf3;
  border-radius: 14px;
  margin-bottom: 1rem;
}
.filter-bar input, .filter-bar select {
  width: auto;
  flex: 1 1 160px;
  min-width: 140px;
  padding: .65rem .9rem;
  font-size: .88rem;
}
.filter-bar .btn { flex-shrink: 0; min-height: 40px; padding: .55rem 1rem; }
.filter-panel  { margin-bottom: 1rem; }
.inline-filter { align-items: end; }
.filter-actions { display: flex; gap: .75rem; align-items: end; }

/* ============================================================
   SUMMARY BOX — Invoice totals
   ============================================================ */
.summary-box {
  background: #f8fafc;
  border: 1.5px solid #e8edf3;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  margin: .5rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
/* Setiap baris summary: label kiri, nilai kanan */
.summary-box > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: .92rem;
  color: #475569;
  gap: 1rem;
}
.summary-box > div:last-child {
  border-bottom: none;
  padding-top: .65rem;
  border-top: 2px solid #111827;
  margin-top: .25rem;
}
.summary-box > div span   { flex: 0 0 auto; white-space: nowrap; }
.summary-box > div strong {
  flex: 0 0 auto;
  white-space: nowrap;
  font-weight: 700;
  color: #0f172a;
  font-size: 1rem;
}
.summary-box > div:last-child span   { font-size: 1rem; font-weight: 700; color: #0f172a; }
.summary-box > div:last-child strong { font-size: 1.2rem; font-weight: 800; color: #046a70; }

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: .92rem;
  color: #475569;
}
.summary-row:last-child { border-bottom: none; }
.summary-row strong { font-size: 1rem; font-weight: 700; color: #0f172a; }
.summary-total {
  padding-top: .65rem;
  border-top: 2px solid #111827;
  border-bottom: none;
  margin-top: .25rem;
}
.summary-total span   { font-size: 1rem; font-weight: 700; color: #0f172a; }
.summary-total strong { font-size: 1.25rem; font-weight: 800; color: #046a70; }

/* ============================================================
   MULTI-ITEM ROW
   ============================================================ */
.item-row {
  position: relative;
  background: #f8fafc;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 14px;
  border: 1.5px dashed #d1d5db;
  transition: border-color .2s;
}
.item-row:hover { border-color: #046a70; }
.item-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}
.item-row-head strong { font-size: .9rem; font-weight: 700; color: #374151; }
.item-remove {
  position: absolute;
  top: 8px; right: 10px;
  cursor: pointer;
  color: #e11d48;
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  width: 24px; height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .15s;
}
.item-remove:hover { background: #ffe4e6; }
.item-subtext { font-weight: 700; color: #046a70; }

/* ============================================================
   BOTTOM NAVIGATION — Mobile
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1.5px solid #e8edf3;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(15,23,42,.08);
}
.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 480px;
  margin: 0 auto;
}
.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  color: #94a3b8;
  font-size: .65rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s;
  text-decoration: none;
}
.bnav-item svg { width: 22px; height: 22px; }
.bnav-item.active { color: #046a70; }
.bnav-item.active svg { filter: drop-shadow(0 0 4px rgba(4,106,112,.35)); }
.bnav-fab {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #046a70, #035c62);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 4px 18px rgba(4,106,112,.45);
  transition: transform .2s, box-shadow .2s;
}
.bnav-fab:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(4,106,112,.55); }
.bnav-fab svg { width: 24px; height: 24px; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ============================================================
   PRINT / INVOICE SHEET
   ============================================================ */
.print-body { background: #eef2f5; padding: 24px; }
.print-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 auto 18px;
  max-width: 210mm;
  padding: 0 12px;
}
.print-hint {
  text-align: center;
  font-size: .78rem;
  color: #94a3b8;
  margin-bottom: 12px;
}
.sheet {
  width: min(100%, 960px);
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(15,23,42,.08);
}
.sheet-c5 {
  width: 190mm;
  min-height: 133mm;
  margin: 0 auto;
  background: #fff;
  border-radius: 0;
  box-shadow: 0 0 0 1px #d9d9d9;
  padding: 9mm 10mm 8mm;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid #141414;
  padding-bottom: 18px;
  margin-bottom: 20px;
}
.sheet-brand { display: flex; gap: 14px; align-items: flex-start; }
.sheet-logo-img { width: 58px; height: 58px; object-fit: cover; border-radius: 18px; }
.sheet-brand h1 { margin: 0; font-size: 1.8rem; }
.sheet-brand p, .muted { margin: .2rem 0 0; color: #5a5a5a; }
.sheet-meta { text-align: right; }
.sheet-meta .label  { text-transform: uppercase; letter-spacing: .08em; color: #777; font-size: .8rem; }
.sheet-meta .number { font-size: 1.18rem; font-weight: 800; margin: .2rem 0; }
.sheet-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.sheet-box    { border: 1px solid #e1e1e1; border-radius: 16px; padding: 16px; }
.sheet-box h3 { margin: 0 0 .6rem; font-size: .92rem; text-transform: uppercase; letter-spacing: .08em; color: #666; }
.sheet-box p  { margin: 0; }
.sheet-table  { width: 100%; border-collapse: collapse; }
.sheet-table th, .sheet-table td { padding: 12px; border-bottom: 1px solid #e9e9e9; text-align: left; }
.sheet-summary { margin-left: auto; max-width: 360px; margin-top: 18px; }
.sheet-summary .line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #d7d7d7; }
.sheet-summary .line.total { border-bottom: 2px solid #111; padding-top: 14px; font-size: 1.1rem; }
.notes-box { margin-top: 20px; }

/* Print rebuild */
.print-body .sheet-head {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 8mm;
  align-items: start;
  padding-bottom: 4mm;
  margin-bottom: 4mm;
  border-bottom: 0.5mm solid #222;
}
.print-body .sheet-brand { gap: 4mm; align-items: flex-start; }
.print-body .sheet-brand h1 { margin: 0 0 2mm; font-size: 16pt; line-height: 1.15; }
.print-body .sheet-brand p,
.print-body .sheet-meta,
.print-body .sheet-box,
.print-body .sheet-table,
.print-body .sheet-summary { font-size: 10.5pt; line-height: 1.35; }
.print-body .sheet-logo,
.print-body .sheet-logo-img { width: 18mm; height: 18mm; min-width: 18mm; object-fit: contain; border-radius: 0; }
.print-body .sheet-meta { text-align: right; }
.print-body .sheet-meta .label  { text-transform: uppercase; letter-spacing: .08em; color: #6a6a6a; font-size: 9pt; }
.print-body .sheet-meta .number { margin: 1mm 0; font-size: 14pt; font-weight: 700; }
.print-body .sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-bottom: 4mm; }
.print-body .sheet-box  { min-height: 29mm; border: 0.35mm solid #cfcfcf; border-radius: 0; padding: 4mm; }
.print-body .sheet-box h3 { margin: 0 0 3mm; font-size: 9pt; text-transform: uppercase; letter-spacing: .12em; color: #5b5b5b; }
.print-body .sheet-box p  { margin: 0; white-space: pre-line; }
.print-body .sheet-table  { width: 100%; border-collapse: collapse; table-layout: fixed; margin-bottom: 4mm; }
.print-body .sheet-table th, .print-body .sheet-table td { border: 0.3mm solid #bdbdbd; padding: 3mm 2.5mm; vertical-align: middle; }
.print-body .sheet-table th { background: #f3f3f3; font-weight: 700; text-align: left; }
.print-body .sheet-table th:nth-child(1), .print-body .sheet-table td:nth-child(1) { width: 30%; }
.print-body .sheet-table th:nth-child(2), .print-body .sheet-table td:nth-child(2) { width: 14%; text-align: center; }
.print-body .sheet-table th:nth-child(3), .print-body .sheet-table td:nth-child(3) { width: 14%; text-align: center; }
.print-body .sheet-table th:nth-child(4), .print-body .sheet-table td:nth-child(4) { width: 19%; text-align: right; }
.print-body .sheet-table th:nth-child(5), .print-body .sheet-table td:nth-child(5) { width: 23%; text-align: right; }
.print-body .sheet-summary { width: 78mm; margin-left: auto; margin-top: 1mm; border-top: 0.5mm solid #222; padding-top: 2mm; }
.print-body .sheet-summary .line { display: grid; grid-template-columns: 1fr auto; gap: 4mm; padding: 2mm 0; border-bottom: 0.2mm dashed #c9c9c9; }
.print-body .sheet-summary .line.total { font-size: 11pt; font-weight: 700; border-bottom: 0.5mm solid #222; }
.print-body .notes-box {
  margin-top: 5mm;
  font-size: 9.5pt;
  color: #444;
  border-top: 0.3mm solid #ddd;
  padding-top: 3mm;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(15,23,42,.15);
    overflow-y: auto;
  }
  .sidebar.open { display: flex; }
  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
  }
  .hamburger svg { width: 20px; height: 20px; color: #334155; }
  .bottom-nav { display: block; }
  .main-content { padding: 16px 16px 90px; }
  .topbar { margin-bottom: 1rem; }
  .topbar h1 { font-size: 1.3rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .content-grid.two-col,
  .content-grid.wide-right,
  .grid.two,
  .summary-box,
  .form-row-2,
  .form-row-3 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; flex: none; }
  .filter-actions { display: grid; }
  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; }
  .chart-wrap { height: 200px; }
  .content-grid > * { min-width: 0; }
  .print-body { padding: 12px; }
  .print-actions { justify-content: center; max-width: 100%; }
  .sheet { padding: 20px 14px; border-radius: 14px; }
  .sheet-grid { grid-template-columns: 1fr; gap: 12px; }
  .sheet-head { flex-direction: column; gap: 12px; }
  .sheet-meta { text-align: left; }
  html, body { overflow-x: hidden !important; max-width: 100vw !important; }
  .main-content { overflow-x: hidden !important; max-width: 100vw !important; width: 100% !important; box-sizing: border-box !important; }
  .content-grid,
  .content-grid.two-col,
  .content-grid.wide-right { display: block !important; width: 100% !important; max-width: 100% !important; overflow-x: hidden !important; box-sizing: border-box !important; }
  .content-grid > .panel,
  .content-grid > * { width: 100% !important; max-width: 100% !important; min-width: 0 !important; overflow: hidden !important; box-sizing: border-box !important; margin-left: 0 !important; margin-right: 0 !important; }
  .table-wrap { width: 100% !important; max-width: 100% !important; overflow-x: auto !important; overflow-y: visible !important; -webkit-overflow-scrolling: touch !important; display: block !important; box-sizing: border-box !important; }
  .table-wrap table { min-width: 540px; width: max-content; }
  .table-wrap th, .table-wrap td { white-space: nowrap !important; word-break: normal !important; }
  .gold-widget-grid { gap: 8px; }
  .gold-widget-card { flex: 1 1 calc(50% - 4px); max-width: none; }
  .stat-mini { min-width: 0; flex: 1 1 calc(50% - 5px); }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat-card strong { font-size: 1.2rem; }
}

/* ============================================================
   @media print
   ============================================================ */
@page { size: A4 portrait; margin: 10mm; }
@media print {
  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .no-print, .sidebar, .topbar, .page-head, .actions, .app-shell, .bottom-nav, .hamburger, .sidebar-overlay {
    display: none !important;
  }
  .print-body { background: #fff !important; padding: 0 !important; }
  .sheet-c5 {
    width: 190mm !important;
    min-height: 133mm !important;
    margin: 0 auto !important;
    padding: 8mm 9mm 7mm !important;
    box-shadow: none !important;
    border: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .print-body .sheet-head,
  .print-body .sheet-grid,
  .print-body .sheet-table,
  .print-body .sheet-summary,
  .print-body .notes-box { break-inside: avoid; page-break-inside: avoid; }
}
