:root {
  --bg: #eef3f8;
  --bg-soft: #dde6f0;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #c5d1dd;
  --text: #183247;
  --muted: #5f7487;
  --brand: #0a6ed1;
  --brand-2: #0854a0;
  --danger: #bb0000;
  --shadow: 0 8px 24px rgba(20, 48, 76, 0.08);
  --top-banner-height: 76px;
  --category-bar-height: 68px;
}

* {
  box-sizing: border-box;
}

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

.bg-glow {
  display: none;
}

.bg-glow-a {
  top: -120px;
  left: -100px;
  background: #1ec8ff;
}

.bg-glow-b {
  bottom: -120px;
  right: -90px;
  background: #5eead4;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.app-shell-hidden {
  display: none;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-gate.hidden {
  display: none;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 26px;
  box-shadow: var(--shadow);
}

#authCodeGroup,
#authResendCodeBtn {
  display: none !important;
}

.auth-brand {
  margin-bottom: 10px;
}

.auth-copy {
  margin: 0 0 18px;
  line-height: 1.5;
}

.auth-alert {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(127, 29, 29, 0.22);
  color: #fecaca;
  font-size: 0.93rem;
  line-height: 1.45;
}

.auth-alert[hidden] {
  display: none !important;
}

.top-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: #f5f8fb;
  min-height: var(--top-banner-height);
}

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

.brand-banner {
  min-width: 240px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--brand);
  box-shadow: none;
}

.brand h1 {
  margin: 0;
  font-size: 1.12rem;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.category-bar {
  position: fixed;
  top: var(--top-banner-height);
  left: 0;
  right: 0;
  z-index: 34;
  padding: 0 28px 14px;
  background: #eef3f8;
  border-bottom: 1px solid var(--line);
  min-height: var(--category-bar-height);
}

.category-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 4px;
}

.category-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 11px 16px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.category-item:hover,
.category-item.active {
  border-color: #8fb5d9;
  background: #dfeaf5;
}

.profile-menu-wrap {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.profile-menu-card {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 40;
}

.profile-menu-card[hidden] {
  display: none !important;
}

.profile-menu-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-menu-logout {
  width: 100%;
}

.section-subnav-wrap {
  margin-bottom: 20px;
}

.section-subnav-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.section-subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.subnav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.subnav-item:hover,
.subnav-item.active {
  border-color: #7aa7d6;
  background: #dce9f7;
  color: var(--text);
}

.content {
  padding: calc(var(--top-banner-height) + var(--category-bar-height) + 28px) 28px 28px;
}

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

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 2px;
  border: 1px solid #b7c9db;
  background: #edf4fa;
  color: #31526f;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab.active {
  display: block;
}

h2 {
  margin-top: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.dashboard-kpis .metric {
  min-height: 112px;
}

.dashboard-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 14px;
}

.home-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.home-context-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.home-context-card h3 {
  margin: 8px 0 10px;
}

.home-context-eyebrow {
  color: rgba(184, 255, 243, 0.8);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home-context-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-context-insights {
  margin: 10px 0 14px;
}

.home-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.docs-grid {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.docs-nav-card,
.docs-summary-card,
.docs-section-card {
  box-shadow: var(--shadow);
}

.docs-anchor-list {
  display: grid;
  gap: 10px;
}

.docs-anchor {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.docs-anchor:hover,
.docs-anchor.active {
  border-color: #7aa7d6;
  background: #e8f0f7;
  color: var(--text);
}

.docs-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.docs-callout {
  padding: 14px 16px;
  border-radius: 2px;
  border: 1px solid #9fc4e9;
  background: #eef5fc;
  color: var(--text);
}

.docs-section-card {
  margin-top: 18px;
}

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

.docs-block {
  padding: 14px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: #fff;
}

.docs-block h4 {
  margin-top: 0;
  margin-bottom: 10px;
}

.docs-list,
.docs-steps {
  margin: 0;
  padding-left: 18px;
}

.docs-list li,
.docs-steps li {
  margin-bottom: 8px;
}

.docs-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.docs-flow-step {
  padding: 14px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  gap: 8px;
}

.worklist-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.worklist-main {
  min-width: 0;
}

.worklist-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.worklist-main p {
  margin: 0;
}

.worklist-side,
.worklist-actions {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.settings-toolbar-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-workbench {
  margin-bottom: 14px;
}

.collapsible-card summary {
  cursor: pointer;
  font-weight: 700;
}

.analytics-panel {
  box-shadow: var(--shadow);
}

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

.panel-head h3 {
  margin: 0;
}

.panel-head p {
  margin: 6px 0 0;
}

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

.insight-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.insight-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(159, 178, 206, 0.35);
  color: #cfe0ff;
  font-size: 0.7rem;
  line-height: 1;
  cursor: help;
  background: rgba(255, 255, 255, 0.04);
}

.metric-help-bubble {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  width: min(280px, 80vw);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(94, 234, 212, 0.18);
  background: rgba(8, 13, 24, 0.96);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 20;
}

.metric-help-bubble strong {
  display: block;
  font-size: 0.86rem;
  margin: 0 0 4px;
}

.metric-help-bubble span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.metric-help:hover .metric-help-bubble,
.metric-help:focus-visible .metric-help-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.insight-item strong {
  display: block;
  font-size: 1.15rem;
  margin-top: 6px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.stack-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack-item-title {
  font-weight: 700;
}

.stack-item-meta {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 6px;
}

.bar-series {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 10px;
  align-items: center;
}

.bar-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #5eead4);
}

.bar-value {
  font-size: 0.84rem;
  color: #d7e8ff;
}

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

.overview-filter-card {
  margin-bottom: 16px;
}

.cost-filter-card {
  margin-bottom: 18px;
  padding: 18px;
}

.cost-filter-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cost-filter-bottom {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 0.8fr));
  gap: 12px;
}

.cost-period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cost-period-pill {
  min-width: 74px;
}

.cost-period-pill.active {
  border-color: rgba(94, 234, 212, 0.65);
  background: rgba(20, 184, 166, 0.16);
  color: #d9fffb;
}

.cost-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.cost-kpi {
  min-height: 118px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cost-kpi small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.cost-kpi strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.05;
}

.cost-kpi span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.cost-insight-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.025);
}

.cost-insight-item small {
  display: block;
  color: rgba(184, 255, 243, 0.8);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.cost-insight-item strong {
  font-size: 0.98rem;
  line-height: 1.5;
  color: #eff7ff;
}

.cost-bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cost-bar-item {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.cost-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cost-bar-head strong {
  font-size: 0.96rem;
}

.cost-bar-head span {
  color: #dff8ff;
  font-weight: 700;
}

.cost-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.cost-bar-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #5eead4);
}

.cost-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.cost-provider-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.cost-provider-card:hover {
  transform: translateY(-1px);
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(94, 234, 212, 0.06);
}

.cost-provider-card.active {
  border-color: rgba(94, 234, 212, 0.6);
  background: rgba(20, 184, 166, 0.12);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.16);
}

.cost-provider-card small,
.cost-provider-card span {
  color: var(--muted);
}

.cost-provider-card strong {
  font-size: 1.35rem;
  color: #f5fbff;
}

.cost-model-table-wrap {
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
}

.cost-mini-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cost-mini-metric {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
}

.cost-mini-metric small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.cost-mini-metric strong {
  font-size: 1.12rem;
}

.table-sort-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.table-sort-btn:hover {
  color: #edf9ff;
}

.cost-hot {
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.08), rgba(255, 255, 255, 0));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px;
}

.metric h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.metric p {
  margin: 10px 0 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.date-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-date {
  min-width: 40px;
  padding: 10px 10px;
}

.spread {
  justify-content: space-between;
}

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

.template-form-grid {
  margin-top: 8px;
}

.template-ai-assistant {
  margin-top: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #f7f9fc;
  box-shadow: none;
}

.template-ai-workbench {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.template-ai-preview-panel {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.template-image-preview {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: #f5f8fb;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.template-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

#templateImagePreviewStatus {
  display: block;
  margin-top: 10px;
}

.template-image-preview-empty {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.template-image-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-ai-feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 2px;
  border: 1px solid #b7c9db;
  background: #eef4fa;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-ai-preview-panel .template-ai-feedback {
  margin-top: 14px;
}

.template-ai-feedback.error {
  border-color: #d99b9b;
  background: #fbefef;
}

.template-ai-feedback strong {
  color: var(--text);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.color-picker {
  width: 44px;
  min-width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a1020;
  cursor: pointer;
}

.label {
  font-size: 0.85rem;
  color: var(--muted);
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 2px;
  padding: 10px 12px;
}

.input:focus {
  outline: none;
  border-color: #0a6ed1;
  box-shadow: 0 0 0 1px #0a6ed1;
}

.btn {
  border: 1px solid var(--line);
  background: #f5f8fb;
  color: var(--text);
  border-radius: 2px;
  padding: 10px 14px;
  cursor: pointer;
}

.btn:hover {
  background: #e8f0f7;
}

.btn-primary {
  border-color: #0a6ed1;
  background: #0a6ed1;
  color: #fff;
  font-weight: 700;
}

.btn-ghost {
  background: #fff;
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

#settings table {
  min-width: 1200px;
}

#settings th:nth-child(2),
#settings td:nth-child(2) {
  width: 320px;
  min-width: 320px;
}

.settings-value-cell {
  min-width: 320px;
}

.settings-value-input {
  min-width: 320px;
}

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-weight: 500;
}

.list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-studio {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.settings-group-card {
  box-shadow: var(--shadow);
}

.settings-group-sections {
  display: grid;
  gap: 14px;
}

.settings-subsection {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px;
  background: #f9fbfd;
}

.settings-subsection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-subsection-head h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.settings-subsection-head p {
  margin: 0;
  max-width: 68ch;
}

.settings-group-grid {
  display: grid;
  gap: 10px;
}

.settings-group-item {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  background: #fff;
}

.settings-group-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.characters-page {
  display: none;
}

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

.characters-page-btn.active {
  border-color: #7aa7d6;
  background: #dce9f7;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px 12px;
  background: #fff;
}

.list-item-glow {
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.24);
}

.compact-row {
  gap: 8px;
  flex-wrap: wrap;
}

.category-compact-item {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.category-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drag-handle {
  color: var(--muted);
  margin-right: 6px;
  cursor: grab;
}

.category-compact-item.drag-over {
  border-color: rgba(94, 234, 212, 0.7);
  background: rgba(94, 234, 212, 0.08);
}

.category-compact-item.dragging {
  opacity: 0.55;
}

.list-item .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

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

.pill {
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  background: #f8fbfd;
}

.pill-ok {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.pill-warn {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.pill-bad {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
}

.support-stage-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.support-level-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.support-level-btn.active,
.support-stage-btn.active {
  border-color: #7aa7d6;
  background: #dce9f7;
}

.support-ticket-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.support-ticket-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.support-ticket-unseen {
  border-color: #8fb5d9;
  box-shadow: inset 3px 0 0 #0a6ed1;
  background: #f4f8fc;
}

.support-ticket-code {
  color: #0a6ed1;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pill-category {
  color: #fef3c7;
  border-color: rgba(250, 204, 21, 0.25);
  background: rgba(250, 204, 21, 0.08);
}

.pill-stage-new {
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
}

.pill-stage-in-progress {
  color: #ddd6fe;
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.12);
}

.pill-stage-resolved {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #0f172a;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s ease;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  :root {
    --top-banner-height: 96px;
    --category-bar-height: 72px;
  }
  .top-banner,
  .section-subnav-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .category-bar {
    top: var(--top-banner-height);
    padding-top: 12px;
  }
  .brand {
    min-width: 0;
  }
  .cards-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
  .dashboard-grid,
  .home-context-grid,
  .docs-grid,
  .docs-two-col,
  .docs-parameter-grid,
  .docs-flow,
  .worklist-item,
  .settings-studio,
  .split-stack,
  .insight-grid,
  .template-ai-workbench {
    grid-template-columns: 1fr;
  }
  .cost-summary-grid,
  .cost-mini-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cost-filter-bottom {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-hero {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  :root {
    --top-banner-height: 104px;
    --category-bar-height: 76px;
  }
  .content {
    padding: calc(var(--top-banner-height) + var(--category-bar-height) + 16px) 16px 16px;
  }
  .top-banner,
  .category-bar {
    padding-left: 16px;
    padding-right: 16px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .cost-summary-grid,
  .cost-mini-metrics,
  .cost-filter-bottom {
    grid-template-columns: 1fr;
  }
  .category-compact-item {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}


.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 20, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 16px;
}

.modal-card {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  padding: 16px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.45);
}
