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

:root {
  --bg: #dce4f1;
  --bg-deep: #c6d3e6;
  --panel: #ffffff;
  --line: #c8d1df;
  --line-strong: #aab8cd;
  --text: #121a2c;
  --muted: #4c5d7e;
  --primary: #173866;
  --danger: #a12b3a;
  --ok: #1a6f4c;
  --warn: #8a6a18;
  --shadow: 0 18px 40px rgba(10, 20, 38, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.06) 30%, transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
}

#app {
  min-height: 100svh;
}

.screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  padding: 16px;
  background: linear-gradient(150deg, #0f1b31, #11264b 50%, #0d1a30);
  color: #dbe8ff;
  text-align: center;
}

.login-brand img {
  width: min(360px, 84%);
  height: auto;
}

.login-brand p {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-form {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.login-form h2 {
  margin: 0;
}

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

.field label {
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field select {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.field input:focus,
.field select:focus {
  border-color: #ba1938;
  box-shadow: 0 0 0 3px rgba(186, 25, 56, 0.14);
  outline: 0;
}

button {
  border: 1px solid #183665;
  border-radius: 10px;
  background: linear-gradient(180deg, #1e3f72, #14335e);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 13px;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
  grid-template-rows: 70px 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar workspace";
}

.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #edf2fb, #dfe8f6);
}

.sidebar-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-head strong,
.sidebar-head small {
  display: block;
}

.sidebar-head small {
  margin-top: 4px;
  color: var(--muted);
}

.menu {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.menu button {
  text-align: left;
  color: #1b2d50;
  border: 1px solid #c8d3e6;
  background: #f7f9fd;
}

.menu button.active {
  background: #dce8fa;
  border-color: #9db4dc;
}

.topbar {
  grid-area: topbar;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f9fbff, #edf2fb);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
}

.topbar h2 {
  margin: 0;
  font-size: 18px;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  background: #fff;
  color: #1b2d50;
  border: 1px solid #c5d1e4;
}

.workspace {
  grid-area: workspace;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.panel-head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f9fbff, #edf2fb);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.split {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.form-grid {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.credentials {
  padding: 12px;
  color: #122746;
}

.credentials p {
  margin: 0 0 6px;
}

.success-box {
  border-color: #b7d8c8;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form select {
  min-width: 260px;
}

.inline-form input,
.inline-form select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px;
}

.metrics-grid {
  padding: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.warning {
  border-top: 1px solid var(--line);
  background: #fff8e8;
  padding: 10px 12px;
}

.warning ul {
  margin: 6px 0 0 18px;
}

.action-cell {
  display: flex;
  gap: 6px;
}

.table-wrap {
  max-height: calc(100vh - 280px);
  overflow: auto;
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5fd;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: #3d4b63;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px;
}

tbody td {
  border-bottom: 1px solid #e2e9f5;
  padding: 10px;
  font-size: 13px;
  vertical-align: top;
}

tbody tr:hover {
  background: #f8fbff;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
}

.badge.ok {
  color: var(--ok);
  background: #e7f6ee;
  border-color: #b9e1cb;
}

.badge.warn {
  color: var(--warn);
  background: #fff5dc;
  border-color: #f0daa3;
}

.badge.danger {
  color: var(--danger);
  background: #ffe8eb;
  border-color: #f4c3cc;
}

.badge.neutral {
  color: #44597e;
  background: #eaf0fb;
  border-color: #c9d8ef;
}

code {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

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

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "topbar"
      "sidebar"
      "workspace";
  }

  .menu {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-wrap {
    max-height: none;
  }

  .inline-form {
    width: 100%;
  }

  .inline-form select,
  .inline-form input {
    width: 100%;
    min-width: 0;
  }
}
