:root {
  --bg: #0b0f17;
  --panel: #0f1624;
  --panel-2: #0b1220;
  --text: #e7eefc;
  --muted: #9bb0d6;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --primary: #6aa7ff;
  --danger: #ff6a6a;
  --ok: #2ad17b;
  --warn: #ffcc66;
  --radius: 14px;
}

html[data-theme="light"] {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f2f5fb;
  --text: #0e1626;
  --muted: #4b5f86;
  --border: rgba(14, 22, 38, 0.14);
  --shadow: 0 12px 30px rgba(14, 22, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1000px 600px at 20% 10%, rgba(106, 167, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 80% 0%, rgba(42, 209, 123, 0.1), transparent 60%), var(--bg);
  overflow-x: hidden;
}

:where(button, input, select, textarea) {
  font: inherit;
}

.container {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(11, 15, 23, 0.7);
  border-bottom: 1px solid var(--border);
}

@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .header {
    backdrop-filter: none;
  }
}

html[data-theme="light"] .header {
  background: rgba(245, 247, 251, 0.75);
}

.header__inner {
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.brand__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand__subtitle {
  font-size: 13px;
  color: var(--muted);
}

.header__tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
}

.toolgroup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.iconbtn {
  height: 40px;
  min-width: 40px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  font-size: 13px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.iconbtn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.iconbtn.is-active {
  border-color: rgba(106, 167, 255, 0.6);
  background: rgba(106, 167, 255, 0.16);
}

html[data-theme="light"] .iconbtn:hover {
  background: rgba(14, 22, 38, 0.06);
}

.divider {
  color: var(--muted);
  font-size: 12px;
  padding: 0 2px;
  user-select: none;
}

.ghicon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

.panel {
  margin-top: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel__controls {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 240px 280px;
  gap: 14px;
  align-items: start;
}

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

.label {
  font-size: 12px;
  color: var(--muted);
}

.input,
.textarea,
.select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  min-height: 40px;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(106, 167, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(106, 167, 255, 0.16);
}

.textarea {
  resize: vertical;
  min-height: 46px;
  line-height: 1.45;
}

.textarea--small {
  min-height: 46px;
}

.textarea--big {
  min-height: 380px;
  resize: vertical;
}

.textarea--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  overflow: auto;
}

.modecards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modecard {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  min-height: 64px;
}

.modecard input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.modecard__body {
  padding: 12px 12px;
  display: grid;
  gap: 6px;
}

.modecard__title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.modecard__desc {
  font-size: 12px;
  color: var(--muted);
}

.modecard:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="light"] .modecard:hover {
  background: rgba(14, 22, 38, 0.05);
}

.modecard.is-selected {
  border-color: rgba(106, 167, 255, 0.65);
  background: rgba(106, 167, 255, 0.14);
}

.modecard:focus-within {
  box-shadow: 0 0 0 4px rgba(106, 167, 255, 0.16);
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.btn {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  border-color: rgba(106, 167, 255, 0.5);
  background: rgba(106, 167, 255, 0.16);
}

.btn--primary:hover {
  background: rgba(106, 167, 255, 0.22);
}

.btn--danger {
  border-color: rgba(255, 106, 106, 0.45);
  background: rgba(255, 106, 106, 0.12);
}

.btn--danger:hover {
  background: rgba(255, 106, 106, 0.18);
}

.workspace {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.workspace__col {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.workspace__body {
  position: relative;
}

.workspace__body--relative {
  position: relative;
}

.workspace__header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}

.workspace__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.workspace__hint {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.workspace .textarea--big {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 14px 16px;
  min-height: 420px;
}

.empty-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.empty-overlay.is-visible {
  display: flex;
}

.dropzone.is-dragover {
  box-shadow: 0 0 0 4px rgba(106, 167, 255, 0.18);
}

.dropzone__hint {
  position: absolute;
  right: 14px;
  top: 10px;
  color: var(--muted);
  font-size: 12px;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.tablepanel {
  margin-bottom: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tablepanel.is-hidden {
  display: none;
}

.tablepanel__header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.tablepanel__title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.tablepanel__body {
  padding: 8px 10px 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  min-width: 860px;
}

.table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  padding: 0 10px;
}

.table td {
  padding: 0 10px;
  vertical-align: top;
}

.tinput,
.tarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  font-size: 13px;
  min-height: 40px;
}

.tarea {
  resize: vertical;
  min-height: 40px;
}

.tinput:focus,
.tarea:focus {
  border-color: rgba(106, 167, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(106, 167, 255, 0.16);
}

.iconbtn--sm {
  height: 40px;
  min-width: 40px;
  padding: 0 10px;
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  justify-content: flex-end;
  min-width: 0;
}

.status__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.status__badge--ok {
  border-color: rgba(42, 209, 123, 0.55);
  background: rgba(42, 209, 123, 0.16);
  color: #b7ffd8;
}

.status__badge--bad {
  border-color: rgba(255, 106, 106, 0.55);
  background: rgba(255, 106, 106, 0.14);
  color: #ffd0d0;
}

.status__badge--neutral {
  color: var(--muted);
}

.status__detail {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footerbar {
  margin-top: 14px;
  margin-bottom: 24px;
}

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

.statsbox__title {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.statsbox__hint {
  color: var(--muted);
  font-size: 12px;
  min-height: 16px;
}

.stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.stat__k {
  color: var(--muted);
  font-size: 12px;
}

.stat__v {
  font-size: 13px;
  font-weight: 700;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  background: rgba(11, 15, 23, 0.55);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer__left {
  color: var(--muted);
  font-size: 12px;
}

.link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  border-bottom: 1px dashed rgba(155, 176, 214, 0.5);
  padding-bottom: 1px;
}

.link:hover {
  color: var(--text);
  border-bottom-color: rgba(231, 238, 252, 0.7);
}

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

@media (max-width: 767px) {
  .container {
    width: min(1200px, calc(100% - 28px));
  }

  .input,
  .select,
  .textarea,
  .btn,
  .iconbtn,
  .tinput,
  .tarea {
    font-size: 16px;
  }

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

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

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

  .workspace__hint {
    display: none;
  }

  .workspace .textarea--big {
    min-height: 300px;
  }
}

@media (max-width: 520px) {
  .brand__title {
    font-size: 20px;
  }

  .brand__subtitle {
    font-size: 12px;
  }

  .header__tools {
    width: 100%;
  }

  .input,
  .select,
  .textarea,
  .btn,
  .iconbtn,
  .tinput,
  .tarea {
    font-size: 16px;
  }
}
