:root {
  --bg: #f6f7f9;
  --ink: #17202a;
  --muted: #687386;
  --panel: #ffffff;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-2: #b45309;
  --soft: #edf7f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  margin: 22px 0 14px;
  font-size: 17px;
}

p {
  margin-top: 6px;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 18px;
}

main {
  padding: 18px;
}

main .layout {
  padding: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.tab-page.layout.active {
  display: grid;
}

.single {
  max-width: 460px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

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

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

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

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

.metric.warning strong {
  color: var(--accent-2);
}

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

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-label {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #eef1f5;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

.bar-value {
  text-align: left;
  font-weight: 700;
}

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

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.55;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.wide {
  min-height: 96px;
}

.tall {
  min-height: 160px;
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.secondary {
  background: var(--soft);
  color: var(--accent);
  border: 1px solid #b8dcd6;
}

.side {
  align-self: start;
  position: sticky;
  top: 14px;
}

.toggle {
  grid-template-columns: 22px 1fr;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  margin-bottom: 12px;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.sample {
  min-height: 96px;
}

.preview {
  margin-top: 12px;
  padding: 12px;
  min-height: 92px;
  border: 1px solid #d7c3a3;
  border-radius: 8px;
  background: #fff8ed;
  line-height: 1.7;
}

.note {
  margin-top: 18px;
  padding: 12px;
  border-right: 4px solid var(--accent-2);
  background: #fff8ed;
  color: #5b4630;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 18px;
  bottom: 18px;
  padding: 11px 14px;
  border-radius: 8px;
  color: #fff;
  background: #1f2937;
  opacity: 0;
  transform: translateY(8px);
  transition: 160ms ease;
}

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

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

.table-head input {
  max-width: 360px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: var(--muted);
  position: sticky;
  top: 0;
}

td.clip {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .topbar,
  .layout {
    grid-template-columns: 1fr;
  }

  .layout {
    display: block;
  }

  .side {
    margin-top: 16px;
    position: static;
  }

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

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


/* platform separation fixes */
select { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 10px 11px; color: var(--ink); background: #fff; font: inherit; line-height: 1.55; }
.settings-page.active { display: block; }
.settings-card { width: min(720px, 100%); margin-inline-start: auto; margin-inline-end: 0; position: static; }
.toolbar { display: flex; justify-content: flex-start; margin-bottom: 14px; }
.toolbar label { width: min(280px, 100%); }
.platform-panel { margin-bottom: 18px; }
.platform-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.platform-card { border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: #fbfcfd; }
.platform-card strong { display: block; margin-bottom: 8px; font-size: 16px; }
.platform-card span { display: block; color: var(--muted); font-size: 12px; line-height: 1.8; }
.table-tools { display: grid; grid-template-columns: 180px 360px; gap: 10px; align-items: end; }
.table-tools input { max-width: none; }
@media (max-width: 900px) { .platform-cards, .table-tools { grid-template-columns: 1fr; } }
