/* VeronaPOS — design.md (PostHog-style) tokens */
:root {
  --canvas: #eeefe9;
  --surface-soft: #e5e7e0;
  --surface-card: #ffffff;
  --surface-doc: #fcfcfa;
  --surface-dark: #23251d;
  --hairline: #bfc1b7;
  --hairline-soft: #dcdfd2;
  --ink: #23251d;
  --body: #4d4f46;
  --mute: #6c6e63;
  --ash: #9b9c92;
  --primary: #f7a501;
  --primary-pressed: #dd9001;
  --link-teal: #1078a3;
  --accent-blue: #2c84e0;
  --accent-blue-soft: #dceaf6;
  --accent-green: #2c8c66;
  --accent-green-soft: #d9eddf;
  --accent-red: #cd4239;
  --accent-red-soft: #f7d6d3;
  --accent-purple: #7c44a6;
  --accent-purple-soft: #e7d8ee;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--canvas);
  color: var(--body);
  font-family: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3 { color: var(--ink); margin: 0 0 8px; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.6px; }
h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.5px; }
h3 { font-size: 18px; font-weight: 600; }
a { color: var(--link-teal); text-decoration: none; }
a:focus { text-decoration: underline; }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; padding: 16px 12px;
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--ink); padding: 8px 12px 20px; }
.brand-dot { width: 14px; height: 14px; border-radius: 9999px; background: var(--primary); display: inline-block; }
.brand-logo { width: 28px; height: auto; display: inline-block; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  padding: 8px 12px; border-radius: 6px; color: var(--body);
  font-weight: 600; font-size: 14px;
}
.sidebar nav a.active { background: var(--surface-card); color: var(--ink); border: 1px solid var(--hairline); }
.sidebar nav a:hover { background: var(--surface-soft); }
.nav-section {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--mute); padding: 16px 12px 4px;
}
.sidebar-footer { border-top: 1px solid var(--hairline-soft); padding-top: 12px; }
.user-chip { font-size: 14px; font-weight: 600; color: var(--ink); padding: 4px 12px; }
.store-chip { padding: 8px 12px; margin-bottom: 8px; background: var(--surface-soft); border-radius: 6px; }
.store-chip a { display: block; margin-top: 4px; }
.content { flex: 1; padding: 32px; max-width: 1280px; }

/* cards */
.card {
  background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: 6px; padding: 24px; margin-bottom: 16px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { background: var(--surface-card); border: 1px solid var(--hairline); border-radius: 6px; padding: 24px; }
.stat-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--mute); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.6px; color: var(--ink); margin-top: 4px; }

/* buttons */
.btn-primary {
  background: var(--primary); color: var(--ink); border: none;
  padding: 8px 16px; height: 40px; border-radius: 6px;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-primary:active { background: var(--primary-pressed); }
.btn-secondary {
  background: var(--surface-soft); color: var(--ink); border: none;
  padding: 8px 16px; height: 40px; border-radius: 6px;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center;
}
.btn-ghost {
  background: transparent; color: var(--ink); border: none;
  padding: 8px 12px; border-radius: 6px;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-ghost:hover { background: var(--surface-soft); }
.btn-sm { height: 32px; padding: 4px 12px; font-size: 13px; }
.btn-danger { background: var(--accent-red-soft); color: var(--accent-red); }

/* forms */
input[type=text], input[type=password], input[type=date], input[type=number], select {
  background: var(--surface-card); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 6px;
  padding: 8px 12px; height: 36px; font-family: inherit; font-size: 14px;
}
input:focus, select:focus { outline: 2px solid rgba(59,130,246,0.5); border-color: var(--accent-blue); }
/* Chrome autofill: force readable colors (default yellow/white bg can hide text) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-card) inset;
  box-shadow: 0 0 0 1000px var(--surface-card) inset;
  transition: background-color 9999s ease-in-out 0s;
}
/* password field with show/hide toggle */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: transparent; border: none; cursor: pointer;
  color: var(--mute); padding: 0; border-radius: 4px;
}
.pw-toggle:hover { background: var(--surface-soft); color: var(--ink); }
.pw-toggle .ic-eye-off { display: none; }
.pw-toggle.on .ic-eye { display: none; }
.pw-toggle.on .ic-eye-off { display: block; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 160px 1fr; gap: 12px 16px; align-items: center; max-width: 560px; }
.form-grid label { font-weight: 600; font-size: 14px; color: var(--ink); }
.field-error { color: var(--accent-red); font-size: 13px; }

/* tables */
table.data { width: 100%; border-collapse: collapse; background: var(--surface-card); border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; }
table.data th {
  text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--mute); padding: 10px 12px; border-bottom: 1px solid var(--hairline);
  background: var(--surface-doc);
}
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--hairline-soft); font-size: 14px; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* banners */
.banner { padding: 16px 20px; border-radius: 6px; margin-bottom: 16px; color: var(--ink); font-size: 14px; }
.banner-red { background: var(--accent-red-soft); }
.banner-blue { background: var(--accent-blue-soft); }
.banner-green { background: var(--accent-green-soft); }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 12px; font-weight: 600; }
.badge-green { background: var(--accent-green-soft); color: var(--accent-green); }
.badge-red { background: var(--accent-red-soft); color: var(--accent-red); }
.badge-blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.badge-gray { background: var(--surface-soft); color: var(--mute); }

/* pagination */
.pager { display: flex; gap: 4px; margin-top: 16px; align-items: center; font-size: 14px; }
.pager a, .pager span.cur {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--hairline);
  background: var(--surface-card); color: var(--body);
}
.pager span.cur { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .meta { margin-left: 12px; color: var(--mute); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--canvas); }
.login-card { position: relative; background: var(--surface-card); border: 1px solid var(--hairline); border-radius: 6px; padding: 32px; width: 440px; }
.login-logo { position: absolute; top: 24px; right: 24px; width: 56px; height: auto; }
.login-card h1 { margin-bottom: 24px; }
.login-card .form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.login-card input { width: 100%; }
.login-card button[type=submit] { width: 100%; margin-top: 8px; }
.login-card .pw-toggle { width: 28px; margin-top: 0; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.mut { color: var(--mute); font-size: 13px; }
.copyright { text-align: center; color: var(--ash); font-size: 12px; margin-top: 24px; padding-top: 12px; }
.content > .copyright { border-top: 1px solid var(--hairline-soft); }
.sig-img { border: 1px solid var(--hairline); border-radius: 6px; background: #fff; max-width: 320px; }

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .content { padding: 16px; }
}

/* ---- receipt preview modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(35,37,29,0.45);
  align-items: center; justify-content: center; padding: 24px;
}
.modal-box {
  background: var(--surface-card); border-radius: 8px;
  max-height: 90vh; width: 360px; display: flex; flex-direction: column;
  border: 1px solid var(--hairline);
}
.modal-body { overflow-y: auto; padding: 24px; background: var(--surface-soft); border-radius: 8px 8px 0 0; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--hairline);
}
/* receipt visible inside preview modal */
.modal-body #receipt {
  display: block; background: #fff; padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ---- print receipt (thermal) ---- */
#receipt {
  display: none;
  width: 280px; margin: 0 auto;
  font-family: 'Courier New', ui-monospace, monospace;
  color: #000; font-size: 12px; line-height: 1.4;
}
#receipt .r-center { text-align: center; }
#receipt .r-bold { font-weight: 700; }
#receipt .r-lg { font-size: 14px; }
#receipt .r-hr { border-top: 1px dashed #000; margin: 6px 0; }
#receipt .r-row { display: flex; justify-content: space-between; gap: 8px; }
#receipt .r-row span:last-child { text-align: right; white-space: nowrap; }
#receipt .r-item { margin-bottom: 2px; }
#receipt .r-item-name { word-break: break-word; }
#receipt .r-sig { display: block; max-width: 100%; margin: 4px auto; }
#receipt .r-thanks { margin-top: 8px; font-weight: 700; }
#receipt .r-barcode { display: block; margin: 10px auto 0; max-width: 100%; }

@media print {
  @page { margin: 8px; }
  body { background: #fff; }
  .sidebar, .page-head, .card, .card-grid, .banner, .modal-footer, .copyright { display: none !important; }
  .content { padding: 0 !important; max-width: none !important; }
  /* neutralize modal chrome so only the receipt prints */
  .modal-overlay { display: block !important; position: static !important; background: none !important; padding: 0 !important; }
  .modal-box { width: auto !important; max-height: none !important; border: none !important; }
  .modal-body { overflow: visible !important; padding: 0 !important; background: none !important; }
  .modal-body #receipt, #receipt { display: block !important; box-shadow: none !important; padding: 0 !important; }
}
