@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --white: #FFFFFF;
    --bg: #F5F6F8;
    --border: #E2E4E9;
    --border-light: #EDEDF0;
    --text: #111;
    --text-2: #666;
    --text-3: #999;
    --sky: #0066FF;
    --sky-bg: #EEF4FF;
    --amber: #D97706;
    --amber-bg: #FFFBEB;
    --green: #059669;
    --green-bg: #ECFDF5;
    --red: #DC2626;
    --violet: #7C3AED;
    --violet-bg: #F5F3FF;
    --orange: #EA580C;
    --orange-bg: #FFF7ED;
}

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

body.page-fs { overflow: hidden; }

/* ═══════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════ */
.topbar {
    height: 54px;
    min-height: 54px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 20;
}

.topbar-logo {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--text-3);
    font-size: 0.72rem; font-weight: 500;
}
.topbar-logo:hover { color: var(--text); }
.topbar-logo svg { opacity: 0.4; }

.topbar-mid {
    display: flex; align-items: baseline; gap: 14px;
    position: absolute; left: 50%; transform: translateX(-50%);
}

.topbar-clock {
    font-family: var(--mono);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.topbar-sep { color: var(--text-3); font-size: 1rem; }

.topbar-date {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-2);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.live-pill {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--green-bg);
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--green);
}

.live-dot {
    width: 5px; height: 5px;
    background: var(--green);
    border-radius: 50%;
    animation: blink 2s ease infinite;
}

@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.15; } }

.date-input {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    background: var(--white);
    cursor: pointer;
}
.date-input:focus { outline: none; border-color: var(--sky); }

.btn-fs {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-3);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-fs:hover { background: var(--bg); color: var(--text); }

.board-stats { display: flex; gap: 12px; }
.bs { font-size: 0.72rem; font-weight: 500; color: var(--text-3); }
.bs-n { font-family: var(--mono); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.bs-n.amber { color: var(--amber); }
.bs-n.green { color: var(--green); }

/* ═══════════════════════════════════════
   IMPORT DRAWER
   ═══════════════════════════════════════ */
.btn-import-toggle {
    display: flex; align-items: center; gap: 5px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-import-toggle:hover { background: var(--bg); }

.import-drawer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.import-drawer.open { max-height: 120px; }

.import-drawer-inner { padding: 10px 24px; display: flex; gap: 28px; }

.import-block { display: flex; align-items: center; gap: 8px; }
.import-label { font-size: 0.7rem; font-weight: 600; }
.import-label.lbl-ing { color: var(--sky); }
.import-label.lbl-usc { color: var(--orange); }

.import-block input[type="file"] { font-size: 0.68rem; color: var(--text-3); max-width: 170px; }
.import-block input[type="file"]::file-selector-button {
    font-size: 0.66rem; font-weight: 500;
    padding: 3px 8px; border: 1px solid var(--border); border-radius: 5px;
    background: var(--white); color: var(--text-2); cursor: pointer; margin-right: 6px;
}

.btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border: none; border-radius: 6px;
    font-size: 0.7rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-sky { background: var(--sky); color: #fff; }
.btn-sky:hover { background: #0055DD; }
.btn-ora { background: var(--orange); color: #fff; }
.btn-ora:hover { background: #D04500; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.import-msg { font-size: 0.7rem; font-weight: 500; padding: 5px 24px; display: none; }
.import-msg.ok { display: block; color: var(--green); }
.import-msg.err { display: block; color: var(--red); }

/* ═══════════════════════════════════════
   BOARD SPLIT — Two panels side by side
   ═══════════════════════════════════════ */
.board-split {
    flex: 1;
    display: flex;
    min-height: 0;
    background: var(--bg);
    gap: 0;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--white);
}

.panel-divider {
    width: 3px;
    background: var(--bg);
    flex-shrink: 0;
}

/* ── Panel header ── */
.panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    flex-shrink: 0;
}

.panel-head h2 {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.panel-head.ing {
    color: var(--sky);
    background: var(--sky-bg);
    border-bottom: 2px solid var(--sky);
}
.panel-head.usc {
    color: var(--orange);
    background: var(--orange-bg);
    border-bottom: 2px solid var(--orange);
}

.panel-cnt {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
    font-variant-numeric: tabular-nums;
    background: rgba(255,255,255,0.7);
}

.panel-head.ing .panel-cnt { color: var(--sky); }
.panel-head.usc .panel-cnt { color: var(--orange); }

/* ── Panel body ── */
.panel-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 6px 10px;
}

body.page-fs .panel-body {
    overflow: hidden;
}

/* ── Page indicator ── */
.panel-page {
    flex-shrink: 0;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    background: var(--bg);
}

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 6px;
    background: var(--white);
    transition: all 0.12s;
}

.card.clickable { cursor: pointer; }
.card.clickable:hover {
    border-color: var(--sky);
    box-shadow: 0 0 0 1px var(--sky-bg);
}

.card[data-stato="RIMOSSO"] { opacity: 0.2; }
.card[data-stato="EFFETTUATO"] { opacity: 0.45; }

/* Card top row: buono + destination */
.card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.card-buono {
    font-family: var(--mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.card-dest {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Card bottom row: meta + status */
.card-bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.card-art {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-vett {
    font-size: 0.7rem;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Tags ── */
.tag {
    display: inline-flex;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.tag-corepla { background: var(--sky-bg); color: var(--sky); }
.tag-coripet { background: var(--amber-bg); color: var(--amber); }
.tag-nuovo { background: var(--violet-bg); color: var(--violet); }

/* ── Status pills ── */
.status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.status-PROGRAMMATO { background: var(--sky-bg); color: var(--sky); }
.status-PROGRAMMATO .status-dot { background: var(--sky); }

.status-IN_CORSO { background: var(--amber-bg); color: var(--amber); }
.status-IN_CORSO .status-dot { background: var(--amber); animation: blink 1.2s ease infinite; }

.status-EFFETTUATO { background: var(--green-bg); color: var(--green); }
.status-EFFETTUATO .status-dot { background: var(--green); }

.status-RIMOSSO { background: #F3F3F3; color: var(--text-3); }
.status-RIMOSSO .status-dot { background: var(--text-3); }

/* ── Empty state ── */
.empty-board {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 100px;
}
.empty-board p { font-size: 0.85rem; color: var(--text-3); font-weight: 500; }

/* ═══════════════════════════════════════
   LANDING
   ═══════════════════════════════════════ */
.landing {
    background: var(--white);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; padding: 2rem; gap: 3rem;
}

.landing-brand { text-align: center; }

.brand-icon {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--bg);
    color: var(--text);
    display: inline-grid; place-items: center;
    margin-bottom: 1.2rem;
}
.brand-icon svg { width: 26px; height: 26px; }

.landing-brand h1 {
    font-size: 1.5rem; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text); margin-bottom: 0.4rem;
}
.landing-brand p { font-size: 0.9rem; color: var(--text-3); }

.landing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 440px; width: 100%; }

.l-card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem 1.2rem 1.6rem; text-align: center;
    text-decoration: none; color: var(--text);
    transition: all 0.2s ease;
}
.l-card:hover { border-color: #CCC; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.l-card-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: inline-grid; place-items: center;
    margin-bottom: 1rem;
}
.l-card-icon svg { width: 18px; height: 18px; }
.l-card.card-a .l-card-icon { background: var(--sky-bg); color: var(--sky); }
.l-card.card-b .l-card-icon { background: var(--orange-bg); color: var(--orange); }

.l-card h2 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem; }
.l-card p { font-size: 0.78rem; color: var(--text-3); line-height: 1.45; }

/* ═══════════════════════════════════════
   FULLSCREEN OVERRIDES
   ═══════════════════════════════════════ */
:fullscreen .topbar { display: none; }
:fullscreen .import-drawer { display: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 1024px) {
    .topbar { padding: 0 16px; }
    .topbar-mid { position: static; transform: none; }
    .topbar-clock { font-size: 1.3rem; }
    .panel-head { padding: 10px 14px; }
    .panel-body { padding: 4px 8px; }
    .card { padding: 8px 10px; }
    .card-buono { font-size: 0.82rem; }
    .card-dest { font-size: 0.78rem; }
}

@media (max-width: 640px) {
    .landing-grid { grid-template-columns: 1fr; max-width: 260px; }
    .board-stats { display: none; }
    .topbar-date { display: none; }
    .board-split { flex-direction: column; }
    .panel-divider { width: auto; height: 3px; }
    .import-block { flex-wrap: wrap; }
}
