:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #17202a;
  --muted: #657080;
  --line: #d6dde6;
  --blue: #2563eb;
  --blue-dark: #1746a2;
  --green: #138a5b;
  --orange: #c46a1a;
  --red: #b42318;
  --shadow: 0 8px 24px rgba(20, 30, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(440px, 100%);
  padding: 0;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1 {
  margin: 4px 0 22px;
  font-size: 28px;
  line-height: 1.15;
}

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

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 44px) 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px clamp(18px, 4vw, 44px) 0;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.tab.is-active {
  border-bottom-color: var(--blue);
  color: var(--text);
}

main {
  padding: 22px clamp(18px, 4vw, 44px) 42px;
}

.is-hidden {
  display: none;
}

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

.account-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto minmax(180px, 260px) auto;
  align-items: end;
  gap: 14px;
}

.account-status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.control-strip {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

input[type="text"],
input[type="search"],
input[type="number"],
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: var(--blue);
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.button {
  padding: 0 16px;
}

.icon-button {
  width: 42px;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
  font-size: 20px;
}

.primary {
  background: var(--blue);
  color: #ffffff;
}

.primary:hover {
  background: var(--blue-dark);
}

.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.secondary:hover,
.icon-button:hover {
  border-color: #9aa8bb;
}

.table-shell {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafc;
  color: #404b5a;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.software-name {
  min-width: 220px;
  font-weight: 800;
}

.version {
  min-width: 150px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  min-width: 78px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #465365;
  font-size: 12px;
  font-weight: 800;
}

.status-ready {
  background: #e4f6ef;
  color: #106d49;
}

.status-warning,
.status-installing {
  background: #fff1d8;
  color: #9a4f00;
}

.status-critical,
.status-deleting {
  background: #fde8e5;
  color: #9f1d13;
}

.rating-control {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 34px;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.rating-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 30px;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--blue-dark);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.score-input {
  max-width: 120px;
}

.usage-input {
  max-width: 140px;
}

.gpu-select {
  min-width: 96px;
}

.gpu-count-input {
  max-width: 120px;
}

.gpu-select:disabled,
.gpu-count-input:disabled {
  color: var(--muted);
  background: var(--surface-2);
  cursor: not-allowed;
}

.toggle-control {
  display: inline-grid;
  grid-template-columns: 18px auto;
  align-items: center;
  gap: 8px;
  min-width: 82px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.toggle-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.chart-section {
  margin: 0 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 16px 16px 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

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

.chart-scroll {
  overflow-x: auto;
  padding: 16px 14px 14px;
}

.column-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 58px;
  align-items: end;
  min-height: 280px;
  gap: 8px;
  padding-top: 24px;
}

.column {
  display: grid;
  grid-template-rows: 210px 48px;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.bar {
  position: relative;
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: var(--blue);
}

.bar.usage {
  background: var(--green);
}

.bar.effort {
  background: var(--orange);
}

.bar-value {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  color: #2e3846;
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
}

.stats-table-shell {
  margin-top: 18px;
}

.stats-table td,
.stats-table th {
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17202a;
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: var(--red);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-strip {
    grid-template-columns: 1fr;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .topbar-actions {
    width: 100%;
  }

  .button.secondary {
    flex: 1;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 11px 10px;
  }
}
