/* =====================================================
   SolCommesse — Custom Design System
   Aesthetic: Industrial Field Service · Mobile-First
   Fonts: Barlow Condensed (display) + Nunito (body)
   Accent: Azure / Sky Blue
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@300;400;500;600;700;800;900&family=Nunito:wght@300;400;500;600;700&display=swap');

/* ================================================
   DESIGN TOKENS
   ================================================ */
:root {
    /* Azure blue palette */
    --sc-accent:        #0ea5e9;
    --sc-accent-hover:  #38bdf8;
    --sc-accent-deep:   #0284c7;
    --sc-accent-subtle: rgba(14, 165, 233, 0.10);
    --sc-accent-glow:   rgba(14, 165, 233, 0.25);

    /* Light mode */
    --sc-bg:            #dce8f2;
    --sc-surface:       #ffffff;
    --sc-surface-alt:   #f5f9fd;
    --sc-border:        #d8e6f0;
    --sc-text:          #0f1e2e;
    --sc-text-muted:    #5c7a92;
    --sc-shadow:        rgba(15, 30, 46, 0.09);
    --sc-shadow-lg:     rgba(15, 30, 46, 0.15);
}

[data-bs-theme="dark"] {
    --sc-bg:            #07111c;
    --sc-surface:       #0f1e2e;
    --sc-surface-alt:   #162536;
    --sc-border:        #1e3347;
    --sc-text:          #d6eaf8;
    --sc-text-muted:    #6a90aa;
    --sc-shadow:        rgba(0, 0, 0, 0.40);
    --sc-shadow-lg:     rgba(0, 0, 0, 0.55);
}

/* Bootstrap body bg sync */
:root[data-bs-theme="light"] { --bs-body-bg: var(--sc-bg); }
:root[data-bs-theme="dark"]  { --bs-body-bg: var(--sc-bg); }

/* ================================================
   BASE — MOBILE FIRST
   ================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    /* iOS safe area support */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

body {
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    background: var(--sc-bg);
    color: var(--sc-text);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
}

/* ================================================
   NAVBAR
   ================================================ */
.sc-navbar {
    background: var(--sc-surface);
    border-bottom: 2.5px solid var(--sc-accent);
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 16px var(--sc-shadow);
    /* Safe area on sides */
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
}

.sc-navbar .sc-brand {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sc-text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.02em;
    transition: color 0.2s;
    flex-shrink: 0;
    /* Minimum tap target */
    min-height: 44px;
    padding: 0.5rem 0;
}

.sc-navbar .sc-brand:hover,
.sc-navbar .sc-brand:active { color: var(--sc-accent); }

.sc-navbar .sc-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sc-text);
    flex: 1;
    text-align: center;
    /* Prevent overlap on narrow screens */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ================================================
   BUTTONS
   ================================================ */
.sc-btn {
    background: var(--sc-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    /* Tall enough for touch */
    min-height: 40px;
    padding: 0.45rem 0.875rem;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.sc-btn:hover  { background: var(--sc-accent-hover); color: #fff; }
.sc-btn:active { transform: scale(0.97); }

.sc-btn-lg {
    font-size: 1.2rem;
    padding: 0.6rem 1.25rem;
    min-height: 48px;
}

/* ================================================
   CONFIRM MODAL (sostituisce window.confirm)
   ================================================ */
.sc-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 17, 28, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.sc-confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.sc-confirm-modal {
    background: var(--sc-surface);
    border: 1.5px solid var(--sc-border);
    border-radius: 18px;
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 12px 40px var(--sc-shadow-lg);
    transform: translateY(8px) scale(0.97);
    transition: transform 0.18s ease;
}

.sc-confirm-overlay.show .sc-confirm-modal {
    transform: translateY(0) scale(1);
}

.sc-confirm-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.9rem;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

[data-bs-theme="dark"] .sc-confirm-icon {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.sc-confirm-message {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--sc-text);
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.sc-confirm-actions {
    display: flex;
    gap: 0.6rem;
}

.sc-confirm-btn {
    flex: 1;
    min-height: 46px;
    border-radius: 10px;
    border: none;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.sc-confirm-btn:active { transform: scale(0.97); }

.sc-confirm-btn-cancel {
    background: var(--sc-surface-alt);
    color: var(--sc-text);
    border: 1.5px solid var(--sc-border);
}

.sc-confirm-btn-cancel:hover { background: var(--sc-border); }

.sc-confirm-btn-danger {
    background: #dc2626;
    color: #fff;
}

.sc-confirm-btn-danger:hover { background: #b91c1c; }

/* ================================================
   DASHBOARD — INDEX PAGE
   ================================================ */
.sc-dashboard {
    padding: 1.25rem 1rem 2rem;
    /* Centered on tablet/desktop */
    max-width: 560px;
    margin: 0 auto;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

.sc-page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sc-border);
}

.sc-page-title {
    font-family: 'Barlow Condensed', sans-serif;
    /* Fluid type — readable on 320px, impactful on 768px */
    font-size: clamp(2rem, 10vw, 3rem);
    font-weight: 900;
    line-height: 0.95;
    color: var(--sc-text);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sc-page-title span { color: var(--sc-accent); }

.sc-page-subtitle {
    font-size: 0.85rem;
    color: var(--sc-text-muted);
    margin-top: 0.6rem;
    font-weight: 500;
}

/* ---- Menu Grid ----
   Layout:
   [  Gestione Ore (full row)  ]
   [ Clienti ]   [ Fornitori  ]
   [ Commesse ]  [Attrezzature]
   -------------------------------- */
.sc-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Full-width card */
.sc-menu-full {
    grid-column: 1 / -1;
}

/* ---- Menu card ---- */
.sc-menu-item {
    background: var(--sc-surface);
    border: 1.5px solid var(--sc-border);
    border-radius: 16px;
    padding: 1.1rem 1rem 0.9rem;
    text-decoration: none;
    color: var(--sc-text);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    transition: border-color 0.22s, transform 0.22s cubic-bezier(.4,0,.2,1), box-shadow 0.22s;
    position: relative;
    overflow: hidden;
    animation: scFadeUp 0.42s ease both;
    /* Large touch target */
    min-height: 100px;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* Full-width card is horizontal on wider screens */
.sc-menu-full {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    min-height: 80px;
    padding: 1rem 1.25rem;
}

.sc-menu-full .sc-menu-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sc-menu-full .sc-menu-footer {
    margin-top: 0;
}

/* Hover / active states */
.sc-menu-item:hover,
.sc-menu-item:focus-visible {
    border-color: var(--sc-accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--sc-shadow-lg);
    color: var(--sc-text);
    text-decoration: none;
    outline: none;
}

.sc-menu-item:active {
    transform: translateY(0) scale(0.98);
}

/* Background wash on hover */
.sc-menu-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--sc-accent-subtle);
    opacity: 0;
    transition: opacity 0.22s;
    pointer-events: none;
}

.sc-menu-item:hover::after { opacity: 1; }

/* Accent top bar */
.sc-menu-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--sc-accent);
    border-radius: 16px 16px 0 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
    z-index: 1;
}

.sc-menu-item:hover::before { transform: scaleX(1); }

/* Icon wrap */
.sc-menu-icon-wrap {
    width: 42px;
    height: 42px;
    background: var(--sc-accent-subtle);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--sc-accent);
    transition: background 0.22s, color 0.22s;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.sc-menu-item:hover .sc-menu-icon-wrap {
    background: var(--sc-accent);
    color: #fff;
}

.sc-menu-content { position: relative; z-index: 1; }

.sc-menu-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sc-text);
    line-height: 1.15;
}

.sc-menu-desc {
    font-size: 0.74rem;
    color: var(--sc-text-muted);
    line-height: 1.3;
    margin-top: 0.15rem;
    font-weight: 500;
}

/* Barcode dashboard — bigger labels on the menu buttons */
.sc-dashboard-barcode .sc-menu-label {
    font-size: 2rem;
}

.sc-menu-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.sc-menu-arrow {
    color: var(--sc-accent);
    font-size: 0.78rem;
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity 0.2s, transform 0.2s;
}

.sc-menu-item:hover .sc-menu-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Animation stagger */
.sc-menu-item:nth-child(1) { animation-delay: 0.04s; }
.sc-menu-item:nth-child(2) { animation-delay: 0.09s; }
.sc-menu-item:nth-child(3) { animation-delay: 0.14s; }
.sc-menu-item:nth-child(4) { animation-delay: 0.19s; }
.sc-menu-item:nth-child(5) { animation-delay: 0.24s; }

/* ================================================
   ORE PAGE — FILTER
   ================================================ */
.sc-filter-wrap {
    padding: 0.875rem 1rem 0;
    max-width: 560px;
    margin: 0 auto;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
}

.sc-filter-card {
    background: var(--sc-surface);
    border: 1.5px solid var(--sc-border);
    border-radius: 12px;
    padding: 0.55rem 0.85rem;
    animation: scFadeUp 0.3s ease both;
}

.sc-filter-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sc-text-muted);
    margin-bottom: 0.4rem;
}

.sc-filter-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.sc-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 110px;
}

.sc-filter-field label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--sc-text-muted);
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.sc-filter-field input[type="date"] {
    background: var(--sc-surface-alt);
    border: 1.5px solid var(--sc-border);
    border-radius: 8px;
    height: 34px;
    padding: 0 0.6rem;
    color: var(--sc-text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.875rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
}

.sc-filter-field input[type="date"]:focus {
    border-color: var(--sc-accent);
    box-shadow: 0 0 0 3px var(--sc-accent-glow);
}

.sc-filter-field input[type="text"],
.sc-filter-field select {
    background: var(--sc-surface-alt);
    border: 1.5px solid var(--sc-border);
    border-radius: 8px;
    height: 34px;
    padding: 0 0.6rem;
    color: var(--sc-text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.875rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.sc-filter-field input[type="text"]:focus,
.sc-filter-field select:focus {
    border-color: var(--sc-accent);
    box-shadow: 0 0 0 3px var(--sc-accent-glow);
}

/* On very small screens, stack filter vertically */
@media (max-width: 380px) {
    .sc-filter-row { flex-direction: column; }
    .sc-filter-row .sc-btn { width: 100%; justify-content: center; }
}

/* ================================================
   ORE PAGE — ENTRY LIST
   ================================================ */
.sc-entry-section {
    max-width: 560px;
    margin: 0 auto;
    padding: 0.875rem 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.sc-entry-count {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sc-text-muted);
    margin-bottom: 0.75rem;
}

.sc-entry-count span { color: var(--sc-accent); font-size: 0.95rem; }

.sc-entries {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* ---- Entry card ---- */
.sc-entry-card {
    background: var(--sc-surface);
    border: 1.5px solid var(--sc-border);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    text-decoration: none;
    color: var(--sc-text);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.18s;
    animation: scFadeUp 0.38s ease both;
    position: relative;
    overflow: hidden;
    /* Touch target */
    min-height: 72px;
    -webkit-tap-highlight-color: transparent;
}

.sc-entry-card:hover,
.sc-entry-card:focus-visible {
    border-color: var(--sc-accent);
    box-shadow: 0 4px 18px var(--sc-shadow-lg);
    transform: translateY(-2px);
    color: var(--sc-text);
    text-decoration: none;
    outline: none;
}

.sc-entry-card:active { transform: scale(0.99); }

/* Left accent strip */
.sc-entry-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--sc-accent);
    border-radius: 14px 0 0 14px;
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.22s ease;
}

.sc-entry-card:hover::before { transform: scaleY(1); }

/* Date badge */
.sc-entry-date {
    flex-shrink: 0;
    background: var(--sc-accent);
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    align-self: flex-start;
}

.sc-date-day {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.55rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.02em;
}

.sc-date-month {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,0.82);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1px;
}

/* Body */
.sc-entry-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.sc-entry-user {
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--sc-accent-deep);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
}

.sc-entry-user i {
    margin-top: 0.1rem;
}

[data-bs-theme="dark"] .sc-entry-user { color: var(--sc-accent); }

.sc-entry-user-altri {
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--sc-text-muted);
}

.sc-entry-notes {
    font-size: 0.88rem;
    color: var(--sc-text);
    line-height: 1.4;
    font-weight: 500;
    white-space: normal;
    word-break: break-word;
}

.sc-entry-notes.empty {
    color: var(--sc-text-muted);
    font-style: italic;
}

.sc-badge-completate {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 6px;
    padding: 0.1rem 0.45rem;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    margin-top: 0.2rem;
}

[data-bs-theme="dark"] .sc-badge-completate {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.30);
}

/* Variante grigia (es. FIRMA ORE NO): stessa forma di .sc-badge-completate */
.sc-badge-completate.sc-badge-no,
[data-bs-theme="dark"] .sc-badge-completate.sc-badge-no {
    background: var(--sc-surface-alt);
    color: var(--sc-text-muted);
    border-color: var(--sc-border);
}

.sc-badge-commessa {
    display: inline-flex;
    align-items: center;
    background: var(--sc-accent-subtle);
    color: var(--sc-accent-deep);
    border: 1px solid var(--sc-accent-glow);
    border-radius: 8px;
    padding: 0.2rem 0.6rem;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

[data-bs-theme="dark"] .sc-badge-commessa {
    color: var(--sc-accent-hover);
}

.sc-entry-clients {
    font-size: 0.74rem;
    color: var(--sc-text-muted);
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

.sc-entry-inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Bombolelista — bigger tank name */
.sc-entries-bombole .sc-entry-user {
    font-size: 1.3rem;
}

/* Inventario — bigger item code and description */
.sc-entries-lg .sc-entry-user {
    font-size: 1.3rem;
}

.sc-entries-lg .sc-entry-notes {
    font-size: 1.1rem;
}

/* Hours */
.sc-entry-hours {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding-left: 0.4rem;
    gap: 0.05rem;
}

.sc-hours-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--sc-accent);
    line-height: 1;
    letter-spacing: -0.02em;
}

.sc-hours-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--sc-text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: right;
}

/* Arrow */
.sc-entry-arrow {
    align-self: center;
    color: var(--sc-border);
    font-size: 0.82rem;
    transition: color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.sc-entry-card:hover .sc-entry-arrow {
    color: var(--sc-accent);
    transform: translateX(3px);
}

/* Stagger */
.sc-entry-card:nth-child(1) { animation-delay: 0.04s; }
.sc-entry-card:nth-child(2) { animation-delay: 0.08s; }
.sc-entry-card:nth-child(3) { animation-delay: 0.12s; }
.sc-entry-card:nth-child(4) { animation-delay: 0.16s; }
.sc-entry-card:nth-child(5) { animation-delay: 0.20s; }
.sc-entry-card:nth-child(6) { animation-delay: 0.24s; }
.sc-entry-card:nth-child(7) { animation-delay: 0.28s; }
.sc-entry-card:nth-child(8) { animation-delay: 0.32s; }

/* Empty state */
.sc-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--sc-text-muted);
}

.sc-empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }

.sc-empty-text {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ================================================
   ORE DETTAGLIO — RAGGRUPPAMENTO PER OPERATORE
   ================================================ */

.sc-operator-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sc-accent-deep);
    padding: 0.6rem 0.1rem 0.3rem;
    border-bottom: 2px solid var(--sc-accent);
    margin-bottom: 0.1rem;
}

[data-bs-theme="dark"] .sc-operator-header { color: var(--sc-accent); }

.sc-op-subtotal {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--sc-text-muted);
    margin-top: 0.25rem;
}

/* ================================================
   ORE DETTAGLIO — CARD A DUE SEZIONI (mobile-first)
   ================================================ */

.sc-card-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
}

.sc-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    min-width: 0;
}

.sc-card-info .sc-entry-user {
    font-size: 0.95rem;
}

.sc-card-ore {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding-left: 0.4rem;
    gap: 0;
}

.sc-ore-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--sc-accent);
    line-height: 1;
    letter-spacing: -0.02em;
}

.sc-ore-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--sc-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: right;
    opacity: 0.8;
}

.sc-card-bottom {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.55rem;
}

.sc-card-bottom-row {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.92rem;
    color: var(--sc-text-muted);
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
}

.sc-card-bottom-row i {
    flex-shrink: 0;
    margin-top: 0.18rem;
}

.sc-card-bottom-row--operazioni {
    font-size: 1rem;
    color: var(--sc-text);
    font-weight: 600;
}

/* ================================================
   FOOTER
   ================================================ */
.sc-footer {
    padding: 1.25rem 1rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    text-align: center;
    font-size: 0.76rem;
    color: var(--sc-text-muted);
    border-top: 1px solid var(--sc-border);
    margin-top: 2rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ================================================
   MODE TOGGLE
   ================================================ */
.bd-mode-toggle { z-index: 1500; }

/* Tuck toggle above footer on small screens */
@media (max-width: 480px) {
    .bd-mode-toggle { bottom: 0.5rem !important; right: 0.5rem !important; }
}

/* On mobile, reflow entry cards: date+hours on top, body text below */
@media (max-width: 600px) {
    .sc-menu-full {
        display: grid;
        grid-template-columns: auto 1fr auto auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "date . hours arrow"
            "body body body body";
        gap: 0.4rem 0.6rem;
        align-items: center;
    }
    .sc-entry-date  { grid-area: date;  align-self: center; }
    .sc-entry-body  { grid-area: body;  }
    .sc-entry-hours { grid-area: hours; }
    .sc-entry-arrow { grid-area: arrow; }
}

/* ================================================
   ORE RIGA EDIT — FORM
   ================================================ */
.sc-form-section {
    max-width: 560px;
    margin: 0 auto;
    padding: 0.875rem 1rem 0;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
}

.sc-form-block {
    background: var(--sc-surface);
    border: 1.5px solid var(--sc-border);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
    animation: scFadeUp 0.3s ease both;
    position: relative;
    z-index: 1;
}

.sc-form-block:focus-within {
    z-index: 10;
}

.sc-form-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sc-text-muted);
    margin-bottom: 0.45rem;
    display: block;
}

.sc-form-label-lg {
    font-size: 1.1rem;
}

.sc-form-input {
    background: var(--sc-surface-alt);
    border: 1.5px solid var(--sc-border);
    border-radius: 10px;
    height: 44px;
    padding: 0 0.875rem;
    color: var(--sc-text);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
}

.sc-form-input:focus {
    border-color: var(--sc-accent);
    box-shadow: 0 0 0 3px var(--sc-accent-glow);
}

.sc-form-hint {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--sc-text-muted);
    line-height: 1.4;
    word-break: break-word;
}

.sc-form-textarea {
    background: var(--sc-surface-alt);
    border: 1.5px solid var(--sc-border);
    border-radius: 10px;
    padding: 0.65rem 0.875rem;
    color: var(--sc-text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    width: 100%;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.sc-form-textarea:focus {
    border-color: var(--sc-accent);
    box-shadow: 0 0 0 3px var(--sc-accent-glow);
}

.sc-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
}

.sc-form-row > div {
    flex: 1 1 130px;
}


.sc-hours-calc-note {
    font-size: 0.7rem;
    color: var(--sc-text-muted);
    margin-top: 0.25rem;
}

/* ---- Autocomplete ---- */
.sc-autocomplete-wrap {
    position: relative;
}

.sc-autocomplete-selected {
    background: var(--sc-surface-alt);
    border: 1.5px solid var(--sc-border);
    border-radius: 10px;
    height: 44px;
    padding: 0 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sc-autocomplete-selected:focus-within {
    border-color: var(--sc-accent);
    box-shadow: 0 0 0 3px var(--sc-accent-glow);
}

.sc-autocomplete-selected input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--sc-text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    min-width: 0;
}

.sc-autocomplete-code {
    background: var(--sc-accent);
    color: #fff;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    border-radius: 5px;
    padding: 0.15rem 0.45rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.sc-autocomplete-display .sc-autocomplete-code {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.35rem;
    font-size: 0.9rem;
}

.sc-autocomplete-clear {
    color: var(--sc-text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
    padding: 0.25rem;
    transition: color 0.15s;
}

.sc-autocomplete-clear:hover { color: var(--sc-text); }

.sc-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--sc-surface);
    border: 1.5px solid var(--sc-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px var(--sc-shadow-lg);
    z-index: 100;
    overflow: hidden;
    display: none;
}

.sc-autocomplete-dropdown.open { display: block; }

.sc-autocomplete-item {
    padding: 0.65rem 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: background 0.15s;
}

.sc-autocomplete-item:not(:last-child) {
    border-bottom: 1px solid var(--sc-border);
}

.sc-autocomplete-item:hover,
.sc-autocomplete-item:active,
.sc-autocomplete-item.active {
    background: var(--sc-accent-subtle);
}

.sc-autocomplete-item-code {
    background: var(--sc-surface-alt);
    color: var(--sc-text-muted);
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    flex-shrink: 0;
}

.sc-autocomplete-item-name {
    font-size: 0.9rem;
    color: var(--sc-text);
    font-weight: 500;
}

.sc-autocomplete-empty {
    padding: 0.75rem 0.875rem;
    color: var(--sc-text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.sc-autocomplete-item-commessa {
    display: block;
    padding: 0.75rem 0.875rem;
}

.sc-autocomplete-item-commessa .sc-autocomplete-item-code {
    display: inline-block;
    font-size: 1rem;
    padding: 0.2rem 0.55rem;
    vertical-align: middle;
}

.sc-autocomplete-item-commessa .sc-autocomplete-item-name {
    font-size: 0.9rem;
}

.sc-autocomplete-disabled .sc-autocomplete-selected {
    opacity: 0.45;
    pointer-events: none;
}

#wrap-commessa .sc-autocomplete-selected {
    height: auto;
    min-height: 44px;
}

.sc-autocomplete-display {
    flex: 1;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    color: var(--sc-text);
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    padding: 0.25rem 0;
    min-width: 0;
}

/* ---- Pulsanti step orario ---- */
.sc-btn-orario {
    background: var(--sc-surface-alt);
    border: 1.5px solid var(--sc-border);
    border-radius: 8px;
    color: var(--sc-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.sc-btn-orario:hover {
    background: var(--sc-accent-subtle);
    border-color: var(--sc-accent);
    color: var(--sc-accent);
}

/* ---- Suggerimenti operazioni ---- */
.sc-suggerimenti-wrap {
    position: relative;
}

.sc-suggerimenti-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--sc-surface);
    border: 1.5px solid var(--sc-border);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.13);
    z-index: 200;
    max-height: 260px;
    overflow-y: auto;
}

.sc-suggerimenti-panel.open { display: block; }

.sc-suggerimenti-item {
    padding: 0.65rem 0.875rem;
    font-size: 0.875rem;
    color: var(--sc-text);
    cursor: pointer;
    line-height: 1.4;
    border-bottom: 1px solid var(--sc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sc-suggerimenti-item:last-child { border-bottom: none; }

.sc-suggerimenti-item:hover,
.sc-suggerimenti-item:active { background: var(--sc-accent-subtle); }

.sc-suggerimenti-item-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--sc-text-muted);
    flex-shrink: 0;
    background: var(--sc-surface-alt);
    border-radius: 20px;
    padding: 0.1rem 0.45rem;
}

.sc-suggerimenti-empty {
    padding: 0.75rem 0.875rem;
    color: var(--sc-text-muted);
    font-size: 0.875rem;
}

.sc-btn-lampadina {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--sc-accent);
    font-size: 1rem;
    line-height: 1;
    margin-left: 0.4rem;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.sc-btn-lampadina:hover { opacity: 1; }

/* ---- Delete button ---- */
.sc-delete-wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

.sc-delete-btn {
    width: 100%;
    background: transparent;
    border: 1.5px solid rgba(220, 53, 69, 0.4);
    border-radius: 14px;
    padding: 0.9rem;
    color: #dc3545;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sc-delete-btn:hover,
.sc-delete-btn:active {
    background: rgba(220, 53, 69, 0.08);
    border-color: #dc3545;
}

/* ---- Animazione pulsante microfono attivo ---- */
@keyframes sc-mic-pulse {
    from { opacity: 1;   transform: scale(1); }
    to   { opacity: 0.5; transform: scale(0.85); }
}

@media (min-width: 600px) {
    .sc-form-section { padding: 1.25rem 1.5rem 0; }
    .sc-delete-wrap  { padding: 0 1.5rem 2.5rem; }
}

/* ---- Toggle switch ---- */
.sc-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.sc-toggle-wrap input[type="checkbox"] {
    display: none;
}

.sc-toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--sc-border);
    border-radius: 13px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.sc-toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.sc-toggle-wrap input[type="checkbox"]:checked + .sc-toggle-slider {
    background: var(--sc-accent);
}

.sc-toggle-wrap input[type="checkbox"]:checked + .sc-toggle-slider::after {
    transform: translateX(22px);
}

.sc-toggle-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sc-text);
}

/* ================================================
   KEYFRAMES
   ================================================ */
@keyframes scFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================================================
   TABLET — 600px and up
   ================================================ */
@media (min-width: 600px) {
    .sc-dashboard    { padding: 1.75rem 1.5rem 2.5rem; }
    .sc-filter-wrap  { padding: 1.25rem 1.5rem 0; }
    .sc-entry-section { padding: 1.25rem 1.5rem; }
    .sc-navbar       { padding: 0 1.5rem; height: 60px; }
    .sc-navbar .sc-title { font-size: 1.2rem; }
    .sc-menu-grid    { gap: 1rem; }
    .sc-menu-item    { padding: 1.35rem 1.2rem 1.1rem; }
    .sc-entry-card   { padding: 1rem 1.1rem; gap: 1rem; }
    .sc-date-day     { font-size: 1.65rem; }
    .sc-hours-value  { font-size: 2.1rem; }
}

/* ================================================
   NARROW — collapse grid to single column
   ================================================ */
@media (max-width: 320px) {
    .sc-menu-grid { grid-template-columns: 1fr; }
    .sc-menu-full { grid-column: 1; }
}

/* ================================================
   MODAL OVERLAY
   ================================================ */
.sc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.sc-modal-card {
    background: var(--sc-surface);
    border: 1px solid var(--sc-border);
    border-radius: 16px;
    padding: 1.4rem 1.2rem 1.2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.28);
}

.sc-modal-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--sc-text);
    margin-bottom: 0.5rem;
}

.sc-modal-desc {
    font-size: 0.85rem;
    color: var(--sc-text-muted);
    margin-bottom: 1rem;
}

/* ================================================
   ACTION DROPDOWN
   ================================================ */
.sc-action-dropdown {
    position: relative;
}

.sc-action-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    background: var(--sc-surface);
    border: 1px solid var(--sc-border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    padding: 0.35rem 0;
    z-index: 200;
}

.sc-action-panel.open { display: block; }

.sc-action-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.55rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sc-text);
    text-align: left;
    transition: background 0.15s;
}

.sc-action-item:hover:not(:disabled) {
    background: var(--sc-surface-alt);
    color: var(--sc-accent);
}

.sc-action-item:disabled {
    opacity: 0.45;
    cursor: default;
}

.sc-action-danger { color: #e05c5c; }
.sc-action-danger:hover:not(:disabled) { color: #e05c5c; background: rgba(224,92,92,0.08); }

.sc-action-separator {
    height: 1px;
    background: var(--sc-border);
    margin: 0.3rem 0;
}
