/* =========================================================
   DBOOST — foglio di stile unico, nessuna dipendenza esterna
   ========================================================= */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-alt: #fafafb;
    --text: #101114;
    --text-soft: #3f434d;
    --muted: #6f7480;
    --muted-light: #a2a7b2;
    --border: #e8e9ed;
    --border-strong: #d8dae0;

    --accent: #f05a22;
    --accent-dark: #d64a15;
    --accent-soft: #fff1ea;

    --ink: #14151c;
    --ink-2: #1c1e28;

    --danger: #d92d43;
    --danger-soft: #fdedef;
    --success: #12854a;
    --success-soft: #e6f7ee;
    --info: #2f4fd0;
    --info-soft: #eef1ff;

    --r-lg: 16px;
    --r-md: 10px;
    --r-sm: 8px;
    --pill: 999px;

    --shadow-sm: 0 1px 2px rgba(16, 17, 22, .05);
    --shadow: 0 1px 3px rgba(16, 17, 22, .04), 0 10px 28px -14px rgba(16, 17, 22, .14);
    --shadow-lg: 0 2px 6px rgba(16, 17, 22, .05), 0 20px 48px -20px rgba(16, 17, 22, .2);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Le icone non devono mai superare la loro dimensione dichiarata */
svg { display: block; flex: none; }

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------
   Shell
   --------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------------------------------------------------------
   Sidebar
   --------------------------------------------------------- */
.sidebar {
    width: 248px;
    min-width: 248px;
    background: var(--ink);
    color: #fff;
    padding: 24px 14px;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -.02em;
    padding: 2px 12px 0;
    color: #fff;
}
.sidebar-logo .dot { color: var(--accent); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: rgba(255, 255, 255, .62);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--r-md);
    font-weight: 500;
    font-size: .9rem;
    transition: background .15s ease, color .15s ease;
}
.sidebar-nav a svg { width: 18px; height: 18px; opacity: .8; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.sidebar-nav a:hover svg { opacity: 1; }
.sidebar-nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 10px 2px;
    border-top: 1px solid rgba(255, 255, 255, .09);
    min-width: 0;
}
.sidebar-user .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .82rem;
    flex: none;
}
.sidebar-user .su-body { min-width: 0; }
.sidebar-user .email {
    font-size: .78rem;
    color: rgba(255, 255, 255, .5);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0;
}
.sidebar-user .plan-tag {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 8px;
    border-radius: var(--pill);
    background: rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .8);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 40;
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    width: 40px; height: 40px;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* ---------------------------------------------------------
   Main
   --------------------------------------------------------- */
.app-main {
    flex: 1;
    min-width: 0;
    padding: 40px 44px 64px;
    max-width: 1160px;
}

h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.02rem; font-weight: 700; margin-bottom: 18px; }
.page-subtitle { color: var(--muted); margin: 6px 0 30px; font-size: .94rem; }

/* ---------------------------------------------------------
   Stat cards
   --------------------------------------------------------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex: none;
}
.stat-card .stat-icon svg { width: 19px; height: 19px; }
.stat-card .stat-body { min-width: 0; }
.stat-card .label {
    font-size: .74rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.stat-card .value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 3px;
    letter-spacing: -.03em;
}

/* ---------------------------------------------------------
   Cards
   --------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 26px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------
   Barra "abbrevia"
   --------------------------------------------------------- */
.shorten-card {
    background: linear-gradient(180deg, #ffffff 0%, var(--surface-alt) 100%);
}

.shorten-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.shorten-row .url-field { flex: 1 1 340px; min-width: 0; }

.shorten-row input[type=url] {
    width: 100%;
    height: 48px;
    padding: 0 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--pill);
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.shorten-row input[type=url]::placeholder { color: var(--muted-light); }
.shorten-row input[type=url]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.shorten-row .btn {
    height: 48px;
    border-radius: var(--pill);
    padding: 0 26px;
    font-size: .93rem;
    flex: none;
}

details.advanced { margin-top: 16px; }
details.advanced summary {
    cursor: pointer;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before {
    content: "";
    width: 0; height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform .15s ease;
}
details.advanced[open] summary::before { transform: rotate(90deg); }
details.advanced summary:hover { color: var(--accent); }
details.advanced .advanced-body {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    max-width: 440px;
}

/* ---------------------------------------------------------
   Form
   --------------------------------------------------------- */
.form-row { margin-bottom: 18px; }
.form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
    font-size: .85rem;
    color: var(--text-soft);
}
.form-row .hint { color: var(--muted-light); font-size: .78rem; margin-top: 6px; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-soft);
    cursor: pointer;
}
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url] {
    width: 100%;
    max-width: 440px;
    height: 42px;
    padding: 0 14px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-md);
    font-size: .92rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--muted-light); }
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------------------------------------------------------
   Bottoni
   --------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1.5px solid transparent;
    border-radius: var(--r-md);
    padding: 10px 18px;
    font-size: .88rem;
    font-family: inherit;
    font-weight: 650;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    line-height: 1;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--accent); }

.btn-secondary { background: #f0f0f3; color: var(--text-soft); border-color: transparent; }
.btn-secondary:hover { background: #e4e4e9; color: var(--text); }

.btn-danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }

.btn-sm { padding: 8px 13px; font-size: .8rem; border-radius: var(--r-sm); }
.btn-icon { padding: 0; width: 34px; height: 34px; border-radius: var(--r-sm); }
.btn-icon svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------
   Alert
   --------------------------------------------------------- */
.alert {
    padding: 13px 16px;
    border-radius: var(--r-md);
    margin-bottom: 18px;
    font-size: .89rem;
    font-weight: 500;
}
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: #b21f33; }
.alert-info { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------
   Toolbar + ricerca
   --------------------------------------------------------- */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.toolbar h2 { margin-bottom: 0; }

.search-wrap { position: relative; flex: none; }
.search-wrap svg {
    position: absolute;
    left: 13px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    color: var(--muted-light);
    pointer-events: none;
}
.search-wrap input[type=text] {
    width: 240px;
    height: 38px;
    padding-left: 36px;
    border-radius: var(--pill);
    font-size: .87rem;
}

/* ---------------------------------------------------------
   Lista link
   --------------------------------------------------------- */
.link-list { display: flex; flex-direction: column; margin-top: 8px; }

.link-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 6px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: background .15s ease;
}
.link-row:last-child { border-bottom: none; }
.link-row:hover { background: var(--surface-alt); }

.link-row .qr-thumb {
    width: 48px; height: 48px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: #fff;
    flex: none;
    object-fit: contain;
    padding: 2px;
}

.link-row .link-info { flex: 1 1 auto; min-width: 0; }

.link-row .short-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.link-row .short-line a {
    font-weight: 700;
    color: var(--text);
    font-size: .95rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-row .short-line a:hover { color: var(--accent); text-decoration: none; }

.link-row .orig-url {
    color: var(--muted);
    font-size: .82rem;
    margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.link-row .clicks {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex: none;
    min-width: 92px;
    color: var(--muted);
    font-size: .8rem;
}
.link-row .clicks strong {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.link-row .actions { display: flex; gap: 6px; flex: none; align-items: center; }
.link-row .actions form { margin: 0; display: flex; }

.copy-btn {
    background: none;
    border: 1.5px solid var(--border-strong);
    color: var(--muted);
    border-radius: 7px;
    width: 27px; height: 27px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex: none;
    padding: 0;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.copy-btn.copied { border-color: var(--success); color: var(--success); background: var(--success-soft); }

/* ---------------------------------------------------------
   Tabelle (pagina utenti)
   --------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td {
    text-align: left;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    font-size: .88rem;
    vertical-align: middle;
}
th {
    color: var(--muted);
    font-weight: 700;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--surface-alt);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-alt); }

.badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: var(--pill);
    font-size: .72rem;
    font-weight: 700;
    background: var(--accent-soft);
    color: var(--accent-dark);
}
.badge-muted { background: #f0f0f3; color: var(--muted); }

/* ---------------------------------------------------------
   Stato vuoto
   --------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 52px 20px;
    color: var(--muted);
    font-size: .92rem;
}
.empty-state svg {
    margin: 0 auto 14px;
    color: var(--muted-light);
    opacity: .5;
}

/* ---------------------------------------------------------
   Intestazione di pagina con azione a destra
   --------------------------------------------------------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}
.page-head .page-subtitle { margin-bottom: 0; }
.page-head .dest {
    color: var(--muted);
    word-break: break-all;
}

/* ---------------------------------------------------------
   Grafico click
   --------------------------------------------------------- */
.chart { width: 100%; height: auto; overflow: visible; }

.chart-bar { fill: var(--accent); }
.chart-bar.is-peak { fill: var(--accent-dark); }

/* Gridline sottili e solide: devono restare dietro ai dati */
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { stroke: var(--border-strong); stroke-width: 1; }

/* Il testo del grafico non indossa mai il colore dei dati */
.chart-tick {
    fill: var(--muted);
    font-size: 11px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}
.chart-value {
    fill: var(--text);
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
}

.chart-hit { fill: transparent; cursor: default; }
.chart-hit:hover { fill: var(--accent); fill-opacity: .06; }

.chart-tooltip {
    position: fixed;
    z-index: 60;
    transform: translate(-50%, -100%);
    background: var(--ink);
    color: #fff;
    padding: 7px 11px;
    border-radius: var(--r-sm);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow);
}
.chart-tooltip[hidden] { display: none; }

.range-tabs { display: flex; gap: 4px; background: #f0f0f3; padding: 3px; border-radius: var(--pill); }
.range-tabs a {
    padding: 6px 14px;
    border-radius: var(--pill);
    font-size: .81rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}
.range-tabs a:hover { color: var(--text); text-decoration: none; }
.range-tabs a.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

details.data-table { margin-top: 18px; }
details.data-table summary {
    cursor: pointer;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 600;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
details.data-table summary::-webkit-details-marker { display: none; }
details.data-table summary::before {
    content: "";
    width: 0; height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform .15s ease;
}
details.data-table[open] summary::before { transform: rotate(90deg); }
details.data-table summary:hover { color: var(--accent); }

/* ---------------------------------------------------------
   Ripartizioni (dispositivo, browser, provenienza)
   --------------------------------------------------------- */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.breakdown-grid .card { margin-bottom: 0; }

.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.breakdown li { display: flex; align-items: center; gap: 12px; font-size: .86rem; }
.bd-label {
    flex: 0 0 92px;
    color: var(--text-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bd-track { flex: 1 1 auto; height: 8px; background: #f0f0f3; border-radius: var(--pill); overflow: hidden; }
.bd-fill { display: block; height: 100%; background: var(--accent); border-radius: var(--pill); }
.bd-value {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    text-align: right;
}
.breakdown-empty { color: var(--muted-light); font-size: .86rem; margin: 0; }

.privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.6;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 16px;
    margin-top: 24px;
}
.privacy-note svg { margin-top: 2px; color: var(--muted-light); }

/* ---------------------------------------------------------
   Selettore tema pagina bio
   --------------------------------------------------------- */
.theme-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-soft);
}
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.theme-swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.theme-light .theme-swatch { background: #ffffff; }
.theme-dark .theme-swatch { background: #16171d; }
.theme-brand .theme-swatch { background: linear-gradient(135deg, #f05a22, #ff9557); }

.add-button-form {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------
   Select
   --------------------------------------------------------- */
select {
    height: 42px;
    padding: 0 34px 0 12px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-md);
    font-size: .9rem;
    font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f7480' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    max-width: 440px;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.plan-form { margin: 0; }
.plan-form select { height: 34px; font-size: .82rem; padding: 0 30px 0 10px; }

/* ---------------------------------------------------------
   Griglia dei tipi di destinazione
   --------------------------------------------------------- */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.type-card-form { margin: 0; display: flex; }

.type-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    text-align: left;
    padding: 20px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.type-card:hover:not(:disabled) {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.type-card.is-current { border-color: var(--accent); background: var(--accent-soft); }
.type-card.is-locked { opacity: .55; cursor: not-allowed; }

.type-icon {
    width: 42px; height: 42px;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex: none;
}
.type-card.is-current .type-icon { background: #fff; }

.type-body { min-width: 0; }
.type-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-weight: 700;
    font-size: .95rem;
    color: var(--text);
    margin-bottom: 4px;
}
.type-label .badge svg { display: inline-block; vertical-align: -1px; }
.type-desc {
    display: block;
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.45;
}

/* ---------------------------------------------------------
   Banner di upgrade e note informative
   --------------------------------------------------------- */
.upgrade-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: linear-gradient(135deg, var(--accent-soft), #fff);
    border: 1.5px solid var(--accent);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    margin-bottom: 24px;
}
.upgrade-banner .ub-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex: none;
}
.upgrade-banner strong { display: block; font-size: .95rem; margin-bottom: 3px; }
.upgrade-banner p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }

.info-note {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 18px;
    margin-bottom: 24px;
    font-size: .84rem;
    line-height: 1.6;
    color: var(--muted);
}
.info-note svg { margin-top: 3px; color: var(--muted-light); flex: none; }
.info-note strong { display: block; color: var(--text-soft); margin-bottom: 3px; }

/* ---------------------------------------------------------
   Attivazione card
   --------------------------------------------------------- */
.claim-card { text-align: center; }

.claim-badge {
    width: 56px; height: 56px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}

.claim-title { font-size: 1.3rem; font-weight: 800; margin: 10px 0 8px; }

.claim-features {
    list-style: none;
    margin: 24px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
    text-align: left;
}
.claim-features li {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: .89rem;
    color: var(--text-soft);
}
.claim-features svg { color: var(--accent); flex: none; }

.claim-note {
    color: var(--muted-light);
    font-size: .8rem;
    margin: 0 0 20px;
}

.claim-cta {
    width: 100%;
    height: 48px;
    border-radius: var(--pill);
    font-size: .95rem;
}

.login-alt {
    margin: 20px 0 0;
    text-align: center;
    font-size: .85rem;
    color: var(--muted);
}

/* ---------------------------------------------------------
   Login
   --------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-card .brand {
    display: flex; align-items: center;
    font-weight: 800;
    font-size: 1.32rem;
    letter-spacing: -.02em;
    margin-bottom: 6px;
}
.login-card .brand .dot { color: var(--accent); }
.login-card p.subtitle { color: var(--muted); margin: 0 0 28px; font-size: .9rem; }
.login-card input { max-width: 100%; }
.login-card .btn {
    width: 100%;
    height: 46px;
    border-radius: var(--pill);
    font-size: .93rem;
    margin-top: 4px;
}

/* ---------------------------------------------------------
   Editor menu
   --------------------------------------------------------- */
textarea {
    width: 100%;
    max-width: 440px;
    padding: 11px 14px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-md);
    font-size: .92rem;
    font-family: inherit;
    line-height: 1.55;
    background: #fff;
    color: var(--text);
    resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

input[type=file] {
    font-size: .85rem;
    font-family: inherit;
    color: var(--muted);
    max-width: 440px;
}
input[type=file]::file-selector-button {
    margin-right: 12px;
    padding: 8px 14px;
    border: none;
    border-radius: var(--r-sm);
    background: #f0f0f3;
    color: var(--text-soft);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: #e4e4e9; }

.image-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    max-width: 440px;
}
.image-preview img {
    width: 78px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    flex: none;
}

.form-row-inline { display: flex; gap: 16px; flex-wrap: wrap; }

.menu-category {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    margin-bottom: 18px;
    background: var(--surface-alt);
}

.mc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.mc-head h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.mc-actions { display: flex; gap: 5px; }
.mc-actions form { margin: 0; }

.menu-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px 0;
    border-top: 1px solid var(--border);
}
.menu-item.is-unavailable { opacity: .55; }
.mi-body { flex: 1 1 auto; min-width: 0; }
.mi-name { font-weight: 650; font-size: .92rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mi-desc { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.mi-allergens { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.allergen-tag {
    font-size: .69rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--pill);
    background: #fff;
    border: 1px solid var(--border);
    color: var(--muted);
}
.mi-price {
    flex: none;
    font-weight: 700;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.mi-actions { display: flex; gap: 5px; flex: none; }
.mi-actions form { margin: 0; }

details.add-item { margin-top: 14px; }
details.add-item summary {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--accent);
    font-size: .84rem;
    font-weight: 650;
    list-style: none;
}
details.add-item summary::-webkit-details-marker { display: none; }
details.add-item summary:hover { text-decoration: underline; }

.add-item-form {
    margin-top: 16px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.allergen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 7px 14px;
    padding: 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    max-width: 560px;
}
.allergen-grid .checkbox-row { font-size: .83rem; font-weight: 500; }

/* ---------------------------------------------------------
   Editor landing
   --------------------------------------------------------- */
.block-list { display: flex; flex-direction: column; margin-bottom: 8px; }

.block-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 4px;
    border-bottom: 1px solid var(--border);
}
.block-row:last-child { border-bottom: none; }

.block-icon {
    width: 34px; height: 34px;
    border-radius: var(--r-sm);
    background: var(--accent-soft);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex: none;
}

.block-body { flex: 1 1 auto; min-width: 0; }
.block-kind {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted-light);
}
.block-preview {
    font-size: .88rem;
    color: var(--text-soft);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.block-actions { display: flex; gap: 5px; flex: none; }
.block-actions form { margin: 0; }

.add-block-tabs {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.add-block-tabs details { margin-top: 0; }
.add-block-tabs .add-item-form { min-width: 300px; }

/* ---------------------------------------------------------
   Pagine documentali (informativa privacy)
   --------------------------------------------------------- */
.doc-page { max-width: 780px; margin: 0 auto; }
.doc-page .brand-line {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -.02em;
    margin-bottom: 28px;
}
.doc-page .brand-line .dot { color: var(--accent); }
.doc-page .card p { color: var(--text-soft); font-size: .92rem; line-height: 1.65; }
.doc-page .card p:last-child { margin-bottom: 0; }
.doc-page .card ul {
    color: var(--text-soft);
    font-size: .92rem;
    line-height: 1.65;
    padding-left: 20px;
}
.doc-page .card li { margin-bottom: 7px; }
.doc-back { text-align: center; font-size: .88rem; margin-top: 30px; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 900px) {
    .menu-toggle { display: block; }
    .sidebar {
        position: fixed;
        left: -270px; top: 0; bottom: 0;
        z-index: 30;
        transition: left .22s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { left: 0; }
    .app-main { padding: 72px 16px 48px; }
    .search-wrap, .search-wrap input[type=text] { width: 100%; }
    .toolbar { align-items: stretch; }
}

@media (max-width: 620px) {
    .link-row { flex-wrap: wrap; gap: 12px; }
    .link-row .link-info { flex-basis: calc(100% - 64px); }
    .link-row .clicks { min-width: 0; margin-left: 64px; }
    .link-row .actions { margin-left: auto; }
    .shorten-row .btn { width: 100%; }
}
