/* Pairing Centralina — redesign 2026 */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Palette */
    --navy:      #0D1B2A;
    --navy-mid:  #19304A;
    --red:       #CC1528;
    --red-soft:  #F5E6E8;
    --blue:      #1A56DB;
    --blue-soft: #EBF2FF;
    --bg:        #F0F3F7;
    --surface:   #FFFFFF;
    --border:    #DDE2EA;
    --border-md: #C5CDD8;
    --text:      #1E2532;
    --text-soft: #4A5568;
    --muted:     #8896A8;

    /* Status */
    --st-open:   #1A56DB;
    --st-wait:   #D97706;
    --st-res:    #059669;
    --st-closed: #6B7280;

    /* Panel accents */
    --panel-it:  #1A56DB;
    --panel-cn:  #CC1528;

    /* Misc */
    --radius:    12px;
    --radius-sm: 8px;
    --shadow:    0 1px 3px rgba(13,27,42,.07), 0 4px 16px rgba(13,27,42,.08);
    --shadow-sm: 0 1px 2px rgba(13,27,42,.06), 0 2px 6px rgba(13,27,42,.05);
    --font:      'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
    --mono:      'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1rem; font-weight: 700; }
h3 { font-size: .9rem; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; }
.req { color: var(--red); font-style: normal; }
.num { text-align: right; }

/* ==============================
   TOPBAR
   ============================== */
.topbar {
    background: var(--navy);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.03em;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(204,21,40,.35);
}
.brand-mark.big { width: 54px; height: 54px; font-size: 1.7rem; }
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.brand-text strong {
    color: #fff;
    font-size: .97rem;
    letter-spacing: -.01em;
}
.brand-text small {
    color: rgba(255,255,255,.45);
    font-size: .7rem;
}

/* Nav links */
.topbar-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
}
.nav-link {
    color: rgba(255,255,255,.65);
    font-size: .82rem;
    font-weight: 500;
    padding: .4rem .7rem;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

/* Topbar right */
.topbar-right {
    display: flex;
    align-items: center;
    gap: .85rem;
}

/* Language switcher */
.lang-switch {
    display: inline-flex;
    background: rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 2px;
    gap: 1px;
}
.lang-btn {
    padding: .25rem .5rem;
    font-size: .72rem;
    font-weight: 600;
    color: rgba(255,255,255,.5);
    border-radius: 6px;
    letter-spacing: .03em;
    transition: all .12s;
}
.lang-btn:hover { color: rgba(255,255,255,.8); }
.lang-btn.active {
    background: rgba(255,255,255,.18);
    color: #fff;
}

/* User chip */
.user-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .6rem .3rem .35rem;
    background: rgba(255,255,255,.08);
    border-radius: 99px;
    cursor: pointer;
}
.user-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.user-chip-name {
    font-size: .82rem;
    font-weight: 600;
    color: rgba(255,255,255,.9);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.role-badge {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .12rem .4rem;
    border-radius: 99px;
    color: #fff;
}
.role-italy  { background: var(--blue); }
.role-china  { background: var(--red); }
.role-admin  { background: #6B4FA0; }

.btn-topbar {
    color: rgba(255,255,255,.7);
    font-size: .82rem;
    font-weight: 500;
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,.18);
    transition: all .15s;
    white-space: nowrap;
    cursor: pointer;
    background: transparent;
    font-family: inherit;
}
.btn-topbar:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

/* ==============================
   LAYOUT
   ============================== */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 5rem;
    flex: 1;
}
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-head-left { display: flex; flex-direction: column; gap: .2rem; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
    margin-bottom: .35rem;
}
.back-link:hover { color: var(--text); }
.page-count { color: var(--muted); font-size: .85rem; margin-top: .15rem; }

/* ==============================
   BUTTONS
   ============================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    padding: .55rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background .15s, box-shadow .15s, transform .05s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-sm   { padding: .38rem .75rem; font-size: .8rem; }
.btn-xs   { padding: .28rem .6rem;  font-size: .76rem; }
.btn-block { width: 100%; }
.btn-primary {
    background: var(--navy);
    color: #fff;
    box-shadow: 0 1px 3px rgba(13,27,42,.2);
}
.btn-primary:hover { background: #162438; box-shadow: 0 2px 8px rgba(13,27,42,.25); }
.btn-ghost {
    background: var(--surface);
    border-color: var(--border-md);
    color: var(--text-soft);
}
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }
.btn-danger {
    background: var(--surface);
    color: var(--red);
    border-color: #F0B8BE;
}
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-warn { background: var(--st-wait); color: #fff; border-color: var(--st-wait); }
.btn-warn:hover { background: #b45309; }
.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

/* ==============================
   INPUTS
   ============================== */
.input, .auto-field, .auto-select, .form input, .form textarea, .form select {
    font-family: inherit;
    font-size: .9rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-md);
    border-radius: var(--radius-sm);
    padding: .55rem .75rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.input:focus, .auto-field:focus, .auto-select:focus, .form input:focus,
.form textarea:focus, .form select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.input-search {
    flex: 1;
    min-width: 180px;
    padding-left: 2.4rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238896A8' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: .75rem center;
}
.auto-field { resize: none; line-height: 1.5; min-height: 2.4rem; overflow: hidden; }
.auto-field[readonly] { background: #F7F9FC; color: var(--text-soft); cursor: default; }
.auto-select { min-height: 2.45rem; }
.auto-select:disabled { background: #F7F9FC; color: var(--text-soft); cursor: default; }

/* Form helpers */
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > label, .field > span {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-soft);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }

/* ==============================
   CARD
   ============================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.card.narrow { max-width: 540px; }
.card-title {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.card-title-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: .95rem;
    flex-shrink: 0;
}

/* ==============================
   ALERT / BADGES
   ============================== */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    margin-bottom: 1.1rem;
}
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-closed {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 500;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    font-weight: 700;
    padding: .28rem .65rem;
    border-radius: 99px;
    letter-spacing: .02em;
}
.status-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
}
.st-open         { background: #EBF2FF; color: var(--st-open); }
.st-waiting_china{ background: #FEF3C7; color: var(--st-wait); }
.st-resolved     { background: #ECFDF5; color: var(--st-res); }
.st-closed       { background: #F3F4F6; color: var(--st-closed); }

/* ==============================
   FILTER PILLS (lista casi)
   ============================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 320px;
}
.search-wrap .input-search { width: 100%; }
.search-submit {
    position: absolute;
    right: .5rem;
    top: 50%;
    translate: 0 -50%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: .25rem;
    display: grid;
    place-items: center;
}
.filter-pills {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .42rem .9rem;
    border-radius: 99px;
    font-size: .8rem;
    font-weight: 600;
    border: 1.5px solid var(--border-md);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
}
.filter-pill:hover { border-color: var(--text-soft); color: var(--text); }
.filter-pill .pill-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
}
.filter-pill .pill-count {
    font-size: .72rem;
    background: var(--bg);
    border-radius: 99px;
    padding: 0 .4rem;
    line-height: 1.6;
}

.filter-pill.fp-all.active    { background: var(--text); color:#fff; border-color: var(--text); }
.filter-pill.fp-open.active   { background: var(--st-open); color:#fff; border-color: var(--st-open); }
.filter-pill.fp-open.active .pill-dot { background: #fff; }
.filter-pill.fp-wait.active   { background: var(--st-wait); color:#fff; border-color: var(--st-wait); }
.filter-pill.fp-res.active    { background: var(--st-res); color:#fff; border-color: var(--st-res); }
.filter-pill.fp-closed.active { background: var(--st-closed); color:#fff; border-color: var(--st-closed); }
.filter-pill.fp-all .pill-dot { background: var(--text-soft); }
.filter-pill.fp-open .pill-dot { background: var(--st-open); }
.filter-pill.fp-wait .pill-dot { background: var(--st-wait); }
.filter-pill.fp-res  .pill-dot { background: var(--st-res); }
.filter-pill.fp-closed .pill-dot { background: var(--st-closed); }
.filter-pill.active .pill-count { background: rgba(255,255,255,.25); color: inherit; }
.filter-pill.active .pill-dot   { background: rgba(255,255,255,.75); }

/* ==============================
   TABLE
   ============================== */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
    padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: #FAFBFD;
}
.data-table td { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: #F8FAFC; }
.data-table tbody tr:last-child td { border-bottom: none; }
.pill {
    display: inline-block;
    min-width: 1.6rem;
    text-align: center;
    background: var(--bg);
    border-radius: 99px;
    padding: .08rem .5rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-soft);
}
.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 3.5rem 1rem;
    background: var(--surface);
    border: 1px dashed var(--border-md);
    border-radius: var(--radius);
    font-size: .92rem;
}

/* ==============================
   LOGIN
   ============================== */
body.page-login {
    background: linear-gradient(145deg, var(--navy) 0%, #1A3050 100%);
    min-height: 100vh;
}
body.page-login .container {
    max-width: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex: 1;
}
.login-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    min-height: 100vh;
}
.login-card {
    background: var(--surface);
    border-radius: 18px;
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.15);
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand .brand-mark { margin: 0 auto 1rem; }
.login-brand h1 { font-size: 1.35rem; color: var(--navy); }
.login-brand p { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.login-langs { display: flex; justify-content: center; gap: .25rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.login-langs .lang-btn { color: var(--muted); }
.login-langs .lang-btn.active { color: var(--navy); background: var(--bg); }
.login-langs .lang-btn:hover { color: var(--text); }

/* ==============================
   CASE DETAIL — header
   ============================== */
.case-page { }
.case-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}
.case-id { display: flex; flex-direction: column; gap: .2rem; }
.case-vin {
    font-size: 1.55rem;
    font-weight: 800;
    font-family: var(--mono);
    letter-spacing: -.01em;
    color: var(--navy);
    line-height: 1.2;
}
.case-serial { font-size: .8rem; color: var(--muted); }
.case-status-block {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}
.status-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.input-select {
    font-family: inherit;
    font-size: .85rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-md);
    border-radius: var(--radius-sm);
    padding: .5rem .7rem;
    outline: none;
    cursor: pointer;
}
.case-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: .78rem;
    padding: .75rem 0 1.1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

/* ==============================
   PANELS (accordion)
   ============================== */
.panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s;
}
.panel.open { box-shadow: var(--shadow); }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    border-top: 3px solid var(--border);
    transition: background .15s;
    gap: 1rem;
}
.panel-italy  .panel-header { border-top-color: var(--panel-it); }
.panel-china  .panel-header { border-top-color: var(--panel-cn); }
.panel-header:hover { background: #FAFBFD; }

.panel-title {
    display: flex;
    align-items: center;
    gap: .85rem;
}
.panel-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.panel-italy .panel-icon { background: var(--blue-soft); }
.panel-china .panel-icon { background: var(--red-soft); }
.panel-label { font-size: .97rem; font-weight: 700; color: var(--text); }
.panel-sublabel { font-size: .76rem; color: var(--muted); margin-top: .1rem; }

.panel-chevron {
    color: var(--muted);
    font-size: .9rem;
    flex-shrink: 0;
    transition: transform .22s;
    display: flex;
    align-items: center;
}
.panel.open .panel-chevron { transform: rotate(180deg); }

.panel-body {
    border-top: 1px solid var(--border);
    padding: 1.25rem;
    display: none;
    animation: panelFadeIn .18s ease;
}
.panel.open .panel-body { display: block; }

@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==============================
   FIELDS GRID (inside panels)
   ============================== */
.fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.5rem;
    margin-bottom: 1.25rem;
}
.field-span2 { grid-column: span 2; }
.field-row { display: flex; flex-direction: column; gap: .3rem; }
.field-label {
    font-size: .73rem;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.readonly-value {
    min-height: 2.4rem;
    display: flex;
    align-items: center;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #F7F9FC;
    color: var(--text);
    font-size: .9rem;
}

/* ==============================
   GALLERIES
   ============================== */
.galleries {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .9rem;
}
.gallery {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .85rem;
    background: #FAFBFD;
}
.gallery-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .65rem;
}
.gallery-title { font-size: .78rem; font-weight: 700; color: var(--text-soft); }
.gallery-count {
    font-size: .68rem;
    color: var(--muted);
    background: var(--bg);
    border-radius: 99px;
    padding: .04rem .45rem;
    font-weight: 600;
}
.thumbs { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-start; }
.thumb { margin: 0; width: 110px; }
.thumb-media {
    position: relative;
    width: 110px; height: 110px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg);
}
.thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    display: block;
    transition: transform .2s;
}
.thumb:hover img { transform: scale(1.04); }
.thumb-del {
    position: absolute; top: 3px; right: 3px;
    width: 22px; height: 22px;
    border-radius: 6px;
    border: none;
    background: rgba(0,0,0,.65);
    color: #fff;
    cursor: pointer;
    font-size: .95rem;
    line-height: 1;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity .12s;
}
.thumb:hover .thumb-del { opacity: 1; }
.thumb-title {
    margin-top: .35rem;
    font-size: .7rem;
    color: var(--muted);
    line-height: 1.25;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.thumb-empty { font-size: .78rem; color: var(--muted); padding: .4rem 0; }
.gallery-upload { width: 110px; display: flex; flex-direction: column; gap: .4rem; }
.photo-title-input {
    width: 100%;
    min-width: 0;
    font-family: inherit;
    font-size: .74rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-md);
    border-radius: 7px;
    padding: .42rem .55rem;
    outline: none;
}
.photo-title-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.dropzone {
    width: 110px; height: 110px;
    border: 1.5px dashed var(--border-md);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: border-color .15s, background .15s, color .15s;
    text-align: center;
    padding: .25rem;
}
.dropzone:hover, .dropzone.drag {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
}
.dropzone.busy { opacity: .5; pointer-events: none; }
.dz-icon { font-size: 1.4rem; line-height: 1; }
.dz-text { font-size: .58rem; margin-top: .2rem; line-height: 1.25; }

/* ==============================
   TIMELINE
   ============================== */
.sec-history {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.sec-history-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.sec-history-body { padding: 1rem 1.25rem; }
.timeline { list-style: none; }
.tl-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.tl-item:last-child { border-bottom: none; }
.tl-main { font-size: .88rem; }
.tl-field { color: var(--muted); margin-left: .35rem; }
.tl-change { color: var(--text-soft); margin-left: .35rem; font-size: .83rem; }
.tl-meta { font-size: .74rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* ==============================
   NEW CASE form
   ============================== */
.new-case-wrap {
    max-width: 560px;
}
.new-case-step {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1.75rem;
}
.step-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.step-desc { font-size: .85rem; color: var(--text-soft); }

/* ==============================
   USERS PAGE
   ============================== */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.user-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s;
}
.user-card:hover { box-shadow: var(--shadow); }
.user-avatar {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.user-avatar.role-italy  { background: var(--blue); }
.user-avatar.role-china  { background: var(--red); }
.user-avatar.role-admin  { background: #6B4FA0; }
.user-card-body { flex: 1; min-width: 0; }
.user-card-name { font-weight: 700; font-size: .97rem; }
.user-card-email { color: var(--muted); font-size: .82rem; margin-top: .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card-meta { margin-top: .6rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.user-card-actions { display: flex; flex-direction: column; gap: .4rem; flex-shrink: 0; }

/* ==============================
   PROFILE PAGE
   ============================== */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    max-width: 860px;
}
.profile-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: .85rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.profile-avatar {
    width: 72px; height: 72px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.9rem;
    font-weight: 800;
    color: #fff;
}
.profile-avatar.role-italy  { background: var(--blue); }
.profile-avatar.role-china  { background: var(--red); }
.profile-avatar.role-admin  { background: #6B4FA0; }

/* ==============================
   MODAL
   ============================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13,27,42,.55);
    backdrop-filter: blur(3px);
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1rem;
    animation: fadeIn .15s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: slideUp .18s ease;
}
@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1rem; }
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--muted);
    line-height: 1;
    padding: .2rem .4rem;
    border-radius: 6px;
    transition: background .12s;
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 1.5rem; }
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* ==============================
   LIGHTBOX
   ============================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10,15,25,.92);
    display: grid;
    place-items: center;
    z-index: 300;
    padding: 2rem;
}
.lightbox[hidden] { display: none; }
.lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.lb-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: rgba(255,255,255,.15);
    color: #fff;
    border: none;
    width: 42px; height: 42px;
    border-radius: 10px;
    font-size: 1.4rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .12s;
}
.lb-close:hover { background: rgba(255,255,255,.25); }

/* ==============================
   TOAST
   ============================== */
.toast {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    translate: -50% 1.5rem;
    background: var(--navy);
    color: #fff;
    padding: .75rem 1.25rem;
    border-radius: 10px;
    font-size: .85rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, translate .2s;
    z-index: 400;
    box-shadow: var(--shadow);
    white-space: nowrap;
}
.toast.show { opacity: 1; translate: -50% 0; }
.toast.err   { background: #9B1C1C; }
.toast.ok    { background: var(--navy); }

/* ==============================
   FOOTER
   ============================== */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--navy);
    color: rgba(255,255,255,.45);
    font-size: .72rem;
    padding: .55rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    z-index: 40;
    border-top: 1px solid rgba(255,255,255,.06);
    text-align: center;
}
.footer-copy strong { color: rgba(255,255,255,.7); font-weight: 600; }
.footer-disclaimer { opacity: .7; }

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 900px) {
    .panels-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .fields-grid { grid-template-columns: 1fr; }
    .field-span2 { grid-column: span 1; }
}

@media (max-width: 680px) {
    .container { padding: 1.25rem 1rem 5rem; }
    .topbar-inner { flex-wrap: wrap; gap: .5rem; }
    .brand-text small { display: none; }
    .topbar-nav { display: none; }
    .filter-bar { gap: .5rem; }

    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { border-bottom: 1px solid var(--border); padding: .4rem .25rem; }
    .data-table td { border: none; padding: .3rem 1rem; display: flex; justify-content: space-between; align-items: center; }
    .data-table td::before { content: attr(data-label); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }

    .page-head { flex-direction: column; align-items: stretch; }
    .case-meta { gap: .4rem .75rem; }
    .case-status-block { flex-direction: column; align-items: flex-start; }
    .galleries { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .users-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .site-footer { gap: .1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
