:root {
  --bg-deep: #1c1410;
  --bg-panel: #261c15;
  --bg-card: #2e2219;
  --bg-card-active: #3a2b1f;
  --wood-line: #3d2e21;
  --gold: #c9a24b;
  --gold-bright: #e0bc6a;
  --cream: #f0e6d6;
  --cream-dim: #b8a98f;
  --green-ok: #6b8f5a;
  --red-empty: #8a4a3d;
  --shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--cream);
  font-family: 'Inter', sans-serif;
  height: 100%;
  overflow-x: hidden;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  padding: 28px 20px 18px;
  border-bottom: 1px solid var(--wood-line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.btn-admin {
  margin-left: auto;
  background: var(--bg-card);
  border: 1px solid var(--wood-line);
  color: var(--gold-bright);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
}

.topbar h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  font-size: 26px;
  margin: 0;
  color: var(--gold-bright);
  letter-spacing: 0.3px;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--cream-dim);
  font-size: 14px;
  font-weight: 500;
}

.order-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
}

.order-topbar h1 {
  flex: 1;
  font-size: 22px;
  text-align: center;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--wood-line);
  color: var(--gold-bright);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-clear {
  color: var(--red-empty);
}

/* ---------- Zones bar ---------- */

.zones-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 20px 0;
}

.zone-btn {
  background: var(--bg-card);
  border: 1px solid var(--wood-line);
  border-radius: 12px;
  padding: 14px 6px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: box-shadow 0.25s, background 0.25s, color 0.25s, border-color 0.25s;
  min-width: 0;
}

.zone-btn-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone-btn-count {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
}

.zone-btn.active {
  border-color: transparent;
  color: #fff;
}

@media (max-width: 400px) {
  .zone-btn-name {
    font-size: 13px;
  }
  .zone-btn-count {
    font-size: 10px;
  }
  .zone-btn {
    padding: 12px 4px;
  }
}

/* ---------- Tables grid ---------- */

.tables-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 20px;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--wood-line);
  border-radius: 14px;
  padding: 18px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px var(--shadow);
}

.table-card.occupied {
  border-color: transparent;
}

.table-number {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--cream);
}

.table-card.occupied .table-number {
  color: var(--gold-bright);
}

.table-status {
  font-size: 12px;
  color: var(--cream-dim);
  font-weight: 500;
}

.table-card.occupied .table-status {
  color: var(--gold);
  font-weight: 600;
}

/* ---------- Category tabs ---------- */

.category-tabs-wrapper {
  position: sticky;
  top: 73px;
  z-index: 9;
  display: flex;
  align-items: stretch;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--wood-line);
}

.category-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 8px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-deep);
  flex: 1;
  min-width: 0;
  scroll-behavior: smooth;
}

.tab-arrow {
  flex-shrink: 0;
  width: 32px;
  border: none;
  background: var(--bg-deep);
  color: var(--gold);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.15s;
}

.tab-arrow:active {
  opacity: 0.6;
}

.tab-arrow.is-hidden {
  visibility: hidden;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--wood-line);
  color: var(--cream-dim);
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.cat-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-deep);
}

/* ---------- Products list ---------- */

.products-list {
  flex: 1;
  padding: 12px 14px 100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-row {
  background: var(--bg-card);
  border: 1px solid var(--wood-line);
  border-radius: 12px;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-row.in-cart {
  border-color: var(--gold);
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--cream);
  line-height: 1.3;
}

.product-price {
  font-size: 13px;
  color: var(--cream-dim);
  margin-top: 2px;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--wood-line);
  background: var(--bg-panel);
  color: var(--gold-bright);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn.minus {
  color: var(--cream-dim);
}

.qty-btn:active {
  background: var(--gold);
  color: var(--bg-deep);
}

.qty-value {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--gold-bright);
}

.add-btn {
  background: var(--gold);
  color: var(--bg-deep);
  border: none;
  border-radius: 9px;
  width: 34px;
  height: 34px;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- Order summary footer ---------- */

.order-summary {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-panel);
  border-top: 1px solid var(--gold);
  padding: 16px 20px;
  box-shadow: 0 -4px 16px var(--shadow);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-label {
  font-size: 14px;
  color: var(--cream-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-total {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--gold-bright);
}

/* ---------- Empty state ---------- */

.empty-category {
  text-align: center;
  color: var(--cream-dim);
  padding: 40px 20px;
  font-size: 14px;
}
.product-tag {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
}


.btn-print {
  background: var(--gold);
  color: var(--bg-card);
}

/* --- Categorii pe 2 randuri, fara scroll (adaugat 16.07.2026) --- */
.category-tabs { overflow-x: visible; flex-wrap: wrap; }
.tab-arrow { display: none; }

/* --- Categorii: exact 2 randuri (5 pe rand) --- */
.category-tabs { gap: 6px; }
.cat-tab { flex: 1 1 calc(20% - 6px); min-width: 0; padding: 8px 4px; font-size: 12px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ BARA MESEI — varianta cu BF si suma (19.08.2026) ============
   Ordinea: [nr masa] [BF] [suma] ..... [imprimanta] [cos]
   BF sta INAINTEA sumei fiindca are latime fixa; suma e variabila si l-ar
   impinge incolo si incoace de la o masa la alta.
   Felul platii si CUI-ul NU mai sunt aici — se aleg in fereastra BF.        */

.order-topbar {
  gap: 8px;
  padding: 12px 12px;
}

.masa-nr {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
  color: var(--gold-bright);
  flex-shrink: 0;
  min-width: 20px;
  text-align: center;
}

/* --- BF: singurul element plin din bara. Restul sunt neutre, ca sa strige
       unul singur. Latime dubla fata de o icoana. --- */
.btn-bf {
  flex-shrink: 0;
  width: 84px;
  height: 40px;
  border-radius: 10px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1.5px;
  background: #c2502f;
  color: #fdf3e6;
  box-shadow: 0 0 0 2px rgba(194, 80, 47, 0.3), 0 2px 10px rgba(194, 80, 47, 0.42);
}

.btn-bf:active { filter: brightness(0.85); }

.btn-bf:disabled {
  background: var(--bg-card);
  color: var(--cream-dim);
  box-shadow: none;
  border: 1px solid var(--wood-line);
  opacity: 0.5;
}

/* --- suma: caseta alba, cifre ingrosate --- */
.masa-total {
  height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  background: #ffffff;
  color: #1a1206;
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* --- imprimanta si cosul: neutre, ca sa nu concureze cu BF --- */
.bara-icoane {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.order-topbar .btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0;
}

.order-topbar .btn-icon svg { width: 21px; height: 21px; display: block; }

.order-topbar .btn-print { color: var(--gold-bright); background: rgba(0, 0, 0, 0.22); }
/* cosul e neutru intentionat: rosul din bara e rezervat lui BF */
.order-topbar .btn-clear { color: var(--cream-dim); }

.order-topbar .btn-icon:active { background: rgba(0, 0, 0, 0.4); }

.casa-avertisment {
  font-size: 12px;
  color: #e0a35a;
  padding: 8px 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--wood-line);
  line-height: 1.35;
}
.casa-avertisment[hidden] { display: none; }

@media (max-width: 380px) {
  .order-topbar { gap: 6px; padding: 10px 8px; }
  .masa-nr { font-size: 25px; }
  .btn-bf { width: 72px; font-size: 16px; }
  .masa-total { font-size: 15px; padding: 0 9px; }
  .order-topbar .btn-icon { width: 36px; height: 36px; }
}

/* ---------------- Fereastra de previzualizare ---------------- */

.fiscal-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 100;
  overflow-y: auto;
}
.fiscal-modal[hidden] { display: none; }

.fiscal-caseta {
  background: var(--bg-panel);
  border: 1px solid var(--wood-line);
  border-radius: 16px;
  padding: 16px 14px 14px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  max-height: 94vh;
  overflow-y: auto;
}

.fiscal-eticheta {
  font-size: 12px;
  color: var(--cream-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* --- alegerea platii, in fereastra --- */
.plata-alegere {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-plata {
  border: 1px solid var(--wood-line);
  background: var(--bg-card);
  color: var(--cream-dim);
  border-radius: 10px;
  padding: 12px 6px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-plata svg { width: 19px; height: 19px; }

.btn-plata.activ {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-deep);
}

#pl-card.activ { background: #7ea36a; border-color: #7ea36a; }

/* --- CUI, in fereastra --- */
.cui-linie {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-cui {
  flex: 1;
  border: 1px dashed var(--wood-line);
  background: transparent;
  color: var(--cream-dim);
  border-radius: 10px;
  padding: 11px 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.cui-camp { display: flex; align-items: center; gap: 7px; width: 100%; }

#cui-prefix {
  background: var(--bg-card);
  border: 1px solid var(--wood-line);
  color: var(--gold-bright);
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

#cui-numar {
  flex: 1;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  color: var(--cream);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;         /* sub 16px, telefonul mareste pagina la focus */
  font-family: 'Inter', sans-serif;
  letter-spacing: 1px;
}
#cui-numar:focus { outline: none; border-color: var(--gold-bright); }

.cui-sterge {
  background: transparent;
  border: 1px solid var(--wood-line);
  color: var(--cream-dim);
  border-radius: 10px;
  width: 40px; height: 40px;
  flex-shrink: 0;
}

/* --- hartia --- */
.hartie {
  background: #f6f1e6;
  color: #1c1410;
  border-radius: 8px;
  padding: 13px 11px;
  text-align: left;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
  margin-bottom: 14px;
}
.hartie .mare { font-size: 15px; font-weight: 700; }
.hartie .sigla { color: #8a7a5e; font-style: italic; }

.fiscal-actiuni { display: flex; flex-direction: column; gap: 9px; }

.fiscal-btn {
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4px;
  font-family: 'Inter', sans-serif;
}
.fiscal-btn-principal { background: #e8b93f; color: #241a10; }
.fiscal-btn-secundar {
  background: transparent;
  border: 1px solid var(--wood-line);
  color: var(--cream-dim);
}
.fiscal-btn:active { filter: brightness(0.85); }
.fiscal-btn:disabled { opacity: 0.5; }

.fiscal-semn { font-size: 42px; line-height: 1; margin-bottom: 6px; }
.fiscal-semn.ok  { color: var(--green-ok); }
.fiscal-semn.rau { color: #c96a52; }

.fiscal-titlu {
  font-family: 'Playfair Display', serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 8px;
}

.fiscal-mesaj {
  font-size: 14px;
  color: var(--cream-dim);
  line-height: 1.5;
  margin-bottom: 16px;
  word-break: break-word;
}
.fiscal-mesaj strong { color: var(--gold-bright); }

.fiscal-rotita {
  width: 42px; height: 42px;
  margin: 6px auto 14px;
  border: 3px solid var(--wood-line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: fiscal-invarte 0.9s linear infinite;
}
@keyframes fiscal-invarte { to { transform: rotate(360deg); } }
