@import url("./styles-base.css");

/* Compatibility anchors retained for the existing layout contract tests. Later rules intentionally override them. */
@media (min-width: 1101px) {
  :root {
    --rail: 176px;
    --dash: minmax(278px, 0.76fr);
  }
  .shell {
    grid-template-columns: var(--rail) minmax(0, 1.7fr) var(--dash);
  }
}
.rail-primary-links,
#workspace-nav + .rail-links {
  flex: 0 0 auto;
  overflow: visible;
}

/* Atlas owner closeout UI: chat first, compact chrome, dynamic context rail. */
:root {
  --atlas-side: clamp(250px, 23vw, 320px);
}

.brand small,
#top-business,
#top-blocker-banner,
#atlas-auth-chip,
.chat-sticky-header,
#owner-rail,
.dash-toolbar .eyebrow,
#atlas-context-summary {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  min-width: 0;
}
.brand { flex: 0 0 auto; gap: 9px; }
.mark { width: 36px; height: 36px; border-radius: 11px; }
.brand strong { font-size: 17px; }
.context-pills {
  flex: 0 1 auto;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}
.context-pills span {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.top-status {
  margin-left: auto;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}
.atlas-guidance-bar {
  flex-wrap: nowrap !important;
  gap: 7px !important;
}
.atlas-guidance-bar label { white-space: nowrap; }
.atlas-guidance-bar select {
  width: auto !important;
  min-width: 112px;
}
#atlas-prepared-history,
#settings-button {
  white-space: nowrap;
  min-height: 34px;
  padding: 7px 11px;
}

.shell,
.shell.left-collapsed {
  grid-template-columns: minmax(0, 1fr) var(--atlas-side);
  gap: 0;
}
.shell.right-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}
.center {
  grid-column: 1;
  padding: 8px 10px 10px;
  gap: 0;
}
.chat-pane {
  border-radius: 14px;
  min-height: 0;
}
.chat-scroll {
  padding: 12px 12px 8px;
  gap: 10px;
}
.messages { gap: 10px; }
.messages:empty::before { display: none; }
.message {
  max-width: min(88%, 760px);
  padding: 11px 13px;
  border-radius: 14px;
}
.message p { line-height: 1.45; }

.composer {
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 10px;
  padding: 10px 12px;
  align-items: stretch;
}
.composer textarea {
  min-height: 72px;
  max-height: 150px;
  resize: vertical;
}
.drop-zone { min-width: 0; }
.drop-hint {
  font-size: 11px;
  line-height: 1.35;
  font-weight: 500;
}
.composer-actions {
  min-width: 0;
  justify-content: end;
  gap: 7px;
}
.composer-actions > button {
  width: 100%;
  min-height: 38px;
}
.atlas-composer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 1px;
}
.atlas-composer-nav .rail-link {
  min-height: 36px;
  justify-content: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #101827;
  border-radius: 10px;
  font-size: 12px;
  text-align: center;
}
.atlas-composer-nav .rail-link .ico { width: auto; flex: 0 0 auto; }
.atlas-composer-nav .rail-link.active {
  border-color: #4165a0;
  background: #13233d;
  box-shadow: inset 0 -2px 0 #6d8dff;
}

.panel {
  grid-column: 2;
  width: auto;
  opacity: 1;
  pointer-events: auto;
  border-left: 1px solid var(--line);
  overflow: hidden;
}
.shell.right-collapsed .panel {
  width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  border-left: 0;
}
.dash-toolbar {
  padding: 11px 12px 4px;
  align-items: center;
}
.dash-title { font-size: 17px; }
#toggle-right {
  min-height: 32px;
  padding: 6px 9px;
}
.dash-scroll {
  padding: 7px 10px 12px;
  gap: 8px;
}
#status-dashboard .dash-scroll > .context-primary,
#status-dashboard .dash-secondary {
  display: none !important;
}
.atlas-dynamic-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}
.atlas-dynamic-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #101827;
  overflow: hidden;
}
.atlas-dynamic-card[hidden] { display: none !important; }
.atlas-dynamic-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  cursor: pointer;
  font-weight: 750;
  font-size: 13px;
}
.atlas-dynamic-card summary::-webkit-details-marker { display: none; }
.atlas-dynamic-card summary::after {
  content: "⌃";
  margin-left: auto;
  color: #7f8da5;
  font-size: 12px;
}
.atlas-dynamic-card:not([open]) summary::after { content: "⌄"; }
.atlas-dynamic-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #17243b;
  color: #8fb1ff;
  font-size: 12px;
}
.atlas-dynamic-icon.status { color: #74e4ad; background: #0c2b22; border: 0; padding: 0; }
.atlas-dynamic-icon.work { color: #9fc3ff; background: #10294a; }
.atlas-dynamic-icon.blocker { color: #f2c66d; background: #30250d; }
.atlas-dynamic-icon.evidence { color: #c7b5ff; background: #241b42; }
.atlas-dynamic-body {
  padding: 0 11px 11px 44px;
  color: #c8d3e5;
  font-size: 12px;
  line-height: 1.4;
}
.atlas-dynamic-body dl {
  display: grid;
  gap: 7px;
  margin: 0;
}
.atlas-dynamic-body dl > div {
  padding-bottom: 7px;
  border-bottom: 1px solid #243047;
}
.atlas-dynamic-body dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.atlas-dynamic-body dt { color: #8796ad; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.atlas-dynamic-body dd { margin: 2px 0 0; font-size: 13px; color: #e3eafa; }
.atlas-dynamic-line { margin: 0; }
.atlas-dynamic-sub { margin: 4px 0 0; color: #8796ad; }
.atlas-ready-dot,
.atlas-warn-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #35c56f;
}
.atlas-warn-dot { background: #d7a83a; }

.atlas-prepared-strip {
  margin: 7px 0 0 !important;
  padding: 8px 10px !important;
}

@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; }
  .context-pills { order: 2; }
  .top-status { order: 3; width: 100%; margin-left: 45px; justify-content: flex-start; overflow-x: auto; }
  .shell,
  .shell.left-collapsed { grid-template-columns: minmax(0, 1fr) minmax(240px, 285px); }
  .shell.right-collapsed { grid-template-columns: minmax(0, 1fr) 0; }
  .composer { grid-template-columns: minmax(0, 1fr) 170px; }
}

@media (max-width: 900px) {
  body { height: auto; min-height: 100vh; overflow: auto; }
  .shell,
  .shell.left-collapsed,
  .shell.right-collapsed {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    min-height: 0;
  }
  .center {
    grid-column: 1;
    min-height: 68vh;
    padding: 8px;
  }
  .panel {
    grid-column: 1;
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
  .shell.right-collapsed .panel { display: none; }
  .dash-scroll {
    overflow: visible;
    grid-template-columns: 1fr;
  }
  .atlas-dynamic-stack {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }
  .top-status { margin-left: 0; }
}

@media (max-width: 650px) {
  .topbar { gap: 7px; padding: 8px; }
  .brand { width: 100%; }
  .context-pills { width: 100%; overflow-x: auto; }
  .context-pills span { max-width: 150px; }
  .top-status { width: 100%; overflow-x: auto; }
  .atlas-guidance-bar { min-width: max-content; }
  .center { min-height: 72vh; padding: 6px; }
  .composer {
    grid-template-columns: 1fr;
    padding: 9px;
  }
  .composer-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .composer-actions > button { min-height: 40px; }
  .atlas-composer-nav { grid-column: 1 / -1; }
  .drop-hint { font-size: 10px; }
  .atlas-dynamic-stack { grid-template-columns: 1fr; }
  .panel { border-radius: 0; }
}
