:root {
  color-scheme: light;
  --purple: #171717;
  --purple-dark: #000;
  --purple-muted: #747474;
  --purple-soft: #f1f1f1;
  --peach: #f2f2f2;
  --cream: #f7f7f7;
  --berry: #dc0403;
  --pink: #dc0403;
  --gold: #bc9a55;
  --green: #1db52c;
  --red: #dc0403;
  --ink: #171717;
  --surface: rgba(255, 255, 255, .92);
  --border: rgba(0, 0, 0, .12);
  --shadow: 0 28px 72px rgba(0, 0, 0, .09);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 0%, rgba(220, 4, 3, .09), transparent 27%),
    radial-gradient(circle at 12% 100%, rgba(0, 0, 0, .06), transparent 28%),
    #f4f4f2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 34px 28px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(22px);
  z-index: 20;
}

.brand {
  display: block;
  color: inherit;
  text-decoration: none;
}

.brand-logotype { width: 210px; }
.brand span {
  display: block;
  margin-top: 11px;
  color: var(--berry);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 58px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 17px;
  padding: 0 16px;
  color: #615a73;
  background: transparent;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}

.nav-link:hover { color: var(--purple); background: rgba(0, 0, 0, .055); }
.nav-link.active {
  color: #fff;
  background: var(--purple);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .20);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(54, 44, 102, .08);
  font-size: .9rem;
}

.nav-link.active .nav-icon { background: rgba(255, 255, 255, .15); }

.sidebar-note {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--cream);
}

.sidebar-note strong { display: block; color: var(--purple); font-size: .84rem; }
.sidebar-note p { margin: 6px 0 0; color: #766e82; font-size: .75rem; line-height: 1.45; }

.live-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 0 6px rgba(201, 127, 148, .16);
}

.sidebar-footer {
  display: grid;
  justify-items: center;
  gap: 13px;
  margin-top: 25px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.sidebar-footer > span { color: var(--purple-muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.sidebar-footer img { width: 160px; }
.sidebar-footer button {
  border: 0;
  color: var(--purple-muted);
  background: transparent;
  font-size: .75rem;
  font-weight: 800;
  cursor: pointer;
}

.main { min-width: 0; padding: 30px clamp(24px, 4vw, 64px) 64px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 82px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--berry);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  color: var(--purple);
  font-family: "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  letter-spacing: -.025em;
  line-height: 1;
  text-transform: uppercase;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 14px;
  color: #625b74;
  background: rgba(255, 255, 255, .76);
  font-size: .75rem;
  font-weight: 800;
}

.sync-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(210, 152, 0, .12);
}

.sync-status[data-state="connected"] i { background: var(--green); box-shadow: 0 0 0 5px rgba(44, 143, 105, .13); }
.sync-status[data-state="error"] i { background: var(--red); box-shadow: 0 0 0 5px rgba(183, 66, 95, .13); }

.refresh-button,
.text-button,
.mobile-menu {
  border: 0;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.refresh-button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 17px;
  color: var(--purple);
  background: #fff;
}

.refresh-button:disabled { opacity: .55; cursor: wait; }
.mobile-menu { display: none; font-size: 1.3rem; }
.view { display: grid; gap: 24px; }
.view[hidden] { display: none; }

.hero-panel,
.panel,
.request-card,
.request-intro {
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: relative;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  overflow: hidden;
  padding: clamp(34px, 5vw, 64px);
  color: #fff;
  background:
    radial-gradient(circle at 85% 20%, rgba(220, 4, 3, .25), transparent 28%),
    linear-gradient(120deg, #0b0b0b, #292929);
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -170px;
  width: 430px;
  height: 430px;
  border: 2px solid rgba(255, 255, 255, .09);
  border-radius: 50%;
  box-shadow: 0 0 0 62px rgba(255, 255, 255, .035), 0 0 0 126px rgba(255, 255, 255, .02);
}

.hero-panel h2,
.request-intro h2 {
  margin: 0;
  color: var(--purple);
  font-family: "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  font-size: clamp(3rem, 6vw, 6.7rem);
  letter-spacing: -.045em;
  line-height: .88;
  text-transform: uppercase;
}

.hero-panel h2 { color: #fff; }
.hero-panel .eyebrow { color: #ff6968; }
.hero-panel h2 em { color: #ff3534; font-style: normal; }
.hero-panel p:last-child { max-width: 590px; margin: 28px 0 0; color: rgba(255, 255, 255, .72); line-height: 1.65; }

.hero-symbol {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 26px 50px rgba(0, 0, 0, .28);
}

.hero-symbol img { width: 132px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  position: relative;
  min-height: 155px;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 18px 40px rgba(54, 44, 102, .07);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: var(--purple-soft);
}

.metric-card--online::after { background: rgba(44, 143, 105, .13); }
.metric-card--program::after { background: rgba(188, 154, 85, .17); }
.metric-card--attention::after { background: rgba(220, 4, 3, .13); }
.metric-card > span { color: #766e82; font-size: .75rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 13px; color: var(--purple); font-size: 2.9rem; line-height: 1; }
.metric-card small { display: block; margin-top: 10px; color: var(--purple-muted); }

.panel { padding: clamp(24px, 3vw, 38px); }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.panel-heading h3, .request-card-heading h3 { margin: 0; color: var(--purple); font-size: clamp(1.55rem, 2.3vw, 2.35rem); letter-spacing: -.025em; }
.text-button { color: var(--berry); }

.zone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.zone-grid--overview .zone-card:nth-child(n+7) { display: none; }

.zone-card {
  display: grid;
  gap: 17px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(247, 247, 247, .88);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.zone-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(54, 44, 102, .09); }
.zone-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.zone-country { display: inline-block; margin-bottom: 6px; color: var(--purple-muted); font-size: .67rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.zone-card h4 { margin: 0; color: var(--purple); font-size: 1rem; line-height: 1.35; }
.zone-card address { margin-top: 5px; color: #756d80; font-size: .76rem; font-style: normal; line-height: 1.45; }

.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 9px;
  font-size: .64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status-badge[data-status="online"] { color: #176a4b; background: rgba(44, 143, 105, .12); }
.status-badge[data-status="online"]::before { background: var(--green); }
.status-badge[data-status="degraded"] { color: #8a6200; background: rgba(210, 152, 0, .15); }
.status-badge[data-status="degraded"]::before { background: var(--gold); }
.status-badge[data-status="offline"] { color: #9b2947; background: rgba(183, 66, 95, .12); }
.status-badge[data-status="offline"]::before { background: var(--red); }
.status-badge[data-status="not_connected"] { color: #6d667a; background: rgba(136, 128, 149, .13); }
.status-badge[data-status="not_connected"]::before { background: var(--purple-muted); }

.program-box {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 13px 14px;
  border-radius: 15px;
  background: #fff;
}

.program-box span { color: var(--purple-muted); font-size: .65rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.program-box strong { overflow: hidden; color: var(--purple); font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.program-box small { overflow: hidden; color: #7a7185; font-size: .73rem; text-overflow: ellipsis; white-space: nowrap; }
.zone-card-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--purple-muted); font-size: .69rem; }

.empty-state {
  grid-column: 1 / -1;
  padding: 50px 20px;
  border: 1px dashed rgba(54, 44, 102, .2);
  border-radius: 20px;
  color: var(--purple-muted);
  text-align: center;
}

.panel-heading--filters { align-items: center; }
.filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.filters input, .filters select {
  min-height: 43px;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0 13px;
  color: var(--purple);
  background: #fff;
  outline: none;
}
.filters input { width: min(260px, 100%); }
.filters input:focus, .filters select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(54, 44, 102, .08); }
.results-copy { margin: -8px 0 20px; color: var(--purple-muted); font-size: .78rem; }

.request-layout { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); gap: 24px; }
.request-intro {
  align-self: start;
  overflow: hidden;
  padding: clamp(30px, 4vw, 50px);
  color: #fff;
  background:
    radial-gradient(circle at 110% -10%, rgba(220, 4, 3, .28), transparent 36%),
    var(--purple-dark);
}
.request-intro .eyebrow { color: var(--peach); }
.request-intro h2 {
  max-width: 100%;
  color: #fff;
  font-size: clamp(3rem, 4.65vw, 5.2rem);
  letter-spacing: -.055em;
}
.request-title-fit { font-size: .88em; }
.request-intro > p:last-of-type { margin: 27px 0; color: rgba(255, 255, 255, .72); line-height: 1.65; }
.request-intro ul { display: grid; gap: 14px; margin: 0; padding-left: 20px; color: rgba(255, 255, 255, .8); font-size: .88rem; line-height: 1.5; }
.request-card { padding: clamp(26px, 4vw, 44px); }
.request-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.request-card-heading > span { border-radius: 999px; padding: 8px 10px; color: var(--berry); background: rgba(201, 127, 148, .13); font-size: .68rem; font-weight: 900; }
.request-form, .request-form label { display: grid; gap: 9px; }
.request-form { gap: 18px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.request-form label > span { color: var(--purple); font-size: .77rem; font-weight: 900; }
.request-form label small { color: var(--purple-muted); font-weight: 700; }
.request-form input, .request-form select, .request-form textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--purple);
  background: #fff;
  outline: none;
}
.request-form textarea { min-height: 126px; resize: vertical; }
.request-form input:focus, .request-form select:focus, .request-form textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(54, 44, 102, .08); }
.request-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 3px; }
.request-actions p { margin: 0; color: var(--purple-muted); font-size: .75rem; }
.request-actions p.is-error { color: var(--red); }
.request-actions button {
  flex: 0 0 auto;
  min-height: 52px;
  border: 0;
  border-radius: 15px;
  padding: 0 24px;
  color: #fff;
  background: var(--purple);
  font-weight: 900;
  cursor: pointer;
}
.request-actions button:disabled { opacity: .55; cursor: wait; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 48px));
  border-radius: 16px;
  padding: 16px 18px;
  color: #fff;
  background: var(--purple);
  box-shadow: 0 24px 60px rgba(54, 44, 102, .3);
  font-size: .85rem;
  font-weight: 800;
}

@media (max-width: 1500px) and (min-width: 1181px) {
  .request-intro h2 { font-size: clamp(2.75rem, 3.3vw, 4.4rem); }
}

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zone-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, calc(100vw - 50px));
    transform: translateX(-105%);
    transition: transform 200ms ease;
    box-shadow: 24px 0 60px rgba(54, 44, 102, .2);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 15;
    border: 0;
    background: rgba(36, 29, 73, .28);
    backdrop-filter: blur(3px);
  }
  body.menu-open .mobile-backdrop { display: block; }
  .main { padding: 18px 18px 40px; }
  .mobile-menu { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #fff; }
  .topbar { align-items: flex-start; gap: 14px; }
  .topbar > div:nth-child(2) { margin-right: auto; }
  .sync-status { display: none; }
  .hero-panel { min-height: 420px; align-items: flex-start; }
  .hero-symbol { position: absolute; right: 28px; bottom: 28px; width: 120px; height: 120px; }
  .hero-symbol img { width: 94px; }
  .panel-heading--filters { align-items: stretch; flex-direction: column; }
  .filters { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .topbar h1 { font-size: 1.6rem; }
  .refresh-button { padding: 0 13px; }
  .hero-panel { min-height: 440px; padding: 30px 24px; }
  .hero-panel h2 { font-size: 3.45rem; }
  .hero-panel::after { opacity: .6; }
  .metrics-grid, .zone-grid, .field-grid { grid-template-columns: 1fr; }
  .zone-grid--overview .zone-card:nth-child(n+5) { display: none; }
  .panel { padding: 22px 17px; border-radius: 24px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .filters { display: grid; width: 100%; }
  .filters input, .filters select { width: 100%; }
  .request-card-heading, .request-actions { align-items: stretch; flex-direction: column; }
  .request-actions button { width: 100%; }
}
