:root {
  --bg: #edf6fb;
  --surface: #ffffff;
  --surface-2: #f7fbfe;
  --text: #152333;
  --muted: #607286;
  --line: #cfe1ee;
  --blue: #006bb6;
  --blue-2: #0b85d7;
  --red: #d71920;
  --gold: #f4b000;
  --green: #3d9b45;
  --shadow: 0 14px 34px rgba(28, 67, 100, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f6fbff 0, var(--bg) 42%, #e7f2f8 100%);
  font-size: 16px;
}

a { color: var(--blue); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 44px);
  background: rgba(247, 251, 254, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 900;
}

.brand img { width: 38px; height: 38px; object-fit: contain; }

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.nav a, .link-button {
  color: var(--text);
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 10px;
}

.nav a:hover, .link-button:hover {
  border-color: var(--line);
  border-radius: 6px;
  text-decoration: none;
  background: var(--surface);
}

.page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px clamp(14px, 3vw, 42px) 52px;
}

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

h1, h2 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(28px, 3vw, 44px); }
h2 { font-size: 20px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 900;
}

.muted { color: var(--muted); }
.alert {
  padding: 11px 13px;
  border: 1px solid rgba(215, 25, 32, 0.26);
  background: #fff3f4;
  color: #9b1015;
  border-radius: 8px;
  font-weight: 800;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.primary:hover { background: var(--blue-2); text-decoration: none; }

.login-shell {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(460px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-logo { width: 64px; height: 64px; }

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

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

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b9d0df;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea { resize: vertical; }
input[type="range"] { padding: 0; }
output { color: var(--blue); font-weight: 900; }

.full { grid-column: 1 / -1; }

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 98px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 7px 18px rgba(28, 67, 100, 0.08);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.15;
}

.status {
  padding: 6px 10px;
  border-radius: 6px;
  color: #fff;
  font-weight: 900;
}

.status.good { background: var(--green); }
.status.warn { background: var(--red); }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.two-col > * { min-width: 0; }

.verdict {
  padding: 14px;
  background: var(--surface-2);
  border-left: 5px solid var(--gold);
  border-radius: 6px;
  font-weight: 800;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 800;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.checks label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checks input {
  width: 20px;
  min-height: 20px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.owner-switch {
  margin-bottom: 16px;
  max-width: 280px;
}

canvas {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav { justify-content: flex-start; }
  .page-head { align-items: stretch; flex-direction: column; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .metric strong { font-size: 21px; }
  .login-panel { padding: 22px; }
}
