:root {
  color-scheme: dark;
  --bg: #081121;
  --panel: rgba(13, 24, 43, 0.86);
  --panel-strong: #0f1d33;
  --line: rgba(150, 186, 255, 0.14);
  --text: #ecf3ff;
  --muted: #9db0d1;
  --primary: #56b7ff;
  --primary-strong: #2495ff;
  --success: #5fe0a1;
  --warning: #ffb34d;
  --danger: #ff6f91;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(36, 149, 255, 0.25), transparent 32%),
    radial-gradient(circle at top right, rgba(95, 224, 161, 0.18), transparent 24%),
    linear-gradient(160deg, #050c17 0%, #07101d 55%, #09192e 100%);
  color: var(--text);
  min-height: 100vh;
}

body.authenticated #login-screen {
  display: none;
}

body:not(.authenticated) #app-shell {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 560px);
  gap: 26px;
  align-items: center;
  padding: 30px;
}

.auth-hero-panel,
.auth-card {
  background: rgba(8, 18, 34, 0.92);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 30px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-hero-panel {
  min-height: 100%;
  justify-content: space-between;
  background:
    radial-gradient(circle at top left, rgba(86, 183, 255, 0.2), transparent 34%),
    linear-gradient(160deg, rgba(11, 24, 43, 0.96), rgba(8, 16, 30, 0.94));
}

.auth-card {
  width: min(100%, 560px);
}

.auth-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.auth-card-top h2 {
  margin: 0;
}

.auth-copy {
  color: var(--muted);
  line-height: 1.6;
}

.auth-step-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auth-step-list span {
  display: inline-flex;
  border: 1px solid rgba(150, 186, 255, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  color: #cfe6ff;
  background: rgba(12, 25, 44, 0.68);
  font-size: 0.86rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.auth-tab {
  border: 1px solid rgba(150, 186, 255, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(10, 20, 36, 0.78);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.auth-tab.is-active {
  background: linear-gradient(135deg, rgba(36, 149, 255, 0.95), rgba(86, 183, 255, 0.95));
  border-color: transparent;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-panel.hidden {
  display: none;
}

.auth-highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.auth-highlight-card {
  border: 1px solid rgba(150, 186, 255, 0.16);
  border-radius: 22px;
  padding: 18px;
  background: rgba(8, 18, 34, 0.62);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-highlight-card strong {
  color: #eaf5ff;
}

.auth-highlight-card span {
  color: var(--muted);
  line-height: 1.5;
}

.credential-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.credential-card {
  background: rgba(11, 24, 43, 0.88);
  border: 1px solid rgba(150, 186, 255, 0.16);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.credential-card strong {
  color: #d7ebff;
}

.auth-result {
  border: 1px solid rgba(95, 224, 161, 0.26);
  background: rgba(11, 31, 28, 0.82);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-result strong {
  font-size: 1rem;
}

.auth-result code {
  font-size: 1rem;
  letter-spacing: 0.14em;
  color: #c8ffe4;
}

.auth-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-result-chip {
  border: 1px solid rgba(95, 224, 161, 0.24);
  border-radius: 14px;
  padding: 12px;
  background: rgba(8, 25, 24, 0.68);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-result-chip span {
  color: var(--muted);
  font-size: 0.9rem;
}

.action-button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #2ea86f, #5fe0a1);
  color: #081121;
  cursor: pointer;
  font-weight: 700;
}

.sidebar {
  padding: 28px;
  border-right: 1px solid var(--line);
  background: rgba(7, 15, 28, 0.88);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h1,
.hero h2,
.panel-head h2 {
  margin: 0;
}

.brand h1,
.auth-card h1 {
  overflow-wrap: anywhere;
}

.brand p,
.hero p,
.panel-head span,
.metric-card p,
.item-meta,
.item-secondary {
  color: var(--muted);
}

.brand-badge {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-strong), #77d3ff);
  color: white;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.form-card,
.inline-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}

label,
input,
select,
textarea {
  color: var(--text);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(157, 176, 209, 0.2);
  background: rgba(5, 13, 24, 0.82);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  transform: translateY(-1px);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.primary-button {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  color: white;
  cursor: pointer;
  font-weight: 600;
}

.ghost-button {
  border: 1px solid rgba(150, 186, 255, 0.24);
  border-radius: 14px;
  padding: 12px 16px;
  background: rgba(8, 17, 31, 0.72);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dashboard-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  background: linear-gradient(135deg, rgba(11, 24, 44, 0.94), rgba(9, 20, 36, 0.96));
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.dashboard-topbar-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.dashboard-topbar-copy h2,
.dashboard-topbar-copy p {
  margin: 0;
}

.dashboard-topbar-copy p {
  color: var(--muted);
}

.dashboard-topbar-side {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dashboard-menu-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-menu-tab {
  border: 1px solid rgba(150, 186, 255, 0.18);
  border-radius: 14px;
  padding: 12px 16px;
  background: rgba(8, 18, 32, 0.74);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.dashboard-menu-tab.is-active {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  border-color: transparent;
}

.dashboard-view-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dashboard-view-panel.hidden {
  display: none;
}

.dashboard-single-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(135deg, rgba(20, 38, 66, 0.94), rgba(8, 22, 39, 0.94));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  margin-bottom: 10px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-pill {
  background: rgba(86, 183, 255, 0.12);
  color: #b5e0ff;
  border: 1px solid rgba(86, 183, 255, 0.24);
  border-radius: 999px;
  padding: 10px 14px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  background: linear-gradient(180deg, rgba(14, 27, 47, 0.96), rgba(9, 19, 35, 0.94));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric-card strong {
  display: block;
  font-size: 1.7rem;
  margin: 8px 0 6px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}

.wide-card {
  min-width: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(157, 176, 209, 0.12);
}

th {
  color: #b9cae8;
  font-size: 0.88rem;
  font-weight: 600;
}

td {
  color: #eff4ff;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.86rem;
}

.status.success {
  background: rgba(95, 224, 161, 0.12);
  color: #9af2c0;
}

.status.warning {
  background: rgba(255, 179, 77, 0.14);
  color: #ffd091;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 450px;
  overflow: auto;
}

.compact-list {
  max-height: 320px;
}

.permission-block.locked {
  opacity: 0.42;
  pointer-events: none;
  filter: grayscale(0.2);
}

.list-item {
  border: 1px solid rgba(157, 176, 209, 0.14);
  border-radius: 18px;
  padding: 14px;
  background: rgba(7, 15, 26, 0.56);
}

.list-item strong,
.list-item span {
  display: block;
}

.list-item strong {
  margin-bottom: 6px;
}

.list-item .item-meta {
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.list-item .item-secondary {
  font-size: 0.92rem;
  line-height: 1.45;
}

.list-item-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(8, 16, 28, 0.96);
  border: 1px solid rgba(86, 183, 255, 0.28);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

@media (max-width: 1280px) {
  .dashboard-topbar {
    flex-direction: column;
  }

  .dashboard-topbar-side {
    justify-content: flex-start;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .credential-grid {
    grid-template-columns: 1fr;
  }

  .auth-highlight-grid {
    grid-template-columns: 1fr;
  }

  .auth-tabs,
  .auth-result-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .dashboard-menu-tabs {
    width: 100%;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .hero {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    padding: 18px;
  }

  .auth-step-list {
    justify-content: flex-start;
  }

  .auth-tabs,
  .auth-result-grid {
    grid-template-columns: 1fr;
  }

  .auth-card-top {
    flex-direction: column;
  }

  .content,
  .sidebar {
    padding: 18px;
  }

  .dashboard-menu-tabs {
    flex-direction: column;
  }

  .dashboard-menu-tab {
    width: 100%;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .button-row {
    grid-template-columns: 1fr;
  }
}
