/* =============================================================================
   viewer.css — S695 (PLAN_OwnerViewer Φ1): το κέλυφος των οθονών στατιστικών του «Παρατηρητή» (/viewer).
   Κινητό πρώτα: κεφαλίδα επάνω, περιεχόμενο σε κάρτες, μπάρα καρτελών κάτω. Ποτέ οριζόντια κύλιση.
   ΟΛΟΙ οι κανόνες με πρόθεμα .vw- ⇒ καμία επίδραση στο υπόλοιπο ERP. Χρώμα: teal #22B2A8.
   ============================================================================= */

.vw-shell {
    --vw-teal: #22B2A8;
    --vw-teal-dark: #1a8f87;
    --vw-up: #198754;
    --vw-down: #dc3545;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--t-body-bg, #f7f9fa);
    color: var(--t-text-primary, #1f2937);
    overflow-x: hidden;
}

/* ---- Κεφαλίδα ---- */
.vw-top {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--vw-teal);
    color: #fff;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.vw-top-row {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 1100px;
    margin: 0 auto;
}

.vw-company {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
}

.vw-company span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vw-top-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

.vw-iconbtn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 10px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.vw-iconbtn:active { background: rgba(255, 255, 255, .3); }

.vw-branch {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 1100px;
    margin: 8px auto 0;
    font-size: 14px;
}

.vw-branch-select {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 10px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 15px;
    padding: 0 10px;
}

.vw-branch-select option { color: #1f2937; background: #fff; }

/* ---- Περιεχόμενο ---- */
.vw-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px;
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));   /* χώρος για τη μπάρα κάτω */
}

.vw-title {
    font-size: 19px;
    font-weight: 700;
    margin: 2px 0 12px;
}

.vw-card {
    background: var(--t-card-bg, #fff);
    border: 1px solid var(--t-border, #e2e8f0);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.vw-empty {
    text-align: center;
    color: var(--t-text-secondary, #5a6577);
    padding: 40px 16px;
    font-size: 15px;
}

.vw-empty i {
    display: block;
    font-size: 34px;
    color: var(--vw-teal);
    margin-bottom: 12px;
}

.vw-muted {
    color: var(--t-text-muted, #94a3b8);
    font-size: 13px;
    margin-top: 6px;
}

/* ---- Μπάρα καρτελών κάτω ---- */
.vw-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020;
    display: flex;
    justify-content: center;
    background: var(--t-card-bg, #fff);
    border-top: 1px solid var(--t-border, #e2e8f0);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -1px 4px rgba(0, 0, 0, .06);
}

.vw-tab {
    flex: 1 1 0;
    min-width: 0;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 2px 8px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--t-text-secondary, #5a6577);
    text-decoration: none;
    border-top: 3px solid transparent;
}

.vw-tab i { font-size: 19px; }

.vw-tab span {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vw-tab:hover { color: var(--vw-teal-dark); text-decoration: none; }

.vw-tab.active {
    color: var(--vw-teal);
    font-weight: 700;
    border-top-color: var(--vw-teal);
}

/* =============================================================================
   Φ2 — κοινά στοιχεία των οθονών στατιστικών: όψεις (chips), φίλτρο, κάρτα συνόλου, γραμμές-κάρτες, μεταβολές
   ============================================================================= */

/* ---- Όψεις / επιλογές (τυλίγουν σε νέα γραμμή — ποτέ οριζόντια κύλιση) ---- */
.vw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.vw-chip {
    border: 1px solid var(--t-border-dark, #cbd5e1);
    background: var(--t-card-bg, #fff);
    color: var(--t-text-secondary, #5a6577);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
}

.vw-chip.active {
    background: var(--vw-teal);
    border-color: var(--vw-teal);
    color: #fff;
    font-weight: 700;
}

.vw-chips-sm .vw-chip { padding: 6px 12px; font-size: 13px; }

/* ---- Φίλτρο (Χρήση · σύγκριση) ---- */
.vw-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    font-size: 15px;
}

.vw-filter-item { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

.vw-select {
    height: 40px;
    min-width: 96px;
    border: 1px solid var(--t-border-dark, #cbd5e1);
    border-radius: 10px;
    background: var(--t-card-bg, #fff);
    color: var(--t-text-primary, #1f2937);
    font-size: 15px;
    padding: 0 10px;
}

.vw-check input { width: 20px; height: 20px; accent-color: var(--vw-teal); }

/* ---- Κάρτα συνόλου ---- */
.vw-kpi-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--t-text-secondary, #5a6577);
}

.vw-kpi-note { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--t-text-muted, #94a3b8); font-size: 12px; }

.vw-kpi-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 2px;
    color: var(--t-text-primary, #1f2937);
    overflow-wrap: anywhere;
}

.vw-kpi-sub { margin-top: 4px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }

.vw-muted-inline { color: var(--t-text-muted, #94a3b8); font-size: 13px; }

.vw-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px 14px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--t-border, #e2e8f0);
}

.vw-kpi-grid > div { display: flex; flex-direction: column; min-width: 0; }
.vw-kpi-grid span { font-size: 12px; color: var(--t-text-secondary, #5a6577); }
.vw-kpi-grid strong { font-size: 16px; overflow-wrap: anywhere; }
.vw-kpi-grid em { font-style: normal; font-size: 13px; color: var(--vw-teal-dark); font-weight: 700; }

.vw-kpi-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; font-size: 14px; }

/* ---- Κάρτα με τίτλο / γράφημα ---- */
.vw-card-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--t-text-secondary, #5a6577); }
.vw-card-title i { color: var(--vw-teal); margin-right: 4px; }
.vw-chart { position: relative; height: 230px; }

/* ---- Γραμμές-κάρτες (δύο–τρεις γραμμές κειμένου, ποτέ πίνακας) ---- */
.vw-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.vw-row {
    display: block;
    background: var(--t-card-bg, #fff);
    border: 1px solid var(--t-border, #e2e8f0);
    border-radius: 12px;
    padding: 11px 14px;
    color: inherit;
    text-decoration: none;
}

.vw-row-link:hover { color: inherit; text-decoration: none; border-color: var(--vw-teal); }
.vw-row-link:active { background: var(--t-border-light, #f1f5f9); }

.vw-row-total { border-color: var(--vw-teal); border-width: 2px; }

.vw-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.vw-row-name { font-size: 15px; font-weight: 700; min-width: 0; }
.vw-row-val { font-size: 16px; font-weight: 800; white-space: nowrap; }
.vw-row-val.neg { color: var(--vw-down); }
.vw-row-date { color: var(--t-text-secondary, #5a6577); font-weight: 400; margin-right: 6px; }

.vw-row-sub {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-top: 3px;
    font-size: 13px;
    color: var(--t-text-secondary, #5a6577);
}

.vw-row-faint { color: var(--t-text-muted, #94a3b8); font-size: 12px; }
.vw-row-faint i { font-size: 11px; }

.vw-ellipsis { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-nowrap { white-space: nowrap; }

/* ---- Μεταβολή ▲ / ▼ ---- */
.vw-chg { font-weight: 700; white-space: nowrap; margin-right: 6px; }
.vw-chg.up { color: var(--vw-up); }
.vw-chg.down { color: var(--vw-down); }
.vw-chg.flat { color: var(--t-text-muted, #94a3b8); }

/* ---- Μπάρα μεριδίου ---- */
.vw-bar { height: 6px; border-radius: 3px; background: var(--t-border, #e2e8f0); margin-top: 7px; overflow: hidden; }
.vw-bar-fill { height: 100%; border-radius: 3px; background: var(--vw-teal); }

/* ---- Κουμπιά ---- */
.vw-btn {
    border: 1px solid var(--vw-teal);
    background: var(--t-card-bg, #fff);
    color: var(--vw-teal-dark);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

.vw-btn-block { display: block; width: 100%; margin: 0 0 12px; }

/* ---- Επικεφαλίδα υπο-οθόνης με «πίσω» ---- */
.vw-back { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }

.vw-backbtn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 1px solid var(--t-border-dark, #cbd5e1);
    border-radius: 10px;
    background: var(--t-card-bg, #fff);
    color: var(--vw-teal-dark);
    font-size: 16px;
    cursor: pointer;
}

.vw-back-title { flex: 1 1 auto; min-width: 0; font-size: 18px; font-weight: 700; }
.vw-back-val { flex: 0 0 auto; font-size: 18px; font-weight: 800; white-space: nowrap; }

/* ---- Φ5 «Επισκόπηση»: τίτλος ενότητας, κάρτα «Χρήματα», πρόσημο διαφοράς ---- */
.vw-section {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--t-text-secondary, #5a6577);
    margin: 18px 2px 8px;
}

.vw-money-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0; font-size: 15px; }
.vw-money-row + .vw-money-row { border-top: 1px solid var(--t-border-light, #f1f5f9); }
.vw-money-row strong { font-size: 16px; white-space: nowrap; }
.vw-money-sub { padding-top: 0; font-size: 13px; color: var(--t-text-secondary, #5a6577); border-top: none !important; }
.vw-money-sub strong { font-size: 14px; }
.vw-warn { color: #b45309; }
.vw-neg { color: var(--vw-down); }
.vw-pos { color: var(--vw-up); }

.vw-empty-sm { padding: 18px 16px; }
.vw-foot { font-size: 11px; color: var(--t-text-muted, #94a3b8); margin: 4px 2px 0; line-height: 1.4; }

/* ---- Tablet / PC: ίδιες κάρτες, περισσότερος αέρας ---- */
@media (min-width: 768px) {
    .vw-main { padding: 20px 20px calc(92px + env(safe-area-inset-bottom, 0px)); }
    .vw-title { font-size: 22px; }
    .vw-tab { font-size: 13px; padding-top: 10px; }
    .vw-tab i { font-size: 21px; }
    .vw-kpi-value { font-size: 36px; }
    .vw-chart { height: 300px; }
    .vw-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (min-width: 1100px) {
    .vw-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Αναφορές (Φ7): λίστα αναφορών + κουμπί «Αποστολή με email» ---- */
.vw-rep { cursor: pointer; }
.vw-rep-icon { color: var(--vw-teal); width: 24px; margin-right: 6px; text-align: center; }
.vw-rep-chev { color: var(--t-text-muted, #94a3b8); font-size: 13px; }
.vw-mailbtn { color: var(--vw-teal); border-color: var(--vw-teal); }
