/* Noleggio Business — web command center.
   Deep emerald, sage glass, champagne gold (the app's Business look). */

:root {
  --bg: #E9EFEB;
  --bg-2: #F3F6F4;
  --ink: #0F1F19;
  --ink-2: #4B5D55;
  --ink-3: #82938B;
  --hair: rgba(14, 59, 46, 0.09);
  --field: rgba(14, 59, 46, 0.06);
  --glass: rgba(252, 253, 252, 0.84);
  --em: #0E3B2E;
  --em-2: #16503F;
  --em-3: #1F6B54;
  --mint: #DCEBE3;
  --mint-text: #CFE0D8;
  --champagne: #EBC680;
  --gold: #D7A752;
  --gold-text: #8A6420;
  --gold-wash: #F6EEDC;
  --cream: #F7F4EC;
  --good: #1F7A52;
  --critical: #C8372D;
  --metal: linear-gradient(135deg, #F4DC9F 0%, #D7A752 38%, #A9752C 68%, #EBC680 100%);
  --shelves: linear-gradient(rgba(235, 198, 128, 0.6) 1px, transparent 1px), linear-gradient(90deg, rgba(235, 198, 128, 0.4) 1px, transparent 1px);
  --shadow: 0 1px 1px rgba(14, 59, 46, 0.05), 0 18px 48px -18px rgba(14, 59, 46, 0.28);
  --font: "Plus Jakarta Sans", -apple-system, system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100dvh; font: 14.5px/1.45 var(--font); color: var(--ink); background: linear-gradient(160deg, var(--bg-2), var(--bg) 60%); background-attachment: fixed; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
.metal-text { background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chip-biz { display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 999px; background: var(--metal); color: #121211; font-weight: 800; }
.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- Login ---------- */
.login { position: relative; min-height: 100dvh; overflow: hidden; color: #fff; background: radial-gradient(120% 90% at 50% 0%, #165A45 0%, #0E3B2E 45%, #082A20 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 90px 20px 80px; text-align: center; }
.login::before { content: ""; position: absolute; inset: 0; opacity: 0.1; background-image: var(--shelves); background-size: 100% 96px, 132px 100%; pointer-events: none; }
.login::after { content: ""; position: absolute; left: 50%; top: 52%; width: 820px; height: 820px; margin: -410px; border-radius: 50%; background: radial-gradient(closest-side, rgba(235, 198, 128, 0.26), transparent); pointer-events: none; }
.login > * { position: relative; z-index: 1; }
.login .help { position: absolute; right: 40px; top: 32px; z-index: 2; height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid rgba(235, 198, 128, 0.3); background: rgba(255, 255, 255, 0.1); color: #fff; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.login .help svg { width: 18px; height: 18px; color: var(--gold); }
.wordmark { display: inline-flex; align-items: center; gap: 12px; }
.wordmark .name { font-size: 42px; font-weight: 800; letter-spacing: -1.9px; line-height: 1; }
.wordmark .chip-biz { font-size: 19px; padding: 7px 18px; }
.login .sub { font-size: 17px; color: var(--mint-text); max-width: 520px; }
.qr-ring { margin-top: 22px; padding: 6px; border-radius: 44px; background: var(--metal); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7); }
.qr-tile { position: relative; padding: 28px; border-radius: 38px; background: var(--cream); }
.qr-tile svg { display: block; width: 250px; height: 250px; }
.qr-tile .logo { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; padding: 6px; border-radius: 16px; background: var(--cream); }
.qr-tile .logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qr-tile.loading svg { opacity: 0.15; filter: blur(2px); }
.qr-tile .veil { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 38px; background: rgba(247, 244, 236, 0.86); color: var(--em); font-weight: 800; }
.qr-tile .veil button { border: 0; border-radius: 999px; background: var(--em); color: #fff; padding: 10px 18px; font-weight: 800; }
.login h1 { margin: 12px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.8px; }
.login .path { font-size: 15px; color: var(--mint-text); max-width: 560px; line-height: 1.5; }
.login .path b { color: #fff; }
.login .path b.gold { color: var(--champagne); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 13px; font-weight: 700; color: var(--mint-text); }
.status-pill i { width: 8px; height: 8px; border-radius: 4px; background: #6FD39E; }
.status-pill.err { color: #FFD0CA; }
.status-pill.err i { background: #FF7468; }
.login .foot { position: absolute; left: 0; right: 0; bottom: 30px; font-size: 12.5px; color: rgba(207, 224, 216, 0.65); padding: 0 20px; }
.login .envtag { position: absolute; left: 40px; top: 40px; z-index: 2; font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--champagne); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 18px; padding: 18px; min-height: 100dvh; }
.side { position: sticky; top: 18px; height: calc(100dvh - 36px); border-radius: 26px; overflow: hidden; padding: 24px 14px 16px; display: flex; flex-direction: column; gap: 4px; color: #EEF4F0; background: linear-gradient(170deg, rgba(14, 59, 46, 0.97), rgba(10, 44, 34, 0.97)); box-shadow: 0 24px 60px -24px rgba(14, 59, 46, 0.6); }
.side::before { content: ""; position: absolute; inset: 0; opacity: 0.14; background-image: var(--shelves); background-size: 100% 96px, 132px 100%; pointer-events: none; }
.side::after { content: ""; position: absolute; left: -60px; top: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(closest-side, rgba(235, 198, 128, 0.25), transparent); pointer-events: none; }
.side > * { position: relative; z-index: 1; }
.side .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 10px 18px; }
.side .brand .name { font-size: 30px; font-weight: 800; letter-spacing: -1.4px; color: #fff; }
.side .brand .chip-biz { font-size: 12px; padding: 4px 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-radius: 14px; background: transparent; color: rgba(238, 244, 240, 0.78); font-weight: 700; font-size: 14.5px; text-align: left; }
.nav button:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav button[aria-current="page"] { background: rgba(220, 235, 227, 0.95); color: var(--em); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; min-width: 22px; padding: 1px 8px; border-radius: 999px; background: var(--critical); color: #fff; font-size: 11px; text-align: center; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(207, 224, 216, 0.12); }
.side .me .tile { width: 38px; height: 38px; border-radius: 12px; background: var(--metal); color: #121211; display: grid; place-items: center; font-weight: 800; font-size: 13px; overflow: hidden; flex: none; }
.side .me .tile img { width: 100%; height: 100%; object-fit: cover; }
.side .me .who { flex: 1; min-width: 0; }
.side .me .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me .who span { font-size: 12px; color: rgba(207, 224, 216, 0.6); }
.iconbtn { width: 34px; height: 34px; border-radius: 11px; border: 0; background: rgba(255, 255, 255, 0.08); color: var(--champagne); display: grid; place-items: center; }
.iconbtn svg { width: 17px; height: 17px; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 18px; padding-bottom: 40px; }
.top { display: flex; align-items: flex-end; gap: 14px; padding: 8px 4px 0; flex-wrap: wrap; }
.top .eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--em-3); text-transform: uppercase; }
.top h1 { margin: 2px 0 0; font-size: 34px; font-weight: 800; letter-spacing: -1.4px; line-height: 1.05; }
.top p { margin: 2px 0 0; color: var(--ink-2); }
.top .spacer { flex: 1; }
.pillbtn { height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--hair); background: var(--glass); display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.pillbtn svg { width: 16px; height: 16px; color: var(--em-3); }
.pillbtn.primary { background: var(--em); color: #fff; border-color: transparent; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.live i { width: 8px; height: 8px; border-radius: 4px; background: #2F8F5B; }
.demo-banner { padding: 10px 16px; border-radius: 16px; background: var(--gold-wash); color: var(--gold-text); font-weight: 700; font-size: 13px; }

.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row2 { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.row3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.card { padding: 20px; border-radius: 24px; background: var(--glass); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), var(--shadow); min-width: 0; }
.card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card .head h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.card .head .sub { color: var(--ink-3); font-size: 12.5px; }
.card .head .end { margin-left: auto; }
.kpi .label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.kpi .value { font-size: 34px; font-weight: 800; letter-spacing: -1.4px; margin-top: 6px; line-height: 1.1; }
.kpi .foot { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.delta { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 800; font-size: 11.5px; background: rgba(31, 122, 82, 0.12); color: var(--good); }
.delta.down { background: rgba(200, 55, 45, 0.12); color: var(--critical); }
.delta.flat { background: var(--field); color: var(--ink-3); }
.kpi.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(150deg, var(--em), var(--em-2)); border-color: rgba(235, 198, 128, 0.18); }
.kpi.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(closest-side, rgba(235, 198, 128, 0.42), transparent); }
.kpi.hero .label, .kpi.hero .foot { color: var(--mint-text); position: relative; }
.kpi.hero .value { position: relative; background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--field); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: 12.5px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--em); color: #fff; }
.chart { width: 100%; height: 240px; display: block; }
.chart text { fill: var(--ink-3); font-size: 11px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.donut-wrap .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-wrap .center b { font-size: 22px; }
.donut-wrap .center span { font-size: 11px; color: var(--ink-3); }
.legend-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.legend-list div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-list span.sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-list span.n { flex: 1; color: var(--ink-2); }

.rows .row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--hair); }
.rows .row:first-child { border-top: 0; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; background: var(--gold-wash); }
.rows .txt { flex: 1; min-width: 0; }
.rows .txt b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .txt small { display: block; color: var(--ink-3); font-size: 12.5px; }
.btn { border: 0; border-radius: 999px; height: 34px; padding: 0 14px; font-weight: 800; font-size: 12.5px; background: var(--em); color: #fff; }
.btn.ghost { background: var(--field); color: var(--ink); }
.btn.gold { background: var(--metal); color: #121211; }
.btn:disabled { opacity: 0.5; cursor: default; }
.bars .bar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) 70px; gap: 12px; align-items: center; padding: 8px 0; font-size: 13.5px; }
.bars .bar .n { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .track { height: 10px; border-radius: 999px; background: var(--field); overflow: hidden; }
.bars .fill { display: block; height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--em-3), var(--champagne)); }
.bars .v { text-align: right; font-weight: 800; }
.empty { padding: 26px 10px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Orders board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.lane h3 { display: flex; align-items: center; gap: 8px; margin: 0 4px 10px; font-size: 14px; }
.lane h3 span { padding: 1px 8px; border-radius: 999px; background: var(--field); font-size: 12px; color: var(--ink-2); }
.ocard { padding: 14px; border-radius: 18px; background: var(--glass); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ocard.hl { outline: 2px solid var(--gold); }
.ocard .t { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 14px; }
.ocard small { color: var(--ink-3); font-size: 12.5px; }
.ocard .tag { align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: var(--gold-wash); color: var(--gold-text); font-size: 11.5px; font-weight: 800; }
.ocard .actions { display: flex; gap: 8px; margin-top: 4px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal .dow { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--ink-3); padding: 0 4px; }
.cal .day { min-height: 112px; padding: 8px; border-radius: 14px; background: var(--glass); border: 1px solid rgba(255, 255, 255, 0.7); }
.cal .day.out { background: transparent; border-color: transparent; }
.cal .day.today { outline: 2px solid var(--gold); }
.cal .day .n { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; }
.cal .day .n em { font-style: normal; font-size: 10.5px; color: var(--critical); }
.cal .ev { margin-top: 5px; padding: 4px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; background: var(--mint); color: var(--em); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.cat { background: var(--em); color: #fff; }
.cal .ev.pending { background: var(--gold-wash); color: var(--gold-text); }

/* Menu */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile-card { border-radius: 20px; overflow: hidden; background: var(--glass); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: var(--shadow); }
.tile-card .ph { height: 92px; background: linear-gradient(150deg, var(--em-2), var(--em-3)); position: relative; }
.tile-card .ph.gold { background: linear-gradient(150deg, #C9622F, #F2B35B); }
.tile-card .ph span { position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 999px; background: #fff; font-size: 11px; font-weight: 800; }
.tile-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tile-card .body b { font-size: 14.5px; }
.tile-card .body small { color: var(--ink-3); font-size: 12.5px; }

/* Help panel */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(6, 18, 14, 0.35); }
.panel { position: fixed; z-index: 50; right: 18px; top: 18px; bottom: 18px; width: min(420px, calc(100vw - 36px)); padding: 22px; border-radius: 24px; background: rgba(252, 253, 252, 0.97); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.panel .ph { display: flex; align-items: center; gap: 10px; }
.panel .ph .ic { width: 40px; height: 40px; border-radius: 14px; background: var(--em); display: grid; place-items: center; color: var(--champagne); }
.panel .ph .ic svg { width: 20px; height: 20px; }
.panel .ph .close { margin-left: auto; border: 0; background: var(--field); width: 34px; height: 34px; border-radius: 17px; font-size: 18px; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.msg { max-width: 80%; padding: 10px 13px; border-radius: 16px; font-size: 13.5px; white-space: pre-wrap; align-self: flex-start; background: var(--field); }
.msg.me { align-self: flex-end; background: var(--em); color: #fff; }
.msg small { display: block; font-size: 11px; opacity: 0.7; margin-bottom: 2px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { border: 0; padding: 6px 11px; border-radius: 999px; background: var(--gold-wash); color: var(--gold-text); font-size: 12px; font-weight: 800; }
.compose { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 16px; border-radius: 24px; border: 1px solid var(--hair); background: #fff; }
.compose input { flex: 1; border: 0; outline: 0; background: transparent; min-height: 36px; }
.compose button { width: 36px; height: 36px; border-radius: 18px; border: 0; background: var(--em); color: #fff; display: grid; place-items: center; }
.compose button svg { width: 16px; height: 16px; }

.toast-host { position: fixed; z-index: 70; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 12px 18px; border-radius: 999px; background: var(--em); color: #fff; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow); }
.toast.err { background: var(--critical); }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row2, .row3 { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .side { position: relative; top: 0; height: auto; }
  .side .nav { flex-direction: row; flex-wrap: wrap; }
  .side .nav button { width: auto; }
  .side .me { margin-top: 10px; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .cal .day { min-height: 70px; }
  .top h1 { font-size: 28px; }
  .wordmark .name { font-size: 34px; }
  .qr-tile svg { width: 210px; height: 210px; }
  .login .help { right: 16px; top: 16px; }
  .login .envtag { left: 16px; top: 22px; }
}
