:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #152033;
  --muted: #667386;
  --border: #d9e1ec;
  --blue: #145fcd;
  --blue-soft: #eaf2ff;
  --green: #188653;
  --green-soft: #e9f7ef;
  --amber: #a96800;
  --amber-soft: #fff4de;
  --shadow: 0 18px 48px rgba(21, 32, 51, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  color: #344052;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: #cfe0ff;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  gap: 10px;
}

.sidebar-card strong {
  display: block;
  font-size: 14px;
}

.sidebar-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot-ok {
  background: var(--green);
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 7px;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 16px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.topbar p,
.section-heading p,
.panel-header p,
.action-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.ok {
  background: var(--green-soft);
  color: var(--green);
  border-color: #c9ebd8;
}

.status-pill.warn {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #f4d59c;
}

.section {
  scroll-margin-top: 22px;
  margin-bottom: 18px;
}

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

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

.status-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-card {
  padding: 20px;
  min-height: 210px;
  border-top-width: 4px;
}

.status-card.good {
  border-top-color: var(--green);
}

.status-card.warning {
  border-top-color: var(--amber);
}

.card-kicker {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

dl {
  display: grid;
  gap: 11px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #edf1f6;
  padding-top: 10px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.7fr);
  gap: 14px;
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-metric {
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--surface-2);
}

.check-status {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.check-status.done {
  background: var(--green);
}

.check-status.pending {
  background: var(--amber);
}

.check-item strong {
  display: block;
  font-size: 14px;
}

.check-item span {
  color: var(--muted);
  font-size: 13px;
}

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

.action-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, #ffffff 0%, #f2f7ff 100%);
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

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

.secondary-button {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
}

.ghost-button {
  color: var(--blue);
  background: transparent;
  border: 1px solid #cfe0ff;
}

.command-header {
  align-items: center;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: #8db6f7;
  box-shadow: 0 0 0 3px rgba(20, 95, 205, 0.12);
}

#commandSearch {
  max-width: 250px;
}

.command-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.command-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(0, 1fr) 132px;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.command-row:last-child {
  border-bottom: 0;
}

.command-row code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid #dde4ef;
  border-radius: 6px;
  background: #f4f6f9;
  padding: 7px 9px;
  color: #263345;
}

.command-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.prompt-panel {
  padding-bottom: 22px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.mode-tab {
  border-radius: 0;
  background: #ffffff;
  color: #344052;
  border-right: 1px solid var(--border);
}

.mode-tab:last-child {
  border-right: 0;
}

.mode-tab.active {
  background: var(--blue);
  color: #ffffff;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: #344052;
  font-size: 13px;
  font-weight: 700;
}

.form-grid label:first-child {
  grid-row: span 2;
}

.preview-block {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

pre {
  margin: 0;
  min-height: 150px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 14px;
  font: 14px/1.55 Consolas, "Courier New", monospace;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  color: #ffffff;
  background: #172033;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav-list {
    display: flex;
    flex-wrap: wrap;
  }

  .sidebar-card {
    margin-top: 0;
    margin-left: auto;
  }

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

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .section-heading,
  .panel-header,
  .command-header {
    flex-direction: column;
    align-items: stretch;
  }

  .status-grid,
  .split-section,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .command-row {
    grid-template-columns: 1fr;
  }

  #commandSearch {
    max-width: none;
  }
}
