:root {
  --cri: #e30613;
  --cri-dark: #bd0711;
  --cri-soft: #fff0f1;
  --ink: #141924;
  --muted: #667085;
  --bg: #f6f7fb;
  --white: #fff;
  --line: #e5e7ee;
  --field: #fff;
  --label: #303848;
  --soft: #f8f9fc;
  --hover: #f1f3f7;
  --panel: #fff;
  --success: #12704a;
  --warning: #996309;
  --radius: 20px;
  --shadow: 0 18px 45px rgba(17, 24, 39, .08);
  --shadow-soft: 0 10px 26px rgba(17, 24, 39, .06);
  --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 top left, rgba(227, 6, 19, .12), transparent 32rem),
    linear-gradient(180deg, #fff 0, var(--bg) 18rem);
}
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: 88px;
  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: 14px 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.45rem; letter-spacing: -.03em; }
.brand-subtitle {
  display: block; color: var(--muted); font-size: .78rem; font-weight: 650; margin-top: 2px;
}
.brand-logo {
  width: 68px; min-height: 58px; display: flex; align-items: center; justify-content: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-soft);
}
.brand-logo img { max-width: 58px; max-height: 50px; 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; }
.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: 88px;
  z-index: 19;
  display: flex; gap: 9px; overflow-x: auto; padding: 12px max(calc((100vw - 1420px) / 2), 28px);
  background: var(--tabs-bg); 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: 34px 36px;
  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: 28px; margin-bottom: 24px; 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: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 23px; box-shadow: var(--shadow-soft);
}
.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; }
#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; }

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; }
.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; }
.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; }
.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; }

.items { display: flex; flex-direction: column; gap: 11px; }
.item {
  padding: 15px; border: 1px solid var(--item-border); border-radius: 15px;
  background: linear-gradient(180deg, var(--panel), var(--white));
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.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; }
.item p { margin: 8px 0 0; font-size: .88rem; }
.item-actions { display: flex; gap: 11px; align-items: center; margin-top: 11px; flex-wrap: wrap; }
.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; }
.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; }
.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; }
.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 { margin: 3px 0 0; padding: 5px 7px; font-size: .79rem; width: 100%; }
.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; }
.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; }
.letterhead-preview 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: 360px;
  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;
}
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1020px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid.two, .grid.form-layout, .availability-flow { grid-template-columns: 1fr; }
}
@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; }
}
