:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #172026;
  --muted: #6a747d;
  --line: #d9dee4;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --warn: #8a4b00;
  --warn-bg: #fff7e6;
  --ok: #087443;
  --shadow: 0 18px 45px rgba(27, 39, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

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

.sidebar {
  background: #101820;
  color: #f8fafc;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

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

.mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #22c55e;
  color: #092112;
  font-weight: 800;
  border-radius: 8px;
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.25;
}

.brand p,
.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.brand p {
  color: #9aa7b2;
}

.stack {
  display: grid;
  gap: 16px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dce4ea;
  font-size: 14px;
}

.switch input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.file-grid {
  display: grid;
  gap: 10px;
}

.file-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.file-card span,
.field span {
  font-size: 13px;
  color: #dce4ea;
  font-weight: 650;
}

.file-card input {
  width: 100%;
  color: #a9b6c2;
  font-size: 12px;
}

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

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #dce4ea;
  background: rgba(2, 6, 23, 0.5);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.primary,
.secondary {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary {
  background: #22c55e;
  color: #082012;
}

.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.secondary {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary:disabled {
  color: #9aa3ad;
  cursor: not-allowed;
}

.button-icon {
  font-size: 18px;
  line-height: 1;
}

.notes {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: #aebbc7;
  font-size: 13px;
}

.note-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-row span {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
}

.workspace {
  min-width: 0;
  padding: 26px 28px 32px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar h2 {
  font-size: 24px;
  line-height: 1.2;
}

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

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(27, 39, 51, 0.04);
}

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

.kpi strong {
  display: block;
  margin-top: 9px;
  font-size: 28px;
  line-height: 1;
}

.kpi.alert strong {
  color: var(--danger);
}

.panel {
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.tab.active {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line);
}

.filters {
  display: flex;
  gap: 10px;
}

.filters input,
.filters select {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
}

.filters input {
  width: min(360px, 32vw);
}

.table-wrap {
  overflow: auto;
  min-height: 420px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1120px;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eaf0f5;
  color: #23313c;
  text-align: left;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

th,
td {
  padding: 10px 11px;
  border-right: 1px solid #edf0f3;
  border-bottom: 1px solid #edf0f3;
  vertical-align: top;
  max-width: 360px;
}

tbody tr:hover {
  background: #f8fbfd;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-weight: 760;
  font-size: 11px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.tag.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.tag.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.tag.ok {
  background: #eaf8f0;
  color: var(--ok);
}

.empty,
.error {
  min-height: 420px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 650;
}

.error {
  color: var(--danger);
}

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

  .sidebar {
    min-height: auto;
  }

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

  .panel-head,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs,
  .filters {
    overflow-x: auto;
  }

  .filters input {
    width: 100%;
  }
}
