:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #241d19;
  background: #f5f2ef;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: #776b64; }
.eyebrow { margin: 0 0 5px; color: #f97316; font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.brand-mark { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 20px; color: white; background: #f97316; font-size: 25px; font-weight: 900; box-shadow: 0 12px 25px #f9731640; }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 17px; }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, #fff2e8, transparent 35%), #f5f2ef; }
.login-card { width: min(100%, 430px); padding: 36px; border: 1px solid #e3dcd7; border-radius: 28px; background: white; box-shadow: 0 30px 70px #49301e18; }
.login-card h1 { margin: 16px 0 4px; font-size: 32px; }
.stack { display: grid; gap: 16px; margin-top: 26px; }
label { display: grid; gap: 7px; color: #463b35; font-size: 13px; font-weight: 750; }
input, select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #d9d0ca; border-radius: 12px; color: #241d19; background: #fbfaf9; outline: none; }
input:focus, select:focus { border-color: #f97316; box-shadow: 0 0 0 3px #f9731620; }
button { min-height: 42px; padding: 0 16px; border: 1px solid #dcd4cf; border-radius: 11px; color: #362b25; background: #f3efec; font-weight: 800; }
button:hover { filter: brightness(.98); }
button:disabled { cursor: wait; opacity: .6; }
button.primary { min-height: 48px; border-color: #f97316; color: white; background: #f97316; }
button.quiet { background: white; }
.message { min-height: 18px; margin: 0; color: #776b64; font-size: 13px; }
.message.error { color: #b42318; }
.message.success { color: #157347; }
.portal { min-height: 100vh; }
.topbar { position: sticky; z-index: 5; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 70px; padding: 10px max(20px, calc((100vw - 1420px)/2)); border-bottom: 1px solid #e6dfda; background: #ffffffeb; backdrop-filter: blur(14px); }
.brand, .account { display: flex; align-items: center; gap: 12px; }
.brand div { display: grid; gap: 2px; }
.brand span:not(.brand-mark) { color: #82766f; font-size: 12px; }
.workspace { width: min(100% - 32px, 1420px); margin: 0 auto; padding: 34px 0 70px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.hero h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); }
.hero p:last-child { margin: 7px 0 0; }
.key-box { display: grid; gap: 5px; min-width: 230px; padding: 14px 17px; border: 1px solid #e3dcd7; border-radius: 15px; background: white; }
.key-box span { color: #82766f; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.key-box strong { font-family: Consolas, monospace; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
.stats article { display: flex; align-items: center; justify-content: space-between; min-height: 84px; padding: 18px; border: 1px solid #e3dcd7; border-radius: 18px; background: white; }
.stats span { color: #776b64; font-size: 13px; font-weight: 750; }
.stats strong { font-size: 28px; }
.panel { margin-top: 20px; padding: 24px; border: 1px solid #e3dcd7; border-radius: 22px; background: white; box-shadow: 0 12px 35px #49301e0d; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-title h2 { margin: 0; font-size: 23px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.platforms { display: flex; align-items: center; gap: 20px; grid-column: span 2; min-height: 72px; margin: 0; padding: 10px 15px; border: 1px solid #ded6d1; border-radius: 14px; }
.platforms legend { padding: 0 5px; color: #463b35; font-size: 13px; font-weight: 750; }
.platforms label { display: flex; align-items: center; gap: 7px; }
.platforms input { width: 18px; min-height: 18px; accent-color: #f97316; }
.form-actions { display: flex; align-items: center; gap: 15px; grid-column: span 2; padding-top: 18px; }
.generated { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 16px; border: 1px solid #a7dfc2; border-radius: 16px; background: #eefbf4; }
.generated > div:first-child { display: grid; gap: 3px; }
.generated span { color: #496358; font-size: 13px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.archive-title { align-items: end; }
.search { width: min(100%, 340px); }
.table-wrap { overflow: auto; border: 1px solid #e7e0dc; border-radius: 15px; }
table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 12px; border-bottom: 1px solid #eee9e6; text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; color: #6f625b; background: #f7f4f2; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
td strong { display: block; }
td small { color: #82766f; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; white-space: nowrap; }
.badge.attiva { color: #166534; background: #dcfce7; }
.badge.in-scadenza, .badge.tolleranza { color: #92400e; background: #fef3c7; }
.badge.scaduta, .badge.non-valida { color: #991b1b; background: #fee2e2; }
.badge.sospesa { color: #991b1b; background: #fee2e2; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.table-actions button { min-height: 34px; padding: 0 10px; font-size: 11px; white-space: nowrap; }
.danger-action { border-color: #fecaca; color: #b42318; background: #fff1f2; }
.success-action { border-color: #a7f3d0; color: #157347; background: #ecfdf5; }
.devices-dialog { width: min(720px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); padding: 24px; border: 1px solid #e3dcd7; border-radius: 22px; color: #241d19; background: white; box-shadow: 0 30px 80px #241d1940; }
.devices-dialog::backdrop { background: #241d196b; backdrop-filter: blur(3px); }
.devices-list { display: grid; gap: 10px; overflow: auto; max-height: 580px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid #e7e0dc; border-radius: 14px; background: #fbfaf9; }
.device-row > div { display: grid; gap: 3px; min-width: 0; }
.device-row span, .device-row small { color: #776b64; font-size: 12px; overflow-wrap: anywhere; }
.empty { padding: 30px; color: #82766f; text-align: center; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 650px) { .workspace { width: min(100% - 20px, 1420px); padding-top: 22px; } .topbar { padding-inline: 10px; } .account span { display: none; } .hero, .generated, .archive-title { align-items: stretch; flex-direction: column; } .key-box { min-width: 0; } .form-grid { grid-template-columns: 1fr; } .platforms, .form-actions { grid-column: span 1; } .stats { gap: 8px; } .stats article { min-height: 70px; padding: 13px; } .panel { padding: 17px; } }
