:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #d8dde6;
  --text: #17202c;
  --muted: #647084;
  --accent: #0f766e;
  --accent-strong: #0b5d56;
  --danger: #b42318;
  --warn: #b7791f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 16px;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  max-width: 1440px;
  margin: 0 auto;
}

.debug-panel {
  grid-column: 1 / -1;
  background: #101828;
  color: #fff;
  border-radius: 8px;
  padding: 14px 16px;
}

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

.debug-label {
  display: block;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.debug-panel strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.notifications {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.notice {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 9px 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.notice.error {
  border-color: rgba(253, 162, 155, 0.55);
  background: rgba(180, 35, 24, 0.35);
}

.notice.ok {
  border-color: rgba(117, 224, 167, 0.55);
  background: rgba(6, 118, 71, 0.35);
}

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

.intake-panel {
  position: sticky;
  top: 16px;
  height: calc(100vh - 98px);
  overflow: auto;
}

form,
label {
  display: grid;
  gap: 7px;
}

form {
  margin-top: 14px;
  gap: 12px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  border: 2px dashed #98a2b3;
  border-radius: 8px;
  background: #f8fafc;
  padding: 24px;
  text-align: center;
  cursor: text;
}

.dropzone:focus,
.dropzone.dragover {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
  background: #ecfdf3;
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.dropzone strong {
  font-size: 20px;
}

.dropzone span {
  max-width: 340px;
  color: var(--muted);
  line-height: 1.45;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

summary {
  cursor: pointer;
  padding: 11px 12px;
  font-weight: 800;
}

.advanced-fields {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

label {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

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

textarea {
  resize: vertical;
}

.attachments-preview {
  display: grid;
  gap: 8px;
}

.attachment-chip {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.attachment-chip img {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef2f6;
}

.attachment-chip strong,
.attachment-chip span {
  display: block;
}

.attachment-chip strong {
  font-size: 13px;
}

.attachment-chip span {
  color: var(--muted);
  font-size: 12px;
}

.attachment-chip button {
  width: 32px;
  height: 32px;
  padding: 0;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 10px 13px;
  cursor: pointer;
}

button,
.button-link {
  text-decoration: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
  font-weight: 900;
}

.system-map {
  display: grid;
  gap: 14px;
}

.map-step {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.map-index {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.map-step h2 {
  margin-bottom: 4px;
}

.map-arrow {
  color: var(--muted);
  text-align: center;
  font-size: 20px;
  font-weight: 900;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 10px 13px;
}

button:hover {
  border-color: #98a2b3;
}

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

.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

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

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

.section-head select {
  max-width: 220px;
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.graph-panel {
  margin-bottom: 16px;
}

.graph-controls {
  display: flex;
  gap: 8px;
}

.graph-controls select {
  min-width: 160px;
}

.graph-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  align-items: stretch;
}

#knowledge-graph {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.graph-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  overflow: auto;
  max-height: 520px;
}

.graph-detail strong {
  display: block;
  overflow-wrap: anywhere;
}

.graph-type {
  display: inline-flex;
  margin-bottom: 8px;
  border: 1px solid #cfd7e3;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.graph-connected {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.graph-connected button {
  width: 100%;
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
}

.synthesis.compact {
  margin-top: 10px;
}

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

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

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.monitor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  padding: 16px;
  max-width: 1440px;
  margin: 0 auto;
}

.event-list {
  display: grid;
  gap: 8px;
}

.event {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  font-size: 13px;
}

.event code {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.item.process {
  border-left: 5px solid var(--accent);
}

.item.saved {
  border-color: #abefc6;
  border-left: 5px solid #12b76a;
  background: #f6fef9;
}

.item.needs-action {
  border-color: #fedf89;
  border-left: 5px solid #f79009;
  background: #fffcf5;
}

.item.discarded {
  border-left: 5px solid #98a2b3;
  background: #f8fafc;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.item-title {
  font-size: 15px;
  font-weight: 800;
}

.item-url {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.badge {
  border: 1px solid #cfd7e3;
  background: #f8fafc;
  border-radius: 999px;
  padding: 4px 8px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.score {
  min-width: 54px;
  text-align: center;
  border-radius: 6px;
  padding: 7px;
  background: #ecfdf3;
  color: #067647;
  font-weight: 900;
}

.score.low {
  background: #fff7ed;
  color: var(--warn);
}

.summary {
  color: #344054;
  line-height: 1.45;
  white-space: pre-wrap;
}

.synthesis {
  border: 1px solid #d1fadf;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: #164b35;
}

.synthesis-title {
  margin-bottom: 6px;
  color: #067647;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.synthesis-subtitle {
  margin-top: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.synthesis p {
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.synthesis ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.synthesis li {
  margin: 3px 0;
}

.saved-badge {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #067647;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

.empty {
  color: var(--muted);
  padding: 32px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.makyna-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px;
}

.makyna-layout .debug-panel {
  grid-column: 1 / -1;
}

.makyna-control {
  align-self: start;
  position: sticky;
  top: 16px;
}

.makyna-control textarea {
  resize: vertical;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.inline-check input {
  width: auto;
}

.makyna-items {
  display: grid;
  gap: 14px;
}

.makyna-card.approved,
.makyna-card.ready-to-export {
  border-color: #abefc6;
}

.makyna-card.rejected {
  border-color: #fecdca;
  opacity: 0.78;
}

.makyna-copy {
  display: grid;
  gap: 8px;
  color: #344054;
  line-height: 1.48;
}

.makyna-copy p {
  margin: 0;
  color: #344054;
}

.storyboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.story-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.story-frame strong {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.story-frame p,
.story-frame span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

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

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

  .makyna-control {
    position: static;
  }

  .monitor-layout,
  .metrics,
  .graph-grid {
    grid-template-columns: 1fr;
  }

  .graph-detail {
    max-height: none;
  }

  .intake-panel {
    position: static;
    height: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .graph-controls,
  .debug-grid,
  .grid-two {
    grid-template-columns: 1fr;
    display: grid;
  }
}

.ads-shell {
  color-scheme: dark;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 12% 6%, rgba(255, 84, 0, 0.25), transparent 28%),
    radial-gradient(circle at 92% 14%, rgba(255, 174, 61, 0.14), transparent 24%),
    radial-gradient(circle at 46% 72%, rgba(51, 94, 148, 0.16), transparent 30%),
    linear-gradient(180deg, #070b12 0%, #0d1420 42%, #080d14 100%);
  background-size: 42px 42px, 42px 42px, auto, auto, auto, auto;
  color: #f5f7fb;
}

.ads-shell .topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 24px 28px;
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: rgba(9, 14, 22, 0.86);
  backdrop-filter: blur(18px);
}

.ads-shell .top-actions {
  flex-wrap: wrap;
}

.ads-shell p {
  color: #9ca9b8;
}

.ads-shell .panel {
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(20, 27, 39, 0.9) 0%, rgba(9, 14, 22, 0.96) 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.ads-shell button,
.ads-shell .button-link {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(19, 27, 39, 0.92);
  color: #f5f7fb;
}

.ads-shell button:hover,
.ads-shell .button-link:hover {
  border-color: rgba(255, 132, 71, 0.5);
}

.ads-shell .button-link.is-active,
.ads-shell .primary {
  border-color: rgba(255, 132, 71, 0.92);
  background: linear-gradient(135deg, #ff5400 0%, #ff7a1a 100%);
  color: #fff7f2;
}

.ads-shell input,
.ads-shell select,
.ads-shell textarea {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(11, 16, 24, 0.9);
  color: #f5f7fb;
}

.ads-shell input::placeholder,
.ads-shell textarea::placeholder {
  color: #677586;
}

.ads-console {
  display: grid;
  gap: 16px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px 18px 28px;
}

.ads-nav-strip {
  position: sticky;
  top: 86px;
  z-index: 15;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 8px;
  background: rgba(7, 11, 18, 0.74);
  backdrop-filter: blur(18px);
}

.ads-nav-strip a {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.04);
  color: #d6e0eb;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.ads-nav-strip a:hover {
  border-color: rgba(255, 132, 71, 0.48);
  color: #fff7f2;
}

.ads-hero {
  overflow: hidden;
  position: relative;
  min-height: 250px;
  border-radius: 28px;
  padding: 22px;
}

.ads-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 84, 0, 0.16), transparent 38%),
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.08), transparent 18%);
  pointer-events: none;
}

.ads-hero-orbit {
  position: absolute;
  right: -90px;
  top: -120px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 132, 71, 0.18);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 84, 0, 0.13), transparent 56%),
    conic-gradient(from 120deg, transparent, rgba(255, 132, 71, 0.18), transparent 34%);
  filter: blur(0.2px);
}

.ads-hero-head,
.ads-hero-grid,
.ads-metrics-board,
.ads-grid,
.ads-panel,
.ads-chat-panel {
  position: relative;
}

.ads-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 14px;
  align-items: stretch;
}

.ads-mission-rail {
  display: grid;
  gap: 8px;
}

.ads-mission-rail div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.ads-mission-rail span {
  grid-row: span 2;
  align-self: center;
  color: #ff9a61;
  font-size: 11px;
  font-weight: 950;
}

.ads-mission-rail strong {
  color: #f8fafc;
  font-size: 13px;
}

.ads-mission-rail small {
  color: #8ea0b4;
  font-size: 11px;
}

.ads-grid {
  display: grid;
  grid-template-columns: minmax(290px, 350px) minmax(0, 1.25fr) minmax(340px, 430px);
  gap: 16px;
  align-items: start;
}

.ads-rail,
.ads-main,
.ads-chat {
  display: grid;
  gap: 18px;
}

.ads-chat {
  position: sticky;
  top: 104px;
}

.ads-panel {
  display: grid;
  gap: 13px;
  border-radius: 22px;
}

.ads-control-panel,
.ads-hermes-panel {
  border-color: rgba(255, 132, 71, 0.18);
}

.ads-section-panel {
  position: relative;
  overflow: hidden;
}

.ads-section-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 132, 71, 0.48), transparent);
  opacity: 0.58;
}

.ads-shell .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: #ff9a61;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ads-shell .eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ff7a1a;
  box-shadow: 0 0 18px rgba(255, 122, 26, 0.7);
}

.ads-notice-strip {
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: #f5f7fb;
}

.ads-notice-strip.ok {
  border-color: rgba(108, 236, 147, 0.38);
  background: rgba(18, 93, 47, 0.35);
}

.ads-notice-strip.error {
  border-color: rgba(255, 125, 125, 0.34);
  background: rgba(107, 22, 22, 0.36);
}

.ads-notice-strip.info {
  border-color: rgba(255, 168, 101, 0.34);
  background: rgba(107, 58, 18, 0.35);
}

.ads-client-palette,
.ads-list {
  display: grid;
  gap: 10px;
}

.ads-client-palette,
.ads-decision-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 3px;
}

.ads-client-card,
.ads-list-card {
  display: grid;
  gap: 9px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.026));
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.ads-client-card:hover,
.ads-list-card:hover {
  transform: translateY(-1px);
}

.ads-client-card strong,
.ads-list-card strong {
  font-size: 14px;
}

.ads-client-card span,
.ads-list-card p,
.ads-list-card span {
  color: #9ca9b8;
}

.ads-status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd7e4;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ads-status-pill.success {
  border-color: rgba(108, 236, 147, 0.28);
  background: rgba(18, 93, 47, 0.22);
  color: #abf4c2;
}

.ads-status-pill.warning {
  border-color: rgba(255, 174, 61, 0.3);
  background: rgba(107, 58, 18, 0.26);
  color: #ffd198;
}

.ads-status-pill.danger {
  border-color: rgba(255, 108, 108, 0.32);
  background: rgba(107, 22, 22, 0.28);
  color: #ffb2b2;
}

.ads-client-card.active,
.ads-list-card.active,
.ads-selectable.active {
  border-color: rgba(255, 132, 71, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 84, 0, 0.18), rgba(255, 255, 255, 0.04));
  box-shadow: inset 3px 0 0 rgba(255, 122, 26, 0.9);
}

.ads-client-card-meta,
.ads-card-foot,
.ads-inline-list,
.ads-chat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ads-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

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

.ads-keyval,
.ads-stat {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.03);
}

.ads-metric-card {
  position: relative;
  overflow: hidden;
  min-height: 104px;
}

.ads-metric-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -32px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(255, 122, 26, 0.11);
}

.ads-metric-card small {
  position: relative;
  color: #8796a7;
  font-size: 11px;
  font-weight: 750;
}

.ads-keyval span,
.ads-stat span {
  color: #8ea0b4;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ads-keyval strong,
.ads-stat strong {
  color: #f7fafc;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ads-keyval-wide {
  grid-column: span 2;
}

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

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

.ads-action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.ads-action-grid .primary {
  min-height: 46px;
}

.ads-action-grid button:not(.primary) {
  justify-content: flex-start;
  min-height: 40px;
  color: #d4dde8;
}

.ads-report {
  display: grid;
  gap: 12px;
}

.ads-report-summary {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(255, 84, 0, 0.1), rgba(255, 255, 255, 0.035));
  color: #edf2f7;
  line-height: 1.55;
}

.ads-report-summary p,
.ads-card-copy {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.ads-priority-strip {
  position: relative;
  z-index: 1;
  margin: 14px 0;
}

.ads-priority-card {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 16px 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
}

.ads-priority-card span {
  color: #ff9a61;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ads-priority-card strong {
  color: #fff;
  font-size: clamp(20px, 2.4vw, 34px);
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.ads-priority-card p {
  color: #a8b5c5;
}

.ads-priority-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.ads-priority-footer a {
  border: 1px solid rgba(255, 132, 71, 0.34);
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff7f2;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.ads-priority-card.is-risk {
  border-color: rgba(255, 95, 95, 0.38);
  background: linear-gradient(135deg, rgba(130, 24, 24, 0.42), rgba(255, 84, 0, 0.08));
}

.ads-priority-card.is-action {
  border-color: rgba(255, 174, 61, 0.36);
}

.ads-priority-card.is-stable {
  border-color: rgba(108, 236, 147, 0.28);
}

.ads-decision-card.high,
.ads-decision-card.critical,
.ads-alert-card {
  border-color: rgba(255, 108, 108, 0.24);
}

.ads-decision-card.pending,
.ads-decision-card.open {
  border-color: rgba(255, 174, 61, 0.2);
}

.ads-ticket-card {
  position: relative;
  padding-left: 16px;
}

.ads-ticket-card::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 0;
  width: 3px;
  border-radius: 999px;
  background: rgba(255, 174, 61, 0.72);
}

.ads-ticket-card.critical::before,
.ads-ticket-card.high::before,
.ads-alert-card::before {
  background: rgba(255, 95, 95, 0.85);
}

.ads-inventory-card .ads-inline-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ads-inventory-card .ads-inline-list span {
  display: grid;
  gap: 2px;
  border-radius: 12px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.04);
}

.ads-inventory-card .ads-inline-list strong {
  color: #fff;
  font-size: 20px;
}

.ads-log-card {
  opacity: 0.88;
}

.ads-bullet-list {
  display: grid;
  gap: 7px;
}

.ads-bullet-list span::before {
  content: "+ ";
  color: #ff7a1a;
}

.ads-checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.ads-checkbox input {
  width: auto;
}

.ads-operation-modal .read-modal-backdrop {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 84, 0, 0.2), transparent 32%),
    rgba(5, 8, 13, 0.72);
}

.ads-operation-panel {
  width: min(1040px, calc(100vw - 28px));
  max-height: min(90vh, 940px);
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(18, 25, 37, 0.98), rgba(8, 13, 21, 0.99));
  color: #f5f7fb;
  box-shadow: 0 34px 130px rgba(0, 0, 0, 0.58);
}

.ads-operation-panel .read-modal-head {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 84, 0, 0.1), transparent 46%),
    rgba(255, 255, 255, 0.02);
}

.ads-operation-panel .read-modal-head p {
  max-width: 640px;
  margin-top: 6px;
  color: #9ca9b8;
}

.ads-operation-panel .eyebrow {
  color: #ff9a61;
}

.ads-operation-panel .modal-close {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f7fb;
}

.ads-operation-form {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 18px 20px 20px;
}

.ads-form-section {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.ads-form-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 14px;
  align-items: start;
}

.ads-form-section h2 {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ads-operation-form label {
  display: grid;
  gap: 7px;
  color: #bfccda;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ads-operation-form input,
.ads-operation-form select,
.ads-operation-form textarea {
  min-height: 42px;
  border-radius: 12px;
  background: rgba(7, 12, 19, 0.82);
}

.ads-operation-form textarea {
  min-height: 104px;
  resize: vertical;
}

.ads-meta-fields {
  display: grid;
  gap: 12px;
}

.ads-meta-fields:has(:disabled) {
  opacity: 0.48;
}

.ads-meta-fields:has(:disabled) input,
.ads-meta-fields:has(:disabled) textarea {
  cursor: not-allowed;
}

.ads-operation-actions {
  position: sticky;
  bottom: -20px;
  z-index: 2;
  margin: 2px -20px -20px;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(9, 14, 22, 0.82), rgba(9, 14, 22, 0.98));
  backdrop-filter: blur(12px);
}

.ads-chat-panel {
  min-height: calc(100vh - 148px);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(18, 25, 37, 0.94), rgba(6, 10, 17, 0.98)),
    radial-gradient(circle at 20% 0%, rgba(255, 84, 0, 0.18), transparent 28%);
}

.ads-chat-context {
  display: grid;
}

.ads-chat-messages {
  display: grid;
  gap: 12px;
  min-height: 360px;
  max-height: 58vh;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 12px;
  background: rgba(3, 6, 11, 0.45);
}

.ads-chat-bubble {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.ads-chat-bubble.user {
  margin-left: 34px;
  background: rgba(255, 84, 0, 0.12);
  border-color: rgba(255, 132, 71, 0.28);
}

.ads-chat-bubble.assistant {
  margin-right: 20px;
}

.ads-chat-bubble.pending {
  opacity: 0.84;
}

.ads-chat-role {
  color: #ff9a61;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ads-chat-copy {
  color: #f5f7fb;
  line-height: 1.6;
  white-space: pre-wrap;
}

.ads-chat-actions {
  flex-wrap: wrap;
}

.ads-chat-form {
  margin-top: auto;
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.ads-chat-form label {
  display: grid;
  gap: 8px;
  color: #bfccda;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ads-chat-form textarea {
  min-height: 128px;
  border-radius: 16px;
  resize: vertical;
}

.ads-shell .actions button,
.ads-chat-actions button {
  min-height: 36px;
  border-radius: 999px;
  padding-inline: 12px;
  font-size: 12px;
  font-weight: 850;
}

.ads-shell .metric {
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.04);
}

.ads-shell .metric span {
  color: #8ea0b4;
}

.ads-shell .metric strong {
  color: #ffffff;
}

.ads-shell .badge {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #ffd1b8;
}

.ads-shell .empty {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #9ca9b8;
}

@media (max-width: 1260px) {
  .ads-grid {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }

  .ads-nav-strip {
    top: 82px;
  }

  .ads-chat {
    position: static;
    grid-column: 1 / -1;
  }

  .ads-chat-panel {
    min-height: 0;
  }

  .ads-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .ads-mission-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .ads-grid,
  .ads-columns-2 {
    grid-template-columns: 1fr;
  }

  .ads-rail,
  .ads-chat {
    position: static;
  }

  .ads-stat-grid,
  .ads-action-grid,
  .ads-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ads-keyval-wide {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .ads-console {
    padding: 14px;
  }

  .ads-hero {
    min-height: 0;
    padding: 16px;
  }

  .ads-shell .topbar {
    padding: 18px 14px;
  }

  .ads-stat-grid,
  .ads-action-grid,
  .ads-summary-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .ads-priority-card strong {
    font-size: 22px;
  }

  .ads-mission-rail,
  .ads-inventory-card .ads-inline-list {
    grid-template-columns: 1fr;
  }

  .ads-nav-strip {
    top: 74px;
  }

  .ads-chat-messages {
    min-height: 260px;
    max-height: 420px;
  }

  .ads-operation-form {
    padding: 14px;
  }

  .ads-form-section-head {
    grid-template-columns: 1fr;
  }

  .ads-operation-actions {
    margin: 0 -14px -14px;
    padding: 12px 14px 14px;
  }
}

/* MAKYNA-OS operations design layer */
:root {
  --os-bg: #eef0ed;
  --os-ink: #121412;
  --os-muted: #68706b;
  --os-soft: #f7f6f1;
  --os-panel: rgba(255, 255, 250, 0.86);
  --os-panel-strong: #fffefa;
  --os-line: rgba(18, 20, 18, 0.12);
  --os-line-strong: rgba(18, 20, 18, 0.22);
  --os-command: #181a17;
  --os-command-2: #262920;
  --os-accent: #b56b28;
  --os-accent-2: #6f7f4f;
  --os-green: #1f7a4d;
  --os-yellow: #9a6a10;
  --os-red: #a3362b;
  --os-radius: 18px;
  --os-radius-sm: 12px;
  --os-shadow: 0 24px 70px rgba(30, 32, 27, 0.12);
  --bg: var(--os-bg);
  --panel: var(--os-panel);
  --line: var(--os-line);
  --text: var(--os-ink);
  --muted: var(--os-muted);
  --accent: var(--os-accent);
  --accent-strong: #8a4f1d;
}

.os-shell {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(18, 20, 18, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 20, 18, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 12% 8%, rgba(181, 107, 40, 0.18), transparent 30%),
    radial-gradient(circle at 88% 6%, rgba(111, 127, 79, 0.2), transparent 32%),
    linear-gradient(180deg, #f4f1e9 0%, #e8ebe5 48%, #f3f2ee 100%);
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
  color: var(--os-ink);
  font-family: "Aptos Display", "Satoshi", "Manrope", "Segoe UI", sans-serif;
}

.os-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.45) 34%, transparent 35%),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.55), transparent 42%);
  mix-blend-mode: soft-light;
}

.os-shell .topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(310px, 1fr) auto;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(18, 20, 18, 0.1);
  background: rgba(246, 245, 239, 0.82);
  backdrop-filter: blur(22px) saturate(1.2);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(18, 20, 18, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(145deg, #22251d, #10120f),
    var(--os-command);
  color: #f8efe0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 16px 30px rgba(18, 20, 18, 0.18);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--os-muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--os-accent);
  box-shadow: 0 0 0 4px rgba(181, 107, 40, 0.12);
}

.os-shell h1 {
  margin-top: 2px;
  font-family: "Aptos Display", "Satoshi", "Manrope", sans-serif;
  font-size: clamp(25px, 2.2vw, 38px);
  font-weight: 900;
  letter-spacing: -0.06em;
}

.os-shell h2 {
  color: var(--os-ink);
  font-size: clamp(22px, 2vw, 34px);
  font-weight: 850;
  letter-spacing: -0.045em;
}

.os-shell p {
  color: var(--os-muted);
  font-size: 14px;
  line-height: 1.5;
}

.os-shell .top-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.os-shell .button-link,
.os-shell .icon-button,
.os-shell button {
  border: 1px solid var(--os-line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.68);
  color: var(--os-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.os-shell .button-link:hover,
.os-shell .icon-button:hover,
.os-shell button:hover {
  border-color: rgba(18, 20, 18, 0.3);
  background: #fffefa;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(18, 20, 18, 0.08);
}

.os-shell .button-link.is-active,
.os-shell .primary {
  border-color: rgba(18, 20, 18, 0.88);
  background: linear-gradient(145deg, #1c1f18, #0f110e);
  color: #fff8e8;
}

.os-shell .ghost-action {
  background: rgba(18, 20, 18, 0.06);
}

.os-workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(0, 1.55fr);
  gap: 18px;
  max-width: 1760px;
  padding: 18px;
}

.os-shell .debug-panel,
.os-shell .panel {
  border: 1px solid var(--os-line);
  border-radius: var(--os-radius);
  background: var(--os-panel);
  box-shadow: var(--os-shadow);
  backdrop-filter: blur(18px) saturate(1.08);
}

.os-shell .debug-panel {
  color: #fff8e8;
  background:
    linear-gradient(135deg, rgba(35, 38, 31, 0.98), rgba(18, 20, 18, 0.96)),
    var(--os-command);
}

.command-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 12px;
  color: #f8f2e7;
  background:
    linear-gradient(135deg, rgba(35, 38, 31, 0.98), rgba(18, 20, 18, 0.96)),
    var(--os-command);
}

.strip-title {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 86px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.strip-title strong {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.command-strip .eyebrow {
  color: rgba(255, 248, 232, 0.58);
}

.command-strip .eyebrow::before {
  background: #d89a4d;
  box-shadow: 0 0 0 4px rgba(216, 154, 77, 0.16);
}

.os-shell .debug-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.debug-card,
.os-shell .debug-grid > div {
  display: grid;
  align-content: space-between;
  min-height: 86px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  padding: 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.os-shell .debug-label {
  color: rgba(255, 248, 232, 0.56);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.os-shell .debug-panel strong {
  color: #fff8e8;
  font-size: 13px;
}

.os-shell .notifications {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.os-shell .notice {
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.065);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.os-shell .notice.ok {
  border-color: rgba(117, 224, 167, 0.45);
  background: rgba(31, 122, 77, 0.28);
}

.os-shell .notice.error {
  border-color: rgba(253, 162, 155, 0.42);
  background: rgba(163, 54, 43, 0.3);
}

.intake-module,
.queue-module {
  overflow: hidden;
  position: relative;
}

.intake-module::before,
.queue-module::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--os-accent), rgba(111, 127, 79, 0.8), transparent);
}

.os-shell .intake-panel {
  top: 92px;
  height: calc(100vh - 112px);
  padding: 16px;
}

.module-head,
.os-shell .section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.mode-pill,
.filter-control span,
.source-dock span,
.field-head small {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-pill {
  border: 1px solid rgba(31, 122, 77, 0.24);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(31, 122, 77, 0.08);
  color: var(--os-green);
}

.source-dock {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.source-dock span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--os-line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.68);
  color: var(--os-muted);
}

.command-dropzone {
  position: relative;
  grid-template-columns: auto minmax(0, 1fr) auto;
  place-items: center stretch;
  min-height: 150px;
  border: 1px dashed rgba(18, 20, 18, 0.32);
  border-radius: 22px;
  padding: 18px;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 254, 250, 0.78), rgba(237, 235, 226, 0.58)),
    repeating-linear-gradient(135deg, transparent 0 10px, rgba(18, 20, 18, 0.03) 10px 11px);
}

.command-dropzone:focus,
.command-dropzone.dragover {
  outline: none;
  border-color: var(--os-accent);
  background:
    linear-gradient(135deg, rgba(255, 248, 229, 0.9), rgba(235, 240, 226, 0.75)),
    repeating-linear-gradient(135deg, transparent 0 10px, rgba(181, 107, 40, 0.06) 10px 11px);
  box-shadow: 0 0 0 5px rgba(181, 107, 40, 0.12);
}

.command-dropzone .dropzone-icon {
  width: 56px;
  height: 56px;
  border-radius: 17px;
  background:
    linear-gradient(145deg, #22251d, #10120f);
  color: #fff8e8;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 30px;
}

.command-dropzone strong {
  display: block;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.command-dropzone span {
  display: block;
  max-width: 520px;
  margin-top: 5px;
  color: var(--os-muted);
  font-size: 13px;
  line-height: 1.45;
}

.field-block {
  color: var(--os-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

.field-head small {
  color: var(--os-muted);
}

.capture-shell {
  border: 1px solid var(--os-line);
  border-radius: 18px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.82), rgba(244, 242, 235, 0.66));
}

.os-shell input,
.os-shell select,
.os-shell textarea {
  border: 1px solid var(--os-line);
  border-radius: 13px;
  background: rgba(255, 254, 250, 0.82);
  color: var(--os-ink);
  font-size: 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.os-shell textarea {
  min-height: 220px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.os-shell input:focus,
.os-shell select:focus,
.os-shell textarea:focus {
  border-color: rgba(181, 107, 40, 0.74);
  background: #fffefa;
  box-shadow: 0 0 0 4px rgba(181, 107, 40, 0.12);
}

.meta-drawer {
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.62);
}

.meta-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
}

.meta-drawer summary span {
  color: var(--os-muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.advanced-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 12px 12px;
}

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

.project-field {
  grid-column: 1 / -1;
}

.submit-command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  border-radius: 16px;
  padding: 14px 16px;
}

.submit-command small {
  color: rgba(255, 248, 232, 0.62);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.attachments-preview {
  gap: 9px;
}

.auto-route-note {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(31, 122, 77, 0.18);
  border-radius: 15px;
  padding: 10px 12px;
  background: rgba(31, 122, 77, 0.07);
}

.auto-route-note span {
  color: var(--os-green);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auto-route-note strong {
  color: #304033;
  font-size: 12px;
  line-height: 1.35;
}

.attachment-chip {
  grid-template-columns: 58px 1fr auto;
  border-radius: 15px;
  background: rgba(255, 254, 250, 0.72);
}

.attachment-preview {
  display: grid;
  place-items: center;
  width: 58px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--os-line);
  border-radius: 12px;
  background: #ece9df;
}

.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview span {
  color: var(--os-muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.filter-control {
  display: grid;
  min-width: 230px;
  gap: 7px;
}

.filter-control span {
  color: var(--os-muted);
}

.os-shell .items {
  gap: 13px;
}

.os-shell .item {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border-color: var(--os-line);
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.9), rgba(247, 246, 241, 0.78));
  box-shadow: 0 14px 35px rgba(18, 20, 18, 0.07);
}

.os-shell .item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--os-accent);
}

.os-shell .item.saved::before {
  background: var(--os-green);
}

.os-shell .item.needs-action::before {
  background: var(--os-yellow);
}

.os-shell .item.discarded::before {
  background: #8a8f86;
}

.os-shell .item-head {
  align-items: flex-start;
}

.os-shell .item-title {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.035em;
}

.os-shell .item-url {
  color: var(--os-accent);
  font-size: 12px;
}

.os-shell .score {
  display: grid;
  gap: 3px;
  min-width: 70px;
  border: 1px solid rgba(31, 122, 77, 0.18);
  border-radius: 16px;
  background: rgba(31, 122, 77, 0.08);
  color: var(--os-green);
}

.os-shell .score span {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.os-shell .score strong {
  font-size: 21px;
}

.os-shell .score.low {
  border-color: rgba(154, 106, 16, 0.2);
  background: rgba(154, 106, 16, 0.08);
  color: var(--os-yellow);
}

.os-shell .badge {
  border-color: rgba(18, 20, 18, 0.1);
  background: rgba(255, 254, 250, 0.7);
  color: #394039;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.os-shell .status-badge {
  border-color: rgba(181, 107, 40, 0.22);
  background: rgba(181, 107, 40, 0.1);
  color: #7a4619;
}

.os-shell .saved-badge {
  border-color: rgba(31, 122, 77, 0.22);
  background: rgba(31, 122, 77, 0.09);
  color: var(--os-green);
}

.os-shell .summary,
.os-shell .synthesis {
  border: 1px solid rgba(18, 20, 18, 0.09);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 254, 250, 0.7);
  color: #384038;
  line-height: 1.58;
}

.os-shell .synthesis-title,
.os-shell .synthesis-subtitle {
  color: var(--os-green);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.06em;
}

.os-shell .time-badges {
  opacity: 0.82;
}

.os-shell .actions button {
  border-radius: 13px;
}

.os-shell .danger {
  border-color: rgba(163, 54, 43, 0.22);
  background: rgba(163, 54, 43, 0.06);
  color: var(--os-red);
}

.os-shell .empty {
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 254, 250, 0.72), rgba(237, 235, 226, 0.5));
}

@media (max-width: 1160px) {
  .os-shell .topbar,
  .os-workspace,
  .command-strip {
    grid-template-columns: 1fr;
  }

  .os-shell .top-actions {
    justify-content: flex-start;
  }

  .os-shell .intake-panel {
    position: static;
    height: auto;
  }
}

@media (max-width: 720px) {
  .os-workspace {
    padding: 12px;
  }

  .os-shell .debug-grid,
  .source-dock,
  .advanced-fields,
  .routing-grid {
    grid-template-columns: 1fr;
  }

  .command-dropzone {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .module-head,
  .os-shell .section-head {
    display: grid;
  }

  .filter-control {
    min-width: 0;
  }
}

/* UX refinement: compact capture + progressive reading */
.os-workspace {
  grid-template-columns: minmax(330px, 0.72fr) minmax(0, 1.85fr);
  align-items: start;
}

.os-shell .intake-panel {
  position: sticky;
  top: 88px;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 14px;
}

.intake-module form {
  gap: 9px;
  margin-top: 10px;
}

.intake-module .module-head {
  margin-bottom: 8px;
}

.intake-module .module-head h2 {
  font-size: clamp(20px, 1.45vw, 27px);
}

.intake-module .module-head p {
  max-width: 520px;
  font-size: 12px;
}

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

.source-dock span {
  min-height: 28px;
  padding: 0 9px;
  font-size: 10px;
}

.command-dropzone {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 96px;
  border-radius: 17px;
  padding: 12px;
}

.command-dropzone .dropzone-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 22px;
}

.command-dropzone strong {
  font-size: 14px;
}

.command-dropzone span {
  max-width: 390px;
  font-size: 12px;
}

.capture-shell {
  padding: 10px;
}

.os-shell .capture-shell textarea {
  min-height: 132px;
  max-height: 280px;
}

.compact-routing {
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
}

.compact-routing .project-field {
  grid-column: 1 / -1;
}

.compact-drawer summary {
  padding: 10px 12px;
}

.advanced-fields {
  gap: 9px;
}

.submit-command {
  position: sticky;
  bottom: 12px;
  z-index: 4;
  padding: 12px 14px;
  box-shadow: 0 18px 45px rgba(18, 20, 18, 0.16);
}

.queue-module {
  min-height: calc(100vh - 138px);
}

.queue-module .section-head p {
  max-width: 680px;
}

.content-preview {
  position: relative;
  overflow: hidden;
}

.content-preview.is-collapsed {
  max-height: 190px;
}

.content-preview.is-collapsed::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 74px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 254, 250, 0), rgba(255, 254, 250, 0.96));
}

.content-preview.is-expanded {
  max-height: none;
}

.content-preview.is-expanded::after {
  display: none;
}

.read-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.read-controls button {
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 11px;
}

.read-controls button[data-open-modal] {
  border-color: rgba(181, 107, 40, 0.24);
  background: rgba(181, 107, 40, 0.08);
  color: #7a4619;
}

.edit-modal-panel {
  width: min(860px, 100%);
}

.edit-item-form {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 18px 20px 22px;
}

.edit-item-form textarea {
  min-height: 170px;
}

/* Knowledge screen: neural network as background, UI as widgets */
.knowledge-stage {
  position: relative;
  min-height: calc(100vh - 86px);
  overflow: hidden;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 18%, rgba(216, 154, 77, 0.18), transparent 34%),
    radial-gradient(circle at 82% 22%, rgba(134, 168, 255, 0.14), transparent 30%),
    linear-gradient(135deg, #11140f 0%, #20231b 48%, #0f120e 100%);
}

.knowledge-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 248, 232, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 248, 232, 0.03) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at center, #000 0%, transparent 78%);
}

.neural-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.neural-background #knowledge-graph {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 86px);
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: crosshair;
}

.knowledge-widget {
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 248, 232, 0.14);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.13), rgba(255, 254, 250, 0.07));
  color: #fff8e8;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(22px) saturate(1.25);
}

.knowledge-widget h2,
.knowledge-widget strong {
  color: #fff8e8;
}

.knowledge-widget p,
.knowledge-widget .event code {
  color: rgba(255, 248, 232, 0.68);
}

.knowledge-widget .eyebrow {
  color: rgba(255, 248, 232, 0.62);
}

.knowledge-widget .eyebrow::before {
  background: #d89a4d;
  box-shadow: 0 0 0 4px rgba(216, 154, 77, 0.18);
}

.knowledge-widget-hero {
  display: grid;
  gap: 12px;
  width: min(860px, calc(100vw - 36px));
  padding: 16px;
}

.knowledge-map-head,
.knowledge-map-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.knowledge-map-head h2 {
  font-size: clamp(26px, 2.5vw, 46px);
  letter-spacing: -0.06em;
}

.knowledge-panel-actions,
.knowledge-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.knowledge-panel-actions button {
  border-color: rgba(216, 154, 77, 0.3);
  background: rgba(216, 154, 77, 0.14);
}

.knowledge-legend {
  max-width: 360px;
}

.knowledge-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 248, 232, 0.12);
  border-radius: 999px;
  padding: 7px 9px;
  background: rgba(255, 254, 250, 0.08);
  color: rgba(255, 248, 232, 0.72);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  box-shadow: 0 0 14px currentColor;
}

.legend-dot.knowledge {
  background: #d89a4d;
  color: #d89a4d;
}

.legend-dot.area {
  background: #8fbf7b;
  color: #8fbf7b;
}

.legend-dot.project {
  background: #86a8ff;
  color: #86a8ff;
}

.legend-dot.tag {
  background: #f0e1b9;
  color: #f0e1b9;
}

.knowledge-widget-detail {
  position: absolute;
  top: 18px;
  right: 18px;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 128px);
  overflow: auto;
  padding: 16px;
}

.knowledge-stage .metrics {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  margin-bottom: 0;
}

.knowledge-stage .metric,
.knowledge-stage .item,
.knowledge-stage .event,
.knowledge-stage .synthesis,
.knowledge-stage .summary,
.knowledge-stage .graph-connected button {
  border-color: rgba(255, 248, 232, 0.12);
  background: rgba(255, 254, 250, 0.08);
  color: #fff8e8;
}

.knowledge-stage .metric span,
.knowledge-stage .badge,
.knowledge-stage .graph-type {
  border-color: rgba(255, 248, 232, 0.13);
  background: rgba(255, 254, 250, 0.08);
  color: rgba(255, 248, 232, 0.76);
}

.knowledge-stage .metric strong,
.knowledge-stage .item-title,
.knowledge-stage .score strong {
  color: #fff8e8;
}

.knowledge-stage .score {
  border-color: rgba(216, 154, 77, 0.28);
  background: rgba(216, 154, 77, 0.14);
  color: #f0e1b9;
}

.knowledge-stage .item-url {
  color: #f0c98f;
}

.knowledge-stage .synthesis-title,
.knowledge-stage .synthesis-subtitle {
  color: #d89a4d;
}

.knowledge-stage input,
.knowledge-stage select,
.knowledge-stage textarea,
.knowledge-stage button {
  border-color: rgba(255, 248, 232, 0.13);
  background: rgba(255, 254, 250, 0.1);
  color: #fff8e8;
}

.knowledge-stage button:hover {
  border-color: rgba(216, 154, 77, 0.5);
  background: rgba(216, 154, 77, 0.16);
}

.knowledge-modal-panel {
  width: min(1120px, calc(100vw - 28px));
  max-height: min(88vh, 960px);
  background:
    linear-gradient(180deg, rgba(22, 25, 19, 0.97), rgba(13, 15, 12, 0.97));
  color: #fff8e8;
}

.knowledge-modal-panel .read-modal-head {
  border-bottom-color: rgba(255, 248, 232, 0.12);
}

.knowledge-modal-toolbar {
  border-bottom: 1px solid rgba(255, 248, 232, 0.1);
  padding: 14px 20px;
}

.knowledge-modal-list {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 18px 20px 22px;
}

.knowledge-engine-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  overflow: auto;
  padding: 18px 20px 22px;
}

.knowledge-engine-grid section {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid rgba(255, 248, 232, 0.1);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 254, 250, 0.06);
}

.knowledge-modal-panel h2,
.knowledge-modal-panel strong,
.knowledge-modal-panel .item-title,
.knowledge-modal-panel .score strong {
  color: #fff8e8;
}

.knowledge-modal-panel p,
.knowledge-modal-panel code {
  color: rgba(255, 248, 232, 0.68);
}

.knowledge-modal-panel .item,
.knowledge-modal-panel .event,
.knowledge-modal-panel .synthesis,
.knowledge-modal-panel .summary,
.knowledge-modal-panel .badge,
.knowledge-modal-panel .metric {
  border-color: rgba(255, 248, 232, 0.12);
  background: rgba(255, 254, 250, 0.07);
  color: #fff8e8;
}

/* SOCIAL section: compact planning console + draft review board */
.social-stage {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.5fr);
  gap: 18px;
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px;
}

.social-command-strip {
  grid-column: 1 / -1;
}

.social-planner,
.social-queue {
  overflow: hidden;
  position: relative;
}

.social-planner::before,
.social-queue::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #d89a4d, rgba(255, 84, 0, 0.8), transparent);
}

.social-planner {
  align-self: start;
  position: sticky;
  top: 92px;
  display: grid;
  gap: 13px;
  padding: 16px;
}

.social-planner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.social-planner-head h2 {
  font-size: clamp(24px, 2vw, 36px);
}

.social-mode-pills {
  display: grid;
  gap: 8px;
  min-width: 104px;
}

.social-mode-pills .inline-check {
  justify-content: center;
  border: 1px solid rgba(18, 20, 18, 0.1);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 254, 250, 0.62);
}

.social-notes textarea {
  min-height: 150px;
  max-height: 280px;
}

.social-planner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.social-queue {
  padding: 16px;
}

.social-queue .section-head {
  align-items: center;
}

.social-queue .makyna-items {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}

.social-queue .makyna-card {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.social-queue .makyna-copy {
  max-height: 128px;
  overflow: hidden;
  position: relative;
}

.social-queue .makyna-copy::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42px;
  background: linear-gradient(180deg, rgba(255, 254, 250, 0), rgba(255, 254, 250, 0.96));
}

.social-modal-panel {
  width: min(1060px, calc(100vw - 28px));
  max-height: min(88vh, 960px);
}

.social-modal-body {
  overflow: auto;
  padding: 18px 20px 24px;
}

.social-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.social-detail-copy,
.social-detail-grid > section {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--os-line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 254, 250, 0.62);
}

.social-detail-grid .storyboard {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.social-revise-form {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 18px 20px 22px;
}

.social-revise-form textarea {
  min-height: 190px;
}

@media (max-width: 1040px) {
  .social-stage,
  .social-detail-grid {
    grid-template-columns: 1fr;
  }

  .social-planner {
    position: static;
  }
}

@media (max-width: 640px) {
  .social-stage {
    padding: 12px;
  }

  .social-planner-head,
  .social-planner-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .knowledge-stage {
    display: grid;
    gap: 14px;
    overflow: visible;
    padding-bottom: 18px;
  }

  .knowledge-widget-detail {
    position: relative;
    inset: auto;
    width: 100%;
    max-height: none;
  }

  .neural-background {
    position: fixed;
  }
}

@media (max-width: 720px) {
  .knowledge-stage {
    min-height: calc(100vh - 132px);
    padding: 12px;
  }

  .knowledge-stage .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .knowledge-map-head,
  .knowledge-map-controls,
  .knowledge-engine-grid {
    display: grid;
  }

  .knowledge-panel-actions,
  .knowledge-legend {
    justify-content: flex-start;
  }

  .knowledge-widget-hero,
  .knowledge-widget-detail {
    border-radius: 18px;
    padding: 12px;
  }
}

.read-modal[hidden] {
  display: none;
}

.read-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
}

.read-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 15, 12, 0.56);
  backdrop-filter: blur(10px);
}

.read-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 100%);
  max-height: min(86vh, 920px);
  overflow: hidden;
  border: 1px solid rgba(255, 254, 250, 0.22);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(243, 241, 233, 0.98));
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.34);
}

.read-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--os-line);
  padding: 18px 20px 14px;
}

.read-modal-head h2 {
  max-width: 760px;
  font-size: clamp(22px, 2vw, 32px);
}

.modal-close {
  flex: 0 0 auto;
}

.read-modal-body {
  overflow: auto;
  padding: 18px 20px 24px;
}

.read-modal-body p,
.read-modal-body li {
  color: #2f362f;
  font-size: 14px;
  line-height: 1.62;
}

.modal-open {
  overflow: hidden;
}

@media (max-width: 1160px) {
  .os-shell .intake-panel {
    position: static;
  }

  .queue-module {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .command-dropzone,
  .compact-routing {
    grid-template-columns: 1fr;
  }

  .submit-command {
    position: static;
  }

  .read-modal {
    padding: 10px;
  }

  .read-modal-panel {
    max-height: 92vh;
    border-radius: 18px;
  }
}
