:root {
  --ink: #14201f;
  --muted: #66736f;
  --line: #dfe8e4;
  --panel: #ffffff;
  --bg: #f4f7f5;
  --brand: #0f8f81;
  --brand-dark: #087266;
  --accent: #d79c33;
  --danger: #bf3d3d;
  --ok: #1b7f4d;
  --shadow: 0 14px 40px rgba(20, 32, 31, .09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(140deg, #e5f3ef, #f7f4eb 55%, #eef5f7);
}
.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.mark {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 800;
}
h1, h2, h3 { margin: 0; letter-spacing: 0; }
p { color: var(--muted); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  background: #102522;
  color: #fff;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand { margin-bottom: 28px; }
.sidebar p { color: #b8cac6; margin: 2px 0 0; }
.nav { display: grid; gap: 8px; }
.nav button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  color: #dce9e6;
  background: transparent;
}
.nav button.active, .nav button:hover { background: rgba(255,255,255,.12); color: #fff; }
.main { padding: 24px; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(20, 32, 31, .04);
}
.stat .value { font-size: 30px; font-weight: 800; margin-top: 8px; }
.stat .label, .muted, small { color: var(--muted); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.btn, button.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 13px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { color: var(--ink); background: #edf4f1; }
.btn.warn { background: var(--accent); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 12px;
  min-height: 42px;
}
textarea { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f7faf8; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 9px; font-weight: 800; font-size: 12px; }
.pending { color: #8a610f; background: #fff4d8; }
.completed { color: #176140; background: #daf2e6; }
.canceled { color: #973838; background: #ffe3e3; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { color: var(--ink); background: #e9f0ed; }
.tabs button.active { color: #fff; background: var(--brand); }
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 24, 22, .55);
  display: grid;
  place-items: start center;
  padding: 18px;
  overflow: auto;
}
.modal-card {
  width: min(840px, 100%);
  margin-top: 20px;
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.signature {
  width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  touch-action: none;
  background: #fff;
}
.receipt {
  width: min(850px, 100%);
  margin: 24px auto;
  background: #fff;
  padding: 28px;
  border-radius: 8px;
}
.receipt-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid var(--line); padding-bottom: 18px; margin-bottom: 18px; }
.synergy-receipt {
  color: #111;
  border: 1px solid #d7d7d7;
}
.receipt-title {
  text-align: center;
  border-bottom: 2px solid #111;
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.receipt-title h1 { font-size: 34px; font-weight: 900; }
.receipt-title h2 { margin-top: 10px; font-size: 22px; text-transform: uppercase; }
.receipt-title p { margin: 4px 0; color: #333; }
.receipt-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.receipt-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.receipt-sections section,
.seller-block,
.receipt-notes {
  border: 1px solid #111;
  padding: 12px;
}
.receipt h3 {
  text-transform: uppercase;
  font-size: 15px;
  margin: 0 0 10px;
}
.receipt-field { margin: 8px 0; color: #111; }
.receipt-table {
  min-width: 0;
  border: 1px solid #111;
  margin-bottom: 18px;
}
.receipt-table th {
  background: #111;
  color: #fff;
}
.receipt-table th,
.receipt-table td {
  border: 1px solid #111;
}
.receipt-notes { min-height: 70px; margin-bottom: 16px; color: #111; }
.receipt-totals {
  margin-left: auto;
  width: min(320px, 100%);
  border: 1px solid #111;
  margin-bottom: 18px;
}
.receipt-totals div {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #111;
}
.receipt-totals div:last-child { border-bottom: 0; background: #f1f1f1; }
.seller-block { margin-bottom: 18px; }
.copy-box { display: flex; gap: 8px; align-items: stretch; }
.copy-box input { min-width: min(460px, 60vw); }
.mobile-menu { display: none; }
.stock-country {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
}
.stock-country summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}
.stock-country summary span { color: var(--muted); font-weight: 800; }
.stock-country .table-wrap { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.stock-country table { min-width: 0; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px; }
  .sidebar .brand { margin-bottom: 12px; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 14px; }
  .topbar { align-items: flex-start; }
  .stats, .two, .form-grid { grid-template-columns: 1fr; }
  .receipt-head { display: grid; }
  .receipt-sections { grid-template-columns: 1fr; }
  .copy-box { display: grid; }
  table { min-width: 640px; }
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .receipt { margin: 0; width: 100%; box-shadow: none; }
  .synergy-receipt { border: 0; border-radius: 0; }
}
