:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #fbfbfd;
  --surface-hover: #f8f8fa;
  --line: #e5e5ea;
  --line-strong: #d2d2d7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --subtle: #8e8e93;
  --blue: #0071e3;
  --blue-soft: #eef6ff;
  --green: #248a3d;
  --green-soft: #eaf6ed;
  --orange: #bf5b00;
  --orange-soft: #fff4e5;
  --red: #d70015;
  --red-soft: #fff0f1;
  --r: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
select,
textarea {
  border-radius: var(--r);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input,
select {
  height: 38px;
  padding: 0 11px;
}

textarea {
  min-height: 92px;
  padding: 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #98c8ff;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 2px 12px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--text);
  color: #ffffff;
  font-size: 19px;
  font-weight: 800;
}

.brand span,
.topbar span,
.section-head span,
.sidebar-foot span,
.hero-copy span,
.readiness span,
label span {
  display: block;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.25;
}

.nav {
  display: grid;
  gap: 18px;
}

.nav-group p {
  margin: 0 0 7px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 800;
}

.nav-group button {
  width: 100%;
  display: block;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.nav-group button:hover {
  background: var(--surface-hover);
}

.nav-group button.active {
  border-color: #b9d7f7;
  background: var(--blue-soft);
}

.nav-group b {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.nav-group small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-soft);
}

.sidebar-foot b {
  display: block;
  margin-top: 5px;
  font-size: 13px;
}

.sidebar-foot small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: -22px -22px 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.9);
  backdrop-filter: blur(18px);
}

.topbar > div,
.top-actions,
.toolbar,
.system-bar,
.section,
.table-wrap {
  min-width: 0;
}

.topbar h1 {
  margin-top: 3px;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 760;
}

.top-actions {
  display: grid;
  grid-template-columns: 280px 220px auto auto auto;
  gap: 8px;
  align-items: center;
}

.top-actions.clean {
  grid-template-columns: auto;
}

.top-actions input {
  min-width: 0;
}

.data-state {
  display: block;
  margin-top: 8px;
}

.primary,
.secondary,
.row-actions button {
  height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 13px;
  font-weight: 720;
  white-space: nowrap;
}

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

.secondary:hover,
.row-actions button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.hero-copy h1 {
  max-width: 820px;
  margin-top: 8px;
  font-size: 32px;
  line-height: 1.16;
  font-weight: 760;
}

.hero-copy p {
  max-width: 780px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.readiness {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-soft);
}

.readiness strong {
  display: block;
  margin-top: 10px;
  font-size: 44px;
  line-height: 1;
  font-weight: 760;
}

.readiness small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.progress {
  height: 7px;
  margin-top: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #ededf0;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

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

.metric,
.section {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.metric {
  min-height: 112px;
  padding: 14px;
}

.metric span,
.metric small {
  display: block;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.45;
}

.metric strong {
  display: block;
  margin: 11px 0 4px;
  font-size: 27px;
  line-height: 1;
  font-weight: 760;
}

.metric.ok {
  border-color: #cde8d4;
}

.metric.warn {
  border-color: #f5d5a9;
}

.metric.danger {
  border-color: #f5b8bf;
}

.layout {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

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

.layout.main-side {
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
}

.section {
  padding: 14px;
}

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

.section-head h2 {
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 760;
}

.toolbar,
.system-bar {
  display: grid;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.system-bar {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.toolbar-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button-row {
  margin-top: 12px;
}

.search span,
label span {
  margin-bottom: 5px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-list button {
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  text-align: left;
}

.compact-list button:hover {
  background: var(--surface-hover);
}

.compact-list b {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-list small {
  grid-column: 2;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.rank {
  width: 34px;
  height: 34px;
  display: grid;
  grid-row: span 2;
  place-items: center;
  border-radius: var(--r);
  background: #f0f0f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rank.ok {
  background: var(--green-soft);
  color: var(--green);
}

.rank.warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.rank.danger {
  background: var(--red-soft);
  color: var(--red);
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

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

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

th {
  background: #f2f2f5;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 780;
}

td {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

tbody tr:hover td {
  background: var(--surface-hover);
}

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

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.row-actions button {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
}

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

.badge.warn {
  color: var(--orange);
  background: var(--orange-soft);
}

.badge.danger {
  color: var(--red);
  background: var(--red-soft);
}

.badge.neutral,
.badge.idle {
  color: var(--muted);
  background: #f0f0f2;
}

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

.status-list div {
  min-height: 136px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-soft);
}

.status-list b,
.status-list span,
.status-list small {
  display: block;
}

.status-list b {
  font-size: 15px;
  line-height: 1.2;
}

.status-list span {
  margin-top: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 740;
}

.status-list small {
  min-height: 48px;
  margin: 7px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.maintenance-form h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 760;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

label.wide {
  grid-column: 1 / -1;
}

.check-field {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-soft);
}

.check-field input {
  width: auto;
  height: auto;
}

.check-field span {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.empty {
  text-align: center;
  color: var(--subtle);
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.login-brand {
  padding-bottom: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: min(720px, calc(100vw - 48px));
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r);
  background: rgba(29, 29, 31, 0.94);
  color: #ffffff;
  font-size: 13px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
}

@media (max-width: 1280px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar,
  .layout.two,
  .layout.main-side,
  .hero {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .status-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    position: static;
    display: grid;
    margin: -14px -14px 14px;
    padding: 14px;
  }

  .top-actions,
  .toolbar,
  .system-bar,
  .metric-grid,
  .status-list,
  .form-grid,
  .nav {
    grid-template-columns: 1fr;
  }

  .top-actions button,
  .toolbar-actions button,
  .system-bar button {
    width: 100%;
  }

  .hero-copy h1 {
    font-size: 25px;
  }
}
