:root {
  --bg: #0c0f12;
  --bg-elevated: #12171d;
  --panel: #171d24;
  --panel-soft: #1d252e;
  --line: #2b3641;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f5f7f9;
  --muted: #9aa6b2;
  --subtle: #66737f;
  --gold: #f2b84b;
  --gold-strong: #ffd36d;
  --green: #35d07f;
  --red: #ff6b6b;
  --blue: #59a8ff;
  --orange: #ff9b45;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 440px;
  gap: 40px;
  align-items: center;
  padding: 48px;
  background:
    linear-gradient(135deg, rgba(242, 184, 75, 0.13), transparent 32%),
    radial-gradient(circle at 74% 24%, rgba(89, 168, 255, 0.12), transparent 28%),
    var(--bg);
}

.login-visual {
  max-width: 680px;
}

.brand-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 30px;
}

.login-visual h1 {
  margin: 0;
  max-width: 620px;
  font-size: 58px;
  line-height: 1.03;
  font-weight: 780;
}

.login-visual p {
  margin: 20px 0 0;
  max-width: 580px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.login-metrics {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.login-metrics span {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold-strong);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 750;
}

.login-card,
.modal-card {
  width: 100%;
  background: rgba(23, 29, 36, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  padding: 34px;
}

.eyebrow,
.section-label {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h2,
h3 {
  margin: 0;
}

.login-card h2 {
  font-size: 30px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: #0f141a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 184, 75, 0.12);
}

.form-error {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--red);
  font-size: 13px;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--gold);
  color: #171002;
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 22px;
}

.btn-secondary {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--text);
}

.btn-ghost {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.btn-small {
  min-height: 34px;
  padding: 0 12px;
  margin: 0;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0f1419;
  border-right: 1px solid var(--line-soft);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-block strong {
  display: block;
  font-size: 15px;
}

.brand-block span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 18px 14px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
}

.nav-item span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--subtle);
  font-size: 10px;
  font-weight: 900;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: rgba(242, 184, 75, 0.1);
}

.nav-item.active span {
  color: #161006;
  background: var(--gold);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line-soft);
}

.api-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--orange);
}

.status-dot.online {
  background: var(--green);
}

.status-dot.offline {
  background: var(--red);
}

.content {
  min-width: 0;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 260px),
    var(--bg);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 28px;
  background: rgba(12, 15, 18, 0.88);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
}

.top-bar h2 {
  font-size: 28px;
}

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

.admin-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.admin-chip span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--gold);
  color: #171002;
  font-weight: 900;
}

.view {
  padding: 26px 28px 36px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.kpi-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.kpi-card {
  padding: 16px;
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.1;
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--subtle);
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 18px;
}

.panel-large {
  grid-row: span 2;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-header h3 {
  font-size: 18px;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.list-row strong {
  display: block;
  font-size: 14px;
}

.list-row span,
.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.bar-chart,
.line-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.bar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--green));
}

.line-chart {
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  align-items: end;
  min-height: 180px;
  padding-top: 14px;
}

.line-bar {
  display: grid;
  align-content: end;
  gap: 7px;
  height: 150px;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
}

.line-bar span:first-child {
  align-self: end;
  min-height: 4px;
  border-radius: 999px 999px 3px 3px;
  background: linear-gradient(180deg, var(--blue), var(--gold));
}

.table-tools {
  align-items: center;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.filters input,
.filters select {
  width: auto;
  min-width: 180px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--subtle);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  color: var(--text);
  font-size: 13px;
}

.cell-main {
  display: grid;
  gap: 3px;
}

.cell-main span {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.badge-active,
.badge-completed {
  color: var(--green);
  background: rgba(53, 208, 127, 0.1);
}

.badge-waiting,
.badge-pending,
.badge-upcoming {
  color: var(--gold-strong);
  background: rgba(242, 184, 75, 0.12);
}

.badge-failed,
.badge-cancelled,
.badge-blocked {
  color: var(--red);
  background: rgba(255, 107, 107, 0.1);
}

.badge-finished {
  color: var(--blue);
  background: rgba(89, 168, 255, 0.12);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.action-btn,
.icon-btn {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.action-btn:hover,
.icon-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.empty-state,
.loading-state,
.error-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.error-state {
  color: var(--red);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 6, 0.78);
}

.modal-card {
  max-width: 520px;
  padding: 22px;
}

.modal-wide {
  max-width: 720px;
}

.modal-header,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check-field {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: 380px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

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

@media (max-width: 780px) {
  body {
    overflow: auto;
  }

  .login-screen,
  .app-shell {
    display: block;
  }

  .login-screen {
    padding: 24px;
  }

  .login-visual {
    margin-bottom: 24px;
  }

  .login-visual h1 {
    font-size: 38px;
  }

  .sidebar {
    min-height: auto;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding: 12px;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .top-bar,
  .table-tools,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .view {
    padding: 18px;
  }

  .kpi-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filters,
  .filters input,
  .filters select {
    width: 100%;
  }
}
