:root {
  --bg: #07111f;
  --bg-soft: #0b1728;
  --surface: #0e1b2e;
  --surface-2: #122239;
  --surface-3: #172a45;

  --border: rgba(255,255,255,.085);
  --border-strong: rgba(255,255,255,.14);

  --text: #f7f9fc;
  --text-soft: #a8b5c8;
  --text-muted: #73839b;

  --primary: #5c7cff;
  --primary-2: #7b61ff;
  --primary-soft: rgba(92,124,255,.14);

  --success: #34d399;
  --success-soft: rgba(52,211,153,.12);

  --warning: #fbbf24;
  --warning-soft: rgba(251,191,36,.12);

  --danger: #fb7185;
  --danger-soft: rgba(251,113,133,.12);

  --info: #38bdf8;
  --info-soft: rgba(56,189,248,.12);

  --shadow:
    0 20px 60px rgba(0,0,0,.28);

  --shadow-soft:
    0 12px 35px rgba(0,0,0,.18);

  --radius: 18px;
  --radius-sm: 12px;

  --sidebar-width: 270px;
  --topbar-height: 78px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(
      circle at 80% -10%,
      rgba(92,124,255,.13),
      transparent 30%
    ),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

input,
select,
textarea {
  width: 100%;
}

.hidden {
  display: none !important;
}

/* LOGIN */

.login-view {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding:
    max(24px, env(safe-area-inset-top))
    20px
    max(24px, env(safe-area-inset-bottom));
  background:
    linear-gradient(
      145deg,
      #06101d 0%,
      #09162a 50%,
      #07111f 100%
    );
}

.login-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(20px);
  pointer-events: none;
}

.glow-one {
  width: 420px;
  height: 420px;
  top: -180px;
  right: -150px;
  background: rgba(92,124,255,.19);
}

.glow-two {
  width: 350px;
  height: 350px;
  bottom: -170px;
  left: -140px;
  background: rgba(123,97,255,.14);
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(100%, 440px);
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background:
    linear-gradient(
      145deg,
      rgba(17,33,55,.96),
      rgba(10,23,40,.96)
    );
  box-shadow:
    0 30px 100px rgba(0,0,0,.42);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-login {
  margin-bottom: 38px;
}

.brand-logo {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-2)
    );
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  box-shadow:
    0 10px 28px rgba(92,124,255,.3);
}

.brand-name {
  font-size: 19px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.3px;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.login-heading {
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-block;
  color: #8fa4ff;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.login-heading h1,
.section-head h1,
.coming-card h1 {
  margin: 8px 0 8px;
  font-size: 29px;
  line-height: 1.15;
  letter-spacing: -.7px;
}

.login-heading p,
.section-head p,
.coming-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.65;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.field small {
  display: block;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.field input,
.field select,
.field textarea {
  min-height: 48px;
  padding: 0 14px;
  outline: none;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(3,12,23,.55);
  color: var(--text);
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

.field textarea {
  min-height: 110px;
  padding-top: 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(92,124,255,.75);
  background: rgba(5,15,28,.8);
  box-shadow:
    0 0 0 3px rgba(92,124,255,.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #52627a;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 70px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  border: 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: transparent;
  color: #8fa4ff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.form-message {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.login-footer {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

/* BUTTONS */

.btn {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform .15s ease,
    opacity .15s ease,
    background .15s ease,
    border-color .15s ease;
}

.btn:active {
  transform: scale(.98);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-2)
    );
  color: #fff;
  box-shadow:
    0 9px 24px rgba(92,124,255,.18);
}

.btn-primary:hover {
  opacity: .93;
}

.btn-secondary {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-3);
}

.btn-ghost {
  border-color: var(--border);
  background: rgba(255,255,255,.035);
  color: var(--text-soft);
}

.btn-danger {
  border-color: rgba(251,113,133,.2);
  background: var(--danger-soft);
  color: #ff9aaa;
}

.btn-success {
  border-color: rgba(52,211,153,.2);
  background: var(--success-soft);
  color: #6ee7b7;
}

.btn-warning {
  border-color: rgba(251,191,36,.2);
  background: var(--warning-soft);
  color: #fcd34d;
}

.btn-wide {
  width: 100%;
}

.btn-small {
  min-height: 35px;
  padding: 0 12px;
  font-size: 11px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.icon-btn {
  width: 41px;
  height: 41px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  font-size: 19px;
  cursor: pointer;
}

/* APP */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(
      180deg,
      #0a1728,
      #081321
    );
  box-shadow: 10px 0 45px rgba(0,0,0,.12);
}

.sidebar-top {
  height: var(--topbar-height);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-close {
  display: none;
}

.navigation {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 12px 24px;
  scrollbar-width: thin;
}

.nav-label {
  margin: 20px 11px 8px;
  color: #53647d;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.35px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 3px 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #9cabc0;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition:
    color .16s ease,
    background .16s ease,
    border-color .16s ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,.035);
}

.nav-item.active {
  border-color: rgba(92,124,255,.16);
  background:
    linear-gradient(
      90deg,
      rgba(92,124,255,.17),
      rgba(92,124,255,.06)
    );
  color: #fff;
}

.nav-icon {
  width: 22px;
  flex: 0 0 22px;
  display: inline-grid;
  place-items: center;
  color: #8fa4ff;
  font-size: 16px;
}

.nav-badge {
  min-width: 22px;
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 9px;
  font-weight: 850;
  text-align: center;
}

.sidebar-footer {
  flex: 0 0 auto;
  padding: 15px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.08);
}

.admin-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  padding: 5px;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  color: #a8b5ff;
  font-size: 14px;
  font-weight: 850;
}

.admin-mini-copy {
  min-width: 0;
}

.admin-mini-copy strong,
.admin-mini-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-mini-copy strong {
  font-size: 12px;
}

.admin-mini-copy span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(7,17,31,.84);
  backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.topbar h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -.25px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.menu-button {
  display: none;
}

.system-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}

.live-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--success);
  box-shadow:
    0 0 0 4px rgba(52,211,153,.09);
}

.content {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 28px;
}

.page {
  display: none;
  animation: pageIn .18s ease;
}

.page.active {
  display: block;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* DASHBOARD */

.hero-card {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  position: relative;
  padding: 30px;
  border: 1px solid rgba(92,124,255,.15);
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(123,97,255,.18),
      transparent 30%
    ),
    linear-gradient(
      135deg,
      rgba(92,124,255,.11),
      rgba(14,27,46,.96) 45%,
      rgba(12,24,41,.98)
    );
  box-shadow: var(--shadow-soft);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -90px;
  bottom: -130px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 50%;
}

.hero-card h1 {
  max-width: 620px;
  margin: 9px 0;
  font-size: clamp(25px, 3vw, 37px);
  line-height: 1.12;
  letter-spacing: -1px;
}

.hero-card p {
  max-width: 630px;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.hero-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid rgba(52,211,153,.17);
  border-radius: 999px;
  background: rgba(52,211,153,.07);
  color: #8eeac8;
  font-size: 11px;
  font-weight: 750;
}

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

.stat-card {
  min-height: 128px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(
      145deg,
      rgba(18,34,57,.94),
      rgba(12,25,43,.94)
    );
  box-shadow: var(--shadow-soft);
}

.stat-icon {
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: #9bacff;
  font-size: 19px;
}

.stat-card span,
.stat-card strong,
.stat-card small {
  display: block;
}

.stat-card span {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}

.stat-card strong {
  margin: 4px 0 3px;
  font-size: 25px;
  letter-spacing: -.5px;
}

.stat-card small {
  color: var(--text-muted);
  font-size: 9px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1.4fr)
    minmax(300px, .8fr);
  gap: 18px;
  margin-top: 18px;
}

/* PANELS */

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(
      145deg,
      rgba(16,31,52,.95),
      rgba(11,24,41,.95)
    );
  box-shadow: var(--shadow-soft);
}

.panel-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 16px 19px;
  border-bottom: 1px solid var(--border);
}

.panel-head h3 {
  margin: 5px 0 0;
  font-size: 15px;
}

.stack-list {
  padding: 10px;
}

.stack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 13px 10px;
  border-bottom: 1px solid var(--border);
}

.stack-item:last-child {
  border-bottom: 0;
}

.stack-item-main {
  min-width: 0;
}

.stack-item strong,
.stack-item span,
.stack-item small {
  display: block;
}

.stack-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack-item span {
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 10px;
}

.stack-item small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
}

.bot-summary {
  min-height: 170px;
  padding: 19px;
}

/* SECTION */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-head h1 {
  font-size: 25px;
}

.section-head p {
  max-width: 650px;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 17px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.filter-chip.active {
  border-color: rgba(92,124,255,.25);
  background: var(--primary-soft);
  color: #b5c0ff;
}

/* CARDS LIST */

.cards-list {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.data-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(
      145deg,
      rgba(17,33,55,.96),
      rgba(11,24,41,.96)
    );
  box-shadow: var(--shadow-soft);
}

.data-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: rgba(92,124,255,.65);
}

.data-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.data-card-title {
  min-width: 0;
}

.data-card-title h3 {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-card-title p {
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.data-field {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,.09);
}

.data-field span,
.data-field strong {
  display: block;
}

.data-field span {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
}

.data-field strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* STATUS */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .2px;
}

.status-badge.active,
.status-badge.sent,
.status-badge.completed {
  background: var(--success-soft);
  color: #6ee7b7;
}

.status-badge.pending,
.status-badge.received,
.status-badge.routed {
  background: var(--warning-soft);
  color: #fcd34d;
}

.status-badge.blocked,
.status-badge.failed,
.status-badge.rejected {
  background: var(--danger-soft);
  color: #fda4af;
}

.status-badge.disabled {
  background: rgba(148,163,184,.11);
  color: #a8b5c8;
}

.status-badge.unmatched {
  background: var(--info-soft);
  color: #7dd3fc;
}

/* EMPTY / LOADING */

.empty-state {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 30px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.empty-state.compact {
  min-height: 120px;
  border: 0;
}

.loading-line {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
}

.loading-line::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255,255,255,.08),
      transparent
    );
  animation: loading 1.2s infinite;
}

@keyframes loading {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(300%);
  }
}

/* TWO COLUMN */

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

.two-column .panel > form {
  padding: 19px;
}

.bot-info {
  display: grid;
  gap: 11px;
}

.bot-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.bot-info-row:last-child {
  border-bottom: 0;
}

.bot-info-row span {
  color: var(--text-muted);
  font-size: 10px;
}

.bot-info-row strong {
  max-width: 65%;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* COMING */

.coming-card {
  min-height: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 25px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 50% 15%,
      rgba(92,124,255,.1),
      transparent 35%
    ),
    linear-gradient(
      145deg,
      rgba(17,33,55,.9),
      rgba(10,22,38,.9)
    );
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.coming-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border: 1px solid rgba(92,124,255,.2);
  border-radius: 18px;
  background: var(--primary-soft);
  color: #9bacff;
  font-size: 27px;
}

.coming-card p {
  max-width: 570px;
  margin-bottom: 20px;
}

/* MODAL */

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    18px
    max(18px, env(safe-area-inset-bottom));
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1,7,14,.76);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(100%, 570px);
  max-height: min(760px, 88dvh);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: #0d1a2c;
  box-shadow: var(--shadow);
}

.modal-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 5px 0 0;
  font-size: 16px;
}

.modal-body {
  max-height: calc(88dvh - 72px);
  overflow-y: auto;
  padding: 19px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* TOAST */

.toast-container {
  position: fixed;
  z-index: 150;
  top: 18px;
  right: 18px;
  width: min(360px, calc(100% - 36px));
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #122239;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 11px;
  line-height: 1.5;
  animation: toastIn .2s ease;
}

.toast.success {
  border-color: rgba(52,211,153,.25);
}

.toast.error {
  border-color: rgba(251,113,133,.28);
}

.toast.warning {
  border-color: rgba(251,191,36,.28);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* MOBILE OVERLAY */

.mobile-overlay {
  display: none;
}

/* TABLE SUPPORT */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  background: rgba(13,27,46,.85);
}

.data-table th,
.data-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: .4px;
}

.data-table td {
  color: var(--text-soft);
}

/* RESPONSIVE */

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

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  :root {
    --topbar-height: 70px;
  }

  .sidebar {
    width: min(84vw, 290px);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 25px 0 70px rgba(0,0,0,.4);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close,
  .menu-button {
    display: grid;
  }

  .mobile-overlay {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(0,0,0,.55);
    opacity: 0;
    transition:
      opacity .2s ease,
      visibility .2s ease;
  }

  .mobile-overlay.show {
    visibility: visible;
    opacity: 1;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 17px;
  }

  .content {
    padding: 20px 17px;
  }

  .cards-list,
  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-view {
    align-items: flex-start;
    padding-left: 14px;
    padding-right: 14px;
  }

  .login-card {
    margin-top: 5vh;
    padding: 25px 20px;
    border-radius: 20px;
  }

  .brand-login {
    margin-bottom: 30px;
  }

  .login-heading h1 {
    font-size: 26px;
  }

  .system-pill {
    display: none;
  }

  .topbar {
    gap: 8px;
  }

  .topbar-right {
    gap: 7px;
  }

  .content {
    padding:
      16px
      13px
      max(25px, env(safe-area-inset-bottom));
  }

  .hero-card {
    min-height: 210px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 22px 19px;
    border-radius: 18px;
  }

  .hero-card h1 {
    font-size: 25px;
  }

  .hero-status {
    padding: 9px 11px;
  }

  .stats-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 10px;
  }

  .stat-card {
    min-height: 118px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    border-radius: 10px;
    font-size: 15px;
  }

  .stat-card strong {
    font-size: 22px;
  }

  .dashboard-grid {
    gap: 11px;
    margin-top: 11px;
  }

  .panel {
    border-radius: 15px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .section-head > .btn {
    width: 100%;
  }

  .section-head h1 {
    font-size: 23px;
  }

  .data-card {
    padding: 15px;
    border-radius: 15px;
  }

  .data-grid {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .data-field {
    padding: 9px;
  }

  .card-actions .btn {
    flex: 1 1 auto;
  }

  .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-row .btn {
    width: 100%;
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 91dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .modal-body {
    max-height: calc(91dvh - 72px);
    padding-bottom:
      max(22px, env(safe-area-inset-bottom));
  }

  .toast-container {
    top: 12px;
    right: 12px;
    width: calc(100% - 24px);
  }
}

@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: auto;
    align-items: center;
    flex-direction: row;
  }

  .data-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
