:root {
  --bg: #eef3f8;
  --card: #ffffff;
  --text: #16304f;
  --primary: #14b8ff;
  --primary-dark: #0284c7;
  --border: #d7e3ef;
  --muted: #64748b;
  --nav: #0f172a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: #2563eb; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--nav); color: white; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.sidebar a { color: white; text-decoration: none; padding: 11px 12px; border-radius: 10px; }
.sidebar a:hover { background: rgba(255,255,255,0.12); }
.brand-box { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: white; padding: 4px; }
.content { flex: 1; padding: 24px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.lang-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-pill { text-decoration: none; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: white; color: var(--text); }
.lang-pill.active { background: #e0f2fe; border-color: var(--primary); }
.card, .ticket-sheet { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: 0 10px 30px rgba(15,23,42,0.05); }
.small-card { max-width: 420px; margin: 50px auto; }
.grid { display: grid; gap: 16px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 24px; }
.two-col, .two-col-wide { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.three-col { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.btn { display: inline-block; background: var(--primary); color: white; padding: 11px 16px; border-radius: 10px; border: none; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #475569; }
.btn-small { padding: 7px 10px; font-size: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; margin-bottom: 12px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.check { flex-direction: row; align-items: center; gap: 8px; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.flash.success { background: #dcfce7; }
.flash.danger { background: #fee2e2; }
.flash.info { background: #dbeafe; }
.flash.warning { background: #fef3c7; }
.summary-box { margin-top: 18px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; max-width: 340px; background: #f8fbff; }
.muted { color: var(--muted); }
.small-label { font-size: 12px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-actions-gap { margin-top: 14px; }
.dashboard-stats .stat-card { display: flex; flex-direction: column; gap: 8px; min-height: 110px; justify-content: center; }
.stat-number { font-size: 30px; font-weight: 800; color: var(--primary-dark); }
.stat-label { font-size: 14px; color: var(--muted); font-weight: 700; }
.ticket-word { font-size: 40px; font-weight: 900; letter-spacing: .04em; color: #075985; }
.invoice-header { display: flex; justify-content: space-between; gap: 20px; padding: 16px; border: 2px solid #cceeff; border-radius: 16px; background: linear-gradient(180deg, #f0faff, #ffffff); }
.ticket-only-header { align-items: center; }
.invoice-chip { display: inline-block; background: #e0f2fe; color: #075985; padding: 6px 10px; border-radius: 999px; font-weight: 700; margin-top: 8px; }
.invoice-id-box { text-align: right; }
.big-id { font-size: 34px; font-weight: 800; color: #0369a1; }
.compact-info-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 12px; margin: 18px 0; }
.info-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: white; }
.info-card.compact { min-height: 88px; }
.info-card .label, .section-title { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.products-box { border: 2px solid #d7efff; border-radius: 16px; padding: 10px 14px; background: #ffffff; }
.invoice-table thead th { color: #075985; }
.invoice-table tfoot td { font-weight: 800; color: #075985; border-top: 2px solid #cceeff; }
.invoice-total-row td:last-child { font-size: 24px; }
.terms-box { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: #fff; }
.terms-after-products { margin-top: 14px; }
.no-print { display: flex; }
.settings-tools-grid { margin-top: 18px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.top-gap { margin-top: 16px; }
.ticket-sheet.80mm { max-width: 80mm; }
.ticket-sheet.4x6 { width: 4in; min-height: 6in; }
.ticket-sheet.a4 { width: min(900px, 100%); margin: 0 auto; }
@media (max-width: 960px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .compact-info-grid { grid-template-columns: 1fr; }
}
@media print {
  body { background: white; }
  .sidebar, .flash, .no-print, .topbar { display: none !important; }
  .content { padding: 0; }
  .ticket-sheet, .card { box-shadow: none; }
}

.table-scroll { max-height: 420px; overflow: auto; border-radius: 14px; }
.search-row { display:flex; gap:10px; align-items:center; margin-bottom:14px; }
.search-row input { flex:1; }
.btn-wide { min-width: 240px; }
.actions-row form { margin: 0; }


.ticket-form-actions .primary-action { min-width: 320px; font-size: 15px; font-weight: 700; }
.print-reference-block {
  border: 1px solid #c9d6e2;
  background: #edf6f6;
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 14px;
}
.print-top-line { height: 4px; background: #11c5b2; }
.print-reference-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 6px;
}
.print-ticket-title {
  font-size: 36px;
  font-weight: 900;
  color: #08345f;
  letter-spacing: .03em;
}
.print-ticket-no {
  font-size: 22px;
  font-weight: 900;
  color: #08345f;
  text-align: right;
}
.print-reference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  padding: 4px 18px 18px;
}
.print-ref-col { display: grid; gap: 16px; }
.print-ref-row {
  font-size: 17px;
  line-height: 1.5;
  color: #0f172a;
}
.print-ref-label { font-weight: 800; }
.print-ref-value { font-weight: 500; }
.reference-products-box {
  border: 1px solid #d7e3ef;
  border-radius: 0;
  background: #fff;
  padding-top: 0;
}
.reference-products-box .invoice-table { margin-top: 0; }
.reference-products-box .invoice-table th { color: #08345f; font-weight: 800; }
.reference-products-box .invoice-table td,
.reference-products-box .invoice-table th { padding-top: 11px; padding-bottom: 11px; }
.terms-after-products { border-radius: 0; }
@media (max-width: 700px) {
  .print-reference-grid { grid-template-columns: 1fr; gap: 12px; }
  .print-reference-header { align-items: flex-start; gap: 10px; }
  .print-ticket-title { font-size: 28px; }
}
@media print {
  .ticket-sheet { padding: 0; border: none; }
  .print-reference-block,
  .reference-products-box,
  .terms-after-products { break-inside: avoid; }
  .print-ref-row { font-size: 13px; }
  .print-ticket-title { font-size: 28px; }
  .print-ticket-no { font-size: 18px; }
}

.reference-like{border-radius:0;background:#edf6f6;border:1px solid #d9e5e5;}
.sample-style{grid-template-columns:1fr 1fr;gap:34px;padding-top:14px;}
.reference-like .print-ref-row{font-size:15px;line-height:1.65;}
.reference-like .print-ref-label{font-weight:800;color:#0f172a;}
.reference-like .print-ref-value{font-weight:500;}

.print-ticket-heading{display:flex;justify-content:space-between;align-items:flex-end;margin:0 0 12px;}.print-ticket-word{font-size:48px;font-weight:900;color:#0b5fa5;letter-spacing:.03em;}.print-ticket-id-line{font-size:28px;font-weight:900;color:#0b5fa5;}.skyblue-print{background:#eef8fd;border-color:#b9e2f7;}.print-top-line.sky{background:#38bdf8;}.reference-products-box .invoice-total-row td{color:#0b5fa5;} .no-print-title{font-size:1px;color:transparent;height:0;margin:0;padding:0;}

.print-ticket-heading.only-id{justify-content:flex-end;align-items:flex-start;margin-bottom:10px;}
.print-ticket-heading.only-id .print-ticket-id-line{font-size:28px;font-weight:900;color:#0b5fa5;}

@media print {
  .products-box, .reference-products-box, .invoice-table { break-inside:auto; }
  .invoice-table thead { display: table-header-group; }
  .invoice-table tr, .invoice-table td, .invoice-table th { break-inside: avoid; }
  .terms-after-products { break-inside: avoid; }
}


.invoice-summary-block{display:flex;flex-direction:column;gap:8px;align-items:flex-end;padding:14px 18px 0;border-top:2px solid #38bdf8;margin-top:8px;}
.invoice-summary-row{display:flex;justify-content:space-between;gap:24px;min-width:240px;font-size:16px;color:#0b5fa5;font-weight:700;}
.invoice-summary-row strong{font-weight:900;}
@media print {
  .invoice-summary-block{break-inside:avoid;page-break-inside:avoid;}
}

.content { min-width: 0; }
.stock-low { color: #9a3412; font-weight: bold; }
.label-preview { max-width: 100%; background: white; border: 1px solid #ccc; }
@media(max-width: 700px) {
 .content { padding: 12px; } .card { padding: 14px; }
 .sidebar { padding: 12px; flex-direction: row; flex-wrap: wrap; gap: 4px; }
 .brand-box { width: 100%; } .sidebar a { padding: 8px; }
 .header-row, .search-row { flex-wrap: wrap; }
 .two-col, .two-col-wide, .three-col { grid-template-columns: minmax(0,1fr); }
 .ticket-form-actions .primary-action, .btn-wide { min-width: 0; width: 100%; }
 input, select, textarea { font-size: 16px; }
 #items-table { min-width: 680px; }
 .topbar-actions { flex-wrap: wrap; }
}

@media(max-width:700px) {
 #items-table, .stock-table { min-width: 0; }
 #items-table thead, .stock-table thead { display: none; }
 #items-table tbody, .stock-table tbody { display: block; }
 #items-table tr, .stock-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 0; border-bottom: 2px solid var(--border); }
 #items-table td, .stock-table td { display: block; border: 0; padding: 0; overflow-wrap: anywhere; }
 #items-table td:nth-child(1), #items-table td:nth-child(2), .stock-table td:first-child { grid-column: 1 / -1; }
 #items-table td:nth-child(2)::before { content: 'Product'; }
 #items-table td:nth-child(3)::before { content: 'Quantity'; }
 #items-table td:nth-child(4)::before { content: 'Price'; }
 #items-table td:nth-child(5)::before { content: 'Line total'; }
 #items-table td::before, .stock-table td::before { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
 .stock-table td:first-child { font-size: 18px; font-weight: 700; }
 .stock-table td:nth-child(2)::before { content: 'Category'; }
 .stock-table td:nth-child(3)::before { content: 'Quality'; }
 .stock-table td:nth-child(4)::before { content: 'Barcode'; }
 .stock-table td:nth-child(5)::before { content: 'Stock remaining'; }
 .stock-table td:nth-child(6)::before { content: 'Price'; }
 .stock-table td:nth-child(5) { font-size: 20px; }
 .table-scroll { max-height: none; }
}
