:root {
  color-scheme: light;
  --field-green: #2f3f25;
  --warm-white: #f6f1e8;
  --sky-blue: #9db7c8;
  --washed-stone: #e7e0d2;
  --soft-black: #161713;
  --sun-gold: #c8a85a;
  --bark-brown: #6b5a43;
  --ink: var(--soft-black);
  --ink-soft: #384036;
  --muted: rgba(107, 90, 67, 0.78);
  --paper: var(--warm-white);
  --surface: #fbf8f1;
  --surface-2: #eee7d9;
  --line: rgba(47, 63, 37, 0.16);
  --green: var(--field-green);
  --green-dark: #223019;
  --blue: #557d92;
  --gold: var(--sun-gold);
  --coral: #9e5d4b;
  --violet: #6c617d;
  --pink: #8b5368;
  --shadow: 0 16px 44px rgba(22, 23, 19, 0.1);
  --radius: 7px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

body {
  overflow-x: hidden;
}

body.request-portal-body {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(157, 183, 200, 0.28), transparent 38%),
    linear-gradient(180deg, var(--warm-white), #efe8da);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
}

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

.portal-shell {
  width: min(860px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.portal-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 6px;
}

.portal-header img {
  width: min(220px, 42vw);
  height: auto;
}

.portal-header h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.05;
  text-align: right;
}

.portal-status,
.portal-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 248, 241, 0.9);
  box-shadow: var(--shadow);
}

.portal-status {
  padding: 14px;
  color: var(--bark-brown);
  font-weight: 800;
}

.portal-status.is-error {
  border-color: rgba(217, 96, 75, 0.34);
  background: rgba(217, 96, 75, 0.08);
  color: #9a3228;
}

.portal-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  padding: 18px 12px;
  background: #26361f;
  color: var(--warm-white);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: block;
  padding: 10px 9px 14px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: min(100%, 164px);
  height: auto;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(246, 241, 232, 0.72);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(246, 241, 232, 0.1);
  color: var(--warm-white);
}

.nav-item span:first-child {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #cbd8cf;
}

.sidebar-foot {
  padding: 10px;
  color: rgba(246, 247, 242, 0.64);
  font-size: 0.84rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 16px;
}

.title-block h1,
.section-heading h2,
.panel-head h2,
.modal-head h2,
.requirements-editor h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

.title-block h1 {
  font-size: clamp(1.9rem, 3.2vw, 3.05rem);
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: end;
  gap: 10px;
}

.select-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.select-control select,
label input,
label select,
label textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.84);
  color: var(--ink);
  padding: 9px 11px;
  outline: 0;
}

label textarea {
  min-height: 108px;
  resize: vertical;
}

select[multiple] {
  min-height: 130px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  line-height: 1;
}

.button {
  padding: 0 13px;
  font-size: 0.9rem;
}

.icon-button {
  width: 36px;
  padding: 0;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
  font-size: 1rem;
}

.button.primary {
  background: var(--soft-black);
  color: var(--warm-white);
}

.button.primary:hover {
  background: var(--field-green);
}

.button.ghost {
  background: rgba(255, 250, 241, 0.7);
  border-color: var(--line);
  color: var(--ink);
}

.button.ghost:hover,
.icon-button:hover {
  background: var(--surface-2);
}

.button.danger {
  margin-right: auto;
  background: rgba(217, 96, 75, 0.08);
  border-color: rgba(217, 96, 75, 0.28);
  color: #9a3228;
}

.button.danger:hover {
  background: rgba(217, 96, 75, 0.16);
}

.notice {
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid #e4cb9a;
  border-radius: var(--radius);
  background: rgba(200, 168, 90, 0.18);
  color: var(--bark-brown);
  font-weight: 700;
}

.view-stack {
  display: grid;
  gap: 28px;
  min-width: 0;
}

.view-section,
.tool-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 248, 241, 0.86);
}

.view-section {
  padding: 16px;
}

.section-heading,
.panel-head,
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.section-heading h2 {
  font-size: 1.35rem;
  font-weight: 800;
}

.panel-head h2 {
  font-size: 1.45rem;
  font-weight: 800;
}

.modal-head h2 {
  font-size: 1.7rem;
  font-weight: 800;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading.compact {
  margin: 0 0 12px;
}

.section-heading.compact h3 {
  font-size: 1rem;
}

.panel-head.compact h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
}

.week-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.week-banner,
.analytics-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(47, 63, 37, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(157, 183, 200, 0.24), rgba(231, 224, 210, 0.45));
}

.week-banner span,
.analytics-subhead span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.week-banner strong,
.analytics-subhead strong {
  display: block;
  margin-top: 2px;
  font-size: 1.1rem;
  font-weight: 900;
}

.week-banner em,
.analytics-subhead p {
  margin: 0;
  color: var(--bark-brown);
  font-style: normal;
  font-weight: 800;
}

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

.metric-card,
.content-card,
.task-card,
.alert-card,
.note-card,
.setup-item,
.calendar-post {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.7);
}

.metric-card {
  padding: 13px;
  display: grid;
  gap: 9px;
}

.metric-card.is-short {
  border-color: rgba(158, 93, 75, 0.46);
  background: rgba(231, 224, 210, 0.72);
}

.metric-card.is-met {
  border-color: rgba(47, 63, 37, 0.35);
  background: rgba(157, 183, 200, 0.18);
}

.metric-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.metric-number {
  font-size: 1.75rem;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(107, 90, 67, 0.18);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.is-short .progress-bar {
  background: var(--coral);
}

.tri-column {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.request-panel {
  min-height: 0;
  margin-top: 14px;
  grid-template-rows: auto auto minmax(0, auto);
}

.request-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.request-list {
  display: grid;
  gap: 9px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.request-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.74);
}

.request-card.status-New {
  border-left-color: var(--gold);
}

.request-card.status-Reviewing,
.request-card.status-Accepted {
  border-left-color: var(--blue);
}

.request-card.status-Converted {
  border-left-color: var(--field-green);
}

.request-card.status-Archived {
  opacity: 0.72;
  border-left-color: var(--muted);
}

.request-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.panel-intro {
  max-width: 820px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.ai-ops-panel {
  min-height: 0;
  margin-top: 14px;
  grid-template-rows: auto auto auto minmax(0, auto) auto;
  background:
    linear-gradient(135deg, rgba(47, 63, 37, 0.06), rgba(157, 183, 200, 0.12)),
    rgba(251, 248, 241, 0.9);
}

.ops-health-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.ops-health-card,
.ops-card,
.ops-mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.72);
}

.ops-health-card {
  min-height: 86px;
  padding: 10px;
  border-top: 3px solid var(--blue);
}

.ops-health-card.is-good {
  border-top-color: var(--field-green);
}

.ops-health-card.is-warn,
.ops-health-card.is-watch {
  border-top-color: var(--sun-gold);
}

.ops-health-card.is-risk {
  border-top-color: var(--coral);
}

.ops-health-card span,
.ops-mini-card > span:first-child {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ops-health-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
  line-height: 1;
}

.ops-health-card em {
  display: block;
  margin-top: 8px;
  color: var(--bark-brown);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
}

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

.ops-card {
  min-width: 0;
  padding: 11px;
}

.ops-card > div:last-child {
  display: grid;
  gap: 8px;
}

.ops-mini-card {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.ops-mini-card strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.22;
}

.ops-mini-card p,
.ops-mini-card em {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.36;
}

.ops-mini-card em {
  color: var(--bark-brown);
  font-style: normal;
  font-weight: 800;
}

.ops-output {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 13px;
  border: 1px solid rgba(47, 63, 37, 0.13);
  border-radius: var(--radius);
  background: rgba(22, 23, 19, 0.94);
  color: var(--warm-white);
  white-space: pre-wrap;
  line-height: 1.45;
  font: inherit;
  font-size: 0.84rem;
}

.severity-High {
  background: rgba(158, 93, 75, 0.16);
  color: #7a3c2f;
}

.severity-Medium {
  background: rgba(200, 168, 90, 0.22);
  color: #705822;
}

.severity-Low {
  background: rgba(157, 183, 200, 0.24);
  color: #284b5a;
}

.analytics-section {
  display: grid;
  gap: 14px;
}

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

.analytics-metric,
.analytics-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.7);
}

.analytics-metric {
  min-height: 92px;
  padding: 11px;
}

.analytics-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.analytics-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.analytics-metric em {
  display: block;
  margin-top: 8px;
  color: var(--bark-brown);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
  gap: 14px;
}

.analytics-panel {
  min-width: 0;
  padding: 12px;
}

.integration-panel {
  display: grid;
  gap: 10px;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.integration-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.72);
  border-top: 3px solid var(--muted);
}

.integration-card.is-connected {
  border-top-color: var(--field-green);
}

.integration-card.is-needs-secret,
.integration-card.is-needs-oauth {
  border-top-color: var(--sun-gold);
}

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

.integration-card strong {
  min-width: 0;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-card p,
.integration-card em {
  display: block;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.35;
}

.integration-card em {
  color: var(--bark-brown);
  font-style: normal;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.integration-actions {
  margin-top: 10px;
}

.integration-setup-body {
  display: grid;
  gap: 10px;
}

.integration-setup-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.72);
}

.integration-setup-card h3,
.integration-setup-card p {
  margin: 0;
}

.integration-setup-card h3 {
  font-size: 0.98rem;
  font-weight: 900;
}

.integration-setup-card p,
.integration-step-list {
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.45;
}

.integration-setup-meta,
.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.missing-secrets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--bark-brown);
  font-size: 0.82rem;
  font-weight: 900;
}

.missing-secrets.is-ready {
  color: var(--field-green);
}

.missing-secrets code {
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(200, 168, 90, 0.16);
  color: var(--bark-brown);
  font: inherit;
  font-size: 0.76rem;
}

.integration-step-list {
  margin: 0;
  padding-left: 20px;
}

.integration-step-list li + li {
  margin-top: 6px;
}

.security-note {
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(200, 168, 90, 0.36);
  border-radius: var(--radius);
  background: rgba(200, 168, 90, 0.12);
  color: var(--bark-brown);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.38;
}

.command-output {
  min-height: 86px;
  max-height: 220px;
  overflow: auto;
  margin: 7px 0 0;
  padding: 12px;
  border: 1px solid rgba(47, 63, 37, 0.18);
  border-radius: var(--radius);
  background: rgba(22, 23, 19, 0.94);
  color: var(--warm-white);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.performance-table {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.performance-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.4fr) repeat(4, minmax(58px, 0.65fr));
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(47, 63, 37, 0.1);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.6);
  font-weight: 800;
}

.performance-row.is-head {
  background: rgba(47, 63, 37, 0.08);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.performance-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-output {
  min-height: 360px;
  max-height: 480px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 13px;
  border: 1px solid rgba(47, 63, 37, 0.13);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.44;
  font: inherit;
  font-size: 0.86rem;
}

.tool-panel {
  min-height: 500px;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

#alerts {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.scroll-list {
  display: grid;
  align-content: start;
  gap: 9px;
  max-height: 484px;
  overflow: auto;
  padding-right: 4px;
}

.content-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 11px;
  padding: 8px;
}

.content-thumb {
  width: 92px;
  aspect-ratio: 3 / 2;
  border-radius: 7px;
  background: var(--surface-2);
  object-fit: cover;
  border: 1px solid var(--line);
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.card-copy {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.35;
}

.meta-row,
.chip-row,
.feed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meta-row {
  margin-top: 10px;
}

.feed-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.feed-manager {
  min-width: 0;
  border: 1px solid rgba(47, 63, 37, 0.14);
  border-radius: var(--radius);
  background: rgba(231, 224, 210, 0.28);
}

.feed-manager summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 0 11px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  list-style: none;
}

.feed-manager summary::-webkit-details-marker {
  display: none;
}

.feed-manager summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 2px;
  border-radius: 999px;
  background: rgba(47, 63, 37, 0.1);
  color: var(--field-green);
  font-weight: 900;
}

.feed-manager[open] summary::before {
  content: "−";
}

.feed-manager summary span {
  flex: 1 1 auto;
  min-width: 0;
}

.feed-manager summary strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.feed-manager-actions {
  display: flex;
  justify-content: flex-start;
  padding: 0 10px 10px;
}

.feed-manager .feed-list {
  padding: 0 10px 10px;
}

.feed-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(47, 63, 37, 0.14);
  border-radius: var(--radius);
  background: rgba(231, 224, 210, 0.35);
}

.feed-card strong,
.feed-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-card strong {
  font-size: 0.84rem;
}

.feed-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.feed-card .card-actions {
  margin-top: 0;
}

.status-chip,
.platform-chip,
.small-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.platform-chip {
  gap: 5px;
  background: rgba(47, 63, 37, 0.08);
  color: var(--soft-black);
  border: 1px solid rgba(47, 63, 37, 0.12);
}

.small-chip {
  background: var(--surface-2);
  color: var(--muted);
}

.status-Idea { background: rgba(231, 224, 210, 0.85); color: var(--bark-brown); }
.status-Draft { background: rgba(157, 183, 200, 0.32); color: #2f5668; }
.status-Needs-Internal-Review { background: rgba(200, 168, 90, 0.28); color: #705822; }
.status-Pending-Client-Approval { background: rgba(158, 93, 75, 0.18); color: #7a3c2f; }
.status-Approved { background: rgba(47, 63, 37, 0.12); color: var(--field-green); }
.status-Scheduled { background: rgba(157, 183, 200, 0.46); color: #284b5a; }
.status-Live { background: rgba(47, 63, 37, 0.18); color: var(--field-green); }
.status-Needs-Revision { background: rgba(139, 83, 104, 0.16); color: #6a3b4c; }

.task-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-pill {
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.summary-pill strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
}

.summary-pill span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.task-card,
.alert-card,
.note-card {
  padding: 10px;
}

.task-card.is-overdue {
  border-color: rgba(217, 96, 75, 0.5);
}

.performance-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.performance-mini span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(157, 183, 200, 0.2);
  color: #284b5a;
  font-size: 0.72rem;
  font-weight: 900;
}

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

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(47, 63, 37, 0.16);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.84);
  color: var(--soft-black);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.action-button:hover {
  background: rgba(157, 183, 200, 0.22);
}

.action-button.success {
  background: rgba(47, 63, 37, 0.1);
  color: var(--field-green);
}

.action-button.danger {
  background: rgba(217, 96, 75, 0.08);
  border-color: rgba(217, 96, 75, 0.22);
  color: #9a3228;
}

.calendar-section {
  overflow: hidden;
}

.month-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.post-Idea { background: #87918b; }
.legend-dot.post-Draft { background: var(--violet); }
.legend-dot.post-Needs-Internal-Review { background: var(--gold); }
.legend-dot.post-Pending-Client-Approval { background: var(--coral); }
.legend-dot.post-Approved { background: var(--green); }
.legend-dot.post-Scheduled { background: var(--blue); }
.legend-dot.post-Live { background: #2e7d45; }
.legend-dot.post-Needs-Revision { background: var(--pink); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  overflow-x: auto;
}

.calendar-day,
.calendar-weekday {
  min-width: 128px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-weekday {
  min-height: 34px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-day {
  position: relative;
  min-height: 116px;
  padding: 7px;
  background: var(--surface);
}

.calendar-day.is-muted {
  background: rgba(231, 224, 210, 0.58);
  color: #9aa59d;
}

.day-number {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
  font-weight: 900;
}

.day-add {
  opacity: 0;
  transition: opacity 140ms ease;
}

.calendar-day:hover .day-add {
  opacity: 1;
}

.calendar-post {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 6px;
  padding: 6px;
  border-left: 3px solid var(--green);
  overflow: hidden;
  text-align: left;
  font-size: 0.74rem;
  line-height: 1.25;
}

.calendar-post strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-post .platform-chip {
  margin-top: 5px;
  min-height: 20px;
  max-width: 100%;
  font-size: 0.68rem;
}

.post-Idea { border-left-color: #87918b; }
.post-Draft { border-left-color: var(--violet); }
.post-Needs-Internal-Review { border-left-color: var(--gold); }
.post-Pending-Client-Approval { border-left-color: var(--coral); }
.post-Approved { border-left-color: var(--green); }
.post-Scheduled { border-left-color: var(--blue); }
.post-Live { border-left-color: #2e7d45; }
.post-Needs-Revision { border-left-color: var(--pink); }

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 18px;
}

.setup-grid {
  display: grid;
  gap: 10px;
}

.setup-item {
  padding: 10px;
}

.setup-item > span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-item strong,
.setup-item p,
.setup-value {
  margin: 5px 0 0;
}

.setup-item p,
.setup-value,
.setup-item a,
.setup-item small {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.setup-item small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.setup-item .platform-chip {
  width: auto;
  max-width: 100%;
  margin: 4px 6px 2px 0;
}

.setup-chip-row {
  align-items: center;
}

.modal {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: transparent;
}

.modal.wide-modal {
  width: min(1120px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(20, 28, 24, 0.58);
}

.modal-card {
  display: grid;
  gap: 14px;
  padding: 15px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 44px);
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.modal-card.wide {
  width: 100%;
}

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

.performance-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(47, 63, 37, 0.13);
  border-radius: var(--radius);
  background: rgba(231, 224, 210, 0.28);
}

.sync-hint {
  margin: -2px 0 0;
  padding: 9px 10px;
  border: 1px solid rgba(47, 63, 37, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.72);
  color: var(--bark-brown);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
}

.sync-hint.is-good {
  border-color: rgba(47, 63, 37, 0.26);
  background: rgba(47, 63, 37, 0.08);
  color: var(--field-green);
}

.sync-hint.is-warn {
  border-color: rgba(200, 168, 90, 0.42);
  background: rgba(200, 168, 90, 0.16);
  color: var(--bark-brown);
}

.sync-copy {
  color: var(--bark-brown);
  font-weight: 800;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.full-label {
  grid-column: 1 / -1;
}

.requirements-editor {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.requirement-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 120px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.draft-output {
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.45;
}

.composer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 270px);
  gap: 14px;
  align-items: start;
}

.composer-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.asset-panel {
  position: sticky;
  top: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.asset-panel > * {
  min-width: 0;
  max-width: 100%;
}

.asset-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--washed-stone);
}

.asset-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
}

.upload-zone {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px dashed rgba(107, 90, 67, 0.5);
  border-radius: var(--radius);
  background: rgba(231, 224, 210, 0.55);
  color: var(--ink);
}

.upload-zone strong,
.naming-hint {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.upload-zone span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.upload-zone input {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.82rem;
}

.naming-card,
.naming-hint {
  border: 1px solid rgba(200, 168, 90, 0.35);
  border-radius: var(--radius);
  background: rgba(200, 168, 90, 0.13);
  color: var(--bark-brown);
}

.naming-card {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.naming-card strong {
  color: var(--ink);
}

.naming-card p,
.naming-hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.38;
}

.naming-hint {
  padding: 10px 12px;
}

.naming-hint.compact {
  padding: 8px 10px;
}

.platform-icon {
  display: inline-flex;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 999px;
  background: rgba(22, 23, 19, 0.08);
  color: var(--soft-black);
  font-size: 0;
  font-weight: 800;
  line-height: 1;
}

.platform-icon svg {
  width: 13px;
  height: 13px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.platform-icon .fill-icon {
  fill: currentColor;
  stroke: none;
}

.platform-icon.is-Instagram,
.platform-icon.is-Facebook,
.platform-icon.is-LinkedIn,
.platform-icon.is-TikTok,
.platform-icon.is-X,
.platform-icon.is-YouTube,
.platform-icon.is-Blog,
.platform-icon.is-Newsletter,
.platform-icon.is-Podcast {
  background: rgba(22, 23, 19, 0.08);
  color: var(--soft-black);
}

.platform-picker {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.platform-picker legend {
  padding: 0 5px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 900;
}

#clientPlatformGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.platform-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--warm-white);
  color: var(--ink);
  font-weight: 700;
}

.platform-option span:last-child,
.platform-chip {
  min-width: 0;
}

.platform-option input {
  width: 16px;
  min-height: 16px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 250, 241, 0.65);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .contract-grid,
  .analytics-summary,
  .integration-grid,
  .analytics-grid,
  .ops-health-grid,
  .ops-grid,
  .tri-column,
  .split-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-grid .ops-card:last-child,
  .tri-column .tool-panel:last-child,
  .split-section .tool-panel:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  body.request-portal-body {
    padding: 16px;
  }

  .portal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-header h1 {
    text-align: left;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto;
  }

  .sidebar-foot {
    display: none;
  }

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

  .workspace {
    width: 100%;
    min-width: 0;
    padding: 18px;
  }

  .topbar,
  .contract-grid,
  .analytics-summary,
  .integration-grid,
  .analytics-grid,
  .ops-health-grid,
  .ops-grid,
  .request-summary,
  .request-card,
  .tri-column,
  .split-section,
  .form-grid,
  .performance-form,
  .requirement-row {
    grid-template-columns: 1fr;
  }

  .week-banner,
  .analytics-subhead {
    align-items: flex-start;
    flex-direction: column;
  }

  .week-controls {
    justify-content: stretch;
    width: 100%;
  }

  .week-controls .button {
    flex: 1 1 120px;
  }

  .performance-row {
    grid-template-columns: 1fr 0.45fr 0.7fr 0.7fr 0.55fr;
    font-size: 0.76rem;
  }

  .topbar-controls {
    justify-content: stretch;
  }

  .topbar-controls > * {
    flex: 1 1 160px;
  }

  .content-card {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .content-thumb {
    width: 86px;
  }

  .composer-layout,
  #clientPlatformGrid {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow-x: hidden;
  }

  .calendar-day,
  .calendar-weekday {
    min-width: 0;
  }

  .calendar-day {
    min-height: 92px;
    padding: 5px;
  }

  .calendar-post {
    min-height: 22px;
    padding: 4px;
    font-size: 0;
  }

  .calendar-post .platform-chip {
    min-height: 18px;
    padding: 0 5px;
    font-size: 0.62rem;
  }

  .day-add {
    display: none;
  }

  .asset-panel {
    position: static;
  }
}
