:root{color-scheme:dark;font-family:"Play",ui-sans-serif,system-ui,sans-serif;--bg:#050505;--panel:#0d0d0f;--panel2:#151518;--text:#f7f7f7;--muted:#a8a8b0;--border:#2c2c31;--red:#d71920;--red2:#ef2b31;--warn-bg:#3a2d00;--warn-text:#ffd86b}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text)}button,input,select,textarea,dialog{font:inherit}button{cursor:pointer}.shell{min-height:100vh}.topbar{height:72px;background:#080809;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;z-index:20}.brand{display:flex;gap:12px;align-items:center}.brand-logo{width:46px;height:46px;object-fit:contain;display:block}.brand h1{font-size:16px;margin:0}.brand p{margin:2px 0 0;font-size:12px;color:var(--muted)}.user-area{display:flex;align-items:center;gap:12px;font-size:13px;color:var(--muted)}.main{padding:24px;max-width:1600px;margin:0 auto}.login-wrap{min-height:100vh;display:grid;place-items:center;padding:24px}.login-card{width:min(440px,100%);background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:30px}.login-logo{width:104px;height:104px;object-fit:contain;display:block;margin:0 auto 18px}.login-card h1{margin:0 0 8px;font-size:24px}.login-card p{margin:0 0 24px;color:var(--muted);font-size:14px;line-height:1.5}.field{display:grid;gap:6px;margin-bottom:14px}.field label{font-size:13px;font-weight:700}.field input{border:1px solid var(--border);border-radius:8px;padding:11px 12px;background:#111114;color:var(--text);outline:none}.field input:focus,.search:focus{border-color:var(--red)}.btn{border:1px solid var(--red);border-radius:8px;padding:10px 14px;background:var(--red);color:#fff;font-weight:700}.btn:hover{background:var(--red2);border-color:var(--red2)}.btn:disabled{opacity:.45;cursor:not-allowed}.btn.secondary,.btn.ghost{background:#fff;color:var(--red);border:1px solid var(--red)}.btn.secondary:hover,.btn.ghost:hover{background:#fff1f1}.btn.danger{background:var(--red);color:#fff}.btn.full{width:100%}.error{color:#ff6b70;font-size:13px;margin-top:10px}.success{color:#6ee7a8;font-size:13px;margin-top:10px}.info{color:var(--muted);font-size:13px}.auth-link{display:block;width:100%;border:0;background:transparent;color:#ddd;padding:12px 4px 2px;text-align:center;font-weight:700}.auth-link:hover{color:#fff;text-decoration:underline}.section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:18px}.section-head h2{margin:0;font-size:22px}.section-head p{margin:6px 0 0;color:var(--muted);font-size:14px}.table-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:14px}.table-card{background:var(--panel);color:var(--text);border:1px solid var(--border);border-radius:12px;padding:18px;text-align:left;transition:.15s ease;min-height:118px}.table-card:hover{border-color:var(--red);background:#131316}.table-card h3{margin:0 0 7px;font-size:16px}.table-card p{margin:0;color:var(--muted);font-size:13px;line-height:1.4}.table-card .meta{margin-top:14px;font-size:12px;color:#85858d}.toolbar{background:var(--panel);border:1px solid var(--border);border-radius:12px 12px 0 0;padding:12px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}.toolbar .spacer{flex:1}.search{min-width:260px;border:1px solid var(--border);border-radius:8px;padding:9px 11px;background:#111114;color:#fff;outline:none}.pending{font-size:13px;font-weight:700;color:var(--warn-text);background:var(--warn-bg);border-radius:999px;padding:7px 10px}.grid-wrap{background:var(--panel);border:1px solid var(--border);border-top:0;border-radius:0 0 12px 12px;overflow:hidden}#dataGrid{width:100%;height:calc(100vh - 200px);min-height:520px}.back{margin-bottom:12px;display:inline-flex;align-items:center;gap:8px;color:#fff;background:transparent;border:0;padding:0}.status-line{font-size:12px;color:var(--muted);margin-top:8px}.confirm-dialog{border:1px solid var(--border);border-radius:14px;padding:0;width:min(420px,calc(100vw - 32px));background:var(--panel);color:var(--text)}.confirm-dialog::backdrop{background:rgba(0,0,0,.72)}.confirm-dialog form{padding:24px}.confirm-dialog h3{margin:0 0 8px}.confirm-dialog p{color:var(--muted);line-height:1.5}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.dialog-actions.vertical{flex-direction:column}.unauthorized{max-width:560px;margin:80px auto;background:var(--panel);border:1px solid var(--border);border-radius:14px;padding:24px}.ag-theme-quartz .ag-cell,.ag-theme-quartz .ag-cell-value,.ag-theme-quartz .ag-cell-wrapper,.ag-theme-quartz .ag-header-cell,.ag-theme-quartz .ag-header-cell-text,.ag-theme-quartz .ag-input-field-input,.ag-theme-quartz .ag-text-field-input,.ag-theme-quartz .ag-number-field-input,.ag-theme-quartz .ag-select,.ag-theme-quartz .ag-select-list-item,.ag-theme-quartz .ag-menu,.ag-theme-quartz .ag-filter,.ag-theme-quartz .ag-paging-panel,.ag-theme-quartz .ag-picker-field-display{font-family:"Play",ui-sans-serif,system-ui,sans-serif!important}.ag-theme-quartz .ag-cell-value,.ag-theme-quartz .ag-header-cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-cell.pending-cell{background:#382b00!important}.ag-tooltip,.ag-theme-quartz .ag-tooltip{background:#fff3b0!important;background-color:#fff3b0!important;color:#1f2937!important;border:1px solid #d8bd4a!important;border-radius:8px!important;box-shadow:0 6px 20px rgba(0,0,0,.35)!important;opacity:1!important;max-width:min(520px,80vw)!important;padding:9px 11px!important;white-space:normal!important;overflow-wrap:anywhere!important;line-height:1.4!important;font-family:"Play",ui-sans-serif,system-ui,sans-serif!important}@media(max-width:700px){.topbar{padding:0 14px}.main{padding:14px}.user-area span{display:none}.search{min-width:100%;width:100%}#dataGrid{height:calc(100vh - 240px)}}

/* -- Grid header + scrollbars --------------------------------------------------
   Header colours live in the theme object in app.js (AG Grid Theming API); what is
   left here is what the theme has no parameter for. */

/* The floating-filter row sits inside .ag-header, so it inherits the red band.
   Kept dark so the filter inputs stay readable and the red reads as one clean bar. */
.ag-theme-quartz .ag-header-row-filter { background: #151518; }

/* Visible scrollbars. Deliberately NOT scoped to .ag-theme-quartz: AG Grid measures
   scrollbar thickness with a probe element outside the grid, so a scoped rule leaves
   the measured height and the painted bar out of step. */
::-webkit-scrollbar { height: 14px; width: 14px; }
::-webkit-scrollbar-track { background: #151518; }
::-webkit-scrollbar-thumb { background: #5a5a63; border-radius: 8px; border: 3px solid #151518; }
::-webkit-scrollbar-thumb:hover { background: #d71920; }
::-webkit-scrollbar-corner { background: #151518; }
* { scrollbar-width: auto; scrollbar-color: #5a5a63 #151518; }


/* -- The grid view fits the window -------------------------------------------
   #dataGrid used a fixed height:calc(100vh - 200px), but the real chrome above it
   is 262px (topbar 72 + back link + title + toolbar), so the page overflowed by
   about 110px and the pagination footer and the horizontal scrollbar fell below
   the fold. The shell is now a full-height column and the grid takes whatever is
   left over, so both are always on screen.

   Scoped with :has(#dataGrid) so the table-chooser page keeps its normal flow.
   width:100% on .main is required: .main centres itself with margin:0 auto, and
   an auto cross-axis margin cancels flex stretching, which would otherwise
   shrink the whole page to the width of its content.

   Deliberately no overflow:hidden -- on a very short window the page can still
   scroll rather than clipping the grid at its 240px minimum. */
body:has(#dataGrid) .shell { height: 100vh; min-height: 0; display: flex; flex-direction: column; }
body:has(#dataGrid) .topbar { flex: none; }
body:has(#dataGrid) .main { flex: 1 1 auto; min-height: 0; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
body:has(#dataGrid) .main > * { flex: none; }
body:has(#dataGrid) .grid-wrap { flex: 1 1 auto; min-height: 240px; }
body:has(#dataGrid) #dataGrid { height: 100%; min-height: 0; }


/* ── Σύνδεσμος προς το εγχειρίδιο ─────────────────────────────────────────────
   Σε ΔΥΟ σημεία επίτηδες. Η κάρτα στο μενού είναι το εμφανές σημείο: εκεί
   κοιτάζει κάποιος που μπήκε και δεν ξέρει τι να κάνει. Ο μικρός σύνδεσμος
   στη μπάρα υπάρχει σε κάθε οθόνη, γιατί η ερώτηση «και τώρα τι πατάω;»
   γεννιέται μέσα στη δουλειά, όχι στο μενού.

   Χρυσό και όχι κόκκινο: το κόκκινο στην εφαρμογή σημαίνει ενέργεια που
   γράφει. Το εγχειρίδιο δεν αλλάζει τίποτα, και δεν πρέπει να διαβάζεται ως
   κουμπί που κάνει κάτι. */
.help-link { color: #ffd86b; text-decoration: none; font-weight: 700; font-size: 13px;
             border: 1px solid #4a3c12; background: #241d06; border-radius: 999px;
             padding: 6px 12px; white-space: nowrap; }
.help-link:hover { background: #33280a; border-color: #6b5518; color: #ffe9a0; }

/* Η κάρτα του εγχειριδίου είναι <a> και όχι <button> -- ο κανόνας .table-card
   γράφτηκε για κουμπιά, οπότε χρειάζεται block και καθαρό υπογράμμισμα. */
a.table-card { display: block; text-decoration: none; }
.tool-card-help { border-color: #4a3c12; }
.tool-card-help:hover { border-color: #ffd86b; background: #1a1509; }
.tool-card-help h3 { color: #ffd86b; }
.tool-card-help h3::before { content: "\1F4D8  "; }

.login-help { display: block; text-align: center; margin-top: 16px; font-size: 13px;
              color: #a8a8b0; text-decoration: none; }
.login-help:hover { color: #ffd86b; text-decoration: underline; }


/* ── Οθόνη φωτογραφιών ────────────────────────────────────────────────────── */
.tool-card { border-color: #3a2a2c; }
.tool-card h3::before { content: "🖼 "; }

.ph-tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.ph-tab { background: #121215; color: #c9c9d1; border: 1px solid var(--border); border-radius: 999px;
          padding: 8px 16px; font-family: inherit; font-size: 14px; cursor: pointer; }
.ph-tab:hover { border-color: #55555e; color: #fff; }
.ph-tab.on { background: #d71920; border-color: #d71920; color: #fff; font-weight: 700; }

.ph-select { background: #121215; color: #f7f7f7; border: 1px solid var(--border);
             border-radius: 8px; padding: 9px 10px; font-family: inherit; font-size: 14px; }

.ph-summary { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.ph-summary strong { color: #f7f7f7; }

.ph-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.ph-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
           padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.ph-slots { display: flex; gap: 6px; }

/* Το κουτί είναι ταυτόχρονα προεπισκόπηση, στόχος για drag και κουμπί.
   aspect-ratio 1 ώστε το πλέγμα να μένει ευθυγραμμισμένο ό,τι σχήμα κι αν έχει
   η εικόνα -- object-fit: contain για να μην κόβεται το προϊόν. */
.ph-slot { position: relative; flex: 1 1 0; aspect-ratio: 1; background: #0a0a0c;
           border: 1px dashed #3a3a42; border-radius: 8px; overflow: hidden; cursor: pointer;
           display: flex; align-items: center; justify-content: center; }
.ph-slot:hover, .ph-slot:focus-visible { border-color: #d71920; outline: none; }
.ph-slot.ph-has { border-style: solid; border-color: #2c2c31; background: #fff; }
.ph-slot img { width: 100%; height: 100%; object-fit: contain; display: block; }

.ph-slot .ph-empty { position: absolute; inset: 0; display: none; flex-direction: column;
                     align-items: center; justify-content: center; gap: 4px;
                     color: #6b6b74; font-size: 22px; pointer-events: none; }
.ph-slot .ph-empty span { font-size: 11px; }
.ph-slot:not(.ph-has):not(:has(img)) .ph-empty,
.ph-slot.ph-none .ph-empty { display: flex; }
.ph-slot.ph-none img { display: none; }
.ph-slot.ph-none .ph-badge { display: none; }

.ph-slot.ph-over { border-color: #d71920; border-style: solid; background: #2a1012; }
.ph-slot.ph-err { border-color: #ff6b6b; }

.ph-badge { position: absolute; top: 5px; left: 5px; font-size: 10px; line-height: 1;
            padding: 3px 6px; border-radius: 4px; font-weight: 700; letter-spacing: .02em; }
.ph-badge.ph-new { background: #0f5132; color: #d1f7e0; }
.ph-badge.ph-old { background: #4a3c00; color: #ffe98a; }
.ph-slotname { position: absolute; bottom: 4px; right: 5px; font-size: 10px; color: #8a8a93;
               background: rgba(0,0,0,.55); padding: 2px 5px; border-radius: 4px; }

/* Η ένδειξη προόδου καλύπτει το κουτί ώστε να είναι προφανές ποιο δουλεύει. */
.ph-prog { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
           background: rgba(5,5,5,.82); color: #fff; font-size: 11px; text-align: center; padding: 6px; }
.ph-slot.ph-busy .ph-prog { display: flex; }
.ph-slot.ph-busy { cursor: progress; }

.ph-meta { min-width: 0; }
.ph-code { font-size: 13px; font-weight: 700; color: #f7f7f7; }
.ph-hidden { font-size: 10px; font-weight: 400; color: #8a8a93; border: 1px solid #3a3a42;
             border-radius: 4px; padding: 1px 4px; }
.ph-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
           white-space: nowrap; }

.ph-pager { display: flex; align-items: center; gap: 14px; justify-content: center;
            margin: 18px 0 4px; font-size: 13px; color: var(--muted); }

.ph-orphans { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ph-orphan { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px;
             display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); }
.ph-orphan img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 6px; }
.ph-orphan span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9c9d1; }

@media (max-width: 700px) {
  .ph-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}


/* ── Μπάρα προόδου μαζικών εργασιών ───────────────────────────────────────────
   Πρώτη έκδοση έδειχνε την πρόοδο σε μια γραμμή κειμένου κάτω αριστερά. Ο
   χρήστης πάτησε "εισαγωγή", δεν είδε τίποτα, και λογικά υπέθεσε ότι κόλλησε.
   Μια εργασία που κρατά λεπτά χρειάζεται δική της θέση, ψηλά και ορατή. */
.ph-banner { background: #121215; border: 1px solid #3a2a2c; border-left: 4px solid #d71920;
             border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
.ph-banner-top { display: flex; justify-content: space-between; align-items: baseline;
                 font-size: 14px; color: #f7f7f7; margin-bottom: 8px; }
.ph-banner-top span { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.ph-bar { height: 8px; background: #0a0a0c; border-radius: 999px; overflow: hidden; }
.ph-bar-fill { height: 100%; width: 0; background: #d71920; border-radius: 999px;
               transition: width .2s linear; }
.ph-banner-note { font-size: 12px; color: var(--muted); margin-top: 8px;
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ── Οθόνη εισαγωγής από ERP ───────────────────────────────────────────────── */
.tool-card-erp h3::before { content: "\1F4E5  "; }

.erp-drop { border: 2px dashed #3a3a42; border-radius: 14px; background: #101013;
            padding: 34px 20px; text-align: center; margin: 0 0 14px;
            transition: border-color .12s, background .12s; }
.erp-drop.erp-over { border-color: #d71920; background: #2a1012; }
.erp-drop.erp-busy { opacity: .55; pointer-events: none; }
.erp-drop-icon { font-size: 26px; color: #6b6b74; line-height: 1; }
.erp-drop-main { font-size: 16px; font-weight: 700; color: #f7f7f7; margin-top: 8px; }
.erp-drop-sub  { font-size: 13px; color: var(--muted); margin-top: 4px; }
.erp-link { color: #ff6b70; text-decoration: underline; cursor: pointer; }

.erp-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
             padding: 16px; margin: 0 0 14px; }
.erp-panel-head { font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
                  color: var(--muted); margin-bottom: 10px; }

.erp-file { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.erp-file strong { color: #f7f7f7; font-size: 15px; }

/* Στατιστικά: μεγάλοι αριθμοί, γιατί αυτό είναι η απόφαση. Ο χρήστης πρέπει να
   δει με μια ματιά πόσα μπαίνουν και πόσα αλλάζουν, χωρίς να διαβάσει κείμενο. */
.erp-stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
             margin: 0 0 14px; }
.erp-stat { background: #101013; border: 1px solid var(--border); border-left-width: 3px;
            border-radius: 10px; padding: 10px 12px; }
.erp-stat b { display: block; font-size: 26px; line-height: 1.1; color: #f7f7f7; }
.erp-stat span { display: block; font-size: 13px; color: #c9c9d1; }
.erp-stat i { display: block; font-size: 11px; color: #7a7a83; font-style: normal; margin-top: 2px; }
.erp-stat-new  { border-left-color: #2f9e5c; }
.erp-stat-upd  { border-left-color: #d71920; }
.erp-stat-orph { border-left-color: #7a6a00; }

.erp-warn { background: #1a1508; border: 1px solid #4a3c00; color: #ffe98a;
            border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 0 0 10px; line-height: 1.5; }
.erp-warn-hot { background: #240b0d; border-color: #6b1a1e; color: #ffb3b6; }
.erp-warn strong { color: #fff; }
.erp-ok { background: #0c1a12; border: 1px solid #1f5138; color: #9fe0bb;
          border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 0 0 10px; }
.erp-prot { font-size: 12px; color: var(--muted); border-left: 3px solid #2c2c31;
            padding: 4px 0 4px 10px; margin: 0 0 12px; line-height: 1.6; }
.erp-prot strong { color: #c9c9d1; }
.erp-note { font-size: 12px; color: #7a7a83; margin: 6px 0; }

.erp-det { border-top: 1px solid var(--border); padding: 10px 0 4px; }
.erp-det > summary { cursor: pointer; font-size: 13px; color: #c9c9d1; padding: 4px 0; }
.erp-det > summary:hover { color: #fff; }

.erp-top2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.erp-top2 h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase;
               letter-spacing: .06em; }
.erp-top { margin: 0; padding-left: 20px; font-size: 12px; color: #c9c9d1; }
.erp-top li { margin-bottom: 4px; }
.erp-desc { color: var(--muted); }

/* Οι λίστες μπορεί να έχουν εκατοντάδες γραμμές: κύλιση μέσα στο πλαίσιο, ώστε
   το κουμπί της εφαρμογής να μη φεύγει τρεις οθόνες πιο κάτω. */
.erp-table { width: 100%; border-collapse: collapse; font-size: 12px; display: block;
             max-height: 340px; overflow: auto; margin-top: 6px; }
.erp-table th, .erp-table td { border-bottom: 1px solid #202024; padding: 5px 8px;
                               text-align: left; vertical-align: top; }
.erp-table th { position: sticky; top: 0; background: #d71920; color: #fff; font-weight: 700; z-index: 1; }
.erp-r { text-align: right; }
.erp-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #f7f7f7; white-space: nowrap; }
.erp-fld { margin-bottom: 3px; }
.erp-fname { display: inline-block; min-width: 118px; color: #8a8a93; }
.erp-old { color: #ff9a9d; text-decoration: line-through; }
.erp-new { color: #9fe0bb; }
.erp-pill { font-size: 10px; border: 1px solid #3a3a42; border-radius: 4px; padding: 1px 5px; color: #8a8a93; }
.erp-pill-live { border-color: #6b1a1e; background: #240b0d; color: #ffb3b6; }

.erp-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
               border-top: 1px solid var(--border); margin-top: 12px; padding-top: 14px; }

@media (max-width: 700px) {
  .erp-top2 { grid-template-columns: 1fr; }
  .erp-fname { min-width: 0; margin-right: 6px; }
}


/* ── Έλεγχος στηλών και υπόδειγμα ─────────────────────────────────────────── */
.erp-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; }
.erp-cols > summary { cursor: pointer; font-size: 13px; color: #c9c9d1; }
.erp-cols > summary:hover { color: #fff; }
/* Χωράει και τις 17 γραμμές: μια λίστα αναφοράς που κρύβει την τελευταία της
   γραμμή πίσω από κύλιση είναι χειρότερη από καθόλου λίστα. */
.erp-table-cols { max-height: 560px; }
.erp-hint { color: #7a7a83; }

/* Η απόρριψη πρέπει να ξεχωρίζει από την προεπισκόπηση με μια ματιά: κόκκινο
   περίγραμμα σε όλο το πλαίσιο, όχι μόνο ένα μήνυμα μέσα σε ουδέτερο κουτί. */
.erp-panel-bad { border-color: #6b1a1e; box-shadow: inset 3px 0 0 #d71920; }
.erp-panel-bad .erp-panel-head { color: #ff9a9d; }
.erp-bad-lead { font-size: 13px; color: #c9c9d1; margin: 0 0 12px; line-height: 1.55; }

.erp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.erp-chip { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px;
            background: #1a1a1f; border: 1px solid #3a3a42; border-radius: 4px;
            padding: 3px 7px; color: #c9c9d1; }
.erp-chip-bad { background: #2a0f11; border-color: #8a2228; color: #ffb3b6; }

.erp-pass { color: #9fe0bb; }
