:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0a1728;
  --panel: rgba(13, 28, 48, .78);
  --panel-solid: #0e1c2f;
  --panel-soft: rgba(25, 47, 75, .62);
  --line: rgba(144, 190, 231, .16);
  --line-strong: rgba(79, 217, 255, .35);
  --text: #eff8ff;
  --muted: #91a8bf;
  --cyan: #35dff6;
  --cyan-2: #1fb6d2;
  --blue: #5895ff;
  --violet: #8b73ff;
  --green: #42d79a;
  --amber: #ffbf5a;
  --red: #ff6f86;
  --shadow: 0 24px 60px rgba(0, 0, 0, .32);
  --radius: 22px;
  --zoom: 1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: calc(16px * var(--zoom));
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf5fb;
  --bg-2: #f7fbfe;
  --panel: rgba(255, 255, 255, .88);
  --panel-solid: #ffffff;
  --panel-soft: rgba(224, 239, 249, .74);
  --line: rgba(33, 85, 124, .14);
  --line-strong: rgba(4, 148, 182, .36);
  --text: #10273a;
  --muted: #587087;
  --cyan: #008fae;
  --cyan-2: #007791;
  --blue: #256dd8;
  --violet: #6850d8;
  --green: #087a54;
  --amber: #9b6506;
  --red: #c93650;
  --shadow: 0 24px 60px rgba(40, 71, 94, .15);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(53, 223, 246, .13), transparent 34rem),
    radial-gradient(circle at 100% 24%, rgba(139, 115, 255, .12), transparent 34rem),
    linear-gradient(145deg, var(--bg), var(--bg-2));
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: .32;
  pointer-events: none;
  background-image: linear-gradient(rgba(112, 169, 207, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(112, 169, 207, .035) 1px, transparent 1px);
  background-size: 42px 42px;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 .4rem;
  color: var(--cyan);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  min-height: 100vh;
  overflow: hidden;
}
.login-visual {
  position: relative;
  display: grid;
  align-content: center;
  padding: clamp(2.5rem, 7vw, 7rem);
  isolation: isolate;
}
.login-visual::after {
  position: absolute;
  inset: 10% 2% 10% 28%;
  z-index: -1;
  content: "";
  border-radius: 50%;
  filter: blur(28px);
  background: radial-gradient(circle, rgba(48, 218, 245, .14), transparent 63%);
}
.login-copy { max-width: 690px; }
.login-copy h1 {
  max-width: 11ch;
  margin: .8rem 0 1rem;
  font-size: clamp(3.2rem, 7vw, 7.4rem);
  line-height: .86;
  letter-spacing: -.08em;
}
.login-copy h1 span { display: block; color: var(--cyan); }
.login-copy > p { max-width: 56ch; color: var(--muted); font-size: 1.08rem; line-height: 1.7; }
.feature-chips { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 2rem; }
.feature-chips span, .chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .56rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .035);
  font-size: .78rem;
  font-weight: 700;
}
.login-mark { display: block; max-width: 100%; height: auto; margin-bottom: 2rem; }
@keyframes orbit { to { transform: rotate(360deg); } }

.login-panel {
  display: grid;
  place-items: center;
  padding: clamp(1.4rem, 5vw, 4rem);
  border-left: 1px solid var(--line);
  background: rgba(4, 13, 25, .25);
  backdrop-filter: blur(24px);
}
:root[data-theme="light"] .login-panel { background: rgba(255, 255, 255, .34); }
.login-card { width: min(100%, 460px); }
.login-card h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.04em; text-align: center; }
.login-card > p { margin: .7rem auto 2rem; color: var(--muted); text-align: center; line-height: 1.55; }
.role-grid { display: grid; gap: .8rem; }
.role-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: left;
  cursor: pointer;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .08);
  transition: border-color .2s, transform .2s, background .2s;
}
.role-card:hover { transform: translateY(-2px); border-color: var(--line-strong); background: var(--panel-solid); }
.role-card strong { display: block; margin-bottom: .25rem; }
.role-card small { display: block; color: var(--muted); line-height: 1.4; }
.role-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; color: var(--cyan); background: rgba(53, 223, 246, .1); font-weight: 900; }
.role-arrow { color: var(--cyan); font-size: 1.25rem; }
.login-footer { margin-top: 2rem; color: var(--muted); font-size: .74rem; line-height: 1.6; text-align: center; }

.otp-wrap { display: grid; gap: 1rem; }
.otp-back { justify-self: start; }
.otp-digits { display: grid; grid-template-columns: repeat(6, 1fr); gap: .55rem; }
.otp-digit {
  width: 100%;
  min-width: 0;
  padding: .9rem 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-solid);
  font-size: 1.45rem;
  font-weight: 800;
  text-align: center;
}
.demo-code { padding: .9rem 1rem; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); background: rgba(53, 223, 246, .06); font-size: .82rem; }
.demo-code b { color: var(--cyan); letter-spacing: .15em; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.2rem;
  min-height: 74px;
  padding: .7rem clamp(1rem, 3vw, 2.4rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(24px);
}
.brand { display: flex; align-items: center; gap: .8rem; min-width: 180px; }
.brand-mark { display: block; flex: 0 0 44px; object-fit: contain; }
.brand b { display: block; letter-spacing: .16em; }
.brand small { display: block; margin-top: .12rem; color: var(--muted); font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.system-status { justify-self: center; display: flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px color-mix(in srgb, var(--green) 12%, transparent); }
.top-actions { display: flex; align-items: center; gap: .55rem; }
.icon-button, .text-button, .primary-button, .secondary-button, .danger-button {
  border: 0;
  cursor: pointer;
  transition: transform .18s, opacity .18s, border-color .18s, background .18s;
}
.icon-button:hover, .text-button:hover, .primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.text-button { padding: .7rem .9rem; color: var(--muted); background: transparent; font-size: .78rem; font-weight: 800; }
.primary-button { padding: .78rem 1rem; border-radius: 12px; color: #03141b; background: linear-gradient(135deg, var(--cyan), #6cf1ff); font-weight: 900; box-shadow: 0 10px 24px rgba(30, 199, 226, .18); }
.secondary-button { padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); font-weight: 800; }
.danger-button { padding: .7rem .9rem; border: 1px solid color-mix(in srgb, var(--red) 38%, transparent); border-radius: 12px; color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); font-weight: 800; }
button:disabled { cursor: not-allowed; opacity: .42; transform: none !important; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.sidebar {
  position: sticky;
  top: 74px;
  align-self: start;
  height: calc(100vh - 74px);
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.nav-section { margin-bottom: 1.6rem; }
.nav-label { padding: 0 .75rem .55rem; color: var(--muted); font-size: .65rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.nav-button {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  margin: .2rem 0;
  padding: .78rem .8rem;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: .86rem;
  font-weight: 700;
}
.nav-button span:first-child { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 9px; background: rgba(255, 255, 255, .035); }
.nav-button:hover, .nav-button.active { color: var(--text); border-color: var(--line); background: var(--panel-soft); }
.nav-button.active span:first-child { color: var(--cyan); background: rgba(53, 223, 246, .1); }
.sidebar-card { margin-top: auto; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.sidebar-card b { display: block; margin-bottom: .35rem; font-size: .82rem; }
.sidebar-card small { display: block; color: var(--muted); line-height: 1.45; }
.content { min-width: 0; padding: clamp(1rem, 3vw, 2.5rem); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.75rem); letter-spacing: -.05em; }
.page-head p:not(.eyebrow) { margin: .4rem 0 0; color: var(--muted); line-height: 1.5; }
.head-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stat-card, .panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.stat-card { position: relative; min-height: 138px; padding: 1.2rem; overflow: hidden; }
.stat-card::after { position: absolute; right: -28px; bottom: -54px; width: 120px; height: 120px; content: ""; border-radius: 50%; background: var(--accent, var(--cyan)); filter: blur(42px); opacity: .14; }
.stat-card > span { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: .7rem; font-size: 2rem; letter-spacing: -.05em; }
.stat-card small { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 1rem; align-items: start; }
.panel { min-width: 0; padding: 1.1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1rem; }
.panel-head small { color: var(--muted); }
.activity-list { display: grid; gap: .15rem; }
.activity-item { display: grid; grid-template-columns: auto 1fr; gap: .8rem; padding: .78rem .4rem; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border: 0; }
.activity-dot { width: 10px; height: 10px; margin-top: .35rem; border: 2px solid var(--panel-solid); border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(53, 223, 246, .1); }
.activity-item b { display: block; font-size: .8rem; }
.activity-item span, .activity-item time { color: var(--muted); font-size: .72rem; }

.table-tools { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .9rem; }
.search-input, .control {
  width: 100%;
  padding: .72rem .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  background: var(--panel-solid);
}
.search-input { max-width: 320px; }
.search-input:focus, .control:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(53, 223, 246, .07); }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th { padding: .75rem; color: var(--muted); font-size: .65rem; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: .85rem .75rem; border-top: 1px solid var(--line); vertical-align: middle; }
tr[data-action] { cursor: pointer; }
tbody tr:hover { background: rgba(53, 223, 246, .035); }
.cell-title { display: block; font-size: .82rem; }
.cell-sub { display: block; margin-top: .18rem; color: var(--muted); font-size: .68rem; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  padding: .35rem .55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .025);
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .03em;
  white-space: nowrap;
}
.status-pill::before { width: 6px; height: 6px; content: ""; border-radius: 50%; background: currentColor; }
.status-pill.active, .status-pill.synced, .status-pill.inviata { color: var(--green); }
.status-pill.suspended, .status-pill.integrazione-richiesta { color: var(--amber); }
.status-pill.revoked, .status-pill.expired { color: var(--red); }
.status-pill.bozza, .status-pill.in-compilazione, .status-pill.local { color: var(--cyan); }
.progress-cell { display: grid; grid-template-columns: minmax(70px, 1fr) auto; align-items: center; gap: .55rem; }
.progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--panel-soft); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--violet)); }

.client-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(130deg, rgba(53, 223, 246, .09), rgba(139, 115, 255, .07)); box-shadow: var(--shadow); }
.client-hero h2 { margin: 0; letter-spacing: -.035em; }
.client-hero p { margin: .4rem 0 0; color: var(--muted); }
.sync-badge { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .7rem; min-width: 210px; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.sync-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; color: var(--green); background: rgba(66, 215, 154, .1); }
.sync-badge b, .sync-badge small { display: block; }
.sync-badge small { margin-top: .12rem; color: var(--muted); font-size: .67rem; }
.practice-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.practice-card { padding: 1rem; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); cursor: pointer; box-shadow: 0 12px 30px rgba(0, 0, 0, .12); transition: transform .2s, border-color .2s; }
.practice-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.practice-card-head { display: flex; align-items: start; justify-content: space-between; gap: .6rem; }
.practice-card h3 { margin: .2rem 0; font-size: 1rem; }
.practice-card .code { color: var(--cyan); font-size: .68rem; font-weight: 900; letter-spacing: .08em; }
.practice-card p { min-height: 2.4em; color: var(--muted); font-size: .75rem; }
.practice-card-footer { display: flex; justify-content: space-between; margin-top: .8rem; color: var(--muted); font-size: .67rem; }

.practice-workspace { max-width: 1500px; margin: 0 auto; }
.practice-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.practice-title { display: flex; align-items: center; gap: .8rem; }
.practice-title h1 { margin: 0; font-size: 1.45rem; }
.practice-title p { margin: .2rem 0 0; color: var(--muted); font-size: .75rem; }
.save-state { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .72rem; }
.save-state span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.phase-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
.phase-rail { position: sticky; top: 88px; display: grid; gap: .35rem; padding: .8rem; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.phase-button { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: .6rem; padding: .66rem; border: 1px solid transparent; border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; }
.phase-button:hover, .phase-button.active { color: var(--text); border-color: var(--line); background: var(--panel-soft); }
.phase-number { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: rgba(255, 255, 255, .04); font-size: .7rem; font-weight: 900; }
.phase-button.done .phase-number { color: #041610; background: var(--green); }
.phase-button small { font-size: .7rem; font-weight: 800; }
.phase-check { color: var(--green); }
.phase-card { min-height: 580px; padding: clamp(1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.phase-card h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.03em; }
.phase-card > p { margin: .35rem 0 1.4rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.form-subsection { grid-column: 1 / -1; margin-top: .25rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--panel-soft) 86%, transparent); }
.form-subsection h3 { margin: 0 0 .8rem; color: var(--text); font-size: .75rem; letter-spacing: .07em; text-transform: uppercase; }
.form-subsection .form-grid { gap: .8rem; }
.field { display: grid; gap: .4rem; }
.field.wide { grid-column: 1 / -1; }
.field label, .fieldset-label { color: var(--muted); font-size: .7rem; font-weight: 800; }
.field small { color: var(--muted); font-size: .65rem; line-height: 1.4; }
textarea.control { min-height: 100px; resize: vertical; }
.radio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.radio-card { display: flex; gap: .55rem; align-items: flex-start; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); cursor: pointer; }
.radio-card:has(input:checked) { color: var(--text); border-color: var(--line-strong); background: rgba(53, 223, 246, .06); }
.notice { display: flex; gap: .7rem; margin-bottom: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: var(--panel-soft); font-size: .72rem; line-height: 1.5; }
.notice b { color: var(--text); }
.notice.warning { border-color: color-mix(in srgb, var(--amber) 32%, transparent); background: color-mix(in srgb, var(--amber) 7%, transparent); }
.drop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.drop-zone { position: relative; display: grid; min-height: 115px; place-items: center; padding: 1rem; border: 1px dashed var(--line-strong); border-radius: 14px; text-align: center; background: rgba(53, 223, 246, .025); overflow: hidden; }
.drop-zone.has-file { border-style: solid; border-color: color-mix(in srgb, var(--green) 45%, transparent); background: color-mix(in srgb, var(--green) 6%, transparent); }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone b { display: block; font-size: .77rem; }
.drop-zone small { display: block; margin-top: .3rem; color: var(--muted); font-size: .65rem; line-height: 1.35; }
.file-chip { display: inline-flex; margin-top: .45rem; padding: .3rem .45rem; border-radius: 8px; color: var(--green); background: color-mix(in srgb, var(--green) 9%, transparent); font-size: .62rem; font-weight: 800; }
.phase-actions { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.generation-flow { display: grid; gap: .9rem; }
.generation-card { padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-soft); }
.generation-card.ready { border-color: color-mix(in srgb, var(--green) 42%, transparent); }
.generation-card h3 { margin: 0 0 .3rem; }
.generation-card p { margin: 0 0 .8rem; color: var(--muted); font-size: .73rem; line-height: 1.5; }
.signature-list { display: grid; gap: .5rem; margin: .8rem 0; }
.signature-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .8rem; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; }
.signature-item b { display: block; font-size: .74rem; }
.signature-item small { color: var(--muted); font-size: .65rem; }
.package-actions { display: flex; flex-wrap: wrap; gap: .55rem; }

.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 7, 14, .64); backdrop-filter: blur(6px); }
.drawer { position: fixed; top: 0; right: 0; z-index: 61; width: min(620px, 96vw); height: 100vh; padding: 1.2rem; border-left: 1px solid var(--line); background: var(--bg-2); box-shadow: -30px 0 70px rgba(0, 0, 0, .35); overflow-y: auto; animation: drawer-in .25s ease both; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.drawer-head h2 { margin: 0; }
.drawer-head p { margin: .3rem 0 0; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.detail-item { padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.detail-item span { display: block; color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.detail-item b { display: block; margin-top: .3rem; font-size: .8rem; }
.section-title { margin: 1.4rem 0 .7rem; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.modal { position: fixed; top: 50%; left: 50%; z-index: 61; width: min(520px, calc(100vw - 2rem)); max-height: 88vh; padding: 1.2rem; border: 1px solid var(--line); border-radius: 22px; background: var(--panel-solid); box-shadow: var(--shadow); overflow-y: auto; transform: translate(-50%, -50%); }
.modal h2 { margin: 0; }
.modal p { color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

.settings-grid { display: grid; gap: .8rem; }
.setting-row { display: grid; grid-template-columns: 1fr minmax(150px, 220px); align-items: center; gap: 1rem; padding: .9rem; border: 1px solid var(--line); border-radius: 14px; }
.settings-view { width: 100%; max-width: 840px; margin-inline: auto; }
.settings-view .settings-grid { gap: .65rem; }
.settings-view .setting-row { gap: .7rem; padding: .75rem; }
.setting-row-wide .control { width: 100%; min-width: 0; box-sizing: border-box; }
@media (min-width: 641px) {
  .settings-view .setting-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); }
  .settings-view .setting-row > :is(select, .toggle, .status-pill) { justify-self: start; }
  .settings-view .setting-row > select { width: min(100%, 220px); }
}
.setting-row b { display: block; font-size: .8rem; }
.setting-row small { display: block; margin-top: .24rem; color: var(--muted); font-size: .67rem; line-height: 1.4; }
.toggle { position: relative; width: 46px; height: 26px; justify-self: end; }
.toggle input { opacity: 0; }
.toggle span { position: absolute; inset: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-soft); cursor: pointer; }
.toggle span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; content: ""; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.toggle input:checked + span::after { transform: translateX(20px); background: var(--cyan); }

.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: grid; gap: .6rem; width: min(360px, calc(100vw - 2rem)); }
.toast { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-solid); box-shadow: var(--shadow); animation: toast-in .2s ease both; font-size: .75rem; }
.toast.success { border-color: color-mix(in srgb, var(--green) 38%, transparent); }
.toast.error { border-color: color-mix(in srgb, var(--red) 42%, transparent); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.empty-state { display: grid; min-height: 280px; place-items: center; padding: 2rem; color: var(--muted); text-align: center; }
.empty-state b { display: block; margin-bottom: .4rem; color: var(--text); }
.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 46vh; padding-bottom: 1.5rem; }
  .login-copy h1 { max-width: none; font-size: clamp(3rem, 15vw, 5.4rem); }
  .login-panel { border-top: 1px solid var(--line); border-left: 0; }
  .layout { grid-template-columns: 1fr; padding-bottom: 72px; }
  .sidebar { display: none; }
  .mobile-nav { position: fixed; right: .7rem; bottom: .7rem; left: .7rem; z-index: 40; display: flex; justify-content: space-around; padding: .45rem; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(20px); box-shadow: var(--shadow); }
  .mobile-nav .nav-button { display: grid; width: auto; justify-items: center; gap: .15rem; margin: 0; padding: .45rem .65rem; font-size: .6rem; }
  .phase-layout { grid-template-columns: 1fr; }
  .phase-rail { position: static; display: flex; overflow-x: auto; }
  .phase-button { min-width: 124px; grid-template-columns: 28px 1fr; }
  .phase-button .phase-check { display: none; }
}

@media (max-width: 640px) {
  .system-status, .brand small, .top-actions .text-button { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .brand { min-width: 0; }
  .content { padding: 1rem; }
  .page-head, .practice-header, .client-hero { align-items: stretch; flex-direction: column; }
  .page-head { display: grid; }
  .client-hero { grid-template-columns: 1fr; }
  .stats-grid, .practice-cards, .form-grid, .drop-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-subsection { grid-column: auto; }
  .field.wide { grid-column: auto; }
  .radio-grid { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: 1fr; }
  .toggle { justify-self: start; }
  .practice-card p { min-height: 0; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.delivery-preparing{padding:1.15rem;margin:1rem 0;border:1px solid var(--cyan);border-radius:16px;background:rgba(42,212,235,.07)}
.delivery-preparing[hidden]{display:none}
.delivery-preparing-heading{display:flex;align-items:center;gap:.7rem}
.delivery-preparing p{font-size:.9rem;line-height:1.5;margin:.8rem 0 0}
.delivery-preparing-track{height:7px;margin-top:1rem;border-radius:20px;overflow:hidden;background:rgba(42,212,235,.15)}
.delivery-preparing-track span{display:block;height:100%;width:38%;border-radius:inherit;background:var(--cyan);animation:delivery-slide 1.8s ease-in-out infinite}
.delivery-preparing-spinner{width:18px;height:18px;flex:none;border:2px solid rgba(42,212,235,.25);border-top-color:var(--cyan);border-radius:50%;animation:delivery-spin 1s linear infinite}
@keyframes delivery-slide{from{transform:translateX(-110%)}to{transform:translateX(370%)}}
@keyframes delivery-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.delivery-preparing-track span,.delivery-preparing-spinner{animation:none}.delivery-preparing-track span{width:100%;opacity:.6}}
