/* PropoVend - Ελληνική Εφαρμογή Vending */
:root {
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --secondary: #1976d2;
  --accent: #ff6f00;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #f57f17;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #dde1e7;
  --text: #212121;
  --text-muted: #757575;
  --tab-active: #ffffff;
  --tab-inactive: #e3eaf5;
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
  --radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

#app-root {
  height: 100vh;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header / Status Bar ─── */
#statusbar {
  background: var(--primary-dark);
  color: white;
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 16px;
  font-size: 12px;
  flex-shrink: 0;
}
#statusbar .app-title { font-weight: 700; font-size: 15px; letter-spacing: .5px; }
#hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px 0 0;
  line-height: 1;
}
#logout-tab { opacity: .8; }
#logout-tab:hover { opacity: 1; background: rgba(255,255,255,0.08) !important; }

/* ─── Main Tabs ─── */
#main-tabs {
  display: flex;
  background: var(--primary);
  flex-shrink: 0;
  overflow-x: auto;
}
.main-tab {
  padding: 9px 18px;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all .2s;
  user-select: none;
}
.main-tab:hover { background: rgba(255,255,255,0.1); color: white; }
.main-tab.active {
  color: white;
  border-bottom-color: #ffb300;
  background: rgba(255,255,255,0.15);
}

/* ─── Tab Content ─── */
#content-area { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.tab-panel { display: none; flex: 1; min-height: 0; overflow: hidden; padding: 12px; flex-direction: column; }
.tab-panel.active { display: flex; flex-direction: column; }

/* ─── Sub Tabs ─── */
.sub-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 12px;
  gap: 2px;
}
.sub-tab {
  padding: 6px 16px;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--tab-inactive);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  border: 1px solid var(--border);
  border-bottom: none;
  user-select: none;
}
.sub-tab.active { background: var(--surface); color: var(--primary); }
.sub-panel { display: none; flex: 1; min-height: 0; }
.sub-panel.active { display: flex; flex-direction: column; }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

/* ─── Forms ─── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  align-items: end;
}
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-5 { grid-template-columns: repeat(5, 1fr); }

.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.field input, .field select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: white;
  color: var(--text);
  width: 100%;
  transition: border-color .2s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
}
.field input[readonly] { background: #f5f5f5; cursor: default; }

/* ─── Buttons ─── */
.btn {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-secondary { background: #455a64; color: white; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ─── AADE Settings fields ─── */
.aade-fields { display: flex; flex-direction: column; gap: 10px; }
.aade-field { display: flex; flex-direction: column; gap: 4px; }
.aade-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.aade-field input, .aade-field select { padding: 8px 10px; font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius); width: 100%; }

/* ─── Αδείασμα form row ─── */
#ad-form-row {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: nowrap;
}
.ad-form-field {
  display: flex; flex-direction: column; gap: 4px;
}
.ad-form-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ad-form-field input { padding: 7px 10px; font-size: 14px; }
#ad-form-row .ad-form-field:first-child { flex: 0 0 150px; }
#ad-form-row .ad-form-field:nth-child(2) { flex: 1; min-width: 90px; }
.ad-form-btn { flex: 0 0 auto; }
.ad-submit-btn { white-space: nowrap; }

/* ─── Login Page ─── */
#login-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0d47a1 0%, #1565c0 50%, #1976d2 100%);
  align-items: center; justify-content: center;
}
#login-box {
  background: #fff; border-radius: 12px;
  padding: 40px 36px 32px;
  width: 100%; max-width: 360px;
  box-shadow: 0 12px 48px rgba(0,0,0,.35);
  animation: modalIn .2s ease;
}
#login-logo {
  font-size: 28px; font-weight: 800; color: var(--primary);
  text-align: center; letter-spacing: 1px; margin-bottom: 4px;
}
#login-subtitle {
  font-size: 12px; color: var(--text-muted);
  text-align: center; margin-bottom: 28px;
}
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase;
}
.login-field input {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  outline: none; transition: border-color .2s;
}
.login-field input:focus { border-color: var(--primary); }
#login-error {
  background: #ffebee; color: var(--danger);
  border: 1px solid #ef9a9a; border-radius: var(--radius);
  padding: 9px 12px; font-size: 13px;
  margin-bottom: 14px; text-align: center;
}

/* ─── Custom Modal ─── */
#app-modal-overlay { display: none; }
#app-modal-box { animation: modalIn .15s ease; }
@keyframes modalIn {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ─── Tables ─── */
.data-table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}
.data-table th, .data-table td {
  white-space: nowrap;
  text-align: left;
}
/* Η .col-fill παίρνει όλο τον υπόλοιπο χώρο */
.data-table .col-fill { width: 100%; }
/* Όλες οι άλλες στήλες συρρικνώνονται στο περιεχόμενο */
#product-table th:not(:nth-child(2)),
#product-table td:not(.col-fill) { width: 1%; }
.data-table th {
  background: var(--primary);
  color: white;
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
.data-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: #e3f2fd; }
.ag-drop-item:hover { background: #e3f2fd !important; }
.data-table tr.selected td { background: #bbdefb; }
.table-wrap { overflow: auto; max-height: 380px; border: 1px solid var(--border); border-radius: 4px; outline: none; }
.table-wrap.flex-1 { max-height: none; }
.table-wrap-sm { max-height: 240px; }
.table-wrap-lg { max-height: 480px; }

.ag-search-input {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  width: 150px;
  box-sizing: border-box;
}
.ag-filter-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.ag-name-clear-btn {
  display: none;
}

/* ─── Badges ─── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.badge-blue { background: #e3f2fd; color: var(--primary); }
.badge-green { background: #e8f5e9; color: var(--success); }
.badge-red { background: #ffebee; color: var(--danger); }
.badge-orange { background: #fff3e0; color: var(--accent); }

/* ─── Status ─── (hidden) */

/* ─── Invoice Form ─── */
.invoice-form {
  background: white;
  border: 2px solid #333;
  padding: 16px;
  max-width: 720px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}
.invoice-header { text-align: center; margin-bottom: 12px; border-bottom: 2px solid #333; padding-bottom: 8px; }
.invoice-header .company { font-size: 15px; font-weight: bold; }
.invoice-header .sub { font-size: 11px; }
.invoice-customer { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 8px 0; }
.invoice-customer .field-row { display: flex; gap: 4px; align-items: baseline; }
.invoice-customer .field-row label { white-space: nowrap; font-weight: bold; font-size: 11px; }
.invoice-customer .field-row span {
  flex: 1; border-bottom: 1px solid #999; min-width: 80px; font-size: 11px;
}
.invoice-grid { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 11px; }
.invoice-grid th, .invoice-grid td { border: 1px solid #333; padding: 3px 5px; }
.invoice-grid th { background: #eee; text-align: center; }
.coins-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 6px; }
.coin-cell { border: 1px solid #999; padding: 3px 6px; text-align: center; font-size: 11px; }
.coin-header { font-weight: bold; font-size: 10px; }
.invoice-totals { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; font-weight: bold; }

/* ─── Loader ─── */
.loader {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid #ccc; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modal / Overlay ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: white; border-radius: var(--radius); padding: 20px;
  min-width: 360px; max-width: 90vw; box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 14px; }
.modal-footer { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; }

/* ─── Warehouse colors ─── */
.exp-ok { color: var(--success); }
.exp-warn { color: var(--warning); font-weight: bold; }
.exp-bad { color: var(--danger); font-weight: bold; background: #ffebee; }

/* ─── Password panel ─── */
#pass-panel {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
#pass-box {
  background: white; padding: 32px; border-radius: 8px;
  text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,.4);
  min-width: 280px;
}
#pass-box h2 { color: var(--primary); margin-bottom: 16px; font-size: 16px; }
#pass-input {
  width: 100%; padding: 8px; border: 2px solid var(--border);
  border-radius: 4px; font-size: 14px; text-align: center;
  letter-spacing: 4px; margin-bottom: 12px;
}
.pass-hint { font-size: 11px; color: var(--text-muted); }

/* ─── Utilities ─── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; min-height: 0; min-width: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-blue { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.num { font-family: monospace; text-align: left; }
.selected-row td { background: #bbdefb !important; }

input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.summary-box {
  background: var(--primary);
  color: white;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: bold;
  font-size: 14px;
  display: inline-block;
}

.editable-cell { background: #fffde7 !important; cursor: text; }

/* ─── ΑΓΟΡΕΣ layout ─── */
.agores-layout {
  height: 100%;
  overflow: hidden;
  min-height: 0;
}
.agores-form-panel {
  width: 420px;
  flex-shrink: 0;
  overflow-y: auto;
}
.agores-grid-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agores-grid-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE  (≤ 768px)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Typography & spacing ── */
  body { font-size: 14px; }
  .card { padding: 10px; margin-bottom: 8px; }
  .card-title { font-size: 13px; }

  /* ── Status bar: mobile — μεγαλύτερη για εύκολο άγγιγμα ── */
  #statusbar {
    padding: 12px 14px;
    min-height: 52px;
    gap: 12px;
  }
  #statusbar .app-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
  }
  #hamburger-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px 0 0;
    margin: -4px 0;
  }

  /* ── Desktop tabs: κρύβονται σε mobile ── */
  #main-tabs { display: none; }

  /* ── Side drawer ── */
  #side-drawer { display: none; }
  #side-drawer.open { display: flex !important; }
  #drawer-overlay.open { display: block !important; }

  .drawer-tab {
    display: block;
    padding: 14px 20px;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s;
  }
  .drawer-tab:hover, .drawer-tab.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--accent);
  }

  /* ── Tabs: scrollable strip ── */
  #main-tabs { -webkit-overflow-scrolling: touch; }
  .main-tab { padding: 10px 14px; font-size: 12px; white-space: nowrap; }
  .sub-tab  { padding: 8px 12px;  font-size: 12px; }

  /* ── Tab content: full padding reduction ── */
  .tab-panel { padding: 8px; }

  /* ── ΑΓΟΡΕΣ: mobile layout ── */
  #tab-agores.tab-panel.active {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .agores-layout {
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    flex: none !important;
    width: 100%;
  }
  .agores-form-panel {
    width: 100% !important;
    overflow-y: visible !important;
    flex-shrink: 0;
    order: 0;
    display: block !important;
  }
  .agores-grid-panel {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    flex: none !important;
    order: 1;
    min-height: 280px !important;
    height: auto !important;
    overflow: hidden !important;
    margin-top: 8px;
    margin-bottom: 0;
  }
  .agores-grid-card {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    height: auto !important;
    min-height: 280px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: 0;
  }
  #tab-agores .agores-grid-card > .flex {
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  #tab-agores .agores-grid-card > .flex .card-title {
    flex: 1 1 100%;
    min-width: 0;
  }
  #tab-agores #ag-search {
    width: 100% !important;
    max-width: 100%;
    flex: 1 1 100%;
    box-sizing: border-box;
  }
  #tab-agores .ag-filter-label {
    flex: 0 0 auto;
    font-size: 13px;
    min-height: 40px;
    padding: 4px 0;
  }
  .ag-name-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
    width: 100%;
  }
  .ag-name-row #ag-name {
    flex: 1;
    min-width: 0;
  }
  .ag-name-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #f5f5f5;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  .ag-name-clear-btn:active {
    background: #e0e0e0;
  }
  #tab-agores .table-wrap.flex-1 {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100%;
    min-height: 200px !important;
    max-height: 42vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    border: none;
    background: transparent;
    box-sizing: border-box;
    padding: 0;
  }
  /* Προϊόντα: συμπαγή cards (2 γραμμές) — πλήρες πλάτος */
  #tab-agores #product-table.data-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate;
  }
  #tab-agores #product-table thead {
    display: none !important;
  }
  #tab-agores #product-table tbody {
    display: block !important;
    width: 100%;
    max-width: 100%;
  }
  #tab-agores #product-table th,
  #tab-agores #product-table td {
    width: auto !important;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal !important;
  }
  #tab-agores #product-table tr.pr-card-row {
    display: block !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
  }
  #tab-agores #product-table tr.pr-card-row:hover {
    border-color: var(--primary);
  }
  #tab-agores #product-table tr.pr-card-row.selected-row {
    background: #e3f2fd;
    border-color: var(--primary);
  }
  #tab-agores #product-table .pr-card-cell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    border: none !important;
    white-space: normal !important;
    box-sizing: border-box;
  }
  #tab-agores #product-table .pr-card-line1 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 5px;
    line-height: 1.25;
    width: 100%;
    max-width: 100%;
  }
  #tab-agores #product-table .pr-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    min-width: 0;
    word-break: break-word;
  }
  #tab-agores #product-table .pr-card-stock {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
  }
  #tab-agores #product-table .pr-card-line2 {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 11px;
    color: var(--text-muted);
    align-items: center;
    line-height: 1.3;
    width: 100%;
    max-width: 100%;
  }
  #tab-agores #product-table .pr-card-line2 .badge {
    font-size: 10px;
    padding: 1px 6px;
  }
  #tab-agores #product-table tr td[colspan] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: 16px 12px !important;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
  }

  /* ── Forms: full width ── */
  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .form-grid-5 { grid-template-columns: 1fr 1fr !important; }

  /* ── Touch-friendly inputs & buttons ── */
  input, select, textarea {
    font-size: 16px !important; /* prevents iOS zoom */
    min-height: 40px;
    padding: 8px !important;
  }
  .btn { min-height: 42px; padding: 10px 14px; font-size: 13px; }
  .btn-sm { min-height: 36px; padding: 7px 10px; font-size: 12px; }

  /* ── Tables → Cards (εκτός από πίνακες με εισαγωγή δεδομένων) ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); }
  .data-table { min-width: unset; width: 100%; }

  /* Card transform μόνο για sales (όχι product-table) */
  #sales-table,
  #sales-table tbody {
    display: block;
    width: 100%;
  }

  #sales-table thead { display: none; }

  #sales-table tr {
    display: flex;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    padding: 8px;
    box-shadow: var(--shadow);
    gap: 4px 12px;
    width: 100%;
  }
  #sales-table tr:hover td { background: transparent; }

  #sales-table td {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    min-width: 70px;
    flex: 1;
    border: none;
    padding: 4px 2px;
    white-space: normal;
  }
  #sales-table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
  }
  #sales-table td[data-label=""]::before { display: none; }

  /* ── Απολογισμός πωλήσεων: card transform ── */
  #pol-report-table thead { display: none; }
  #pol-report-table tr {
    display: flex; flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 8px; padding: 8px; box-shadow: var(--shadow); gap: 4px 12px;
  }
  #pol-report-table tr:hover td { background: transparent; }
  #pol-report-table td {
    display: flex; flex-direction: column;
    font-size: 12px; flex: 1; border: none; padding: 4px 2px;
  }
  #pol-report-table td::before {
    content: attr(data-label);
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; margin-bottom: 2px;
  }
  #pol-report-table tr td:first-child {
    flex: 1 1 100%; font-size: 14px; font-weight: 700;
    border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 2px;
  }
  /* Αφαίρεση max-height σε mobile */
  #pol-report-wrap .table-wrap { max-height: none !important; overflow: visible !important; }

  /* tfoot ΣΥΝΟΛΟ */
  #pol-report-tfoot tr {
    display: flex; flex-wrap: wrap;
    background: #e8f5e9; border-radius: var(--radius);
    padding: 8px; gap: 4px 12px; font-weight: 700;
  }
  #pol-report-tfoot td { display: flex; flex: 1; font-size: 13px; }

  /* Προϊόν (3ο td στο sales) → full width header */
  #sales-table tr td:nth-child(3) {
    flex: 1 1 100%;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin-bottom: 2px;
    order: -1;
  }

  /* Editable cells */
  .data-table td.editable-cell { flex: 1 1 100%; }
  .data-table td.editable-cell input { width: 100%; font-size: 15px; border: 1px solid var(--border); border-radius: 4px; padding: 6px; }

  /* ── Dropdown ονόματος προϊόντος ── */
  #ag-name-drop { font-size: 15px; }
  #ag-name-drop .ag-drop-item { padding: 10px 12px; }

  /* ── Invoice form ── */
  #sub-tim-form .flex { flex-direction: column; }
  #sub-tim-form .flex > div { width: 100% !important; }

  /* ── Κουμπιά απογραφής 50%/50% ── */
  #sub-apografi .card button {
    flex: 1 !important;
    min-width: 0 !important;
    font-size: 12px;
  }

  /* ── Απογραφή: full width + height (μόνο όταν είναι active) ── */
  #sub-apografi.active {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-height: 0 !important;
  }
  #sub-apografi.active > .card { flex-shrink: 0; width: 100% !important; }
  #sub-apografi.active > .flex-1 {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #sub-apografi.active .table-wrap {
    flex: 1 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }
  /* ── Απογραφή: card transform ── */
  #apografi-table { table-layout: auto !important; width: 100% !important; }
  #apografi-table colgroup { display: none; }
  #apografi-table thead { display: none; }
  #apografi-table tr {
    display: flex;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    padding: 8px;
    box-shadow: var(--shadow);
    gap: 4px 8px;
    align-items: center;
  }
  #apografi-table tr:hover td { background: transparent; }
  #apografi-table td {
    display: flex;
    flex-direction: column;
    border: none;
    padding: 2px;
    white-space: normal;
    font-size: 13px;
  }
  #apografi-table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  /* ROW 1: Α.Α (κρυφό) + Όνομα (flex) + Σύστ. + Σύνολο — όλα σε μια γραμμή */
  #apografi-table tr td:nth-child(1) { flex: 0 0 0; overflow:hidden; padding:0; margin:0; font-size:0; }
  #apografi-table tr td:nth-child(2) { flex: 1 1 50%; font-weight:700; font-size:14px; min-width:120px; }
  #apografi-table tr td:nth-child(3) { flex: 0 1 60px; min-width:50px; }
  #apografi-table tr td:nth-child(4) { flex: 0 1 60px; min-width:50px; }
  /* Διαχωριστής μεταξύ 1ης και 2ης γραμμής */
  #apografi-table tr td:nth-child(4) { border-right: none; }

  /* Σύστ. + Σύνολο έντονα */
  #apografi-table tr td:nth-child(3),
  #apografi-table tr td:nth-child(4) { font-weight: 700; font-size: 13px; }

  /* ROW 2: Απογρ.1 Απογρ.2 Απογρ.3 — χωρίς label, ισόποσα */
  #apografi-table tr td:nth-child(5),
  #apografi-table tr td:nth-child(6),
  #apografi-table tr td:nth-child(7) {
    flex: 1 1 30%;
    min-width: 80px;
    border-top: 1px solid var(--border);
    padding-top: 6px;
    margin-top: 2px;
  }
  #apografi-table tr td:nth-child(5)::before,
  #apografi-table tr td:nth-child(6)::before,
  #apografi-table tr td:nth-child(7)::before { display: none; }
  #apografi-table td.editable-cell input {
    width: 100%;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 6px;
    text-align: right;
    background: #fffde7;
  }

  /* ── Επιστροφές / Καταστροφές: mobile layout ── */
  #tab-epistrofes .flex,
  #tab-katastrofes .flex { flex-direction: column; height: auto !important; }

  /* Αριστερή φόρμα: full width */
  #tab-epistrofes .flex > div:first-child,
  #tab-katastrofes .flex > div:first-child {
    width: 100% !important; flex-shrink: unset; overflow-y: visible;
  }
  /* Δεξί ιστορικό: fixed height ώστε να scrollάρει */
  #tab-epistrofes .flex > div:last-child,
  #tab-katastrofes .flex > div:last-child {
    overflow: hidden; height: 45vh;
  }

  /* Batches πίνακας: μικρότερος σε mobile */
  #ep-batches, #kat-batches { font-size: 12px; }
  .table-wrap-sm { max-height: 120px; }

  /* Κουμπιά φόρμας: full width */
  #tab-epistrofes .btn-group,
  #tab-katastrofes .btn-group { flex-direction: column; }
  #tab-epistrofes .btn-group .btn,
  #tab-katastrofes .btn-group .btn { width: 100%; text-align: center; }

  /* ── Flex rows → wrap ── */
  .flex.gap-8, .flex.gap-12 { flex-wrap: wrap; }

  /* ── Summary box full width ── */
  .summary-box { display: block; text-align: center; width: 100%; }

  /* ── Τιμολόγια - Φόρτωση δεδομένων: card transform ── */
  #tim-items-table thead { display: none; }
  #tim-items-table tr {
    display: flex; flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 8px; padding: 10px 12px; box-shadow: var(--shadow); gap: 4px 10px;
    align-items: center;
  }
  #tim-items-table tr:hover td { background: transparent; }
  #tim-items-table td {
    display: flex; flex-direction: column;
    font-size: 12px; flex: 1; border: none; padding: 3px 2px; min-width: 55px;
  }
  #tim-items-table td::before {
    content: attr(data-label);
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; margin-bottom: 2px;
  }
  /* Header cell: full width τίτλος κάρτας */
  #tim-items-table .tim-card-header {
    flex: 1 1 100%; font-size: 13px;
    border-bottom: 1px solid var(--border); padding-bottom: 7px; margin-bottom: 2px;
  }
  #tim-items-table .tim-card-header::before { display: none; }
  /* ΤΙΜ/ΣΗ input: full width, μεγάλο */
  #tim-items-table .tim-qty-cell {
    flex: 1 1 100%; flex-direction: row; align-items: center; gap: 8px;
    border-top: 1px solid var(--border); padding-top: 7px; margin-top: 2px;
  }
  #tim-items-table .tim-qty-cell::before { flex-shrink: 0; }
  #tim-items-table .tim-qty-cell input {
    width: 100% !important; border: 1.5px solid var(--primary) !important;
    border-radius: var(--radius); padding: 6px 10px; font-size: 16px;
    background: #e8f0fe !important; text-align: left !important;
    min-height: 40px;
  }

  /* ── Επιστροφές: card transform ── */
  #returns-table thead { display: none; }
  #returns-table tr {
    display: flex; flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 8px; padding: 10px 12px; box-shadow: var(--shadow); gap: 4px 12px;
  }
  #returns-table tr:hover td { background: transparent; }
  #returns-table td {
    display: flex; flex-direction: column;
    font-size: 12px; flex: 1; border: none; padding: 3px 2px; min-width: 70px;
  }
  #returns-table td::before {
    content: attr(data-label);
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; margin-bottom: 2px;
  }
  #returns-table td:nth-child(4) { flex: 1 1 100%; font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 2px; }
  #returns-table td:nth-child(1), #returns-table td:nth-child(3) { flex: 0 0 60px; font-size: 11px; color: var(--text-muted); }

  /* ── Καταστροφές: card transform ── */
  #dest-table thead { display: none; }
  #dest-table tr {
    display: flex; flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 8px; padding: 10px 12px; box-shadow: var(--shadow); gap: 4px 12px;
  }
  #dest-table tr:hover td { background: transparent; }
  #dest-table td {
    display: flex; flex-direction: column;
    font-size: 12px; flex: 1; border: none; padding: 3px 2px; min-width: 70px;
  }
  #dest-table td::before {
    content: attr(data-label);
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; margin-bottom: 2px;
  }
  /* Προϊόν → full width header */
  #dest-table td:nth-child(4) { flex: 1 1 100%; font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 2px; }
  /* # και ID → compact */
  #dest-table td:nth-child(1), #dest-table td:nth-child(3) { flex: 0 0 60px; font-size: 11px; color: var(--text-muted); }

  /* ── Αδείασμα: card transform ── */
  #ad-table thead { display: none; }
  #ad-table tr {
    display: flex; flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 8px; padding: 10px 12px; box-shadow: var(--shadow); gap: 4px 16px;
    align-items: center;
  }
  #ad-table tr:hover td { background: transparent; }
  #ad-table td {
    display: flex; flex-direction: column;
    font-size: 13px; flex: 1; border: none; padding: 2px 4px; min-width: 80px;
  }
  #ad-table td::before {
    content: attr(data-label);
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; margin-bottom: 2px;
  }
  #ad-table td:first-child { flex: 0 0 auto; min-width: 40px; font-size:11px; color:var(--text-muted); }
  #ad-table td:nth-child(2) { flex: 2; }
  #ad-table td:nth-child(3) { flex: 1; }
  #ad-table .ad-del-cell { flex: 0 0 auto; align-items: flex-end; justify-content: center; }
  #ad-table .ad-del-cell::before { display: none; }

  /* Κουμπί κλεισίματος full width σε mobile */
  #ad-close-btn { width: 100%; }
  /* Φόρμα εισαγωγής αδεiasmάτος — WebView-safe */
  #tab-adeiasma.tab-panel.active {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  #tab-adeiasma .card {
    max-width: 100% !important;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
  }
  #ad-form-row {
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    align-items: flex-end;
  }
  #ad-form-row .ad-form-field:first-child,
  #ad-form-row .ad-form-btn {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .ad-form-field input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    min-height: 42px;
  }
  .ad-form-btn .btn,
  .ad-submit-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    font-size: 14px;
    justify-content: center;
    padding: 10px 12px;
  }
}
