/* Franchise Portal — stylesheet
   Χωρίς build step, χωρίς CDN. Ένα αρχείο, σερβίρεται ως έχει. */

:root {
  --brand:        #0b3d91;
  --brand-dark:   #082c6b;
  --brand-light:  #e8eefb;

  --ink:      #1f2933;
  --ink-soft: #52606d;
  --ink-mute: #7b8794;

  --line:     #e4e7eb;
  --line-soft:#f0f2f5;
  --bg:       #f4f5f7;
  --surface:  #ffffff;

  --green: #0a7c42;  --green-bg: #e6f4ec;
  --blue:  #1c6fd4;  --blue-bg:  #e7f0fb;
  --amber: #a35c00;  --amber-bg: #fdf1e0;
  --red:   #b3261e;  --red-bg:   #fce9e8;
  --gray:  #52606d;  --gray-bg:  #eceff2;

  --radius:    8px;
  --radius-sm: 5px;
  --shadow:    0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 4px 12px rgba(16,24,40,.10);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.16);

  --topbar-h: 56px;
  --sidebar-w: 232px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand); color: #fff; padding: 10px 16px;
}
.skip-link:focus { left: 8px; top: 8px; }

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

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 50;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--brand); color: #fff;
}

.topbar-brand {
  display: flex; align-items: center; gap: 9px;
  color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .01em;
}
.topbar-brand:hover { text-decoration: none; opacity: .92; }
.topbar-logo { font-size: 19px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.topbar-store {
  font-size: 12.5px; color: rgba(255,255,255,.88);
  background: rgba(255,255,255,.12); padding: 4px 10px; border-radius: 100px;
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}

.topbar-toggle {
  display: none; flex-direction: column; gap: 4px; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: none; border: 0; cursor: pointer;
}
.topbar-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; }

.usermenu { position: relative; }
.usermenu summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 4px; border-radius: var(--radius-sm);
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: rgba(255,255,255,.12); }
.usermenu-name { font-size: 13px; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.22); color: #fff;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
  text-transform: uppercase;
}

.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.usermenu-panel a, .usermenu-panel button {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; font-size: 13.5px; color: var(--ink);
  background: none; border: 0; font-family: inherit; cursor: pointer;
}
.usermenu-panel a:hover, .usermenu-panel button:hover {
  background: var(--line-soft); text-decoration: none;
}
.usermenu-panel button { border-top: 1px solid var(--line); color: var(--red); }

/* --- Shell ---------------------------------------------------------------- */

.shell { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 14px 10px 32px;
  background: var(--surface); border-right: 1px solid var(--line);
  z-index: 40;
}

.nav-group { margin-bottom: 18px; }
.nav-title {
  padding: 0 10px 5px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute);
}

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin-bottom: 1px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 13.5px; font-weight: 500;
}
.nav-link:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex: none; }

.nav-backdrop {
  display: none; position: fixed; inset: var(--topbar-h) 0 0 0;
  background: rgba(16,24,40,.45); z-index: 39;
}

.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 22px 26px 60px;
}

/* --- Page header ---------------------------------------------------------- */

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head-text { min-width: 0; }
.page-sub { margin: 3px 0 0; color: var(--ink-mute); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.breadcrumb {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin-bottom: 8px; font-size: 12.5px; color: var(--ink-mute);
}
.breadcrumb a { color: var(--ink-mute); }
.breadcrumb a:hover { color: var(--brand); }

/* --- Cards ---------------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-body { padding: 16px; }
.card-body-flush { padding: 0; }
.card-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  background: var(--line-soft); border-radius: 0 0 var(--radius) var(--radius);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Κάρτες επιλογής έτοιμου σχεδίου προσφοράς. */
.preset-option { border: 1px solid var(--border, #d7dce2); border-radius: 10px; padding: 12px 14px; }
.preset-option.is-active { border-color: var(--primary, #0b3d91); box-shadow: inset 0 0 0 1px var(--primary, #0b3d91); }

.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* --- Stats ---------------------------------------------------------------- */

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow);
}
.stat-label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-mute); margin-bottom: 5px;
}
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.15; color: var(--ink); }
.stat-value.sm { font-size: 19px; }
.stat-meta { margin-top: 4px; font-size: 12px; color: var(--ink-mute); }
.stat-accent-green { border-left: 3px solid var(--green); }
.stat-accent-blue  { border-left: 3px solid var(--blue); }
.stat-accent-amber { border-left: 3px solid var(--amber); }
.stat-accent-red   { border-left: 3px solid var(--red); }

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

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 14px; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-mute); background: var(--line-soft);
  border-bottom: 1px solid var(--line);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .shrink { width: 1%; white-space: nowrap; }
.table-fixed { table-layout: fixed; }

.cell-strong { font-weight: 600; color: var(--ink); }
.cell-sub { display: block; font-size: 12px; color: var(--ink-mute); margin-top: 1px; }
.cell-mono { font-family: var(--mono); font-size: 12.5px; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-mute); }
.empty-icon { font-size: 34px; opacity: .5; margin-bottom: 8px; }
.empty-title { font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }

/* --- Badges --------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 100px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-gray  { background: var(--gray-bg);  color: var(--gray); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn-default { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-default:hover:not(:disabled) { background: var(--line-soft); border-color: #cdd4db; }

.btn-ghost { background: none; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--line-soft); color: var(--ink); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(.92); }

.btn-danger { background: var(--surface); color: var(--red); border-color: #f0c4c1; }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* --- Forms ---------------------------------------------------------------- */

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field-label .req { color: var(--red); margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--ink-mute); }
.field-error { font-size: 12px; color: var(--red); font-weight: 500; }

.input, .select, .textarea {
  width: 100%; padding: 8px 11px;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--surface); border: 1px solid #cdd4db; border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,61,145,.12);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--line-soft); color: var(--ink-mute); cursor: not-allowed;
}
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.textarea { resize: vertical; min-height: 76px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }

.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--brand); flex: none; }
.check-text { font-size: 13.5px; }
.check-hint { display: block; font-size: 12px; color: var(--ink-mute); margin-top: 1px; }

.form-actions {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--line);
}

.filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 13px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px;
}
.filters .field { flex: 1 1 150px; }
.filters .field-grow { flex: 2 1 220px; }

/* --- Alerts --------------------------------------------------------------- */

.alert {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 13.5px; border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: var(--green); border-color: #b8e2ca; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border-color: #f3c9c6; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: #f6dcb4; }
.alert-info    { background: var(--blue-bg);  color: var(--blue);  border-color: #c3dcf7; }
.alert-close {
  background: none; border: 0; cursor: pointer; color: inherit;
  font-size: 18px; line-height: 1; opacity: .6; padding: 0 2px;
}
.alert-close:hover { opacity: 1; }

/* --- Lead protection panel -------------------------------------------------
   Το πιο σημαντικό στοιχείο του UI: πρέπει να σταματάει το μάτι. */

.lead-alert {
  border: 1px solid #f0c98a; border-left: 4px solid var(--amber);
  border-radius: var(--radius); background: #fffaf2;
  padding: 15px 17px; margin-bottom: 16px;
}
.lead-alert.is-own {
  border-color: #b8e2ca; border-left-color: var(--green); background: #f4fbf7;
}
.lead-alert.is-hidden { display: none; }

.lead-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.lead-icon { font-size: 19px; }
.lead-title { font-size: 14.5px; font-weight: 700; color: var(--amber); }
.lead-alert.is-own .lead-title { color: var(--green); }

.lead-body { font-size: 13.5px; color: var(--ink-soft); }

.lead-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 18px; margin: 11px 0;
  padding: 11px 0; border-top: 1px solid rgba(163,92,0,.16); border-bottom: 1px solid rgba(163,92,0,.16);
}
.lead-fact-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-mute); margin-bottom: 2px;
}
.lead-fact-value { font-size: 13.5px; font-weight: 600; color: var(--ink); }

.lead-fee {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: rgba(163,92,0,.10); font-size: 13.5px; font-weight: 600; color: var(--amber);
}

.lead-note { margin-top: 9px; font-size: 12.5px; color: var(--ink-mute); }

/* --- Timeline ------------------------------------------------------------- */

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 5px; bottom: 5px;
  width: 2px; background: var(--line);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ''; position: absolute; left: -21px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-soft);
}
.timeline-item.is-green::before  { border-color: var(--green); }
.timeline-item.is-blue::before   { border-color: var(--blue); }
.timeline-item.is-amber::before  { border-color: var(--amber); }
.timeline-item.is-red::before    { border-color: var(--red); }
.timeline-time { font-size: 11.5px; color: var(--ink-mute); }
.timeline-title { font-size: 13.5px; font-weight: 600; }
.timeline-text { font-size: 12.5px; color: var(--ink-soft); }

/* --- Definition list ------------------------------------------------------ */

.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 9px 16px; font-size: 13.5px; }
.dl dt { color: var(--ink-mute); }
.dl dd { margin: 0; color: var(--ink); font-weight: 500; word-break: break-word; }

/* --- Items editor (quote lines) ------------------------------------------- */

.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th {
  padding: 8px 8px; text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mute);
  background: var(--line-soft); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.items-table td { padding: 5px 5px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.items-table .input, .items-table .select { padding: 6px 8px; font-size: 13px; }
.items-table .col-qty   { width: 88px; }
.items-table .col-unit  { width: 74px; }
.items-table .col-price { width: 108px; }
.items-table .col-disc  { width: 78px; }
.items-table .col-tax   { width: 78px; }
.items-table .col-total { width: 108px; text-align: right; }
.items-table .col-del   { width: 38px; }

.line-total { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.row-delete {
  background: none; border: 0; cursor: pointer; color: var(--ink-mute);
  font-size: 17px; line-height: 1; padding: 4px 6px; border-radius: var(--radius-sm);
}
.row-delete:hover { background: var(--red-bg); color: var(--red); }

.totals { margin-left: auto; width: min(320px, 100%); }
.totals-row {
  display: flex; justify-content: space-between; gap: 20px;
  padding: 6px 0; font-size: 13.5px;
}
.totals-row.is-grand {
  border-top: 2px solid var(--line); margin-top: 5px; padding-top: 10px;
  font-size: 16px; font-weight: 700;
}
.totals-label { color: var(--ink-soft); }
.totals-value { font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- Pagination ----------------------------------------------------------- */

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-mute);
}
.pagination-links { display: flex; gap: 4px; }
.pagination-links a, .pagination-links span {
  min-width: 32px; height: 32px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-soft); font-weight: 500;
}
.pagination-links a:hover { background: var(--line-soft); text-decoration: none; }
.pagination-links .is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination-links .is-disabled { opacity: .45; pointer-events: none; }

/* --- Auth ----------------------------------------------------------------- */

.body-centered {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, #0b3d91 0%, #123a7d 45%, #1f2933 100%);
}
/* Το --login-oy το ορίζει inline το blank.php (ρύθμιση, ακέραιος px).
   Θετικό = κατεβαίνει, αρνητικό = ανεβαίνει. */
.auth-wrap { width: 100%; max-width: 400px; transform: translateY(var(--login-oy, 0)); }

/* Θέση πλαισίου εισόδου πάνω στο φόντο (ρυθμιζόμενη). Το body-centered κεντράρει
   με grid· εδώ μετακινούμε οριζόντια όταν ζητηθεί αριστερά/δεξιά. */
.body-centered.pos-left  { justify-items: start; padding-left: clamp(24px, 8vw, 120px); }
.body-centered.pos-right { justify-items: end;   padding-right: clamp(24px, 8vw, 120px); }

.auth-card {
  background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 32px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo { font-size: 38px; }
.auth-title { margin-top: 8px; font-size: 19px; font-weight: 700; }
.auth-sub { margin-top: 3px; font-size: 13px; color: var(--ink-mute); }

/* Προαιρετικό μήνυμα κάτω από τη φόρμα (π.χ. οδηγίες/τηλέφωνο). */
.auth-note {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border, #e4e7eb);
  font-size: 12.5px; line-height: 1.55; color: var(--ink-mute); text-align: center;
  white-space: pre-line;
}
.auth-fields { display: flex; flex-direction: column; gap: 14px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 12.5px; }

/* --- Tickets / messages ---------------------------------------------------- */

.message {
  padding: 13px 15px; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 11px; background: var(--surface);
}
.message.is-mine { background: var(--brand-light); border-color: #cddcf5; }
.message.is-internal { background: #fffaf2; border-color: #f0c98a; border-style: dashed; }
.message-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px; font-size: 12.5px;
}
.message-author { font-weight: 600; }
.message-time { color: var(--ink-mute); }
.message-body { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }

/* --- Template editor ------------------------------------------------------- */

.code-editor {
  display: block;
  width: 100%;
  min-height: 560px;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #e4e7eb;
  background: #1f2933;
  /* Το tab μέσα σε textarea αλλάζει πεδίο· τα 2 κενά κρατούν τη στοίχιση
     αναγνώσιμη χωρίς να χρειάζεται tab. */
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
.code-editor:focus { outline: 2px solid var(--brand); outline-offset: -2px; }

/* --- Tabs του editor ------------------------------------------------------- */

.tabs { display: flex; gap: 2px; }

.tab {
  padding: 7px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  color: var(--ink-mute);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.tab:hover:not(:disabled) { background: var(--line-soft); color: var(--ink); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab:disabled { opacity: .4; cursor: not-allowed; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Tabs στη σελίδα Ρυθμίσεων: χωρίζουν τα μεγάλα blocks (Email, OpenCart, …)
   σε καρτέλες. Δουλεύουν με data-stab μέσω JS — και σε καρτέλες που ζουν σε
   ξεχωριστές φόρμες (test/branding). */
.settings-tabs {
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

/* Μικρογραφία προϊόντος (λίστα & καρτέλα). Οι εικόνες φορτώνουν από το OpenCart
   site — object-fit ώστε να μη «σπάνε» οι αναλογίες. */
.product-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #fff;
  display: block;
}
.product-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: .5;
}
.product-thumb-lg { width: 120px; height: 120px; }

/* Γραμμή προσφοράς/παραγγελίας: εικόνα αριστερά, επιλογέας, απόθεμα δεξιά.
   Το απόθεμα είναι βοήθημα του editor — δεν τυπώνεται. */
.line-product { display: flex; align-items: center; gap: 8px; }
.line-product .select { flex: 1 1 auto; min-width: 120px; }
.product-thumb-sm {
  width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto;
  border: 1px solid var(--line-soft); border-radius: 6px; background: #fff;
}
.line-stock { flex: 0 0 auto; font-size: 12px; color: var(--ink-mute); white-space: nowrap; }
.line-stock.in  { color: #1a7f37; }
.line-stock.out { color: #b42318; }

/* Μπάρα ομαδικής ενέργειας (π.χ. αποδεκτές προσφορές → παραγγελία) */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--bg-accent, #eef2ff);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.bulk-bar[hidden] { display: none; }

/* Οδηγίες χρήσης */
.guide { max-width: 760px; color: var(--ink); font-size: 14px; line-height: 1.65; }
.guide h2 {
  font-size: 15px; font-weight: 700; margin: 22px 0 8px;
  padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--brand);
}
.guide h2:first-of-type { border-top: 0; padding-top: 0; }
.guide ul { margin: 0 0 6px; padding-left: 20px; }
.guide li { margin: 4px 0; }
.guide .guide-lead { font-size: 15px; color: var(--ink-mute); margin: 0 0 8px; }
.guide .guide-note,
.guide .guide-foot {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--brand-light); font-size: 13.5px;
}
.guide code { background: var(--line-soft); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

.tpl-frame {
  display: block;
  width: 100%;
  height: 620px;
  border: 0;
  background: #f0f1f3;
}

.visual-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--line-soft);
  min-height: 46px;
}

.token-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* Χρησιμοποιείται ήδη στο σχεδιαστικό — απαντά στο «ποια πεδία έχω βάλει;»
   χωρίς να ψάχνει ο χρήστης μέσα στο HTML. */
.token-used {
  background: var(--green-bg);
  border-color: #b8e2ca;
  color: var(--green);
}

.token {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line-soft);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.token:hover { background: var(--brand-light); border-color: #cddcf5; color: var(--brand); }
.token:active { transform: translateY(1px); }

/* --- Branding previews ----------------------------------------------------- */

.branding-preview {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  /* Το checkerboard δείχνει τη διαφάνεια — ένα PNG με λευκό φόντο δεν
     ξεχωρίζει αλλιώς από ένα με πραγματικό alpha κανάλι. */
  background-image:
    linear-gradient(45deg, #eceff2 25%, transparent 25%),
    linear-gradient(-45deg, #eceff2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eceff2 75%),
    linear-gradient(-45deg, transparent 75%, #eceff2 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.branding-preview-logo { max-height: 72px; padding: 6px; }
.branding-preview-login_background { width: 100%; height: 130px; object-fit: cover; }

/* --- Login page background ------------------------------------------------- */

/* Όταν έχει ανέβει εικόνα, μπαίνει πάνω από το ντεγκραντέ. Το ::before σκουραίνει
   ώστε η λευκή κάρτα να διαβάζεται πάνω σε οποιαδήποτε φωτογραφία. */
.body-centered.has-bg { position: relative; background: #1f2933; }
.body-centered.has-bg .login-bg {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.body-centered.has-bg::before {
  content: ''; position: fixed; inset: 0; z-index: 1;
  background: linear-gradient(160deg, rgba(11,61,145,.72), rgba(31,41,51,.82));
}
.body-centered.has-bg .auth-wrap { position: relative; z-index: 2; }

.auth-logo-img { max-height: 56px; max-width: 220px; }
.topbar-logo-img { height: 26px; max-width: 150px; object-fit: contain; display: block; }

/* --- Utilities ------------------------------------------------------------ */

.muted { color: var(--ink-mute); }
.small { font-size: 12.5px; }
.mono  { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-amber { color: var(--amber); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.stack   { display: flex; flex-direction: column; gap: 12px; }
.stack-sm{ display: flex; flex-direction: column; gap: 6px; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.spread  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.mt-0 { margin-top: 0; }    .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 6px; }  .mb-1 { margin-bottom: 6px; }
.mt-2 { margin-top: 12px; } .mb-2 { margin-bottom: 12px; }
.mt-3 { margin-top: 18px; } .mb-3 { margin-bottom: 18px; }
.mt-4 { margin-top: 26px; }

.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

.progress { height: 6px; background: var(--line-soft); border-radius: 100px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand); border-radius: 100px; }
.progress-bar.is-amber { background: var(--amber); }
.progress-bar.is-red   { background: var(--red); }
.progress-bar.is-green { background: var(--green); }

/* --- Errors --------------------------------------------------------------- */

.error-page { text-align: center; padding: 70px 20px; }
.error-code { font-size: 64px; font-weight: 800; color: var(--brand); line-height: 1; }
.error-message { margin: 12px 0 22px; font-size: 15px; color: var(--ink-soft); }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .topbar-toggle { display: flex; }
  .topbar-store, .usermenu-name { display: none; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .nav-backdrop.is-open { display: block; }

  .main { margin-left: 0; padding: 16px 14px 48px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions .btn { flex: 1; }

  .totals { width: 100%; }
  .form-actions .btn { flex: 1; }
}

@media print {
  .topbar, .sidebar, .page-actions, .no-print { display: none !important; }
  .main { margin: 0; padding: 0; }
  body { background: #fff; }
}
