:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #121316;
  --panel-2: #181a20;
  --panel-3: #24272f;
  --line: #2d3038;
  --line-soft: #20232a;
  --text: #f3f5f8;
  --muted: #969da8;
  --dim: #68717c;
  --blue: #3478f6;
  --blue-soft: rgba(52, 120, 246, 0.15);
  --green: #29c779;
  --red: #ff6058;
  --yellow: #f2c94c;
  --cyan: #4ec7e6;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1160px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  min-height: 760px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #090a0c;
  border-bottom: 1px solid var(--line);
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #6da5a8;
  color: white;
  font-weight: 850;
}

.symbol-pill {
  height: 38px;
  min-width: 170px;
  border-radius: 6px;
  padding: 0 16px;
  text-align: left;
  background: #2c2f35;
  font-weight: 850;
}

.timeframes {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}

.timeframes button {
  height: 38px;
  min-width: 42px;
  border-radius: 6px;
  background: transparent;
  color: #dce3ee;
  font-weight: 760;
}

.timeframes button.active,
.timeframes button:hover {
  background: #30343b;
}

.title {
  margin-left: auto;
  font-weight: 850;
}

.publish {
  height: 36px;
  border-radius: 18px;
  padding: 0 18px;
  background: #fff;
  color: #0a0b0d;
  font-weight: 850;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 64px minmax(650px, 1fr) 455px;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px;
  background: #101115;
  border-right: 1px solid var(--line);
}

.rail-button,
.icon-button {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: #d7dbe2;
}

.rail-button {
  width: 42px;
  height: 42px;
  font-size: 18px;
}

.rail-button.active,
.rail-button:hover,
.icon-button:hover {
  background: #2d3037;
}

.chart-stage {
  min-width: 0;
  padding: 16px;
  background: #f6f7f9;
  color: #1f242c;
}

.chart-panel {
  height: 100%;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  border: 1px solid #d6dae2;
  background:
    repeating-linear-gradient(90deg, rgba(52, 120, 246, 0.08) 0 18px, transparent 18px 72px),
    repeating-linear-gradient(0deg, transparent 0 68px, rgba(42, 49, 59, 0.11) 68px 69px),
    #fbfcfe;
}

.chart-head {
  height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #dfe3eb;
}

.chart-head span {
  display: block;
  color: #78818e;
  font-size: 12px;
  font-weight: 750;
}

.chart-head strong {
  font-size: 22px;
}

.chart-head em {
  height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 0 12px;
  background: #111318;
  color: #f6f7f9;
  font-style: normal;
  font-size: 12px;
  font-weight: 850;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px 18px 0;
}

.stat-card {
  min-height: 82px;
  border: 1px solid #d4d9e2;
  border-radius: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.stat-card span {
  display: block;
  color: #68717e;
  font-size: 12px;
  font-weight: 760;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.1;
}

.stat-card em {
  display: block;
  margin-top: 6px;
  color: #68717e;
  font-style: normal;
  font-size: 12px;
}

.board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  align-content: start;
  gap: 12px;
  padding: 14px 18px 18px;
  overflow: auto;
}

.tile {
  min-height: 160px;
  border: 1px solid #d2d8e1;
  border-radius: 6px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.tile header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.tile h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.tile p {
  min-height: 38px;
  margin: 10px 0;
  color: #5f6875;
  font-size: 12px;
  line-height: 1.45;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 0 8px;
  background: #eef1f5;
  color: #313943;
  font-size: 12px;
  font-weight: 760;
}

.pill {
  height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.active {
  background: rgba(41, 199, 121, 0.16);
  color: #138a58;
}

.pill.inactive {
  background: rgba(107, 116, 128, 0.15);
  color: #657080;
}

.pill.red {
  background: rgba(255, 96, 88, 0.15);
  color: #d9362d;
}

.pill.yellow {
  background: rgba(242, 201, 76, 0.22);
  color: #997000;
}

.alerts-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 18px 16px 10px;
}

.tab {
  height: 44px;
  border-radius: 7px;
  background: #2e3035;
  color: #b8bec8;
  font-weight: 850;
}

.tab.active {
  background: #51545a;
  color: white;
}

.tab span {
  min-width: 22px;
  border-radius: 999px;
  padding: 1px 6px;
  background: #ec5252;
  color: white;
  font-size: 11px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 16px 10px;
}

.filter {
  min-height: 32px;
  border-radius: 5px;
  background: #1c1e23;
  color: #9ea5b0;
  font-size: 12px;
  font-weight: 760;
}

.filter.active {
  background: #2f333b;
  color: white;
}

.symbols {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 16px 10px;
}

.symbol-chip {
  height: 28px;
  flex: 0 0 auto;
  border-radius: 14px;
  padding: 0 10px;
  background: #1e2127;
  color: #aeb5bf;
  font-size: 12px;
  font-weight: 780;
}

.symbol-chip.active {
  background: var(--blue);
  color: white;
}

.actions-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 40px auto minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 34px;
  height: 34px;
  font-size: 18px;
}

.search {
  height: 34px;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #2a2d34;
  border-radius: 6px;
  background: #1a1d22;
}

.search span {
  width: 28px;
  height: 100%;
  position: relative;
}

.search span::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 9px;
  width: 10px;
  height: 10px;
  border: 2px solid #8d949f;
  border-radius: 50%;
}

.search span::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 21px;
  width: 8px;
  height: 2px;
  background: #8d949f;
  transform: rotate(45deg);
  transform-origin: left center;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f2f4f7;
}

.status-strip {
  min-height: 38px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: #aab1bc;
  font-size: 12px;
}

.list-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.alarm-list,
.incidents-list,
.log-list {
  height: 100%;
  overflow: auto;
}

.alarm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.alarm-row:hover {
  background: #15171b;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dot {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 11px;
  font-weight: 850;
}

.dot.inactive {
  background: #5f6672;
}

.row-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.row-meta,
.row-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.row-summary {
  color: #c1c7d0;
}

.row-meta span::after {
  content: "•";
  margin-left: 6px;
  color: #5b626e;
}

.row-meta span:last-child::after {
  content: "";
}

.row-buttons {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  gap: 5px;
  align-content: start;
}

.row-buttons button {
  width: 32px;
  height: 30px;
  border-radius: 5px;
  background: #20232a;
  color: #d2d7df;
  font-size: 13px;
}

.row-buttons button:hover {
  background: #30343c;
}

.row-buttons button.danger-icon {
  color: var(--red);
}

.row-buttons button.danger-icon:hover {
  background: rgba(255, 96, 88, 0.18);
}

.log-row {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.log-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.log-row span {
  display: block;
  color: #949ba6;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.empty {
  padding: 28px 16px;
  color: #89919c;
  font-size: 13px;
  text-align: center;
}

.drawer {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: 520px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #101115;
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform 180ms ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  min-height: 86px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-head span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.drawer-head strong {
  display: block;
  font-size: 20px;
  line-height: 1.35;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px;
}

.detail-card {
  border-bottom: 1px solid var(--line-soft);
  padding: 0 0 16px;
  margin-bottom: 16px;
}

.detail-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.detail-card p {
  margin: 6px 0;
  color: #c5cbd4;
  font-size: 13px;
  line-height: 1.45;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.text-button {
  height: 32px;
  border-radius: 6px;
  padding: 0 12px;
  background: #272a31;
  color: #f1f3f6;
  font-weight: 780;
}

.text-button.primary {
  background: var(--blue);
}

.text-button.danger {
  color: #ff8b84;
}

.text-button.danger:hover {
  background: rgba(255, 96, 88, 0.18);
}

.mini-button {
  height: 34px;
  flex: 0 0 auto;
  border-radius: 6px;
  padding: 0 12px;
  background: #20232a;
  color: #eef2f7;
  font-size: 12px;
  font-weight: 850;
}

.mini-button:hover {
  background: #30343c;
}

.incidents-list {
  display: flex;
  flex-direction: column;
}

.incident-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.incident-row.pending,
.alarm-row.has-incident {
  background: rgba(255, 96, 88, 0.08);
}

.tile.has-incident {
  border-color: rgba(255, 96, 88, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 96, 88, 0.2);
}

.pill.pending {
  background: rgba(255, 96, 88, 0.16);
  color: #ffb0aa;
}

.incident-detail {
  border: 1px solid rgba(255, 96, 88, 0.34);
  border-radius: 6px;
  padding: 12px;
  background: rgba(255, 96, 88, 0.08);
}

.row-meta span::after {
  content: "·";
}

.hidden {
  display: none !important;
}
