:root {
  --bg-main: #f2f4f8;
  --bg-shell-top: #1f3550;
  --bg-shell-bottom: #2f4f73;
  --bg-sidebar: #243a55;
  --bg-card: #ffffff;
  --text-main: #1b2838;
  --text-muted: #5f7086;
  --line-soft: #d6dde7;
  --accent: #285f9e;
  --accent-dark: #1f4d81;
  --danger: #b23b3b;
  --ok: #2f7d4a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", "Trebuchet MS", sans-serif;
  color: var(--text-main);
  background: var(--bg-main);
}

.shell-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(125deg, var(--bg-shell-top), var(--bg-shell-bottom));
  clip-path: polygon(0 0, 100% 0, 100% 23%, 0 38%);
  opacity: 0.95;
  z-index: -2;
}

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

body.auth-mode .layout {
  grid-template-columns: 1fr;
}

body.auth-mode .sidebar,
body.auth-mode .topbar {
  display: none;
}

body.auth-mode .main-panel {
  max-width: 860px;
  margin: 2.5rem auto;
  width: 100%;
  padding: 0 1rem;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #f5f7fb;
  padding: 1.2rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.35rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.brand-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.83);
  font-weight: 500;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.main-panel {
  padding: 0.85rem 1.2rem 1.3rem;
}

.topbar {
  border: 1px solid rgba(199, 211, 227, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  color: var(--text-main);
  padding: 0.7rem 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 22px rgba(20, 37, 56, 0.08);
  animation: fadeInDown 0.35s ease;
}

.page-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.page-subtitle {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.83rem;
}

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

.session-user {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cfd9e8;
  background: #f4f8fd;
  color: #2d4258;
  border-radius: 999px;
  padding: 0.18rem 0.58rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.content-area {
  padding-bottom: 1rem;
}

.card-panel {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(35, 58, 85, 0.08);
  background: var(--bg-card);
  animation: fadeInUp 0.35s ease;
}

.hero-panel {
  background: linear-gradient(145deg, #fbfdff, #f2f7ff);
}

.section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.section-copy {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  max-width: 72ch;
}

.auth-wrapper {
  max-width: 760px;
  margin: 1.3rem auto 0;
}

.auth-card {
  border-top: 5px solid var(--accent);
}

.metric-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 0.95rem;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.metric-value {
  margin: 0.35rem 0 0;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.panel-header {
  background: #f7f9fc;
  border-bottom: 1px solid var(--line-soft);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-caption {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.form-section-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.table {
  font-size: 0.92rem;
}

.table > :not(caption) > * > * {
  border-bottom-width: 1px;
  border-color: #e2e8f0;
  vertical-align: middle;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: #f9fbff;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-soft.ok {
  background: #e8f6ee;
  color: var(--ok);
}

.badge-soft.warn {
  background: #fbeaea;
  color: var(--danger);
}

.badge-soft.partial {
  background: #fff4df;
  color: #9a5a00;
}

.badge-soft.neutral {
  background: #e9eef7;
  color: #425b7a;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.form-control,
.form-select {
  border-color: #c9d4e3;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #7ca3d3;
  box-shadow: 0 0 0 0.2rem rgba(40, 95, 158, 0.15);
}

.mono-area {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
}

.alert {
  border-radius: 11px;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.86rem;
  padding: 1rem;
  text-align: center;
}

.text-ok {
  color: var(--ok);
}

.text-warn {
  color: #9a5a00;
}

.servers-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid #dae3ef;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(40, 95, 158, 0.06), rgba(255, 255, 255, 0.9)),
    #fbfdff;
}

.servers-toolbar-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.servers-toolbar-subtitle {
  margin: 0.2rem 0 0;
  color: #607790;
  font-size: 0.8rem;
  max-width: 62ch;
}

.servers-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.servers-check-col {
  width: 42px;
}

.servers-row-check {
  margin-top: 0;
}

.servers-queue-card,
.servers-bulk-card {
  border: 1px solid #dae3ef;
  border-radius: 12px;
  background: #fcfdff;
  padding: 0.9rem 1rem 1rem;
}

.servers-queue-head,
.servers-bulk-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.servers-queue-kicker {
  margin: 0 0 0.12rem;
  color: #5f7891;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.servers-queue-note {
  margin: 0;
  color: #607790;
  font-size: 0.8rem;
}

.servers-queue-actions,
.servers-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.servers-bulk-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.servers-bulk-preview-title {
  margin: 0;
  font-size: 0.83rem;
  font-weight: 700;
  color: #30475f;
}

.servers-bulk-preview-meta {
  margin: 0;
  color: #647c96;
  font-size: 0.76rem;
}

.servers-bulk-preview-table {
  border: 1px solid #dfe7f2;
  border-radius: 10px;
  background: #fff;
}

.servers-queue-table .empty-state,
.servers-bulk-preview-table .empty-state {
  padding: 0.9rem;
}

.servers-queue-run-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.servers-queue-run-link:hover {
  text-decoration: underline;
}

.queue-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.queue-status.pending {
  background: #edf1f7;
  color: #4e6784;
}

.queue-status.running {
  background: #e8f1ff;
  color: #275e97;
}

.queue-status.ok {
  background: #e8f6ee;
  color: #2f7d4a;
}

.queue-status.failed {
  background: #fbeaea;
  color: #b23b3b;
}

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

.logs-summary-pill {
  border: 1px solid #dce4ef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.65rem 0.75rem;
}

.logs-summary-label {
  margin: 0;
  color: #5a718a;
  font-size: 0.75rem;
  font-weight: 600;
}

.logs-summary-value {
  margin: 0.3rem 0 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.logs-run-row.is-selected {
  background: #edf4ff;
}

.logs-table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.logs-table-toolbar-block {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.logs-table-toolbar-block .form-label {
  color: #5e7690;
  font-size: 0.76rem;
  font-weight: 600;
}

.logs-table-toolbar-block .form-select {
  min-width: 5rem;
}

.logs-table-meta {
  margin: 0;
  color: #5d7690;
  font-size: 0.78rem;
  font-weight: 600;
}

.logs-table-wrap {
  border: 1px solid #dce4ef;
  border-radius: 10px;
  background: #fff;
}

.logs-table-wrap .table {
  margin-bottom: 0;
}

.logs-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.logs-pagination .btn {
  min-width: 2rem;
}

.logs-pagination .btn.active {
  cursor: default;
}

.logs-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 29, 44, 0.36);
  z-index: 991;
}

.logs-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(780px, 100vw);
  background: #f7faff;
  border-left: 1px solid #d7e0ed;
  box-shadow: -14px 0 30px rgba(19, 37, 57, 0.18);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  z-index: 996;
  display: flex;
  flex-direction: column;
}

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

.logs-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #dbe4f0;
  background: #ffffff;
}

.logs-drawer-kicker {
  margin: 0;
  color: #5a738d;
  font-size: 0.76rem;
  font-weight: 600;
}

.logs-drawer-title {
  margin: 0.12rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.logs-drawer-subtitle {
  margin: 0.08rem 0 0;
  color: #607893;
  font-size: 0.8rem;
}

.logs-drawer-content {
  padding: 0.9rem;
  overflow-y: auto;
}

.logs-progress-card {
  border: 1px solid #d9e2ee;
  border-radius: 10px;
  background: #fff;
  padding: 0.72rem;
  margin-bottom: 0.7rem;
}

.logs-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.logs-progress-phase {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2e465f;
}

.logs-progress-eta {
  margin: 0;
  font-size: 0.76rem;
  color: #5f7891;
}

.logs-progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e8eef7;
}

.logs-progress-bar {
  background: linear-gradient(90deg, #2f6ea7, #2f8cc1);
}

.logs-progress-foot {
  margin-top: 0.45rem;
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  font-size: 0.75rem;
  color: #536d87;
}

.logs-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.58rem;
  margin-bottom: 0.72rem;
}

.logs-detail-wide {
  grid-column: 1 / -1;
}

.logs-detail-label {
  margin: 0;
  color: #617890;
  font-size: 0.72rem;
}

.logs-detail-value {
  margin: 0.08rem 0 0;
  color: #1f3043;
  font-size: 0.82rem;
  font-weight: 600;
  word-break: break-word;
}

.logs-stream-card {
  border: 1px solid #dce5f1;
  border-radius: 10px;
  background: #fff;
  padding: 0.7rem;
}

.logs-stream-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.logs-stream-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #2c425a;
}

.logs-stream-state {
  font-size: 0.74rem;
  color: #5f7891;
}

.logs-tail {
  margin: 0;
  border: 1px solid #dfe8f3;
  border-radius: 8px;
  background: #f9fbfe;
  min-height: 320px;
  max-height: 460px;
  overflow: auto;
  padding: 0.65rem;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #2f4259;
  white-space: pre-wrap;
}

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

.uptime-summary-card {
  border: 1px solid #dce4ef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.7rem 0.8rem;
}

.uptime-summary-label {
  margin: 0;
  color: #58708a;
  font-size: 0.78rem;
  font-weight: 600;
}

.uptime-summary-value {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.uptime-server-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.uptime-server-card {
  width: 100%;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  padding: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.uptime-server-card:hover {
  border-color: #b5c6dc;
  box-shadow: 0 8px 20px rgba(25, 51, 79, 0.08);
  transform: translateY(-1px);
}

.uptime-server-card:focus-visible {
  outline: 3px solid rgba(40, 95, 158, 0.25);
  outline-offset: 2px;
}

.uptime-server-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.uptime-server-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.uptime-server-url {
  margin: 0.08rem 0 0;
  color: #5d748d;
  font-size: 0.79rem;
}

.uptime-server-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}

.uptime-server-kv {
  min-width: 0;
}

.uptime-server-kv-label {
  margin: 0;
  color: #617890;
  font-size: 0.72rem;
}

.uptime-server-kv-value {
  margin: 0.08rem 0 0;
  color: #1f3043;
  font-size: 0.82rem;
  font-weight: 600;
}

.uptime-server-sparkline {
  height: 44px;
  border: 1px solid #e2e9f3;
  border-radius: 8px;
  background: #fafcff;
  padding: 0.2rem 0.25rem;
}

.uptime-server-sparkline svg {
  width: 100%;
  height: 100%;
  display: block;
}

.uptime-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 29, 44, 0.35);
  z-index: 990;
}

.uptime-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(740px, 100vw);
  background: #f7faff;
  border-left: 1px solid #d7e0ed;
  box-shadow: -14px 0 28px rgba(19, 37, 57, 0.16);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  z-index: 995;
  display: flex;
  flex-direction: column;
}

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

.uptime-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #dbe4f0;
  background: #ffffff;
}

.uptime-drawer-kicker {
  margin: 0;
  color: #5a738d;
  font-size: 0.76rem;
  font-weight: 600;
}

.uptime-drawer-title {
  margin: 0.12rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.uptime-drawer-subtitle {
  margin: 0.08rem 0 0;
  color: #607893;
  font-size: 0.8rem;
}

.uptime-drawer-content {
  padding: 0.9rem;
  overflow-y: auto;
}

.uptime-drawer-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.uptime-mini-label {
  margin: 0;
  color: #607892;
  font-size: 0.72rem;
}

.uptime-mini-value {
  margin: 0.14rem 0 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.uptime-chart-card {
  border: 1px solid #dce5f1;
  border-radius: 10px;
  background: #fff;
  padding: 0.7rem;
  margin-bottom: 0.7rem;
}

.uptime-chart-title {
  margin: 0 0 0.45rem;
  font-size: 0.83rem;
  font-weight: 700;
  color: #2c425a;
}

.uptime-latency-chart {
  min-height: 136px;
}

.uptime-latency-chart svg {
  width: 100%;
  height: 136px;
  display: block;
}

.uptime-availability-strip {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 0.2rem;
}

.uptime-availability-dot {
  height: 8px;
  border-radius: 6px;
  background: #d8e2ef;
}

.uptime-availability-dot.ok {
  background: #59a273;
}

.uptime-availability-dot.fail {
  background: #cc6464;
}

.uptime-events {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.uptime-event {
  border: 1px solid #e0e7f2;
  border-radius: 8px;
  background: #fcfdff;
  padding: 0.55rem 0.6rem;
}

.uptime-event-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.uptime-event-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334b66;
}

.uptime-event-time {
  margin: 0;
  font-size: 0.73rem;
  color: #637d97;
}

.uptime-event-desc {
  margin: 0.3rem 0 0;
  color: #4d6781;
  font-size: 0.76rem;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.1rem;
  }

  .sidebar-nav .nav-link {
    white-space: nowrap;
  }

  .main-panel {
    padding: 0.75rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

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

  .servers-toolbar,
  .servers-queue-head,
  .servers-bulk-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .servers-toolbar-actions,
  .servers-queue-actions,
  .servers-bulk-actions {
    justify-content: flex-start;
  }

  .logs-table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .logs-pagination {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .logs-drawer {
    width: 100vw;
  }

  .logs-detail-grid {
    grid-template-columns: 1fr;
  }

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

  .uptime-drawer {
    width: 100vw;
  }

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