:root {
  color-scheme: dark;
  --bg: #050b0e;
  --surface: #0a151a;
  --surface-2: #0e1c22;
  --surface-3: #13242b;
  --line: #21343c;
  --line-soft: rgba(173, 210, 221, .12);
  --text: #f4f8fa;
  --muted: #8ea3ac;
  --muted-2: #657a83;
  --cyan: #55e7ff;
  --cyan-soft: rgba(85, 231, 255, .12);
  --orange: #ff7a00;
  --orange-soft: rgba(255, 122, 0, .12);
  --green: #5ee0a0;
  --green-soft: rgba(94, 224, 160, .12);
  --red: #ff646c;
  --red-soft: rgba(255, 100, 108, .12);
  --violet: #a892ff;
  --radius: 14px;
  --shadow: 0 20px 55px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 76% -10%, rgba(85, 231, 255, .08), transparent 28rem),
    linear-gradient(135deg, rgba(85, 231, 255, .025) 25%, transparent 25%) 0 0 / 18px 18px,
    var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
svg { display: block; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template: 72px minmax(0, 1fr) / 224px minmax(0, 1fr);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 24px 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 11, 14, .92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}
.brand-mark { width: 38px; height: 38px; color: var(--cyan); stroke-width: 1.4; }
.brand > span { display: flex; flex-direction: column; line-height: 1.08; }
.brand strong { font-size: 17px; letter-spacing: .19em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }

.topbar-meta { display: flex; align-items: center; gap: 10px; }
.sync-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 192px;
  padding: 7px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255,255,255,.02);
}
.live-dot, .nav-status {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(94, 224, 160, .1), 0 0 12px rgba(94,224,160,.7);
}
.sync-pill span:last-child { display: flex; flex-direction: column; }
.sync-pill b { font-size: 11px; letter-spacing: .07em; }
.sync-pill small { color: var(--muted); font-size: 10px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
}
.icon-button:hover, .icon-button:focus-visible { border-color: var(--cyan); color: var(--cyan); }
.icon-button svg { width: 18px; height: 18px; }

.role-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px 5px 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}
.role-badge:hover { border-color: var(--line); background: var(--surface); }
.role-badge > span:first-child {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(85,231,255,.28);
  border-radius: 9px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-weight: 800;
}
.role-badge > span:nth-child(2) { display: flex; flex-direction: column; min-width: 90px; }
.role-badge b { font-size: 12px; }
.role-badge small { color: var(--muted); font-size: 10px; }
.role-badge svg { width: 14px; height: 14px; color: var(--muted); }

.sidebar {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100vh - 72px);
  padding: 22px 14px 16px;
  border-right: 1px solid var(--line);
  background: rgba(7, 16, 20, .76);
}
.nav-list { display: grid; gap: 6px; }
.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: .18s ease;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 8px;
  width: 3px;
  height: 28px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.025); }
.nav-item.is-active { border-color: rgba(85,231,255,.12); background: var(--cyan-soft); color: var(--cyan); }
.nav-item.is-active::before { background: var(--cyan); box-shadow: 0 0 13px rgba(85,231,255,.65); }
.nav-item svg { width: 20px; height: 20px; }
.nav-item span { font-size: 12px; font-weight: 650; }
.nav-item b {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  color: var(--text);
  font-size: 10px;
  text-align: center;
}
.nav-item .nav-status { width: 6px; height: 6px; }

.sidebar-foot { display: grid; gap: 16px; padding: 0 5px; }
.capacity { display: grid; gap: 7px; }
.capacity > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.capacity span, .capacity small { color: var(--muted); font-size: 10px; }
.capacity strong { color: var(--cyan); font-size: 11px; }
.progress-track { height: 4px; overflow: hidden; border-radius: 4px; background: rgba(255,255,255,.08); }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), #26aabd); }
.prototype-tag {
  padding: 6px 8px;
  border: 1px solid rgba(255,122,0,.28);
  border-radius: 6px;
  background: var(--orange-soft);
  color: #ffb067;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
}

.main-content {
  min-width: 0;
  padding: 32px clamp(20px, 3vw, 42px) 54px;
}
.view { width: min(1480px, 100%); margin: 0 auto; animation: view-in .25s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}
.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.page-heading h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1.04;
  letter-spacing: -.04em;
}
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; gap: 9px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .025em;
  transition: .16s ease;
}
.button svg { width: 16px; height: 16px; }
.button:hover { transform: translateY(-1px); }
.button-primary { border-color: var(--cyan); background: var(--cyan); color: #051013; box-shadow: 0 8px 24px rgba(85,231,255,.12); }
.button-primary:hover { background: #8cf0ff; }
.button-secondary { background: var(--surface); color: var(--text); }
.button-secondary:hover { border-color: #49616b; background: var(--surface-2); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.metric-card {
  position: relative;
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(17, 33, 40, .88), rgba(8, 20, 25, .88));
}
.metric-card-accent { border-color: rgba(85,231,255,.31); }
.metric-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--cyan-soft);
  color: var(--cyan);
}
.metric-icon.orange { background: var(--orange-soft); color: var(--orange); }
.metric-icon.green { background: var(--green-soft); color: var(--green); }
.metric-icon.violet { background: rgba(168,146,255,.12); color: var(--violet); }
.metric-icon svg { width: 20px; height: 20px; }
.metric-card > div:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.metric-card span { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.metric-card strong { margin: 2px 0 1px; font-size: 21px; line-height: 1.25; }
.metric-card small { color: var(--muted-2); font-size: 9px; }
.metric-card small i { margin-right: 4px; font-style: normal; }
.trend-up { color: var(--orange); }
.trend-good { color: var(--green); }
.spark { position: absolute; right: 10px; bottom: 13px; width: 72px; height: 25px; color: rgba(85,231,255,.4); stroke-width: 1.2; }

.focus-banner {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px 15px;
  border: 1px solid rgba(255,122,0,.25);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255,122,0,.11), rgba(255,122,0,.03));
  transition: .2s ease;
}
.focus-banner.is-collapsed { display: none; }
.focus-symbol { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--orange-soft); color: var(--orange); }
.focus-symbol svg { width: 18px; height: 18px; }
.focus-banner > div:nth-child(2) { display: flex; flex-direction: column; }
.focus-banner span { color: var(--orange); font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.focus-banner strong { margin-top: 2px; font-size: 12px; }
.focus-banner button { display: flex; align-items: center; gap: 7px; border: 0; background: transparent; color: #ffb36c; font-size: 10px; font-weight: 800; }
.focus-banner button span { display: grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; background: var(--orange); color: #14100b; }
.focus-banner button svg { width: 13px; height: 13px; }

.queue-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, .72fr); gap: 12px; align-items: start; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 21, 26, .9);
  box-shadow: 0 16px 38px rgba(0,0,0,.13);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 63px;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
}
.panel-head > div:first-child { display: flex; align-items: baseline; gap: 8px; }
.panel-head h2 { margin: 0; font-size: 14px; }
.panel-head span { color: var(--muted); font-size: 10px; }
.view-toggle { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 7px; }
.view-toggle button { display: grid; place-items: center; width: 29px; height: 27px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.view-toggle button.is-active { background: var(--surface-3); color: var(--cyan); }
.view-toggle svg { width: 14px; height: 14px; }

.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.filter-tabs { display: flex; align-items: center; gap: 2px; }
.filter-tabs button {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.filter-tabs button:hover { color: var(--text); }
.filter-tabs button.is-active { background: var(--cyan-soft); color: var(--cyan); }
.filter-tabs button span { display: grid; place-items: center; min-width: 18px; height: 16px; padding: 0 4px; border-radius: 8px; background: rgba(255,255,255,.06); font-size: 8px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  width: min(210px, 100%);
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #071216;
  color: var(--muted);
}
.search-field:focus-within { border-color: rgba(85,231,255,.55); }
.search-field svg { width: 14px; height: 14px; flex: 0 0 auto; }
.search-field input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 10px; }
.search-field input::placeholder { color: var(--muted-2); }
.search-field kbd { padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted-2); font: 8px/1.2 inherit; white-space: nowrap; }

.queue-table { min-height: 490px; }
.queue-header, .request-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.7fr) minmax(90px, .65fr) minmax(90px, .72fr) minmax(102px, .76fr) 25px;
  align-items: center;
  gap: 10px;
}
.queue-header {
  min-height: 36px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.request-row {
  position: relative;
  width: 100%;
  min-height: 75px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  transition: .16s ease;
}
.request-row:last-child { border-bottom: 0; }
.request-row:hover { background: rgba(255,255,255,.025); }
.request-row.is-selected { background: linear-gradient(90deg, var(--cyan-soft), rgba(85,231,255,.025)); }
.request-row.is-selected::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--cyan); }
.request-main { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; align-items: center; }
.request-code {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .04em;
}
.request-main div { min-width: 0; }
.request-main strong { display: block; overflow: hidden; margin-bottom: 2px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.request-main small { display: flex; align-items: center; gap: 5px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.request-main small i { width: 3px; height: 3px; flex: 0 0 auto; border-radius: 50%; background: var(--muted-2); }
.request-value strong, .request-next strong { display: block; font-size: 10px; }
.request-value small, .request-next small { display: block; margin-top: 2px; color: var(--muted-2); font-size: 8px; }
.priority { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 12px; font-size: 8px; font-weight: 800; }
.priority::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.priority.decision { background: var(--orange-soft); color: #ff9d43; }
.priority.risk { background: var(--red-soft); color: #ff7c83; }
.priority.new { background: var(--cyan-soft); color: var(--cyan); }
.priority.normal { background: rgba(255,255,255,.06); color: #a9bbc2; }
.request-arrow { width: 14px; height: 14px; color: var(--muted-2); }
.queue-table.is-compact .request-row { min-height: 57px; }
.queue-table.is-compact .request-main small, .queue-table.is-compact .request-next small { display: none; }
.queue-table.is-compact .request-code { width: 29px; height: 29px; }

.empty-state { min-height: 490px; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-state:not([hidden]) { display: grid; }
.empty-state svg { width: 48px; height: 48px; color: var(--muted-2); }
.empty-state h3 { margin: 12px 0 2px; font-size: 14px; }
.empty-state p { margin: 0 0 14px; color: var(--muted); font-size: 11px; }

.detail-panel { position: sticky; top: 92px; min-height: 590px; overflow: hidden; }
.detail-cover { position: relative; height: 6px; background: linear-gradient(90deg, var(--cyan), rgba(85,231,255,.15)); }
.detail-body { padding: 18px; }
.detail-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.detail-id { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.detail-top h2 { margin: 5px 0 3px; font-size: 18px; line-height: 1.15; }
.detail-top p { margin: 0; color: var(--muted); font-size: 10px; }
.detail-score { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto; border: 1px solid rgba(85,231,255,.32); border-radius: 50%; color: var(--cyan); font-size: 12px; font-weight: 850; box-shadow: inset 0 0 0 5px rgba(85,231,255,.06); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0 15px; }
.detail-tags span { padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 8px; }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 15px; }
.detail-stat { padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(255,255,255,.02); }
.detail-stat span { display: block; color: var(--muted-2); font-size: 8px; text-transform: uppercase; }
.detail-stat strong { display: block; margin-top: 3px; font-size: 11px; }
.detail-section { padding: 14px 0; border-top: 1px solid var(--line); }
.detail-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.detail-section h3 { margin: 0; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.detail-section-head span { color: var(--muted); font-size: 8px; }
.stage-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.stage-track i { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); }
.stage-track i.is-done { background: var(--cyan); }
.stage-labels { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted-2); font-size: 7px; }
.ai-box { padding: 11px; border: 1px solid rgba(168,146,255,.25); border-radius: 9px; background: rgba(168,146,255,.07); }
.ai-head { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.ai-symbol { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(168,146,255,.15); color: var(--violet); font-size: 10px; font-weight: 850; }
.ai-head div { display: flex; flex-direction: column; }
.ai-head strong { font-size: 9px; }
.ai-head small { color: var(--muted); font-size: 8px; }
.ai-fields { display: grid; gap: 5px; margin: 8px 0 9px; }
.ai-fields span { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #c9c0ef; font-size: 8px; }
.ai-fields b { overflow: hidden; color: var(--text); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ai-box .button { width: 100%; min-height: 31px; border-color: rgba(168,146,255,.35); background: rgba(168,146,255,.12); color: #d5cdff; font-size: 9px; }
.ai-box.is-applied { border-color: rgba(94,224,160,.28); background: var(--green-soft); }
.ai-box.is-applied .ai-symbol { background: var(--green-soft); color: var(--green); }
.ai-applied { color: var(--green); font-size: 9px; font-weight: 750; }
.detail-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 7px; padding-top: 14px; border-top: 1px solid var(--line); }
.detail-actions .button { padding: 0 8px; font-size: 9px; }

.pipeline-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.pipeline-summary div { padding: 15px 20px; border-right: 1px solid var(--line); }
.pipeline-summary div:last-child { border: 0; }
.pipeline-summary span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.pipeline-summary strong { display: block; margin-top: 3px; font-size: 15px; }
.orange-text { color: var(--orange); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 12px; }
.kanban-column { min-width: 220px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(8,18,22,.72); }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: 3px 3px 11px; }
.kanban-head div { display: flex; align-items: center; gap: 7px; }
.kanban-head i { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
.kanban-column:nth-child(2) .kanban-head i { background: var(--violet); }
.kanban-column:nth-child(3) .kanban-head i { background: var(--orange); }
.kanban-column:nth-child(4) .kanban-head i { background: var(--green); }
.kanban-head strong { font-size: 10px; text-transform: uppercase; }
.kanban-head span { display: grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 9px; }
.kanban-cards { display: grid; gap: 8px; align-content: start; min-height: 350px; }
.kanban-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); transition: .16s ease; }
.kanban-card:hover { border-color: #3a535d; transform: translateY(-1px); }
.kanban-card-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted-2); font-size: 8px; }
.kanban-card h3 { margin: 9px 0 3px; font-size: 11px; line-height: 1.35; }
.kanban-card > small { color: var(--muted); font-size: 8px; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.kanban-card-meta strong { font-size: 9px; }
.kanban-card-meta span { color: var(--muted); font-size: 8px; }
.kanban-card button { width: 100%; margin-top: 10px; min-height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 8px; font-weight: 750; }
.kanban-card button:hover { border-color: var(--cyan); color: var(--cyan); }

.integration-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 30px;
  min-height: 166px;
  margin-bottom: 12px;
  padding: 25px 32px;
  overflow: hidden;
  border: 1px solid rgba(85,231,255,.22);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(85,231,255,.06), transparent 50%),
    var(--surface);
}
.integration-logos { display: flex; align-items: center; max-width: 610px; }
.system-logo { display: grid; place-items: center; width: 74px; height: 74px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); box-shadow: var(--shadow); }
.system-logo span { font-size: 21px; font-weight: 900; }
.system-logo small { color: var(--muted); font-size: 8px; letter-spacing: .14em; text-transform: uppercase; }
.crm-logo { border-color: rgba(85,231,255,.32); color: var(--cyan); }
.one-c-logo { border-color: rgba(255,122,0,.3); color: var(--orange); }
.connection-line { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; color: var(--green); }
.connection-line i { height: 1px; background: linear-gradient(90deg, transparent, var(--green), transparent); }
.connection-line span { margin: 0 12px; padding: 5px 9px; border: 1px solid rgba(94,224,160,.26); border-radius: 12px; background: var(--green-soft); font-size: 8px; font-weight: 800; white-space: nowrap; }
.integration-status { display: flex; align-items: center; gap: 12px; min-width: 255px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.13); }
.integration-status > div { display: flex; flex-direction: column; }
.integration-status strong { font-size: 11px; }
.integration-status small { color: var(--muted); font-size: 8px; }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; }
.status-ok { background: var(--green); box-shadow: 0 0 9px rgba(94,224,160,.45); }
.status-warn { background: var(--orange); box-shadow: 0 0 9px rgba(255,122,0,.4); }
.status-loading { background: var(--cyan); box-shadow: 0 0 9px rgba(85,231,255,.4); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.sync-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 12px; }
.sync-grid .panel { padding: 20px; }
.section-title { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 17px; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 12px; font-size: 8px; font-weight: 800; }
.badge-success { background: var(--green-soft); color: var(--green); }
.mapping-list { display: grid; }
.mapping-row { display: grid; grid-template-columns: 34px 1fr auto 10px; align-items: center; gap: 11px; min-height: 67px; border-top: 1px solid var(--line-soft); }
.mapping-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 7px; background: var(--cyan-soft); color: var(--cyan); font-size: 8px; font-weight: 850; }
.mapping-row > div { display: flex; flex-direction: column; }
.mapping-row strong { font-size: 10px; }
.mapping-row small { color: var(--muted); font-size: 8px; }
.mapping-row > b { display: flex; flex-direction: column; align-items: end; font-size: 11px; }
.mapping-row > b small { font-weight: 400; }
.sync-history ol { margin: 0; padding: 0; list-style: none; }
.sync-history li { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 10px; min-height: 67px; border-top: 1px solid var(--line-soft); }
.sync-history li > div { display: flex; flex-direction: column; }
.sync-history li strong { font-size: 10px; }
.sync-history li small { color: var(--muted); font-size: 8px; }
.sync-history li > b { color: var(--green); font-size: 8px; }
.sync-history li > button { padding: 0; border: 0; background: transparent; color: var(--orange); font-size: 8px; font-weight: 750; }

.role-preview-control { display: flex; align-items: center; gap: 9px; }
.role-preview-control label { color: var(--muted); font-size: 10px; }
.role-preview-control select {
  min-width: 188px;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
}
.role-preview-control select:focus { border-color: var(--cyan); }
.access-summary {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
  padding: 18px 20px;
  border: 1px solid rgba(85,231,255,.2);
  border-radius: 12px;
  background: linear-gradient(90deg, var(--cyan-soft), rgba(85,231,255,.02));
}
.access-avatar { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(85,231,255,.32); border-radius: 12px; background: var(--cyan-soft); color: var(--cyan); font-weight: 850; }
.access-summary > div:nth-child(2) span { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.access-summary h2 { margin: 1px 0; font-size: 16px; }
.access-summary p { margin: 0; color: var(--muted); font-size: 9px; }
.matrix-panel { padding: 20px; }
.muted-note { color: var(--muted); font-size: 9px; }
.permission-table-wrap { overflow-x: auto; }
.permission-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.permission-table th { height: 39px; border-bottom: 1px solid var(--line); color: var(--muted-2); font-size: 8px; letter-spacing: .06em; text-align: center; text-transform: uppercase; }
.permission-table th:first-child { text-align: left; }
.permission-table td { height: 61px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.permission-table td:first-child { text-align: left; }
.permission-table td:first-child b, .permission-table td:first-child small { display: block; }
.permission-table td:first-child b { font-size: 10px; }
.permission-table td:first-child small { color: var(--muted); font-size: 8px; }
.permission-table td.is-highlighted { background: rgba(85,231,255,.035); }
.permission { display: inline-flex; min-width: 55px; justify-content: center; padding: 4px 7px; border-radius: 11px; font-size: 8px; font-style: normal; font-weight: 750; }
.permission.full { background: var(--green-soft); color: var(--green); }
.permission.view { background: var(--cyan-soft); color: var(--cyan); }
.permission.none { background: rgba(255,255,255,.045); color: var(--muted-2); }
.security-note { display: flex; align-items: start; gap: 11px; margin-top: 18px; padding: 13px; border: 1px solid rgba(255,122,0,.18); border-radius: 9px; background: var(--orange-soft); }
.security-note svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--orange); }
.security-note strong { font-size: 10px; }
.security-note p { margin: 2px 0 0; color: #be9b7e; font-size: 8px; }

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 5, 7, .78);
  backdrop-filter: blur(7px);
}
.modal { position: relative; width: min(470px, 100%); padding: 27px; border: 1px solid #36505a; border-radius: 15px; background: var(--surface-2); box-shadow: var(--shadow); }
.modal .modal-close, .help-drawer .modal-close { position: absolute; top: 14px; right: 14px; }
.modal h2, .help-drawer h2 { margin: 2px 0 4px; font-size: 24px; }
.modal > p { margin: 0 0 20px; color: var(--muted); font-size: 11px; }
.modal form { display: grid; gap: 13px; }
.modal label { display: grid; gap: 6px; color: #bdcbd1; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.modal input, .modal select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #081318;
  color: var(--text);
  font-size: 11px;
  text-transform: none;
}
.modal input:focus, .modal select:focus { border-color: var(--cyan); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; justify-content: end; gap: 8px; margin-top: 5px; }
body.has-overlay { overflow: hidden; }

.help-drawer {
  position: fixed;
  z-index: 110;
  top: 0;
  right: 0;
  width: min(390px, 100%);
  height: 100vh;
  padding: 30px;
  border-left: 1px solid #36505a;
  background: var(--surface-2);
  box-shadow: -24px 0 60px rgba(0,0,0,.4);
  animation: drawer-in .24s ease;
}
@keyframes drawer-in { from { transform: translateX(100%); } }
.help-drawer ol { display: grid; gap: 8px; margin: 22px 0; padding: 0; list-style: none; counter-reset: steps; }
.help-drawer li { counter-increment: steps; display: grid; grid-template-columns: 30px 1fr; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.help-drawer li::before { content: "0" counter(steps); grid-row: span 2; color: var(--cyan); font-size: 11px; font-weight: 850; }
.help-drawer li b, .help-drawer li span { grid-column: 2; }
.help-drawer li b { font-size: 11px; }
.help-drawer li span { color: var(--muted); font-size: 9px; }
.help-drawer > p { padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }

.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; min-width: 260px; max-width: 360px; padding: 12px 14px; border: 1px solid rgba(94,224,160,.28); border-radius: 9px; background: #10251e; color: #daf9e9; box-shadow: var(--shadow); animation: toast-in .2s ease; font-size: 10px; font-weight: 650; }
.toast::before { content: "✓"; display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; background: var(--green); color: #07140e; font-weight: 900; }
.toast.warning { border-color: rgba(255,122,0,.3); background: #281b10; color: #ffe0c1; }
.toast.warning::before { content: "!"; background: var(--orange); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .queue-layout { grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); }
  .queue-header, .request-row { grid-template-columns: minmax(190px, 1.4fr) minmax(85px,.7fr) minmax(90px,.7fr) 22px; }
  .queue-header span:nth-child(4), .request-next { display: none; }
  .integration-hero { grid-template-columns: 1fr; }
  .integration-status { justify-self: start; }
}

@media (max-width: 930px) {
  .app-shell { grid-template: 64px minmax(0, 1fr) 66px / 1fr; }
  .topbar { height: 64px; padding: 0 14px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand strong { font-size: 14px; }
  .sync-pill { min-width: 0; padding: 6px 8px; }
  .sync-pill span:last-child small { display: none; }
  .role-badge > span:nth-child(2), .role-badge > svg { display: none; }
  .role-badge > span:first-child { width: 34px; height: 34px; }
  .sidebar {
    position: fixed;
    z-index: 50;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 66px;
    padding: 6px 8px;
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(7,16,20,.96);
    backdrop-filter: blur(14px);
  }
  .nav-list { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; gap: 1px; min-height: 52px; padding: 4px; text-align: center; }
  .nav-item::before { top: -7px; left: 25%; width: 50%; height: 2px; }
  .nav-item svg { width: 18px; height: 18px; }
  .nav-item span { font-size: 8px; }
  .nav-item b, .nav-item .nav-status { position: absolute; top: 3px; right: 19%; }
  .sidebar-foot { display: none; }
  .main-content { grid-row: 2; padding: 25px 18px 40px; }
  .queue-layout { grid-template-columns: 1fr; }
  .detail-panel { position: static; min-height: 0; }
  .sync-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar-meta > .icon-button { display: none; }
  .sync-pill { border: 0; background: transparent; }
  .sync-pill b { font-size: 9px; }
  .main-content { padding: 21px 12px 30px; }
  .page-heading { align-items: start; flex-wrap: wrap; margin-bottom: 18px; }
  .page-heading h1 { font-size: 29px; }
  .page-heading p { max-width: 250px; font-size: 10px; }
  .heading-actions { align-self: end; }
  .heading-actions .button { width: 40px; padding: 0; font-size: 0; }
  .heading-actions .button svg { width: 17px; height: 17px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 94px; padding: 13px; }
  .metric-icon { width: 31px; height: 31px; }
  .metric-card strong { font-size: 16px; }
  .metric-card span { font-size: 8px; }
  .metric-card small { display: none; }
  .spark { display: none; }
  .focus-banner { grid-template-columns: 31px 1fr; gap: 9px; }
  .focus-banner > button { grid-column: 2; justify-self: start; padding: 0; }
  .focus-banner strong { font-size: 10px; }
  .panel-head { min-height: 54px; }
  .queue-toolbar { align-items: stretch; flex-direction: column; }
  .filter-tabs { overflow-x: auto; }
  .filter-tabs button { flex: 0 0 auto; }
  .search-field { width: 100%; }
  .search-field kbd { display: none; }
  .queue-header { display: none; }
  .request-row { grid-template-columns: minmax(0,1fr) auto 18px; min-height: 72px; }
  .request-value { display: none; }
  .request-priority { justify-self: end; }
  .request-main strong { max-width: 230px; }
  .queue-table { min-height: 360px; }
  .empty-state { min-height: 360px; }
  .detail-panel { scroll-margin-top: 74px; }
  .detail-actions { position: sticky; bottom: 74px; padding: 10px; margin: 0 -18px -18px; border-top: 1px solid var(--line); background: rgba(9,21,26,.96); backdrop-filter: blur(9px); }
  .pipeline-summary { grid-template-columns: 1fr 1fr; }
  .pipeline-summary div:nth-child(2) { border-right: 0; }
  .pipeline-summary div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .kanban { margin-right: -12px; }
  .integration-hero { padding: 20px 14px; }
  .system-logo { width: 58px; height: 58px; border-radius: 14px; }
  .connection-line span { margin: 0 5px; padding: 4px 5px; font-size: 7px; }
  .integration-status { width: 100%; min-width: 0; }
  .sync-grid .panel, .matrix-panel { padding: 15px; }
  .mapping-row { grid-template-columns: 32px 1fr 8px; }
  .mapping-row > b { display: none; }
  .role-preview-control { align-items: end; flex-direction: column; margin-left: auto; }
  .role-preview-control label { display: none; }
  .role-preview-control select { min-width: 145px; width: 145px; }
  .access-summary { grid-template-columns: 43px 1fr; }
  .access-summary .badge { grid-column: 2; justify-self: start; }
  .access-avatar { width: 42px; height: 42px; }
  .modal { padding: 24px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .toast-region { right: 10px; bottom: 76px; left: 10px; }
  .toast { width: 100%; min-width: 0; }
}

@media (max-width: 420px) {
  .brand small { display: none; }
  .metrics-grid { gap: 7px; }
  .metric-card { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 10px; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-icon svg { width: 17px; height: 17px; }
  .metric-card strong { font-size: 14px; }
  .focus-banner { padding: 10px; }
  .request-main strong { max-width: 170px; }
  .priority { padding: 4px 5px; }
  .detail-body { padding: 15px; }
  .help-drawer { padding: 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
