:root {
  --ink: #15191f;
  --ink-2: #4a5260;
  --ink-3: #7b8391;
  --line: #e3e1da;
  --paper: #f5f4ef;
  --card: #ffffff;
  --accent: #0d6b4e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #b4231b;
  --danger-soft: #fbe7e5;
  --info-soft: #e7eef9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 25, 31, .06), 0 2px 8px rgba(20, 25, 31, .05);
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; font-size: 15px; line-height: 1.45; background: var(--paper); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
small, .muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); }
[x-cloak] { display: none !important; }

/* Gornja traka */
.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 56px; }
.brand { font-weight: 800; letter-spacing: .04em; color: #fff; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; font-size: 13px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: #c9ced6; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255, 255, 255, .14); }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #c9ced6; white-space: nowrap; }
.topbar-right form { margin: 0; }
.linkbtn { background: none; border: 0; color: #c9ced6; cursor: pointer; font: inherit; padding: 6px 8px; border-radius: 6px; }
.linkbtn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.env { font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; }
.env-demo { background: #f2c94c; color: #3a2a00; }
.env-sandbox { background: #7fb3ff; color: #062048; }
.env-production { background: #43c08a; color: #04291a; }
.impersonate { background: var(--warn-soft); color: var(--warn); padding: 8px 20px; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.impersonate form { margin: 0; }

.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Kartice, tabele */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; background: #faf9f6; }
tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
tbody tr:hover { background: #fbfaf7; }
.table-card { padding: 0; overflow: hidden; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }

/* Forme */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfccc3; border-radius: 8px; background: #fff; font: inherit; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=file] { font: inherit; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters .field { margin: 0; }
.filters input, .filters select { width: auto; min-width: 140px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid #cfccc3; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f3f2ee; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #0a5a41; }
.btn-danger { color: var(--danger); border-color: #e7bdb9; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 14px 22px; font-size: 17px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-ok { background: var(--accent-soft); color: #0a4a36; }
.alert-error { background: var(--danger-soft); color: #7d1711; }
.alert-warn { background: var(--warn-soft); color: #6b3f00; }
.alert-info { background: var(--info-soft); color: #1d3a6b; }
.alert ul { margin: 0; padding-left: 18px; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eceae4; color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--accent-soft); color: #0a4a36; }
.badge-error { background: var(--danger-soft); color: #7d1711; }
.badge-warn { background: var(--warn-soft); color: #6b3f00; }
.badge-info { background: var(--info-soft); color: #1d3a6b; }

.meter { height: 8px; background: #ebe9e2; border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.warn > span { background: #d9901a; }
.meter.full > span { background: var(--danger); }
.stat { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; word-break: break-word; }
.pagination { margin-top: 14px; }
.pagination nav > div:first-child { display: none; }
.pagination svg { width: 16px; height: 16px; }

/* Prijava */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { color: var(--ink); margin-bottom: 18px; font-size: 18px; }

/* KASA */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; height: calc(100vh - 56px); padding: 16px; max-width: 1500px; margin: 0 auto; }
.pos-left, .pos-right { display: flex; flex-direction: column; min-height: 0; }
.pos-search { display: flex; gap: 8px; margin-bottom: 12px; }
.pos-search input { font-size: 17px; padding: 12px 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; align-content: start; padding-bottom: 12px; }
.tile { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; font: inherit; color: var(--ink); min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile:active { transform: scale(.98); }
.tile .t-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.tile .t-price { font-weight: 700; color: var(--accent); margin-top: 8px; font-variant-numeric: tabular-nums; }
.tile .t-meta { font-size: 11px; color: var(--ink-3); }
.tile.fav { border-left: 3px solid var(--accent); }
.quick { margin-top: auto; }
.cart { flex: 1; overflow-y: auto; min-height: 120px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.cart-line .c-name { font-weight: 600; }
.cart-line .c-ctrl { display: flex; align-items: center; gap: 6px; }
.cart-line input { width: 74px; padding: 5px 7px; text-align: right; }
.qbtn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid #cfccc3; background: #fff; cursor: pointer; font-size: 17px; line-height: 1; }
.qbtn:hover { background: #f3f2ee; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 10px; border-top: 2px solid var(--ink); margin-top: 6px; }
.cart-total .label { font-weight: 600; color: var(--ink-2); }
.cart-total .value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.paytypes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.paytypes button, .paytypes select { padding: 10px 6px; border-radius: 8px; border: 1px solid #cfccc3; background: #fff; font: inherit; font-weight: 600; cursor: pointer; font-size: 13px; width: 100%; }
.paytypes select { padding: 9px 4px; }
.paytypes button.on, .paytypes select.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.payrow { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.payrow span { flex: 1; font-size: 14px; }
.payrow input { width: 130px; text-align: right; }
.change { display: flex; justify-content: space-between; font-weight: 700; padding: 6px 0; }
.mode-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.mode-bar button { border: 1px solid #cfccc3; background: #fff; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.mode-bar button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.refund-banner { background: var(--warn-soft); color: #6b3f00; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.limit-note { font-size: 12px; color: var(--ink-3); margin-top: 8px; text-align: center; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 18, 24, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; max-height: 92vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 560px; }
.receipt-frame { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Prikaz žurnala računa na ekranu */
.journal { font-family: var(--mono); font-size: 12.5px; line-height: 1.35; white-space: pre; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; width: max-content; max-width: 100%; }
.journal img { display: block; margin: 8px auto; width: 180px; height: 180px; image-rendering: pixelated; }
.qr-placeholder { width: 160px; height: 160px; margin: 8px auto; border: 2px dashed #bbb; display: grid; place-items: center; font-family: system-ui, sans-serif; color: #888; font-size: 13px; white-space: normal; text-align: center; }

@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .tiles { max-height: 46vh; }
  .topbar-right .who { display: none; }
}
