:root {
  --cri: #e30613;
  --cri-dark: #bd0711;
  --cri-soft: #fff0f1;
  --ink: #141924;
  --muted: #667085;
  --bg: #f2f4f8;
  --white: #fff;
  --line: #e5e7ee;
  --field: #fff;
  --label: #303848;
  --soft: #f8f9fc;
  --hover: #f1f3f7;
  --panel: #fff;
  --success: #12704a;
  --warning: #996309;
  --radius: 20px;
  --shadow: 0 14px 34px rgba(17, 24, 39, .08);
  --shadow-soft: 0 7px 18px rgba(17, 24, 39, .055);
  --panel-border: rgba(229, 231, 238, .92);
  --topbar-bg: rgba(255, 255, 255, .88);
  --tabs-bg: rgba(246, 247, 251, .82);
  --item-border: #e7ebf2;
  --input-border: #d7dce5;
  --toast-bg: #141924;
  --toast-text: #fff;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
html:has(body[data-theme="dark"]) { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(227, 6, 19, .11), transparent 28rem),
    radial-gradient(circle at 90% 16%, rgba(20, 25, 36, .08), transparent 24rem),
    linear-gradient(180deg, #fff 0, var(--bg) 20rem);
}
body[data-theme="dark"] {
  --ink: #f5f5f5;
  --muted: #bbbfc6;
  --bg: #08090d;
  --white: #14161c;
  --line: #292d36;
  --field: #191c23;
  --label: #ecedf0;
  --soft: #181b22;
  --hover: #222631;
  --panel: #12141a;
  --success: #63d89d;
  --warning: #f0ba55;
  --shadow: 0 20px 50px rgba(0, 0, 0, .35);
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, .24);
  --panel-border: rgba(60, 66, 80, .96);
  --topbar-bg: rgba(20, 22, 28, .9);
  --tabs-bg: rgba(8, 9, 13, .78);
  --item-border: #2d3340;
  --input-border: #414650;
  --toast-bg: #f5f5f5;
  --toast-text: #11131a;
  background:
    radial-gradient(circle at top left, rgba(227, 6, 19, .16), transparent 30rem),
    linear-gradient(180deg, #11131a 0, var(--bg) 18rem);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, h4, legend, strong { color: var(--ink); }
h2 { font-size: clamp(1.4rem, 2vw, 1.8rem); margin-bottom: .35rem; }
h3 { font-size: 1.05rem; margin-bottom: 1rem; }
p { color: var(--muted); line-height: 1.45; }
code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  font-size: .9em;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 34px 18px;
  background:
    radial-gradient(circle at 18% 12%, rgba(227, 6, 19, .18), transparent 28rem),
    radial-gradient(circle at 80% 86%, rgba(20, 25, 36, .12), transparent 24rem);
}
.login-card {
  width: min(100%, 470px);
  padding: 34px;
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  background: linear-gradient(145deg, var(--panel), var(--white));
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo {
  width: 104px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
}
.login-logo img { max-width: 88px; max-height: 78px; display: block; }
.login-card h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 3rem);
  letter-spacing: -.06em;
}
.login-subtitle {
  margin: 4px 0 24px;
  font-weight: 800;
  color: var(--ink);
}
.login-fields { display: grid; gap: 13px; text-align: left; margin-bottom: 18px; }
.login-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
.login-status { display: inline-flex; margin-bottom: 10px; }
.login-note { margin: 0; font-size: .86rem; }
.login-theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 3;
}
.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(229, 231, 238, .82);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px max(calc((100vw - 1420px) / 2), 28px);
  gap: 20px;
}
body[data-theme="dark"] .topbar { border-bottom-color: rgba(41, 45, 54, .9); }
.brand { display: flex; align-items: center; gap: 16px; }
.brand h1 { margin: 0; font-size: 1.35rem; letter-spacing: -.03em; }
.brand-subtitle {
  display: block; color: var(--muted); font-size: .78rem; font-weight: 650; margin-top: 2px;
}
.brand-logo {
  width: 58px; min-height: 50px; display: flex; align-items: center; justify-content: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-soft);
}
.brand-logo img { max-width: 50px; max-height: 44px; display: block; }
.cross {
  width: 48px; height: 48px; display: grid; place-content: center;
  background: var(--cri); color: white; border-radius: 9px;
  font: bold 2.5rem/1 Arial;
}
.eyebrow {
  font-size: .73rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 3px; font-weight: 700;
}
.operator { display: flex; align-items: center; gap: 10px; font-size: .87rem; font-weight: 600; }
.operator input { width: 220px; margin-top: 0; }
.auth-box {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding-left: 10px; border-left: 1px solid var(--line);
}
.auth-box input { width: 150px; margin: 0; padding: 8px 10px; font-size: .82rem; }
.install-app { white-space: nowrap; }
.auth-status {
  color: var(--muted); font-size: .78rem; font-weight: 800; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--soft);
}
.theme-toggle {
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px;
  background: var(--field); color: var(--ink); font-weight: 700;
  box-shadow: var(--shadow-soft);
}
.compact-theme {
  min-width: 74px;
  padding: 8px 12px;
  border-color: rgba(227, 6, 19, .24);
  background: linear-gradient(135deg, var(--field), var(--soft));
}
body[data-theme="dark"] .compact-theme {
  border-color: rgba(227, 6, 19, .5);
  background: #1b1f29;
}

.tabs {
  position: sticky;
  top: 76px;
  z-index: 19;
  display: flex; gap: 8px; overflow-x: auto; padding: 10px max(calc((100vw - 1420px) / 2), 28px);
  background: color-mix(in srgb, var(--panel) 86%, transparent); border-bottom: 1px solid rgba(229, 231, 238, .78);
  backdrop-filter: blur(16px);
}
.nav-select {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 5px 4px 12px;
  background: rgba(255, 255, 255, .58);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.nav-select select {
  width: auto;
  min-width: 150px;
  margin: 0;
  padding: 8px 34px 8px 11px;
  border-radius: 999px;
  font-size: .86rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 750;
  background: var(--field);
}
.nav-select select.active-nav {
  border-color: var(--cri);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, .12);
}
.tab {
  white-space: nowrap; border: 1px solid transparent; background: transparent; padding: 10px 15px;
  color: var(--muted); font-weight: 750; border-radius: 999px;
  transition: .18s ease;
}
.tab:hover { background: var(--white); color: var(--ink); border-color: var(--line); }
.tab.active { background: var(--cri); color: #fff; box-shadow: 0 10px 22px rgba(227, 6, 19, .22); }
body[data-theme="dark"] .tabs { background: rgba(8, 9, 13, .78); border-bottom-color: rgba(41, 45, 54, .9); }
body[data-theme="dark"] .nav-select { background: rgba(20, 22, 28, .72); border-color: var(--panel-border); }
body[data-theme="dark"] .tab.active { background: var(--cri); }
body[data-theme="dark"] .tab:hover { background: var(--hover); border-color: var(--panel-border); }

main { max-width: 1420px; margin: 0 auto; padding: 30px 28px 50px; }
.view { display: none; }
.view.active { display: block; }
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 30px;
  padding: 26px 30px;
  background:
    linear-gradient(135deg, rgba(227, 6, 19, .1), transparent 34%),
    linear-gradient(135deg, var(--panel), var(--white));
  border: 1px solid var(--panel-border);
  border-radius: 24px; margin-bottom: 22px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -110px; width: 260px; height: 260px;
  border: 35px solid rgba(227, 6, 19, .08); border-radius: 50%;
}
.hero > * { position: relative; z-index: 1; }
.hero h2 { max-width: 760px; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.05; letter-spacing: -.05em; }
.hero p { margin-bottom: 0; }
.metrics {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px;
}
.metric {
  background: var(--panel); border: 1px solid var(--panel-border); padding: 20px 22px;
  border-radius: 22px; box-shadow: var(--shadow-soft); position: relative; overflow: hidden;
}
.metric::before {
  content: ""; position: absolute; left: 0; top: 0; width: 5px; height: 100%;
  background: linear-gradient(180deg, var(--cri), var(--cri-dark));
}
.metric strong { display: block; font-size: 2.15rem; margin-top: 7px; letter-spacing: -.05em; }
.metric span { color: var(--muted); font-weight: 750; font-size: .83rem; text-transform: uppercase; letter-spacing: .04em; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.form-layout { grid-template-columns: 1fr; }
.panel {
  background: color-mix(in srgb, var(--panel) 96%, var(--soft));
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}
.modal-form {
  display: none;
  position: fixed;
  z-index: 80;
  left: 50%;
  top: 50%;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 42px);
  overflow: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .34);
}
.modal-form.open { display: block; }
.modal-controls {
  position: sticky;
  top: -23px;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -23px -23px 16px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--panel), rgba(255,255,255,.92));
  border-bottom: 1px solid var(--panel-border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-controls button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}
.modal-controls .modal-close {
  background: var(--cri);
  border-color: var(--cri);
  color: #fff;
}
.modal-controls .modal-save-draft {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
body[data-theme="dark"] .modal-controls {
  background: linear-gradient(180deg, var(--panel), rgba(18,20,26,.94));
}
body[data-theme="dark"] .modal-controls button {
  background: #1b1f27;
  color: var(--ink);
  border-color: var(--panel-border);
}
body[data-theme="dark"] .modal-controls .modal-close {
  background: var(--cri);
  color: #fff;
}
body[data-theme="dark"] .modal-controls .modal-save-draft {
  background: #33230f;
  border-color: #7c4a12;
  color: #fdba74;
}
#activation-form.modal-form {
  width: min(1180px, calc(100vw - 28px));
}
#activation-form.modal-form .check-list {
  max-height: 230px;
}
body.modal-active::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 79;
  background: rgba(7, 9, 14, .55);
  backdrop-filter: blur(5px);
}
.panel-title {
  display: flex; justify-content: space-between; align-items: center; gap: 15px;
  margin-bottom: 14px;
}
.panel-title h3 { margin: 0; }
.section-head {
  margin-bottom: 21px; padding: 2px 2px 0;
  display: flex; justify-content: space-between; align-items: end; gap: 18px;
}
.section-head h2 { letter-spacing: -.035em; }
.section-head p { margin-bottom: 0; }
.settings-shortcuts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -8px 0 18px;
}
.settings-shortcuts a {
  text-decoration: none;
  color: var(--cri);
  border: 1px solid color-mix(in srgb, var(--cri) 26%, var(--line));
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 850;
  font-size: .84rem;
}
.settings-group-title {
  margin: 22px -4px 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--cri);
  border-radius: 12px;
  background: var(--soft);
}

label {
  display: block; font-size: .88rem; font-weight: 600; margin-bottom: 14px;
  color: var(--label);
}
.form-panel label:has([required])::after {
  content: " *";
  color: var(--cri);
  font-weight: 800;
}
.hint {
  display: block; margin-top: 5px; color: var(--muted); font-size: .77rem; font-weight: 400;
}
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--input-border); border-radius: 12px; background: var(--field);
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
body[data-theme="dark"] input, body[data-theme="dark"] select, body[data-theme="dark"] textarea { border-color: var(--input-border); }
::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); opacity: 1; }
select option { background: var(--field); color: var(--ink); }
input:focus, select:focus, textarea:focus {
  border-color: var(--cri); outline: 2px solid rgba(227, 6, 19, .12);
}
textarea { resize: vertical; }
.fields { display: grid; gap: 13px; min-width: 0; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.primary, .secondary, .danger {
  border: 1px solid transparent; border-radius: 12px; padding: 11px 17px;
  font-weight: 800; display: inline-flex; justify-content: center; align-items: center;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.primary { background: linear-gradient(135deg, var(--cri), var(--cri-dark)); color: white; box-shadow: 0 12px 24px rgba(227, 6, 19, .22); }
.primary:hover { background: linear-gradient(135deg, #f00716, var(--cri-dark)); transform: translateY(-1px); }
.secondary { background: var(--field); color: var(--ink); border-color: var(--input-border); }
.secondary:hover { background: var(--hover); transform: translateY(-1px); }
.compact { padding: 8px 12px; font-size: .86rem; }
.compact-fields { margin-top: 12px; gap: 10px; }
.compact-fields label { font-size: .78rem; }
.compact-fields select { margin-top: 5px; padding: 8px 10px; }
.danger { background: #fff2f3; color: var(--cri-dark); border-color: #f2bec2; }
.link { border: 0; background: transparent; color: var(--cri); padding: 3px; font-weight: 750; }
.form-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.inline-check input {
  width: auto;
  margin: 0;
}
.count { font-size: .82rem; color: var(--muted); background: var(--soft); padding: 5px 10px; border-radius: 20px; }
.search { max-width: 225px; margin: 0; font-size: .86rem; }
.list-filter { margin: 0 0 12px; font-size: .86rem; }
.contact-filter-bar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 260px);
  gap: 10px;
}
.contact-filter-bar .search { max-width: none; }
.contact-bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.category-picker {
  background: var(--soft);
}
.category-picker legend {
  font-weight: 800;
  color: var(--ink);
}
.category-picker label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  margin: 4px 8px 6px 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: .82rem;
}
.category-picker input {
  width: auto;
  margin: 0;
}
.category-picker label:has(input:checked) {
  border-color: rgba(227, 6, 19, .38);
  background: #fff4f5;
  color: var(--cri-dark);
}
body[data-theme="dark"] .category-picker label:has(input:checked) {
  background: #2a1216;
  color: #fff;
}
.choice-search { margin: 0 0 9px; font-size: .84rem; }
.import-box {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.import-box h3 { margin-bottom: 6px; }
.import-box p { font-size: .84rem; }
.contact-email-picker {
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}
.picker-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.picker-head strong {
  color: var(--cri);
}
.email-picker-list {
  max-height: 190px;
  overflow-y: auto;
  display: grid;
  gap: 7px;
  padding-right: 4px;
}
.email-picker-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  font-size: .84rem;
}
.email-picker-choice input {
  width: auto;
  margin: 0;
}
.email-picker-choice strong,
.email-picker-choice small {
  display: block;
}
.email-picker-choice small {
  color: var(--muted);
  margin-top: 2px;
}
.email-picker-choice:has(input:checked) {
  border-color: rgba(227, 6, 19, .38);
  background: #fff4f5;
}
body[data-theme="dark"] .email-picker-choice:has(input:checked) {
  background: #2a1216;
}

.items {
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.item {
  padding: 14px 15px; border: 1px solid var(--item-border); border-radius: 14px;
  background: var(--panel);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  min-width: min(100%, 760px);
}
.item:hover { transform: translateY(-1px); border-color: rgba(227, 6, 19, .22); box-shadow: 0 12px 26px rgba(17, 24, 39, .06); }
body[data-theme="dark"] .item:hover { box-shadow: 0 14px 32px rgba(0, 0, 0, .28); }
.item-line { display: flex; gap: 12px; justify-content: space-between; align-items: start; }
.item strong { font-size: .96rem; }
.item small, .meta { display: block; color: var(--muted); margin-top: 5px; font-size: .83rem; line-height: 1.45; }
.item p { margin: 8px 0 0; font-size: .88rem; }
.item-actions { display: flex; gap: 11px; align-items: center; margin-top: 11px; flex-wrap: wrap; }
.census-item { padding: 17px 18px; }
.census-item .item-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.census-item .item-line > div { min-width: 0; }
.census-item .item-line .badge {
  grid-column: 2;
  justify-self: start;
  margin-top: 8px;
}
.census-item > small {
  margin-left: 36px;
  padding-top: 7px;
  line-height: 1.45;
  word-break: break-word;
}
.census-item > .item-actions {
  margin-left: 36px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.contact-item {
  min-width: 0;
}
.contact-item .item-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}
.contact-item .item-line > div {
  flex: 1 1 auto;
  min-width: 0;
}
.contact-item .badge {
  flex: 0 1 42%;
  max-width: 42%;
  margin-left: auto;
  white-space: normal;
  line-height: 1.35;
  text-align: right;
}
.contact-item .item-actions {
  margin-left: 36px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.badge {
  font-size: .72rem; font-weight: 800; padding: 6px 10px; border-radius: 999px;
  background: #eff1f5; color: #4e5967; white-space: nowrap;
}
.badge.ok { background: #e7f5ee; color: var(--success); }
.badge.warn { background: #fff2d9; color: var(--warning); }
.badge.red { background: #fde9eb; color: var(--cri-dark); }
.empty {
  color: var(--muted); text-align: center; border: 1px dashed var(--line);
  border-radius: 10px; padding: 27px 14px;
}

.availability-flow {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px;
}
.availability-flow article {
  border: 1px solid var(--line); border-radius: 18px; padding: 15px 17px; background: var(--panel);
  box-shadow: var(--shadow);
}
.availability-flow strong { display: block; color: var(--cri); margin-bottom: 5px; }
.availability-flow span { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.response-panel { margin-top: 20px; }
.public-link-box {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  background: var(--soft);
}
.public-link-box strong, .public-link-box small { display: block; }
.public-link-box input { margin-top: 7px; font-size: .78rem; }
.response-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 12px;
  background: var(--panel);
}
.response-details summary { cursor: pointer; font-weight: 800; color: var(--cri); }
.response-details article {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.response-details p { margin: 8px 0 0; line-height: 1.45; }
.availability-editor {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  overflow: hidden;
}
.availability-editor > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(227, 6, 19, .12), var(--soft));
  color: var(--ink);
  font-weight: 900;
}
.availability-editor > summary::-webkit-details-marker { display: none; }
.availability-editor > summary::after {
  content: "Apri";
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--cri);
  color: #fff;
  font-size: .78rem;
}
.availability-editor[open] > summary::after { content: "Chiudi"; }
.availability-editor > summary small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-top: 3px;
}
.availability-editor-body {
  padding: 16px;
}
.availability-sheet-card {
  border-left: 5px solid var(--cri);
}
.availability-sheet-card > p {
  margin: 10px 0;
  color: var(--muted);
}
.sheet-shifts {
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.sheet-shifts strong { display: block; color: var(--cri); margin-bottom: 6px; }
.sheet-shifts ul { margin: 0; padding-left: 18px; line-height: 1.55; }
.sheet-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.sheet-stats span {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}
.sheet-stats b {
  color: var(--cri);
  font-size: 1.15rem;
  margin-right: 4px;
}
.sheet-response-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.availability-response-sheet h4 {
  margin: 14px 0 8px;
  color: var(--cri);
}
.availability-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.availability-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: .84rem;
}
.availability-table th {
  background: var(--cri);
  color: #fff;
  text-align: left;
  padding: 9px 10px;
  white-space: nowrap;
}
.availability-table td {
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
.availability-table tr:nth-child(even) td {
  background: color-mix(in srgb, var(--soft) 60%, transparent);
}
.availability-management-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.availability-management-layout > article.panel {
  min-width: 0;
  grid-column: 1 / -1;
}
.availability-management-layout #availability-list .item {
  min-width: 0;
}
.availability-management-layout .response-details {
  overflow-x: auto;
}
.availability-management-layout .availability-table {
  min-width: 980px;
}
.public-response-list {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
}
.public-response-list::before {
  content: "Disponibilita gia inserite";
  display: block;
  margin-bottom: 10px;
  color: var(--cri);
  font-weight: 900;
}
.availability-closed-notice {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #f2bec2;
  border-left: 4px solid var(--cri);
  border-radius: 14px;
  background: #fff2f3;
}
body[data-theme="dark"] .availability-closed-notice {
  background: #351014;
  border-color: #63242a;
}
.availability-closed-notice strong,
.availability-closed-notice span {
  display: block;
}
.availability-closed-notice span {
  margin-top: 3px;
  color: var(--muted);
  font-size: .86rem;
}
body.public-availability .topbar,
body.public-availability .tabs,
body.public-availability .site-footer,
body.public-availability #login-screen,
body.public-availability #password-setup-screen,
body.public-availability .view:not(#disponibilita),
body.public-availability .section-head,
body.public-availability .availability-flow,
body.public-availability #availability-form,
body.public-availability #availability-list,
body.public-availability #disponibilita .grid.two > article.panel,
body.public-availability .census-selector {
  display: none !important;
}
body.public-availability .app-shell { display: block !important; }
body.public-availability .app-shell.hidden { display: none !important; }
body.public-availability main {
  width: 100%;
  max-width: none;
  padding: 22px clamp(14px, 2vw, 34px) 42px;
}
body.public-availability #disponibilita { display: block !important; }
body.public-availability .availability-management-layout { display: block; }
body.public-availability #response-form {
  display: block !important;
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: clamp(16px, 2vw, 24px);
}
body.public-availability .public-form-summary,
body.public-availability .availability-editor,
body.public-availability .public-response-list {
  width: 100%;
}
body.public-availability .fields.three {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
body.public-availability .response-entry .fields.three {
  grid-template-columns: repeat(3, minmax(170px, 1fr));
}
body.public-availability .response-entry .fields.two {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}
.public-access-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cri);
  border-radius: 14px;
  background: var(--soft);
  color: var(--muted);
  font-size: .86rem;
  font-weight: 750;
}
.public-access-badge strong {
  color: var(--ink);
}
body.public-availability .public-response-list {
  overflow-x: auto;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}
body.public-availability .availability-table {
  min-width: 980px;
}
body.limited-availability .tabs,
body.limited-availability .view:not(#disponibilita),
body.limited-availability #availability-form,
body.limited-availability .availability-flow,
body.limited-availability #disponibilita .section-head .primary.open-form,
body.limited-availability .availability-admin-action,
body.limited-availability #cancel-response,
body.limited-availability .public-link-box,
body.limited-availability .census-selector {
  display: none !important;
}
body.limited-availability #disponibilita {
  display: block !important;
}
body.limited-availability main {
  max-width: 1280px;
}
body.limited-availability #disponibilita .section-head {
  align-items: start;
}
body.limited-availability #disponibilita .grid.two {
  display: block;
}
body.limited-availability #availability-list {
  margin-bottom: 18px;
}
body.limited-availability #response-form {
  border-top: 5px solid var(--cri);
}
body.limited-availability #response-form .panel-title h3::after {
  content: " - foglio disponibilita";
  color: var(--muted);
  font-weight: 700;
}
body.limited-availability .availability-block {
  padding: 12px;
  background: var(--panel);
}
body.limited-availability .availability-block legend {
  color: var(--cri);
  font-size: .95rem;
}
body.limited-availability .response-entry {
  border-radius: 12px;
  background: var(--soft);
  padding: 12px;
}
body.limited-availability .response-entry .entry-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
body.limited-availability .response-entry .fields {
  gap: 8px;
}
.admin-log-panel {
  grid-column: 1 / -1;
}
.admin-user-panel #admin-user-list {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}
.admin-log-panel #admin-log-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}
.admin-log-panel .audit-item {
  min-width: 0;
}
.admin-user-panel #admin-user-list::-webkit-scrollbar,
.admin-log-panel #admin-log-list::-webkit-scrollbar {
  width: 10px;
}
.admin-user-panel #admin-user-list::-webkit-scrollbar-thumb,
.admin-log-panel #admin-log-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--cri) 35%, var(--line));
  border-radius: 999px;
}
.public-form-summary {
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(227, 6, 19, .1), var(--soft));
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.public-form-summary h2 { margin: 4px 0 7px; }
.public-form-summary p { margin: 0 0 8px; color: var(--muted); }
.public-form-summary .public-notes {
  color: var(--ink);
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.public-shifts {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.public-shifts strong { display: block; margin-bottom: 6px; color: var(--cri); }
.public-shifts ul { margin: 0; padding-left: 18px; color: var(--ink); line-height: 1.5; }
.public-response-list { margin-top: 0; }
.hidden { display: none !important; }
fieldset {
  border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 0 0 15px;
}
.availability-block { margin-top: 17px; padding: 15px; }
.response-entry {
  background: var(--soft); border: 1px solid var(--line); border-radius: 15px; padding: 14px; margin-bottom: 12px;
}
.period-entry {
  border: 1px solid var(--line); border-radius: 15px; background: var(--soft); padding: 12px; margin-bottom: 10px;
}
.period-entry label { margin-bottom: 7px; }
.compact-list { max-height: 110px; margin-bottom: 15px; }
.recipient-builder {
  background: color-mix(in srgb, var(--soft) 58%, transparent);
}
.recipient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.recipient-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.recipient-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.recipient-card-head strong { display: block; }
.recipient-card-head small { color: var(--muted); font-size: .78rem; }
.contact-list {
  max-height: 260px;
  margin-bottom: 14px;
  padding-right: 4px;
}
.contact-choice {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) 72px;
  align-items: center !important;
  gap: 9px !important;
  border: 1px solid transparent;
}
.contact-choice:has(input:checked) {
  background: #fff4f5;
  border-color: rgba(227, 6, 19, .28);
}
body[data-theme="dark"] .contact-choice:has(input:checked) {
  background: #2a1216;
}
.contact-choice-main strong,
.contact-choice-main small {
  display: block;
}
.contact-choice-main small {
  color: var(--muted);
  font-size: .76rem;
  margin-top: 2px;
}
.contact-order-wrap {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
}
.form-panel fieldset h4 { margin: 9px 0 7px; font-size: .88rem; }
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.response-panel h4 { margin: 8px 0 13px; font-size: .96rem; }
legend { font-size: .87rem; font-weight: 700; padding: 0 6px; }
.check-list {
  max-height: 142px; overflow: auto; display: flex; flex-direction: column; gap: 6px;
}
.check-list label {
  display: flex; align-items: center; gap: 8px; padding: 8px; margin: 0;
  font-weight: 600; font-size: .86rem; border-radius: 10px;
}
.check-list label:hover { background: var(--hover); }
.check-list .filtered-out { display: none; }
.check-list input { display: inline-block; width: auto; margin: 0; }
.check-list span { flex: 1; }
.contact-order {
  width: 58px !important; min-width: 58px; padding: 5px 7px !important; font-size: .78rem !important; text-align: center;
}
.recipient-preview {
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--soft);
  padding: 10px 12px;
}
.recipient-preview strong {
  display: block;
  margin-bottom: 6px;
  color: var(--cri);
  font-size: .8rem;
}
.recipient-preview pre {
  margin: 0;
  white-space: pre-wrap;
  font: .8rem/1.45 Arial, sans-serif;
  color: var(--ink);
}
.inline-select {
  display: inline-block; width: auto; max-width: 175px; margin: 0; padding: 5px 7px; font-size: .82rem;
}
.resource-choice { flex-wrap: wrap; }
.availability-badge {
  display: inline-flex; align-items: center; margin-left: 6px; padding: 3px 8px;
  border-radius: 999px; background: #fdecee; color: var(--cri); font-weight: 800; font-size: .7rem;
}
body[data-theme="dark"] .availability-badge { background: #350e12; color: #ff9aa2; }
.resource-dates {
  display: flex; gap: 5px; width: 100%; padding-left: 24px; margin-top: 3px;
}
.resource-dates label { display: block; width: calc(50% - 3px); color: var(--muted); font-size: .73rem; }
.resource-dates input, .resource-dates select { margin: 3px 0 0; padding: 5px 7px; font-size: .79rem; width: 100%; }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.bulk-check { flex: 0 0 auto; padding-top: 2px; margin: 0; display: flex; justify-content: center; }
.bulk-check input { width: auto; margin: 0; }
.group-title {
  margin: 8px 0 4px; padding: 7px 10px; background: var(--soft); border-radius: 7px;
  color: var(--muted); font-size: .85rem;
}
.empty-choice { color: var(--muted); font-size: .84rem; padding: 5px; }

.tools { display: flex; flex-direction: column; align-items: start; gap: 13px; }
.tools p { margin: 0; }
.inline-tools {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px 0 14px;
}
.inline-tools .hint { margin: 0; }
.import-button { margin: 0; cursor: pointer; }
.import-button input { display: none; }
.roadmap {
  margin-top: 12px; padding: 19px; border-radius: 11px; background: var(--soft); width: 100%;
}
.roadmap h3 { margin-bottom: 10px; }
.roadmap ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.8; }
.logo-preview-box img {
  max-width: 100%; max-height: 100px; border: 1px solid var(--line); margin: 0 0 14px;
}
.site-footer {
  max-width: 1420px; margin: 0 auto; border-top: 1px solid var(--line); color: var(--muted);
  padding: 18px 28px 24px; font-size: .84rem; text-align: center;
}
.site-footer a { color: var(--cri); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
body[data-theme="dark"] .badge { background: #252a31; color: #d6d9de; }
body[data-theme="dark"] .badge.ok { background: #102c20; color: var(--success); }
body[data-theme="dark"] .badge.warn { background: #33250e; color: var(--warning); }
body[data-theme="dark"] .badge.red, body[data-theme="dark"] .danger { background: #351014; color: #ff7b85; border-color: #63242a; }
body[data-theme="dark"] .primary { color: #fff; }
body[data-theme="dark"] .secondary { border-color: var(--panel-border); }
body[data-theme="dark"] .link { color: #ff6b75; }
body[data-theme="dark"] .empty { border-color: var(--panel-border); }
.toast {
  position: fixed; bottom: 22px; right: 25px; max-width: 460px;
  padding: 13px 18px; background: var(--toast-bg); color: var(--toast-text); border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); transform: translateY(120px);
  opacity: 0; transition: .25s ease; z-index: 300;
}
.toast.show { transform: translateY(0); opacity: 1; }
body.modal-active .toast {
  top: 18px;
  bottom: auto;
  left: 50%;
  right: auto;
  width: min(620px, calc(100vw - 28px));
  transform: translate(-50%, -120px);
  border: 2px solid rgba(255,255,255,.32);
  box-shadow: 0 18px 50px rgba(0,0,0,.34);
  font-weight: 750;
}
body.modal-active .toast.show { transform: translate(-50%, 0); }
.minimized-forms {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 75;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: calc(100vw - 420px);
}
.minimized-form {
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--cri);
  background: var(--panel);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 13px;
  box-shadow: var(--shadow-soft);
  text-align: left;
  cursor: pointer;
}
.minimized-form strong,
.minimized-form span {
  display: block;
}
.minimized-form span {
  margin-top: 2px;
  color: var(--muted);
  font-size: .76rem;
}

@media (max-width: 1020px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid.two, .grid.form-layout, .availability-management-layout, .availability-flow, .recipient-grid { grid-template-columns: 1fr; }
  .fields.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-user-groups .item { min-width: 820px; }
}
@media (max-width: 650px) {
  .topbar { position: static; height: auto; flex-direction: column; align-items: stretch; padding: 16px; }
  .operator { justify-content: space-between; flex-wrap: wrap; }
  .operator input { width: 100%; }
  .auth-box { width: 100%; padding-left: 0; border-left: 0; }
  .auth-box input { width: 100%; }
  .tabs { position: sticky; top: 0; padding: 8px 12px; }
  main { padding: 18px 12px 35px; }
  .hero { padding: 20px; flex-direction: column; align-items: start; }
  .metrics, .fields.two, .fields.three { grid-template-columns: 1fr; }
  .contact-filter-bar { grid-template-columns: 1fr; }
  .contact-bulk-actions button,
  .contact-bulk-actions select { width: 100%; }
  .panel { padding: 18px; }
  .item { min-width: 680px; }
  .items { margin-left: -2px; margin-right: -2px; }
  .availability-sheet-card,
  .response-panel,
  .admin-user-groups .item {
    min-width: 0;
  }
  body.public-availability .availability-table,
  .availability-table {
    min-width: 820px;
  }
  .minimized-forms {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}
