:root {
  --bg: #0f172a; --panel: #ffffff; --ink: #1e293b; --muted: #64748b;
  --accent: #EC1841; --accent-ink: #ffffff; --line: #e2e8f0;
  --ok: #047857; --err: #b91c1c; --warn: #b45309;
}
* { box-sizing: border-box; }
/* Ensure the `hidden` attribute always wins over element display rules (e.g. .login-wrap) */
[hidden] { display: none !important; }
body { margin: 0; font-family: "Segoe UI", system-ui, Arial, sans-serif; color: var(--ink); background: #f1f5f9; }
.muted { color: var(--muted); }
.error { color: var(--err); }
.ok { color: var(--ok); }
button { cursor: pointer; border: 0; border-radius: 8px; padding: .55rem .9rem; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
button.ghost { background: transparent; color: var(--accent-ink); border: 1px solid rgba(255,255,255,.4); }
button.secondary { background: #e2e8f0; color: var(--ink); }
input, select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; background: #fff; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .7rem; }
label input, label select, label textarea { margin-top: .25rem; color: var(--ink); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg,#0f172a,#1e3a8a); padding: 1rem; }
.login-card { width: min(380px, 100%); }
.login-card h1 { margin: 0 0 .2rem; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 1rem; background: var(--bg); color: #fff; padding: .6rem 1rem; }
.topbar .spacer { flex: 1; }
.topbar .muted { color: #cbd5e1; }
.tabs button { background: transparent; color: #cbd5e1; }
.tabs button.active { background: rgba(255,255,255,.14); color: #fff; }
main { padding: 1rem; max-width: 1600px; margin: 0 auto; }

/* Toolbar + layout */
.toolbar { display: flex; gap: 1rem; align-items: end; margin-bottom: .8rem; }
.toolbar label { margin: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
#map { height: 540px; border-radius: 12px; border: 1px solid var(--line); }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 72vh; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: #f8fafc; }
.badge { padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; }
.badge.ok { background: #d1fae5; color: var(--ok); }
.badge.warnb { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: var(--err); }
tr:hover td { background: #f8fafc; cursor: pointer; }

/* Casual (ad-hoc, no appointment) visits stand out in amber. */
tr.casual td { background: #fff7ed; }
tr.casual td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
tr.casual:hover td { background: #ffedd5; }
.legend { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .85rem; margin-left: auto; }
.legend .swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.legend .swatch.casual { background: #fff7ed; box-shadow: inset 3px 0 0 #f59e0b, inset 0 0 0 1px var(--line); }

/* Appointment form: date/time row + day availability calendar */
.when-row { display: flex; gap: 1rem; }
.when-row label { flex: 1; }
.day-agenda { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; margin: 0 0 .8rem; background: #f8fafc; }
.day-head { font-size: .85rem; font-weight: 600; margin-bottom: .45rem; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .35rem; }
.slot { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: .35rem .5rem;
  border-radius: 6px; font-size: .8rem; border: 1px solid var(--line); min-height: 2.6rem; }
.slot .t { font-weight: 600; }
.slot .who { font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.slot.free { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; cursor: pointer; }
.slot.free:hover { background: #d1fae5; }
.slot.busy { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.slot.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.warn { color: var(--warn); font-size: .85rem; margin: 0 0 .6rem; }

/* Blocked (closed) days for a salesman */
.day-blocked { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-radius: 6px;
  padding: .4rem .55rem; font-size: .82rem; font-weight: 600; margin-bottom: .45rem; }
.slots.blocked { opacity: .45; pointer-events: none; }
.block-panel { border: 1px dashed var(--line); border-radius: 10px; padding: .55rem .7rem; margin: 0 0 .8rem; background: #fff; }
.block-head { font-size: .85rem; font-weight: 600; margin-bottom: .4rem; }
.block-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.block-chip { display: inline-flex; align-items: center; gap: .3rem; background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a; border-radius: 999px; padding: .15rem .5rem; font-size: .78rem; }
.block-chip .chip-x { border: none; background: transparent; color: #92400e; cursor: pointer; font-size: .85rem; line-height: 1; padding: 0 .1rem; }
.block-chip .chip-x:hover { color: #b91c1c; }
.block-add { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.block-add label { font-size: .78rem; }
.block-add input, .block-add select { font-size: .85rem; }

/* Salesmen never see GPS: hide the GPS/Distance columns and the map for them. */
.hide-gps .col-gps, .hide-gps .col-dist, .hide-gps .col-geo { display: none; }
.badge.prec-ok { background: #d1fae5; color: var(--ok); }
.badge.prec-mid { background: #fef3c7; color: #92400e; }
.badge.prec-low { background: #f1f5f9; color: var(--muted); }
.no-map .split { grid-template-columns: 1fr; }
.no-map #map { display: none; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  #map { height: 320px; }
}

/* Detail modal */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; z-index: 1000; padding: 1rem; }
.modal-card { background: #fff; border-radius: 14px; padding: 1.5rem 1.8rem; width: min(820px, 94vw); max-height: 86vh; overflow: auto; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-card h3 { margin: 0 0 1rem; }
.modal-close { position: absolute; top: .5rem; right: .5rem; background: transparent; color: var(--muted); font-size: 1.1rem; padding: .3rem .5rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 0; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; word-break: break-word; }
tr.clickable { cursor: pointer; }
button.small { padding: .2rem .5rem; font-size: .8rem; white-space: nowrap; }
button.danger { background: var(--err); color: #fff; }

/* Appointment change/cancel */
.form-buttons { display: flex; gap: .6rem; }
.detail-actions { display: flex; gap: .6rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.detail-actions p { margin: 0; }
.update-banner { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 2000; display: flex; gap: 1rem;
  align-items: center; background: #1e3a8a; color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.update-banner button { background: #fff; color: #1e3a8a; font-weight: 600; }
.confirm-card { width: min(520px, 94vw); }
.confirm-warn { margin: 1rem 0 0; padding: .6rem .8rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b; }
#confirmModal { z-index: 1100; }
/* Appointments tab: form (left) and the salesman's appointment list (right) side by side. */
.appt-split { display: grid; grid-template-columns: minmax(420px, 5fr) 7fr; gap: 1rem; align-items: start; }
.appt-split > .card { margin: 0; min-width: 0; }
.appt-list .toolbar { margin-bottom: .4rem; }
.appt-list .table-wrap { max-height: calc(100vh - 230px); }
/* Fit the narrower right column: text columns wrap, date/status stay on one line. */
#apptTable td { white-space: normal; }
#apptTable td:nth-child(4), #apptTable td:nth-child(5) { white-space: nowrap; }
#apptTable td:first-child { min-width: 150px; }
#apptTable td:nth-child(3) { min-width: 120px; max-width: 220px; }
#apptTable td:last-child { min-width: 160px; max-width: 260px; }
#apptTable td:last-child .clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 1100px) { .appt-split { grid-template-columns: 1fr; } }
/* Customer detail: wide two-column modal — details + actions left, map right (no scrolling). */
.modal-card.wide { width: min(1280px, 96vw); }
.cust-grid { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 1.5rem; align-items: start; }
.cust-grid.single { grid-template-columns: 1fr; }
.cust-left .kv { gap: .35rem .9rem; }
.cust-left .detail-actions { margin-top: 1rem; flex-wrap: wrap; }
.cust-right .cust-map-title { margin-top: 0; }
.cust-right .cust-map { height: min(55vh, 480px); margin-top: .5rem; }
.cust-right .site-list { max-height: 170px; }
.cust-right h4 { margin-top: 0 !important; }
.cust-right.has-list .site-list { max-height: 130px; }
.cust-right.has-list .cust-map { height: min(calc(100vh - 560px), 400px); min-height: 220px; }
.cust-right .map-notes { font-size: .8rem; }
@media (max-width: 900px) { .cust-grid { grid-template-columns: 1fr; } }
.site-search { margin-bottom: .5rem; }
.site-list { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.site-item { display: flex; justify-content: space-between; align-items: center; gap: .6rem; width: 100%; text-align: left;
  background: #fff; color: var(--ink); border-radius: 0; border-bottom: 1px solid var(--line); padding: .45rem .7rem; font-size: .88rem; }
.site-item:hover { background: #f8fafc; }
.site-item.sel { background: #eff6ff; box-shadow: inset 3px 0 0 var(--accent); }
.cust-map-title { margin-top: 1rem; font-size: .9rem; }
.visit-map { height: 320px; border-radius: 10px; border: 1px solid var(--line); }
.map-legend { font-size: .8rem; color: var(--muted); margin: .4rem 0 1rem; display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; }
.map-legend .lg { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; }
.lg-checkin { background: #2a81cb; }
.lg-pin { background: #10b981; border: 2px solid #047857; }
.lg-erp { background: #a78bfa; border: 2px solid #6d28d9; }
.pos-bar { margin-top: .5rem; }
.pos-panel { margin-top: .6rem; padding: .7rem .8rem; border: 1px solid #fed7aa; background: #fff7ed; border-radius: 10px; }
.pos-help { margin: 0 0 .5rem; font-size: .85rem; }
.pos-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .4rem 0; }
.pos-row .pos-coords { flex: 1; min-width: 240px; }
.pos-row label.chk { display: inline-flex; align-items: center; gap: .3rem; margin: 0; color: var(--ink); font-size: .85rem; }
.pos-row label.chk input[type=checkbox] { width: auto; margin: 0; }
.pos-row .pos-radius { width: 80px; margin: 0; padding: .25rem .4rem; }
.pos-now { margin: .3rem 0; font-size: .82rem; }
.pos-edit-icon { background: #ea580c; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #ea580c, 0 2px 6px rgba(0,0,0,.4); cursor: grab; }
.cust-map { height: 340px; border-radius: 10px; border: 1px solid var(--line); margin-top: 1rem; }
a.btn-link { display: inline-block; padding: .55rem .9rem; border-radius: 8px; text-decoration: none; font-size: .95rem; }
a.btn-link.secondary { background: #e2e8f0; color: var(--ink); }
.assigned { font-size: .78rem; color: #6d28d9; margin-top: .15rem; }
tr.cancelled td { color: #94a3b8; text-decoration: line-through; }
tr.cancelled td:nth-child(5) { text-decoration: none; }

/* Audit */
.audit-filters { flex-wrap: wrap; }
.audit-filters label { min-width: 130px; }
#auditTable td:nth-child(5) { white-space: normal; min-width: 280px; }
tr.audit-bad td { background: #fef2f2; }
tr.audit-req td { color: #475569; font-size: .84rem; }
.audit-details h4 { margin: 1.2rem 0 .4rem; }
.audit-details pre { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: .7rem; font-size: .8rem;
  white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; }
table.changes { font-size: .85rem; }
table.changes td { white-space: normal; }

/* Report/statistics filters */
.report-filters { flex-wrap: wrap; }
.report-filters select, .report-filters input { min-width: 240px; }
.small { font-size: .82rem; }

/* Στατιστικά */
.kpis { display: flex; gap: .8rem; flex-wrap: wrap; margin: .2rem 0 .8rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .55rem .9rem; min-width: 150px; }
.kpi span { display: block; font-size: .78rem; color: var(--muted); }
.kpi b { font-size: 1.15rem; }
.neg { color: var(--err); }
.pos { color: var(--ok); }
.stats-table th.num, .stats-table td.num { text-align: right; white-space: nowrap; }
.stats-table tfoot th { background: #f1f5f9; border-top: 2px solid var(--line); }
tr.st-group { cursor: pointer; font-weight: 600; }
tr.st-group:hover td { background: #f8fafc; }
tr.st-group.open td { background: #eff6ff; }
tr.st-group .caret { display: inline-block; width: 1em; color: var(--muted); }
tr.st-sub td:first-child { padding-left: 2.2rem; }
tr.st-sub td { font-size: .88rem; }
tr.st-sub.link { cursor: pointer; }
tr.st-sub.link:hover td:first-child { text-decoration: underline; color: var(--accent); }
td.share { min-width: 170px; white-space: nowrap; }
td.share .bar { display: inline-block; width: 110px; height: 9px; background: #e2e8f0; border-radius: 5px; vertical-align: middle; margin-right: .4rem; overflow: hidden; }
td.share .bar i { display: block; height: 100%; background: var(--accent); }
td.share span { font-size: .82rem; color: var(--muted); }
.cs-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.cs-head h2 { margin: 0; font-size: 1.25rem; }
.fin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.fin-card { margin: 0; }
.fin-card h3 { margin: 0 0 .6rem; font-size: 1rem; }
.fin-card .kv { grid-template-columns: 1fr auto; }
.fin-card .kv dt { white-space: normal; }
.fin-card .kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.items-table td { white-space: normal; }
.items-table td:first-child { min-width: 260px; }

/* Geographic drill-down: νομός → πόλη → πελάτες */
tr.st-city { cursor: pointer; }
tr.st-city:hover td { background: #f8fafc; }
tr.st-city.open td { background: #f8fafc; font-weight: 600; }
tr.st-city .caret { display: inline-block; width: 1em; color: var(--muted); }
tr.st-cust td:first-child { padding-left: 3.8rem; }
tr.st-cust td { font-size: .84rem; }
tr.st-cust.link { cursor: pointer; }
tr.st-cust.link:hover td:first-child { text-decoration: underline; color: var(--accent); }

/* Customer statistics (Εικόνα / Τι αγοράζει) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; align-self: end; }
.seg button { background: #fff; color: var(--ink); border-radius: 0; padding: .55rem 1.3rem; font-weight: 600; }
.seg button.on { background: var(--accent); color: #fff; }
.fin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem; margin: .4rem 0 1rem; }
.fin-cards .kpi { min-width: 0; }
.visit-note { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; }
.visit-note h4 { margin: 0 0 .3rem; font-size: .78rem; letter-spacing: .03em; color: var(--muted); text-transform: uppercase; }
.visit-note p { margin: 0; }
.fin-grid.charts { margin-bottom: 1rem; }
svg.chart { width: 100%; max-width: 440px; height: auto; display: block; }
svg.chart .ch-val { font-size: 10px; fill: #334155; }
svg.chart .ch-lbl { font-size: 11px; fill: #64748b; }
svg.chart .ch-tot { font-size: 13px; font-weight: 700; fill: #0f172a; }
.donut { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.donut svg.chart { width: 180px; }
.legend { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.legend li { display: flex; align-items: center; gap: .45rem; margin: .25rem 0; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend b { margin-left: auto; padding-left: .8rem; }
.hbars .hb { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: .5rem; align-items: center; margin: .3rem 0; font-size: .85rem; }
.hb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { position: relative; height: 14px; }
.hb-track i { position: absolute; left: 0; border-radius: 3px; }
.hb-track i.a { top: 0; height: 9px; background: var(--accent); }
.hb-track i.b { top: 10px; height: 4px; background: #cbd5e1; }
.hb-val { font-variant-numeric: tabular-nums; }
.hbars .lg-a, .hbars .lg-b { display: inline-block; width: 12px; height: 8px; border-radius: 2px; vertical-align: middle; }
.hbars .lg-a { background: var(--accent); } .hbars .lg-b { background: #cbd5e1; }
.tree-table tr[data-path] { cursor: pointer; }
.tree-table tr[data-path]:hover td { background: #f8fafc; }
.tree-table .caret { display: inline-block; width: 1em; color: var(--muted); }
.tree-table tr.lv0 td { font-weight: 700; }
.tree-table tr.lv0.open td { background: #eff6ff; }
.tree-table tr.lv1 td:first-child { padding-left: 1.8rem; font-weight: 600; }
.tree-table tr.lv2 td:first-child { padding-left: 3.2rem; }
.tree-table tr.lv3 td:first-child { padding-left: 4.8rem; }
.tree-table tr.lv4 td:first-child { padding-left: 6.4rem; }
.tree-table tr.leaf td { font-size: .85rem; white-space: normal; }
/* layout tweaks */
.donut { flex-wrap: nowrap; }
.donut ul.legend { display: block; flex: 1; min-width: 150px; }
.fin-grid.charts { grid-template-columns: minmax(330px, 1fr) minmax(420px, 2fr); }
@media (max-width: 900px) { .fin-grid.charts { grid-template-columns: 1fr; } }
.hbars .hb { grid-template-columns: minmax(110px, 210px) minmax(120px, 1fr) 90px; }
.hbars .hb-val { text-align: right; }
.fin-card .kv { grid-template-columns: minmax(170px, 1fr) minmax(0, max-content); }
.fin-card .kv dt { white-space: normal; }
.fin-card .kv dd { max-width: 260px; }

/* Krivek logo */
.login-logo { display: block; width: 220px; max-width: 80%; margin: 0 auto 1rem; }
.login-card h1 { text-align: center; }
.login-card > p.muted:first-of-type { text-align: center; }
.brand-chip { background: #fff; border-radius: 8px; padding: 4px 10px; display: inline-flex; align-items: center; flex: none; }
.brand-chip img { height: 24px; width: auto; display: block; }
.topbar strong, .topbar > .muted, #who { white-space: nowrap; }
.topbar .tabs { flex-wrap: nowrap; }
.topbar .tabs button { white-space: nowrap; }

/* Visits: customer belongs to another salesman */
td.sm-diff { color: #b45309; font-weight: 600; }

/* Appointment filter chips (like the tablet) */
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin: .2rem 0 .6rem; }
.chips button { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .35rem .9rem; font-size: .88rem; }
.chips button.on { background: #e0e7ff; border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Βοήθεια / Αλλαγές */
.help-h { font-size: 1.05rem; margin: 1rem 0 .6rem; }
.promo-table td { white-space: normal; }
#ordTable tr.ord-row { cursor: pointer; }
.oe-box { margin-bottom: 1rem; padding: 1rem 1.2rem; border: 2px solid var(--accent); }
.oe-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.oe-head h2 { margin: 0; }
.oe-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .oe-grid { grid-template-columns: 1fr; } }
.oe-cat input[type=search] { width: 100%; margin-bottom: .5rem; }
.oe-crumbs { margin: .2rem 0 .5rem; }
.oe-crumbs .chip { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; padding: .15rem .6rem; border-radius: 999px; font-size: .85rem; }
.oe-list { max-height: 58vh; overflow: auto; }
.oe-nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem; }
.oe-node { display: flex; justify-content: space-between; align-items: center; gap: .5rem; text-align: left; background: #fff; color: inherit; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.oe-node:hover { border-color: var(--accent); background: #f8fafc; }
.oe-items, .oe-lines { width: 100%; }
input.oe-q { width: 4.5rem; text-align: right; }
input.oe-q.invalid { border-color: #dc2626; background: #fef2f2; }
.oe-pl { color: #047857; }
.oe-cart h3 { margin: 0 0 .5rem; }
.oe-total { text-align: right; font-size: 1.05rem; margin: .6rem 0; }
.oe-notes { display: block; margin: .5rem 0; }
.oe-notes textarea { width: 100%; }
td.nowrap { white-space: nowrap; }
/* Μηνύματα */
.msg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .msg-grid { grid-template-columns: 1fr; } }
label.block { display: block; margin-bottom: .5rem; }
label.block input, label.block textarea { width: 100%; }
.msg-recipients { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; background: #fff; }
.msg-rcpt { display: block; padding: .15rem 0; }
.msg-fs { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 .7rem; padding: .5rem .8rem; }
.msg-fs legend { font-weight: 600; }
.ok-msg { color: #15803d; }
.ord-st.msg-failed { background: #fee2e2; color: #b91c1c; }
/* Πελάτες: compact, zebra, actions first */
#custTable.cust-compact { font-size: .82rem; }
#custTable.cust-compact th, #custTable.cust-compact td { padding: .32rem .45rem; white-space: normal; vertical-align: top; }
#custTable.cust-compact tbody tr:nth-child(even) td { background: #f1f5f9; }
#custTable.cust-compact tbody tr:hover td { background: #e0f2fe; }
#custTable .cust-acts { white-space: nowrap; }
#custTable .cust-acts button { font-size: .72rem; padding: .2rem .4rem; margin: 0 .2rem .2rem 0; }
#custTable .c-name { min-width: 150px; max-width: 220px; }
#custTable .c-brand, #custTable .c-cat, #custTable .c-sm { max-width: 130px; }
#custTable .c-addr { max-width: 180px; }
#custTable .c-city { max-width: 100px; }
/* Παραγγελίες: colours */
.oe-promo { color: #dc2626; font-weight: 700; }
.oe-bought { color: #15803d; font-weight: 600; }
.oe-badge { font-size: .68rem; padding: .05rem .35rem; border-radius: 999px; vertical-align: middle; white-space: nowrap; }
.oe-badge-promo { background: #fee2e2; color: #b91c1c; }
.oe-badge-bought { background: #dcfce7; color: #166534; }
.oe-nostock { color: #b45309; }
.oe-qcell { white-space: nowrap; }
select.oe-u { font-size: .85rem; padding: .15rem .25rem; min-width: 6.5rem; }
.oe-ucell { white-space: nowrap; }
input.oe-c { display: block; width: 100%; margin-top: .25rem; font-size: .8rem; padding: .2rem .4rem; }
.oe-legend span.oe-promo, .oe-legend span.oe-bought { font-size: inherit; }
#visitsTable tr.map-hover td { background: #e0f2fe; }
#toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(150%); background: #0f172a; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); transition: transform .25s; z-index: 2000; max-width: 90vw; }
#toast.show { transform: translateX(-50%) translateY(0); }
#ordTable tr.ord-row:hover td { background: #f1f5f9; }
#ordTable td { white-space: normal; }
#ordTable tr.ord-detail > td { background: #f8fafc; padding: .6rem 1rem; }
.ord-lines { font-size: .85rem; background: #fff; border: 1px solid var(--line); }
.ord-lines th, .ord-lines td { position: static; white-space: normal; }
.ord-lines .num { text-align: right; white-space: nowrap; }
.ord-st { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: #e2e8f0; white-space: nowrap; }
.ord-st.ord-pending { background: #dbeafe; color: #1e40af; }
.ord-st.ord-cancelled { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.ord-st.ord-sent { background: #dcfce7; color: #166534; }
.promo-table td:first-child, .promo-table td.num { white-space: nowrap; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; }
.help-card { display: flex; align-items: center; gap: .9rem; }
.help-icon { font-size: 1.8rem; }
.help-txt { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
a.btn { display: inline-block; background: var(--accent); color: #fff; padding: .5rem .9rem; border-radius: 8px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.cl-list { display: flex; flex-direction: column; gap: .5rem; max-width: 980px; }
.cl-item { display: flex; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.cl-ver { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; min-width: 92px; }
.cl-badge { background: #e0e7ff; color: var(--accent); border-radius: 999px; padding: .1rem .6rem; font-weight: 700; font-size: .85rem; }
.cl-text { line-height: 1.45; }
/* «Προωθητικές ενέργειες» tab while items are in an active promotion */
.tabs button.promo-alert { background: #dc2626; color: #fff; font-weight: 700; }
.tabs button.promo-alert.active { background: #b91c1c; }
/* «Παραγγελίες» tab always orange (Krivek, 26/11) */
.tabs button[data-tab="orders"] { background: #ea580c; color: #fff; font-weight: 700; }
.tabs button[data-tab="orders"].active { background: #c2410c; }
.tabs button[data-tab="orders"]:hover { background: #c2410c; color: #fff; }
.tabs button .promo-count { display: inline-block; margin-left: .4rem; min-width: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: #fff; color: #dc2626; font-size: .8rem; font-weight: 700; line-height: 1.3rem; text-align: center; }
.oe-instock { color: #15803d; font-weight: 600; }
/* Web messages */
/* Inbox: icon only (the word «Μηνύματα» clashed with the tab of the same name), red badge with the unread count. */
.inbox-btn { position: relative; margin-right: .75rem; padding: .3rem .6rem; line-height: 1; }
.inbox-icon { font-size: 1.25rem; line-height: 1; }
.inbox-count { position: absolute; top: -.45rem; right: -.5rem; min-width: 1.2rem; padding: 0 .3rem; border-radius: 999px; background: #dc2626; color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.2rem; text-align: center; box-shadow: 0 0 0 2px #0f172a; }
.inbox-panel { position: fixed; top: 4.2rem; right: 1rem; width: min(420px, calc(100vw - 2rem)); max-height: 70vh; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); z-index: 900; }
.inbox-head { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.inbox-list { overflow-y: auto; padding: .4rem .8rem .8rem; }
.inbox-item { padding: .55rem 0; border-bottom: 1px solid var(--line); line-height: 1.4; }
.inbox-item.unread { font-weight: 600; }
.inbox-item-head, .msg-popup-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.msg-popups { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .6rem; z-index: 1000; width: min(380px, calc(100vw - 2rem)); }
.msg-popup { background: #fff; border-left: 5px solid #dc2626; border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.25); padding: .75rem .9rem; animation: msgIn .25s ease-out; line-height: 1.4; }
.msg-popup-body { margin: .35rem 0; white-space: pre-wrap; }
.msg-popup-foot { display: flex; justify-content: flex-end; }
@keyframes msgIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.login-credit { margin: .8rem 0 0; text-align: center; font-size: .75rem; color: var(--muted, #6b7280); }
.oe-actions { white-space: nowrap; }
.oe-actions button + button { margin-left: .25rem; }
.oe-badge-quote { background: #ede9fe; color: #6d28d9; }
.inbox-item-meta { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.inbox-del { padding: 0 .3rem; line-height: 1.2; color: var(--muted, #6b7280); }
.inbox-del:hover { color: #b91c1c; }
/* Ghost buttons are white-on-dark for the header; inside the white inbox panel make them dark. */
.inbox-panel button.ghost { color: var(--muted, #6b7280); border-color: transparent; }
.inbox-panel button.ghost:hover { color: #0f172a; background: #f1f5f9; }
#inboxClose { font-size: 1rem; padding: .1rem .5rem; }
.tabs button[data-tab="quotes"] { background: #7c3aed; color: #fff; font-weight: 700; }
.tabs button[data-tab="quotes"].active { background: #6d28d9; }
.tabs button[data-tab="quotes"]:hover { background: #6d28d9; color: #fff; }
.oe-lines input.oe-p { width: 6.5rem; text-align: right; }
.oe-lines input.oe-d { width: 3.6rem; text-align: right; }
.oe-manual { color: #6d28d9; }
.ord-link { color: #6d28d9; font-weight: 600; }
/* ERP execution status of sent orders */
.erp-exec { display: inline-block; font-size: .7rem; font-weight: 600; padding: .05rem .4rem; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.erp-exec-done { background: #dcfce7; color: #166534; }
.erp-exec-part { background: #fef3c7; color: #92400e; }
.erp-exec-none { background: #e2e8f0; color: #334155; }
.erp-exec-closed { background: #f1f5f9; color: #64748b; }
.erp-exec-deleted { background: #fee2e2; color: #991b1b; }
/* Item prices in orders/quotes: bold green (Krivek, 27/11) */
.oe-price { color: #15803d; font-weight: 700; }
#oeLines input.oe-p { color: #15803d; font-weight: 700; }
#oeLines input.oe-d { color: #15803d; font-weight: 600; }

/* Καρτέλα πελάτη */
.ledger .nowrap { white-space: nowrap; }
.ledger tr.ledger-open td { font-weight: 600; background: #f1f5f9; }
.ledger tfoot th { font-weight: 700; }

.ledger tr.link { cursor: pointer; }
.ledger tr.link:hover td { background: #eff6ff; }


/* ERP document view (1.4.7): printed-form layout */
.doc-band { display: flex; flex-wrap: wrap; gap: .5rem 2rem; padding: .6rem .8rem; background: #f1f5f9; border: 1px solid var(--line); border-radius: 6px; margin-bottom: .8rem; }
.doc-band > div { display: flex; flex-direction: column; }
.doc-band b { font-size: 1rem; }
.doc-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; margin-bottom: .8rem; }
.doc-blocks .kv { gap: .3rem .9rem; font-size: .9rem; }
.doc-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(260px, 1fr); gap: 1rem 2rem; margin-top: .8rem; align-items: start; }
.doc-foot h4, #detailBody h4 { margin: .8rem 0 .4rem; font-size: .95rem; }
.doc-foot .ord-lines { width: auto; }
.doc-totals .kv { grid-template-columns: 1fr auto; gap: .25rem 1rem; font-size: .9rem; }
.doc-totals .kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.doc-pay { display: flex; justify-content: space-between; gap: 1rem; margin-top: .5rem; padding: .5rem .7rem; border: 2px solid var(--text, #0f172a); border-radius: 6px; font-weight: 700; }
.doc-pay b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .doc-blocks, .doc-foot { grid-template-columns: 1fr; } }

/* 1.5.0 (Krivek, 01/12) */
.appt-hl { font-weight: 700; color: #15803d; }
.appt-res { font-weight: 700; color: #1d4ed8; }
dd.appt-hl, dd.appt-res { white-space: pre-wrap; }
.slot.busy[data-appt] { cursor: pointer; text-align: left; font: inherit; }
.slot.busy.done { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.prospect-box { border: 1px solid var(--line); border-radius: 6px; padding: .6rem .8rem; margin: .2rem 0 .6rem; }
.prospect-box legend { font-weight: 600; padding: 0 .3rem; }
#apptNewCust { align-self: flex-start; margin: -.2rem 0 .4rem; }
select.saved-ok { outline: 2px solid #16a34a; }
.call-admin { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.call-admin h3 { margin: 0 0 .3rem; font-size: 1rem; }
label.inline { display: inline-flex; gap: .35rem; align-items: center; }

/* 1.5.2: several call recipients */
.rec-list { display: flex; flex-direction: column; gap: .3rem; max-height: 260px; overflow: auto; margin: .3rem 0 .5rem; }

/* 1.5.4: checkboxes/radios never stretch to the full width (the general input rule made them 100%). */
input[type=checkbox], input[type=radio] { width: auto; padding: 0; margin: 0; flex: 0 0 auto; }
label.inline { color: var(--ink); margin-bottom: .4rem; }
.rec-list { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; background: #fff; gap: .15rem; }
.rec-list label { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: .55rem; margin: 0; padding: .3rem 0; text-align: left; font-size: .9rem; }
.rec-list label input { margin: 0; }

/* 1.5.5: customer autocomplete of a phone call — code and name in aligned columns */
.ac-wrap { position: relative; display: block; }
.ac-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); max-height: 300px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(15, 23, 42, .12); }
.ac-row { display: grid; grid-template-columns: 7.5rem 1fr; gap: .8rem; padding: .38rem .7rem; cursor: pointer; color: var(--ink); font-size: .88rem; }
.ac-row:hover, .ac-row.on { background: #eff6ff; }
.ac-code { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-empty { padding: .5rem .7rem; }

/* web login: Knock logo (Krivek, 01/12) */
.login-logo.knock { width: 300px; max-width: 92%; margin: .2rem auto 1.2rem; }

/* 1.5.6 (Krivek, 02/12): visits — bigger list with smaller text, numbered coloured pins */
.visits-split { grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); }
.visits-split #visitTableWrap { max-height: 72vh; overflow: auto; }
.visits-split #map { height: 72vh; }
table.visits-compact { font-size: .8rem; }
table.visits-compact th, table.visits-compact td { padding: .32rem .35rem; }
table.visits-compact .clip { max-width: 180px; }
.col-del { width: 1%; white-space: nowrap; }
.num-pin { background: none; border: 0; }
.num-pin span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 700 12px/1 system-ui, sans-serif; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.pin-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; margin: 0 0 .5rem; font-size: .8rem; }
.pin-key { display: inline-flex; align-items: center; gap: .35rem; }
.pin-key i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.seq-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; border-radius: 9px;
  color: #fff; font-size: .7rem; font-weight: 700; padding: 0 4px; }
@media (max-width: 1100px) { .visits-split { grid-template-columns: 1fr; } .visits-split #map { height: 420px; } }
/* visits list: let text wrap so every column fits the frame (global td rule is nowrap) */
/* only the notes column wraps (Krivek, 02/12); every other cell stays on one line */
table.visits-compact td:nth-child(11) { white-space: normal; min-width: 170px; max-width: 320px; }
table.visits-compact td:nth-child(11) .clip { max-width: none; white-space: normal; overflow-wrap: anywhere; }

/* 1.5.7: Greek date picker (flatpickr) — the visible box looks like the other inputs */
input.flatpickr-input.form-control, input.flatpickr-input + input { width: 100%; }
.toolbar input.flatpickr-input + input { width: 9.5rem; }
.flatpickr-calendar { font-family: inherit; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: #2563eb; border-color: #2563eb; }
/* Large screens (Krivek, 02/12): use the full width — no 1600px cap; visits list gets the space, map ~30% */
main { max-width: none; padding: 1rem 1.5rem; }
/* Krivek, 02/12: the map takes one third of the width */
.visits-split { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); }

/* 1.5.9: «Στατιστικά Πωλητών» */
.ss-table { font-size: .85rem; }
.ss-table th, .ss-table td { padding: .4rem .55rem; }
.ss-table thead tr.grp th { text-align: center; border-bottom: 1px solid var(--line); }
.ss-table th.g-appt { background: #eff6ff; } .ss-table th.g-visit { background: #f0fdf4; } .ss-table th.g-out { background: #faf5ff; }
.ss-table tfoot th, .ss-table tfoot td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--line); }
#ssQuick { display: inline-flex; gap: .3rem; align-self: flex-end; margin-bottom: .7rem; }

/* Code+name dropdowns: monospace so the padded customer code lines up with the description. */
#apptCustomer, #oeCustomer { font-family: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace; }
