:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #14213d;
  --muted: #64748b;
  --line: #dbe4ee;
  --blue: #2563eb;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --nav: #101828;
  --shadow: 0 18px 45px rgba(20, 33, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 36%),
    radial-gradient(circle at 80% 0%, rgba(5, 150, 105, 0.14), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 28px;
  width: min(920px, 100%);
  grid-template-columns: 1.1fr 0.9fr;
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(40px, 7vw, 78px);
  line-height: 0.95;
}

h2 {
  font-size: 34px;
}

h3 {
  font-size: 18px;
}

.muted {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

button,
.button-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
}

.button-link.alt {
  background: var(--nav);
}

.ghost-button {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: var(--nav);
  color: white;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #38bdf8;
  color: #082f49;
  font-weight: 900;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #b6c3d4;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  border-radius: 8px;
  color: #d5deeb;
  padding: 12px;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.content {
  display: grid;
  gap: 22px;
  padding: 26px;
}

.topbar,
.panel-title,
.report-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar,
.filters,
.report-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.kpi,
.panel {
  border: 1px solid rgba(219, 228, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(20, 33, 61, 0.07);
}

.kpi {
  display: grid;
  gap: 8px;
  padding: 18px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  font-size: 34px;
}

.kpi small {
  color: var(--muted);
}

.panel {
  padding: 18px;
}

.panel-title {
  margin-bottom: 14px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

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

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #1f2937;
  font-size: 13px;
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.warn {
  color: var(--amber);
}

.danger {
  color: var(--red);
}

.log-output {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  padding: 16px;
  font: 12px/1.55 "Cascadia Mono", "Consolas", monospace;
  white-space: pre-wrap;
}

.card-list,
.timeline {
  display: grid;
  gap: 10px;
}

.mini-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.mini-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mini-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-card .actions button {
  min-height: 34px;
  padding: 0 10px;
}

.timeline-item {
  border-left: 4px solid var(--blue);
  background: #f8fafc;
  padding: 10px 12px;
}

.timeline-item.critical {
  border-color: var(--red);
}

.timeline-item.warning {
  border-color: var(--amber);
}

.timeline-item small {
  color: var(--muted);
}

.terminal-grid {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 10px;
  margin-bottom: 12px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  padding: 11px 12px;
  font: 13px/1.5 "Cascadia Mono", "Consolas", monospace;
}

.compact-title {
  margin-top: 16px;
}

.status-up {
  color: var(--green);
}

.status-down {
  color: var(--red);
}

.mobile-nav {
  display: none;
}

.detail-modal {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 22px;
}

.detail-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
}

.detail-modal p {
  color: var(--muted);
  line-height: 1.5;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  min-height: 34px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--ink);
  padding: 0;
}

@media (max-width: 1000px) {
  .app-shell,
  .login-panel,
  .grid-two,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar,
  .panel-title,
  .report-panel,
  .terminal-grid,
  .toolbar,
  .filters,
  .report-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .terminal-grid {
    display: flex;
  }

  body {
    background: #f3f7fb;
  }

  .app-shell {
    display: block;
    padding-bottom: 76px;
  }

  .content {
    gap: 14px;
    padding: 14px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -14px -14px 0;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(243, 247, 251, 0.94);
    backdrop-filter: blur(12px);
  }

  h2 {
    font-size: 24px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar select,
  .toolbar button {
    min-width: 0;
  }

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

  .kpi,
  .panel {
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(20, 33, 61, 0.07);
  }

  .kpi {
    min-height: 118px;
    padding: 14px;
  }

  .kpi strong {
    font-size: 28px;
  }

  .panel {
    padding: 14px;
  }

  .panel-title {
    gap: 8px;
    margin-bottom: 10px;
  }

  .grid-two .panel canvas {
    max-height: 220px;
  }

  table {
    min-width: 620px;
  }

  th,
  td {
    padding: 9px 7px;
    font-size: 12px;
  }

  #docker,
  #processes {
    max-height: 560px;
    overflow: hidden;
  }

  .table-wrap {
    max-height: 430px;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .log-output {
    max-height: 300px;
    font-size: 11px;
  }

  .mobile-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    border: 1px solid rgba(219, 228, 238, 0.9);
    border-radius: 18px;
    background: rgba(16, 24, 40, 0.94);
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.24);
    padding: 8px;
    backdrop-filter: blur(14px);
  }

  .mobile-nav a {
    display: grid;
    min-height: 42px;
    place-items: center;
    border-radius: 12px;
    color: #dbeafe;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
  }

  .mobile-nav a:active,
  .mobile-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .detail-modal {
    position: fixed;
    top: auto;
    bottom: 0;
    width: 100vw;
    max-width: none;
    margin: 0;
    border-radius: 18px 18px 0 0;
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  }
}
