@import url('brand.css');

body { background: var(--night); min-height: 100vh; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--graphite); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; color: var(--white); }
.side .brand img { width: 44px; height: 44px; border-radius: 10px; }
.side .brand b { font-family: var(--f-display); font-size: 16px; letter-spacing: .02em; }
.side .brand small { display: block; color: var(--steel); font-size: 11px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--steel); text-decoration: none; font-weight: 600; font-size: 14px; }
.side a.nav:hover { background: var(--graphite-2); color: var(--white); }
.side a.nav.on { background: rgba(0, 212, 255, .12); color: var(--cyan); }
.side .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #5c6375; margin: 14px 12px 4px; }
.side .foot { margin-top: auto; font-size: 13px; color: var(--steel); padding: 8px 12px; }
.side .foot a { color: var(--steel); }

main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-family: var(--f-display); text-transform: uppercase; font-size: 26px; margin: 0; letter-spacing: .01em; }
.top h1 small { display: block; font-family: var(--f-body); text-transform: none; font-size: 13px; color: var(--steel); font-weight: 500; margin-top: 4px; letter-spacing: 0; }

.card { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 15px; margin: 0 0 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 16px; }
.stat .v { font-family: var(--f-num); font-size: 34px; font-weight: 700; }
.stat .l { color: var(--steel); font-size: 13px; margin-top: 4px; }
.stat.accent .v { color: var(--cyan); }
.stat.gold .v { color: var(--gold); }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--steel); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--graphite-2); }
.muted { color: var(--steel); }
.small { font-size: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--cyan); color: var(--night); border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; font-size: 14px; cursor: pointer; text-decoration: none; font-family: var(--f-body); }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--white); border: 1px solid var(--line); }
.btn.gold { background: var(--gold); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid rgba(255, 59, 59, .4); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

form.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
form.grid .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--steel); }
input, select, textarea { background: var(--night); border: 1px solid var(--line); color: var(--white); border-radius: 10px; padding: 11px 12px; font-size: 15px; font-family: var(--f-body); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); border-color: transparent; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--white); font-weight: 500; }
label.check input { width: 18px; height: 18px; accent-color: var(--cyan); }
.hint { font-weight: 400; font-size: 12px; color: #6b7386; }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.st-nuovo { background: rgba(0, 212, 255, .15); color: var(--cyan); }
.st-preparazione { background: rgba(255, 184, 28, .15); color: var(--gold); }
.st-pronto { background: rgba(46, 229, 157, .15); color: var(--green); }
.st-consegnato { background: var(--graphite-2); color: var(--steel); }
.st-annullato { background: rgba(255, 59, 59, .12); color: var(--red); }

.switch { position: relative; width: 44px; height: 24px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #3a3a48; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }

.flash { background: rgba(46, 229, 157, .12); border: 1px solid rgba(46, 229, 157, .35); color: var(--green); padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .b i { display: block; width: 100%; background: linear-gradient(var(--cyan), var(--cyan-deep)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bars .b span { font-size: 11px; color: var(--steel); }
.bars .b em { font-style: normal; font-size: 11px; font-family: var(--f-num); }
.screens { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.screens a { display: block; background: var(--graphite-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: var(--white); text-decoration: none; font-weight: 700; font-size: 14px; }
.screens a small { display: block; color: var(--steel); font-weight: 500; font-size: 12px; margin-top: 4px; }
.screens a:hover { border-color: var(--cyan); }
.cat-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 10px; }
.cat-head h3 { font-family: var(--f-display); text-transform: uppercase; margin: 0; font-size: 18px; }
.preview-img { width: 160px; height: 160px; border-radius: 14px; object-fit: cover; background: var(--graphite-2); border: 1px solid var(--line); }

/* login / install */
body.auth { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, rgba(0, 212, 255, .14), transparent 60%), var(--night); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-family: var(--f-display); text-transform: uppercase; margin: 0; font-size: 22px; text-align: center; }
.auth-logo { width: 190px; margin: 0 auto -6px; }
.err { color: var(--red); margin: 0; font-weight: 600; font-size: 14px; }
.ok { color: var(--green); font-weight: 700; margin: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side .sep, .side .foot { display: none; }
  .two, form.grid { grid-template-columns: 1fr; }
  main { padding: 20px 16px; }
}

/* ===================== v2: animazioni e look moderno ===================== */
body:not(.auth) { background: radial-gradient(circle at 85% -10%, rgba(0, 212, 255, .10), transparent 40%), radial-gradient(circle at 0% 110%, rgba(255, 184, 28, .05), transparent 40%), var(--night); background-attachment: fixed; }
.side { background: rgba(22, 22, 31, .72); backdrop-filter: blur(16px); }
.side .navwrap { position: relative; display: flex; flex-direction: column; gap: 4px; }
.side .nav-ind { position: absolute; left: 0; right: 0; border-radius: 10px; background: rgba(0, 212, 255, .12); border-left: 3px solid var(--cyan); transition: top .45s cubic-bezier(.3, 1.3, .4, 1), height .3s; pointer-events: none; box-shadow: inset 0 0 20px rgba(0, 212, 255, .08); }
.side a.nav { position: relative; z-index: 1; transition: color .2s, transform .2s; }
.side a.nav:hover { background: transparent; transform: translateX(4px); }
.side a.nav.on { background: transparent; }
.side .live { margin-left: auto; min-width: 22px; height: 22px; border-radius: 99px; background: var(--cyan); color: var(--night); font: 800 12px/22px var(--f-num); text-align: center; padding: 0 6px; position: relative; display: none; }
.side .live.show { display: inline-block; animation: popIn .4s cubic-bezier(.2, 1.5, .4, 1); }
.side .live::after { content: ''; position: absolute; inset: -4px; border-radius: inherit; border: 2px solid var(--cyan); animation: ping 1.6s ease-out infinite; }
@keyframes ping { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes popIn { from { transform: scale(0); } }
.side .brand img { transition: transform .4s cubic-bezier(.2, 1.5, .4, 1); }
.side .brand:hover img { transform: rotate(-8deg) scale(1.08); }

main { animation: pageIn .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } }
.top .clock { font-family: var(--f-num); color: var(--steel); font-size: 13px; display: flex; align-items: center; gap: 8px; margin-right: 12px; }
.top .clock i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: blinkDot 2s ease-in-out infinite; }
@keyframes blinkDot { 50% { opacity: .3; } }
.top > div:last-child { display: flex; align-items: center; gap: 10px; }

.card { position: relative; overflow: hidden; transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .3s, box-shadow .3s; animation: cardIn .6s cubic-bezier(.2, .8, .2, 1) backwards; }
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: radial-gradient(400px circle at var(--mx, -100px) var(--my, -100px), rgba(0, 212, 255, .5), transparent 40%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.cards .card:hover, .screens a:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
@keyframes cardIn { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.cards .card:nth-child(2) { animation-delay: .06s; } .cards .card:nth-child(3) { animation-delay: .12s; } .cards .card:nth-child(4) { animation-delay: .18s; }
.two .card:nth-child(2) { animation-delay: .1s; }
.stat .v { letter-spacing: -.01em; }
.stat.accent::after, .stat.gold::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(currentColor, transparent 70%); opacity: .12; }
.stat.accent { color: var(--cyan); } .stat.gold { color: var(--gold); }
.stat .l { color: var(--steel); }
.stat .spark { position: absolute; right: 16px; bottom: 14px; width: 90px; height: 30px; opacity: .8; }

.bars .b i { transform-origin: bottom; animation: grow .9s cubic-bezier(.2, .9, .2, 1.1) backwards; position: relative; }
.bars .b:nth-child(2) i { animation-delay: .05s; } .bars .b:nth-child(3) i { animation-delay: .1s; } .bars .b:nth-child(4) i { animation-delay: .15s; } .bars .b:nth-child(5) i { animation-delay: .2s; } .bars .b:nth-child(6) i { animation-delay: .25s; } .bars .b:nth-child(7) i { animation-delay: .3s; }
.bars .b:last-child i { background: linear-gradient(var(--gold), #c98a00); box-shadow: 0 0 20px rgba(255, 184, 28, .35); }
.bars .b:hover i { filter: brightness(1.3); }
@keyframes grow { from { transform: scaleY(0); } }

tr { transition: background .2s; }
tbody tr:hover, table tr:not(:first-child):hover { background: rgba(255, 255, 255, .025); }
.btn { position: relative; overflow: hidden; transition: transform .15s, box-shadow .25s, filter .2s; }
.btn:active { transform: scale(.96); }
.btn:not(.ghost):not(.danger):hover { box-shadow: 0 0 22px rgba(0, 212, 255, .4); filter: none; }
.btn.gold:hover { box-shadow: 0 0 22px rgba(255, 184, 28, .4) !important; }
.btn .rip { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .45); transform: scale(0); animation: rip .6s ease-out; pointer-events: none; }
@keyframes rip { to { transform: scale(4); opacity: 0; } }
.switch span::after { transition: transform .35s cubic-bezier(.3, 1.6, .4, 1), width .2s; }
.switch input:active + span::after { width: 24px; }
.switch input:checked + span { box-shadow: 0 0 14px rgba(46, 229, 157, .45); }
input, select, textarea { transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(0, 212, 255, .15); }
.thumb { transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); }
tr:hover .thumb { transform: scale(1.12) rotate(-3deg); }
.pill { animation: popIn .3s cubic-bezier(.2, 1.5, .4, 1) backwards; }
.st-nuovo { box-shadow: 0 0 0 0 rgba(0, 212, 255, .5); animation: popIn .3s backwards, pillPulse 2s ease-in-out infinite; }
@keyframes pillPulse { 50% { box-shadow: 0 0 0 4px rgba(0, 212, 255, 0); } 0% { box-shadow: 0 0 0 0 rgba(0, 212, 255, .45); } }

/* toast */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 10px; }
.toast { display: flex; align-items: center; gap: 12px; background: rgba(22, 22, 31, .92); backdrop-filter: blur(12px); border: 1px solid rgba(46, 229, 157, .4); color: var(--white); padding: 14px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); animation: toastIn .5s cubic-bezier(.2, 1.3, .4, 1); overflow: hidden; position: relative; }
.toast b { width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: var(--night); display: grid; place-items: center; font-size: 14px; flex: none; }
.toast i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--green); animation: toastBar 4s linear forwards; }
.toast.out { animation: toastOut .4s forwards; }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }
@keyframes toastBar { from { width: 100%; } to { width: 0; } }
.toast.new { border-color: rgba(0, 212, 255, .5); } .toast.new b { background: var(--cyan); } .toast.new i { background: var(--cyan); }

/* login animato */
body.auth { overflow: hidden; }
.auth .rain { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.auth .rain i { position: absolute; top: -20px; width: 8px; height: 8px; background: var(--cyan); opacity: .5; box-shadow: var(--glow); animation: rain linear infinite; }
@keyframes rain { to { transform: translateY(110vh); } }
.auth-card { position: relative; animation: cardIn .7s cubic-bezier(.2, .8, .2, 1); background: rgba(22, 22, 31, .8); backdrop-filter: blur(16px); }
.auth-logo { animation: floatLogo 4s ease-in-out infinite; }
@keyframes floatLogo { 50% { transform: translateY(-8px) rotate(-1deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
