:root {
  --ep-ink: #172235;
  --ep-ink-soft: #31435d;
  --ep-sidebar: #142034;
  --ep-sidebar-2: #1d2d46;
  --ep-brand: #0b72df;
  --ep-brand-soft: #eaf4ff;
  --ep-good: #1f9d55;
  --ep-warn: #c27605;
  --ep-bad: #d63939;
  --ep-bg: #eef3f9;
  --ep-panel: #ffffff;
  --ep-border: #d9e2ef;
  --ep-muted: #64748b;
  --ep-radius: 14px;
  --ep-shadow: 0 14px 36px rgba(26, 41, 66, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body,
#entrypoint-root {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(11, 114, 223, 0.12), transparent 36rem),
    linear-gradient(135deg, #f8fbff 0%, var(--ep-bg) 58%, #e8eef7 100%);
  color: var(--ep-ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.auth-screen {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--ep-panel);
  border: 1px solid var(--ep-border);
  border-radius: 22px;
  box-shadow: var(--ep-shadow);
  max-width: 440px;
  overflow: hidden;
  width: 100%;
}

.auth-card__hero {
  background: linear-gradient(135deg, #0d2442, #0b72df);
  color: #fff;
  padding: 2rem;
}

.auth-card__body {
  padding: 2rem;
}

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

.app-sidebar {
  background: linear-gradient(180deg, var(--ep-sidebar), #0e1828);
  color: #dce8f8;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.app-brand {
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  gap: 0.85rem;
  min-height: 84px;
  padding: 1.15rem 1.35rem;
}

.app-brand__mark {
  align-items: center;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  display: inline-flex;
  font-weight: 800;
  height: 46px;
  justify-content: center;
  letter-spacing: 0.04em;
  width: 46px;
}

.app-brand__title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: normal;
}

.app-brand__subtitle {
  color: #aac0da;
  font-size: 0.84rem;
}

.app-nav {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
}

.app-nav__button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 11px;
  color: #d9e6f7;
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  text-align: left;
  width: 100%;
}

.app-nav__button:hover,
.app-nav__button.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.app-sidebar__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  display: grid;
  gap: 0.5rem;
  margin-top: auto;
  padding: 1rem;
}

.status-pill {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  color: #d9e6f7;
  font-size: 0.78rem;
  overflow: hidden;
  padding: 0.55rem 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  min-width: 0;
  padding: 1.25rem;
}

.page-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.page-title {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 0;
}

.page-actions {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.surface {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  box-shadow: var(--ep-shadow);
}

.surface__header {
  align-items: center;
  border-bottom: 1px solid var(--ep-border);
  display: flex;
  justify-content: space-between;
  min-height: 62px;
  padding: 1rem 1.15rem;
}

.surface__body {
  padding: 1.15rem;
}

.split-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.45fr) minmax(420px, 0.85fr);
}

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

.metric {
  padding: 1.15rem;
}

.metric__label {
  color: var(--ep-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric__value {
  font-size: 2.15rem;
  font-weight: 850;
  line-height: 1;
  margin-top: 0.4rem;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.subnav .btn.is-active {
  background: var(--ep-brand);
  border-color: var(--ep-brand);
  color: #fff;
}

.rich-table {
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  overflow: hidden;
}

.rich-table__toolbar {
  align-items: center;
  background: #fbfdff;
  border-bottom: 1px solid var(--ep-border);
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  padding: 0.65rem;
}

.rich-table__search-wrap {
  align-items: center;
  display: flex;
  flex: 1 1 320px;
  max-width: 520px;
  position: relative;
}

.rich-table__search-wrap .ti {
  color: var(--ep-muted);
  left: 0.7rem;
  position: absolute;
  z-index: 1;
}

.rich-table__search {
  padding-left: 2rem;
}

.rich-table__meta {
  color: var(--ep-muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.rich-table__empty {
  border-top: 1px solid var(--ep-border);
}

.table-zone {
  max-height: calc(100vh - 22rem);
  overflow: auto;
}

.table-zone--tall {
  max-height: calc(100vh - 15rem);
}

.table thead th {
  background: #f7f9fc;
  color: #667085;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  min-width: 9rem;
  overflow: hidden;
  position: sticky;
  resize: horizontal;
  text-transform: uppercase;
  top: 0;
  z-index: 2;
}

.table thead th:last-child {
  min-width: 7rem;
}

.table td {
  vertical-align: middle;
}

.table tbody tr.is-selected td {
  background: #eaf4ff;
}

.row-actions {
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
}

.chip-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.empty-state {
  color: var(--ep-muted);
  padding: 2.4rem;
  text-align: center;
}

.detail-card {
  min-height: 360px;
}

.detail-heading {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.detail-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}

.detail-subtitle {
  color: var(--ep-muted);
  margin-top: 0.2rem;
}

.hardware-strip {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.hardware-strip > div {
  background: #f8fbff;
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  padding: 0.8rem;
}

.hardware-strip span {
  color: var(--ep-muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hardware-strip strong {
  display: block;
  margin-top: 0.25rem;
}

.drawer {
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.18s ease;
  z-index: 1060;
}

.drawer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer__backdrop {
  background: rgba(15, 23, 42, 0.36);
  inset: 0;
  position: absolute;
}

.drawer__panel {
  background: var(--ep-panel);
  box-shadow: -24px 0 46px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin-left: auto;
  max-width: min(860px, 94vw);
  position: relative;
  transform: translateX(22px);
  transition: transform 0.18s ease;
  width: 860px;
}

.drawer.is-open .drawer__panel {
  transform: translateX(0);
}

.drawer__header {
  align-items: start;
  border-bottom: 1px solid var(--ep-border);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem 1.2rem;
}

.drawer__body {
  overflow: auto;
  padding: 1.2rem;
}

.drawer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.drawer-tabs .btn.is-active {
  background: var(--ep-brand);
  border-color: var(--ep-brand);
  color: #fff;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid .full {
  grid-column: 1 / -1;
}

.check-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.check-card {
  align-items: center;
  border: 1px solid var(--ep-border);
  border-radius: 10px;
  display: flex;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
}

.toast-stack {
  bottom: 1rem;
  display: grid;
  gap: 0.65rem;
  position: fixed;
  right: 1rem;
  z-index: 1100;
}

.toast-card {
  background: #fff;
  border-left: 4px solid var(--ep-brand);
  border-radius: 12px;
  box-shadow: var(--ep-shadow);
  max-width: 420px;
  padding: 0.85rem 1rem;
}

.toast-card.is-error {
  border-left-color: var(--ep-bad);
}

.schedule-grid {
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  overflow: auto;
}

.schedule-row {
  display: grid;
  grid-template-columns: 92px repeat(96, 12px);
  min-width: 1244px;
}

.schedule-row__label {
  background: #f7f9fc;
  border-bottom: 1px solid var(--ep-border);
  border-right: 1px solid var(--ep-border);
  font-weight: 700;
  padding: 0.35rem 0.5rem;
  position: sticky;
  left: 0;
  z-index: 1;
}

.schedule-cell {
  background: #fff;
  border-bottom: 1px solid #edf1f6;
  border-right: 1px solid #edf1f6;
  height: 24px;
}

.schedule-cell.is-active {
  background: linear-gradient(135deg, #0b72df, #3fa2ff);
}

.schedule-hour {
  color: var(--ep-muted);
  display: grid;
  font-size: 0.72rem;
  grid-template-columns: 92px repeat(24, 48px);
  min-width: 1244px;
}

.schedule-hour span {
  padding: 0.3rem 0.15rem;
}

.timeline {
  display: grid;
  gap: 0.65rem;
}

.timeline-item {
  border-left: 3px solid var(--ep-brand);
  padding-left: 0.8rem;
}

.preview-summary {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preview-summary__card {
  border: 1px solid var(--ep-border);
  border-radius: 14px;
  padding: 1rem;
}

.preview-summary__card span {
  display: block;
  font-size: 1.9rem;
  font-weight: 850;
  line-height: 1;
}

.preview-summary__card strong {
  color: var(--ep-muted);
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  margin-top: 0.35rem;
  text-transform: uppercase;
}

.preview-summary__card.is-good {
  background: linear-gradient(135deg, #ecfdf3, #ffffff);
}

.preview-summary__card.is-blocked {
  background: linear-gradient(135deg, #fff1f2, #ffffff);
}

.kv-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kv {
  background: #f7f9fc;
  border: 1px solid var(--ep-border);
  border-radius: 10px;
  padding: 0.7rem;
}

.kv__label {
  color: var(--ep-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kv__value {
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
}

.raw-payload {
  background: #0f172a;
  border-radius: 12px;
  color: #dbeafe;
  max-height: 280px;
  overflow: auto;
  padding: 1rem;
}

.mobile-nav-toggle {
  display: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    min-height: auto;
    position: relative;
  }

  .app-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app-sidebar__footer {
    display: none;
  }

  .split-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-main {
    padding: 0.85rem;
  }

  .app-nav {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid,
  .form-grid,
  .form-grid--3,
  .kv-grid,
  .preview-summary {
    grid-template-columns: 1fr;
  }

  .rich-table__toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .rich-table__search-wrap {
    max-width: none;
    width: 100%;
  }
}
