@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

:root {
  --brand-primary: #08183a;
  --brand-accent: #c14f79;
  --brand-blue: #2f6de1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --page-bg: #f3f6fb;
  --border-soft: rgba(8, 24, 58, 0.1);
  --success-bg: rgba(68, 181, 92, 0.14);
  --success-text: #25813b;
  --danger-bg: #fff1ee;
  --danger-text: #a8241b;
  --shadow-card: 0 8px 24px rgba(24, 39, 75, 0.06);
  --radius-sm: 8px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Poppins", system-ui, sans-serif;
  background: var(--page-bg);
  color: var(--text-main);
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.login-app {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(148, 163, 184, 0.12), transparent 24%),
    linear-gradient(180deg, #0b1220 0%, #111827 56%, #0f172a 100%);
  position: relative;
}

.login-app::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 88%);
  pointer-events: none;
}

.login-stage {
  width: min(100%, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.card,
.login-card,
.login-panel {
  background: white;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.login-panel {
  width: min(100%, 420px);
  padding: 28px 28px 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.login-panel__brand {
  display: grid;
  justify-items: center;
  text-align: center;
  margin-bottom: 20px;
}

.login-panel__logo {
  width: min(100%, 220px);
  height: auto;
  margin-bottom: 14px;
}

.login-panel__eyebrow {
  color: var(--brand-primary);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.login-panel__brand p,
.card-copy {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 0.85rem;
}

.login-form,
.stack,
.stack-col {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-primary);
}

.field--compact span {
  display: none;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(8, 24, 58, 0.14);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  color: var(--brand-primary);
}

input::placeholder {
  color: #9aa7bb;
}

input:focus {
  outline: none;
  border-color: rgba(47, 109, 225, 0.4);
  box-shadow: 0 0 0 4px rgba(47, 109, 225, 0.1);
}

.button,
button,
.header-link {
  min-height: 42px;
  border: none;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

button {
  width: 100%;
  background: #b8bec8;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

.button {
  background: var(--brand-blue);
  color: white;
}

.button--secondary,
.header-link {
  background: white;
  color: var(--brand-primary);
  border: 1px solid var(--border-soft);
}

.button--danger {
  background: var(--brand-accent);
  color: white;
}

.flash {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.flash--error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(168, 36, 27, 0.12);
}

.login-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.login-check input {
  width: 14px;
  min-height: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border-radius: 3px;
  box-shadow: none;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(243, 246, 251, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.portal-header__inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}

.portal-brand {
  display: grid;
  gap: 2px;
}

.portal-brand strong {
  font-size: 1.05rem;
  color: var(--brand-primary);
}

.portal-brand span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.portal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-nav a {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.portal-nav a.is-active {
  background: white;
  color: var(--brand-primary);
  border: 1px solid var(--border-soft);
}

.portal-main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

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

.page-head h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1;
  color: var(--brand-primary);
}

.page-head p {
  margin: 0;
  max-width: 44rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.simple-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.simple-grid--metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.simple-grid--sidebar {
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(260px, 300px);
}

.card {
  padding: 18px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--brand-primary);
}

.card-head {
  margin-bottom: 12px;
}

.info-list,
.action-list {
  display: grid;
  gap: 12px;
}

.info-list div,
.action-tile {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.info-list div:last-child,
.action-tile:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.info-list strong,
.action-tile strong {
  color: var(--brand-primary);
}

.info-list span,
.action-tile span {
  color: var(--text-muted);
  line-height: 1.55;
}

.metric-box {
  padding: 16px;
  background: white;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 6px;
}

.metric-box__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-box__value {
  font-size: 1.35rem;
  color: var(--brand-primary);
}

.metric-box__hint {
  color: var(--text-muted);
  line-height: 1.5;
}

.output {
  min-height: 120px;
  margin: 0;
  padding: 14px;
  background: #0f172a;
  color: #e2f1f0;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
}

.output--tall {
  min-height: 360px;
}

.table-shell {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: white;
}

.table-shell--tall .table-scroll {
  max-height: 720px;
}

.table-scroll {
  max-height: 420px;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.92rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--brand-primary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table td {
  color: var(--text-main);
  background: white;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table__empty {
  color: var(--text-muted) !important;
  text-align: center !important;
}

.monitor-placeholder {
  min-height: 180px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px dashed rgba(8, 24, 58, 0.16);
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
}

.monitor-placeholder strong {
  color: var(--brand-primary);
}

.monitor-placeholder span {
  color: var(--text-muted);
  line-height: 1.65;
}

.monitor-frame {
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: white;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.status-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-muted);
}

.status-card.is-ok {
  background: rgba(68, 181, 92, 0.08);
  border-color: rgba(68, 181, 92, 0.16);
}

.status-card.is-ko {
  background: rgba(193, 79, 121, 0.08);
  border-color: rgba(193, 79, 121, 0.16);
}

.status-card__label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.status-card__state {
  color: var(--brand-primary);
  font-size: 1rem;
}

.status-card__message {
  color: var(--text-muted);
  line-height: 1.55;
}

.debug-block {
  margin-top: 14px;
}

.debug-block summary {
  cursor: pointer;
  color: var(--brand-primary);
  font-weight: 600;
  margin-bottom: 10px;
}

.empty-state {
  min-height: 72px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  display: grid;
  align-items: center;
}

.monitor-embed-page {
  background: var(--page-bg);
}

.monitor-embed {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.portal-main--single {
  padding-top: 20px;
}

@media (max-width: 1040px) {
  .simple-grid--metrics,
  .simple-grid--two,
  .simple-grid--sidebar,
  .status-grid,
  .portal-header__inner {
    grid-template-columns: 1fr;
  }

  .portal-header__inner {
    display: grid;
    padding: 12px 0;
  }
}

@media (max-width: 820px) {
  .page-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .portal-main,
  .portal-header__inner {
    width: min(100% - 28px, 1120px);
  }

  .login-panel {
    width: min(100%, 420px);
    padding: 24px 20px 20px;
  }
}
