/* Mercantico UI contemporanea - bottoni chiari, leggibili e realmente cliccabili */
:root{
    --ui-bg:#f3f5f8;
    --ui-card:#ffffff;
    --ui-card-soft:#f8fafc;
    --ui-text:#172033;
    --ui-muted:#5f6f85;
    --ui-border:#d7dee9;

    --ui-primary:#2457e6;
    --ui-primary-2:#1b46c7;
    --ui-primary-light:#e9efff;

    --ui-green:#0f8a72;
    --ui-green-2:#0b705d;
    --ui-warning:#7f1d1d;
    --ui-red:#d33838;

    --ui-radius:16px;
    --ui-btn-radius:12px;
    --ui-shadow:0 12px 30px rgba(23,32,51,.08);
    --ui-btn-shadow:0 4px 0 rgba(16,34,81,.22), 0 12px 22px rgba(36,87,230,.18);
    --ui-btn-shadow-hover:0 5px 0 rgba(16,34,81,.24), 0 16px 30px rgba(36,87,230,.24);
    --ui-focus:0 0 0 4px rgba(36,87,230,.22);
}

html{
    background:var(--ui-bg);
}

body{
    background:
        radial-gradient(circle at top left, rgba(36,87,230,.10), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(15,138,114,.08), transparent 34rem),
        var(--ui-bg) !important;
    color:var(--ui-text);
    font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.main{
    background:transparent !important;
}

h1{
    color:var(--ui-text) !important;
    border:0 !important;
    background:transparent !important;
    text-shadow:none !important;
    padding-bottom:8px !important;
    position:relative;
}

h1::after{
    content:"";
    display:block;
    width:86px;
    height:5px;
    border-radius:999px;
    background:linear-gradient(90deg,var(--ui-primary),var(--ui-green));
    margin-top:10px;
}

h2{
    color:var(--ui-text);
}

.panel{
    background:rgba(255,255,255,.96) !important;
    border:1px solid rgba(215,222,233,.95) !important;
    border-radius:var(--ui-radius) !important;
    box-shadow:var(--ui-shadow) !important;
    backdrop-filter:saturate(130%) blur(4px);
}

.flash{
    border-radius:14px !important;
    border:1px solid #9fd6ae !important;
    background:#eaf9ef !important;
    color:#126135 !important;
    box-shadow:0 8px 22px rgba(18,97,53,.10);
}

/* Bottoni veri: pieni, con bordo, rilievo, hover e stato premuto */
button,
.btn,
input[type="submit"],
input[type="button"],
a.btn,
.quick-sale,
.quick-move{
    appearance:none !important;
    -webkit-appearance:none !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:8px !important;
    min-height:42px !important;
    padding:10px 16px !important;
    border-radius:var(--ui-btn-radius) !important;
    border:1px solid rgba(18,45,130,.34) !important;
    background:
        linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,0) 42%),
        linear-gradient(180deg, var(--ui-primary), var(--ui-primary-2)) !important;
    color:#fff !important;
    font-weight:850 !important;
    letter-spacing:.01em !important;
    line-height:1.1 !important;
    text-decoration:none !important;
    text-align:center !important;
    cursor:pointer !important;
    box-shadow:var(--ui-btn-shadow) !important;
    text-shadow:0 1px 0 rgba(0,0,0,.18) !important;
    transition:
        transform .12s ease,
        box-shadow .12s ease,
        filter .12s ease,
        background .12s ease,
        border-color .12s ease !important;
    user-select:none !important;
}

button:hover,
.btn:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
a.btn:hover{
    transform:translateY(-1px) !important;
    box-shadow:var(--ui-btn-shadow-hover) !important;
    filter:saturate(1.05) brightness(1.03) !important;
}

button:active,
.btn:active,
input[type="submit"]:active,
input[type="button"]:active,
a.btn:active{
    transform:translateY(3px) !important;
    box-shadow:0 1px 0 rgba(16,34,81,.26), 0 6px 14px rgba(36,87,230,.18) !important;
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible{
    outline:none !important;
    box-shadow:var(--ui-focus), var(--ui-btn-shadow) !important;
}

button[disabled],
.btn[disabled],
button:disabled{
    opacity:.55 !important;
    cursor:not-allowed !important;
    transform:none !important;
    filter:grayscale(.2) !important;
    box-shadow:none !important;
}

.btn.small,
button.small,
.small.btn{
    min-height:34px !important;
    padding:7px 11px !important;
    border-radius:10px !important;
    font-size:13px !important;
    box-shadow:0 3px 0 rgba(16,34,81,.20), 0 8px 16px rgba(36,87,230,.14) !important;
}

/* Bottoni secondari: sempre bottoni, non link piatti */
.btn.soft,
button.soft,
a.btn.soft{
    background:
        linear-gradient(180deg,#ffffff,#e8efff) !important;
    color:#193c99 !important;
    border:1px solid #adc2ff !important;
    text-shadow:none !important;
    box-shadow:0 3px 0 #c7d4f6, 0 10px 18px rgba(30,64,175,.10) !important;
}

.btn.soft:hover,
button.soft:hover,
a.btn.soft:hover{
    background:linear-gradient(180deg,#ffffff,#dfe8ff) !important;
    box-shadow:0 4px 0 #bccbf0, 0 13px 22px rgba(30,64,175,.14) !important;
}

.btn.danger,
button.danger,
.danger{
    background:
        linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 40%),
        linear-gradient(180deg,#e34a4a,#bd2525) !important;
    border-color:#a92121 !important;
    color:#fff !important;
    box-shadow:0 4px 0 #9e1f1f, 0 12px 22px rgba(211,56,56,.20) !important;
}

.btn.success,
button.success{
    background:
        linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 40%),
        linear-gradient(180deg,var(--ui-green),var(--ui-green-2)) !important;
    border-color:#086554 !important;
    box-shadow:0 4px 0 #075746, 0 12px 22px rgba(15,138,114,.18) !important;
}

.btn.warning,
button.warning{
    background:
        linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 40%),
        linear-gradient(180deg,#8f3342,#712632) !important;
    border-color:#5f1f2a !important;
    color:#fff !important;
    box-shadow:0 4px 0 #5f1f2a, 0 12px 22px rgba(113,38,50,.18) !important;
}

/* Campi form contemporanei ma evidenti */
label{
    color:var(--ui-text);
    font-weight:750;
}

input,
select,
textarea{
    border:1px solid #c8d2e0 !important;
    border-radius:12px !important;
    background:#fff !important;
    color:var(--ui-text) !important;
    box-shadow:inset 0 1px 2px rgba(15,23,42,.06) !important;
    transition:border-color .12s ease, box-shadow .12s ease !important;
}

input:focus,
select:focus,
textarea:focus{
    border-color:var(--ui-primary) !important;
    box-shadow:0 0 0 4px rgba(36,87,230,.14), inset 0 1px 2px rgba(15,23,42,.05) !important;
    outline:none !important;
}

/* Tabelle leggibili */
.table-wrap{
    border:1px solid var(--ui-border);
    border-radius:14px;
    overflow:auto;
    background:#fff;
}

table{
    border-collapse:separate !important;
    border-spacing:0 !important;
    background:#fff;
}

th{
    background:#edf2f8 !important;
    color:#172033 !important;
    border-color:#d2dbe8 !important;
    text-shadow:none !important;
    font-weight:900 !important;
}

td{
    border-color:#e3e9f1 !important;
}

tr:nth-child(even) td{
    background:#f9fbfd !important;
}

tr:hover td{
    background:#eef5ff !important;
}

/* Menu laterale più pulito */
.side{
    background:linear-gradient(180deg,#121b2f,#0b1220) !important;
    color:#e7edf7 !important;
    border-right:1px solid rgba(255,255,255,.08);
    box-shadow:10px 0 30px rgba(3,7,18,.22) !important;
}

.brand{
    color:#fff !important;
    letter-spacing:.03em;
}

.nav-section{
    color:#8fb7ff !important;
    font-size:11px !important;
    letter-spacing:.09em !important;
    text-transform:uppercase;
}

.side-nav a{
    border:1px solid transparent !important;
    border-radius:13px !important;
    color:#dbe7ff !important;
    background:transparent !important;
    margin:4px 8px !important;
    box-shadow:none !important;
}

.side-nav a:hover{
    background:rgba(36,87,230,.20) !important;
    border-color:rgba(147,197,253,.22) !important;
    color:#fff !important;
    transform:none !important;
}

.quick-sale,
.quick-move{
    background:
        linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,0) 40%),
        linear-gradient(135deg,#2457e6,#0f8a72) !important;
    color:#fff !important;
    border:1px solid rgba(255,255,255,.18) !important;
    box-shadow:0 4px 0 rgba(0,0,0,.22), 0 12px 22px rgba(36,87,230,.20) !important;
}

/* Scheda cliente e workflow */
.customer-hero{
    display:grid;
    grid-template-columns:1fr auto;
    gap:20px;
    align-items:start;
    background:
        linear-gradient(135deg,rgba(36,87,230,.08),rgba(15,138,114,.06)),
        #fff !important;
}

.eyebrow{
    text-transform:uppercase;
    color:var(--ui-primary);
    font-size:12px;
    font-weight:950;
    letter-spacing:.10em;
}

.customer-hero h2{
    margin:5px 0 14px;
    font-size:30px;
    letter-spacing:-.02em;
}

.customer-fields{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
}

.customer-fields span{
    background:#fff;
    border:1px solid var(--ui-border);
    border-radius:14px;
    padding:11px;
    box-shadow:0 4px 14px rgba(23,32,51,.05);
}

.customer-fields b{
    display:block;
    color:var(--ui-muted);
    font-size:12px;
    margin-bottom:3px;
}

.customer-actions{
    display:flex;
    flex-wrap:wrap;
    gap:9px;
    justify-content:flex-end;
}

.client-workflow-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:14px;
}

.workflow-card{
    position:relative;
    display:block;
    text-decoration:none;
    color:var(--ui-text);
    background:linear-gradient(180deg,#ffffff,#f8fafc);
    border:1px solid var(--ui-border);
    border-radius:18px;
    padding:17px;
    min-height:112px;
    box-shadow:0 9px 24px rgba(23,32,51,.07);
    overflow:hidden;
    transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.workflow-card::before{
    content:"";
    position:absolute;
    inset:0 auto 0 0;
    width:6px;
    background:var(--ui-primary);
}

.workflow-card:hover{
    transform:translateY(-2px);
    box-shadow:0 16px 34px rgba(23,32,51,.11);
    border-color:#b8c6dd;
}

.workflow-card span{
    display:block;
    color:var(--ui-muted);
    font-weight:850;
    margin-bottom:11px;
}

.workflow-card b{
    display:block;
    font-size:28px;
    color:var(--ui-text);
    letter-spacing:-.03em;
}

.workflow-card small{
    display:block;
    margin-top:5px;
    color:var(--ui-muted);
    font-weight:800;
}

.workflow-card.primary{
    background:linear-gradient(135deg,#2457e6,#0f8a72);
    color:#fff;
    border-color:rgba(255,255,255,.18);
}

.workflow-card.primary::before{
    background:rgba(255,255,255,.65);
}

.workflow-card.primary span,
.workflow-card.primary b{
    color:#fff;
}

.workflow-card.money::before{background:#0f8a72}
.workflow-card.warn::before{background:#8f3342}
.workflow-card.journal::before{background:#2457e6}
.workflow-card.done::before{background:#0f8a72}

.journal-pill{
    display:inline-block;
    border-radius:999px;
    padding:7px 10px;
    font-size:12px;
    font-weight:950;
    line-height:1.15;
    white-space:nowrap;
    border:1px solid transparent;
}

.journal-pill.done{
    background:#dff8ef;
    color:#075c4b;
    border-color:#9de4d0;
}

.journal-pill.todo{
    background:#f8e8eb;
    color:#7f1d1d;
    border-color:#d8a9b1;
}

.journal-pill.muted{
    background:#eef2f7;
    color:#536173;
    border-color:#d8e0eb;
}

/* Stato mobile */
.mobile-topbar{
    background:#10192c !important;
    border-bottom:1px solid rgba(255,255,255,.08);
}

.mobile-sale{
    background:linear-gradient(180deg,#2457e6,#1b46c7) !important;
    color:#fff !important;
    border-radius:10px !important;
    box-shadow:0 3px 0 rgba(0,0,0,.25) !important;
}

@media(max-width:980px){
    .customer-hero{
        grid-template-columns:1fr;
    }

    .customer-actions{
        justify-content:flex-start;
    }

    .customer-fields,
    .client-workflow-grid{
        grid-template-columns:1fr;
    }

    button,
    .btn,
    input[type="submit"],
    input[type="button"],
    a.btn{
        min-height:46px !important;
    }
}
