:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #f1f1f1;
  --text: #252326;
  --muted: #7b7b80;
  --line: #e2e2e4;
  --primary: #f0444d;
  --primary-dark: #c92e38;
  --accent: #252326;
  --gold: #a56a00;
  --green: #16834f;
  --red: #d92d3a;
  --shadow: 0 18px 42px rgba(37, 35, 38, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 256px 1fr;
}

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

button {
  cursor: pointer;
}

.sidebar {
  background: #252326;
  color: #f8fbfc;
  padding: 24px 18px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

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

.brand-mark {
  width: 58px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #252326;
  border-radius: 8px;
  font-weight: 800;
  padding: 6px;
}

.brand-mark img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.sidebar-footer {
  color: #b9b9bd;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  color: #eeeeef;
  background: transparent;
  text-align: left;
  padding: 12px 14px;
}

.nav-item.active,
.nav-item:hover {
  background: var(--primary);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.app {
  padding: 28px;
  min-width: 0;
}

.auth-panel {
  display: none;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
}

body.needs-auth .auth-panel {
  display: grid;
}

body.needs-auth .app {
  display: none;
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 430px;
  padding: 24px;
  width: 100%;
}

.auth-box[hidden] {
  display: none;
}

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

.auth-message {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.auth-message.error {
  color: var(--red);
}

.auth-link-button {
  background: transparent;
  border: 0;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 750;
  justify-self: center;
  padding: 4px 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link-button:hover {
  color: var(--primary);
}

.user-chip {
  align-items: center;
  background: #f7f7f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 750;
  min-height: 38px;
  padding: 0 12px;
}

.topbar,
.section-toolbar,
.panel-header,
.modal-header,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 17px;
  margin-bottom: 0;
}

h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

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

.primary-button,
.ghost-button,
.icon-button,
.small-button {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 38px;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  padding: 0 14px;
  font-weight: 750;
}

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

.ghost-button,
.small-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  padding: 0 12px;
}

.icon-button {
  width: 38px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.client-card,
.deal-card,
.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 28px;
  margin: 8px 0 4px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 18px;
}

.daily-strip {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  align-items: stretch;
  background: #252326;
  color: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.daily-copy {
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  padding-right: 16px;
}

.daily-copy .eyebrow {
  color: #ff6870;
}

.daily-copy h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.daily-copy span {
  color: #ceced2;
}

.daily-tasks {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 280px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.daily-card {
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 8px;
  min-height: 146px;
  border-left: 4px solid var(--primary);
}

.daily-card.done {
  border-left-color: var(--green);
  opacity: 0.78;
}

.daily-card h3 {
  margin-bottom: 0;
}

.done-button {
  border: 0;
  border-radius: 8px;
  min-height: 36px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.done-button.done {
  background: #e8f5ee;
  color: var(--green);
}

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

.panel.wide {
  grid-row: span 2;
}

.progress-list,
.compact-list,
.cards-grid,
.pipeline,
.task-board,
.report-metrics {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.progress-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.progress-item:first-child {
  border-top: 0;
}

.progress-bar {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.green {
  background: #dff3e8;
  color: var(--green);
}

.badge.red {
  background: #fee4e2;
  color: var(--red);
}

.badge.gold {
  background: #fff2c2;
  color: var(--gold);
}

.badge.blue {
  background: #dff0ff;
  color: #11618f;
}

.compact-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.section-toolbar {
  justify-content: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  min-height: 40px;
}

textarea {
  resize: vertical;
  min-height: 86px;
}

.cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-card,
.deal-card,
.task-card,
.adm-card {
  padding: 16px;
}

.card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

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

.pipeline,
.adm-board {
  grid-template-columns: repeat(6, minmax(210px, 1fr));
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-column,
.task-column,
.adm-column {
  background: #eaf0f4;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 260px;
}

.pipeline-column.relationship-stage {
  background: #fff0f1;
  border-color: #ffc5ca;
}

.pipeline-column.relationship-stage .column-title {
  color: var(--primary-dark);
}

.column-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 800;
}

.pipeline-total {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
  padding: 9px 10px;
}

.pipeline-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.pipeline-total strong {
  color: var(--primary-dark);
  font-size: 16px;
}

.task-board {
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.task-card,
.deal-card,
.adm-card {
  margin-bottom: 10px;
  box-shadow: none;
}

.adm-board {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.adm-column.adm-gray {
  background: #eef2f4;
}

.adm-column.adm-red {
  background: #fff0f1;
  border-color: #ffc5ca;
}

.adm-column.adm-blue {
  background: #eaf6ff;
  border-color: #b8def9;
}

.adm-column.adm-green {
  background: #edf9f2;
  border-color: #b7e7c9;
}

.adm-column.adm-yellow {
  background: #fff7d6;
  border-color: #f8dc83;
}

.adm-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 9px;
  padding: 12px;
}

.adm-card h3 {
  font-size: 14px;
  line-height: 1.25;
  margin-bottom: 3px;
}

.adm-card p,
.adm-card .card-actions {
  margin: 0;
}

.adm-card a {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.add-adm-card {
  width: 100%;
}

.report-workspace {
  display: grid;
  gap: 18px;
}

.report-input-panel,
.report-output-panel,
.report-card,
.report-metric,
.report-visual-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.report-input-panel,
.report-output-panel {
  padding: 18px;
}

.report-output-panel {
  border-top: 0;
  overflow: hidden;
  padding: 0;
}

.report-output-panel.pdf-export {
  box-shadow: none;
  width: 720px;
}

.pdf-export-root {
  background: #fff;
  left: 0;
  padding: 0;
  position: fixed;
  top: 0;
  width: 720px;
  z-index: 99999;
}

.report-output-panel.pdf-export .print-hide {
  display: none;
}

.report-output-panel.pdf-export .report-card,
.report-output-panel.pdf-export .report-metric,
.report-output-panel.pdf-export .report-visual-card {
  break-inside: avoid;
  page-break-inside: avoid;
}

.report-output-panel.pdf-export .report-cover {
  padding: 18px;
}

.report-output-panel.pdf-export .report-cover h2 {
  font-size: 24px;
}

.report-output-panel.pdf-export .report-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px;
}

.report-output-panel.pdf-export .report-metric {
  padding: 12px;
}

.report-output-panel.pdf-export .report-metric strong {
  font-size: 21px;
}

.report-output-panel.pdf-export .report-visuals,
.report-output-panel.pdf-export .report-grid {
  gap: 10px;
  margin-left: 14px;
  margin-right: 14px;
}

.report-output-panel.pdf-export > .report-card {
  margin-left: 14px;
  margin-right: 14px;
}

.report-output-panel.pdf-export .report-mini-funnel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.report-fields .full {
  grid-column: 1 / -1;
}

#reportRawData {
  min-height: 170px;
}

.report-cover {
  align-items: center;
  background: #252326;
  border-bottom: 5px solid var(--primary);
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
  padding: 22px;
}

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

.report-brand img {
  background: #fff;
  border: 0;
  border-radius: 8px;
  height: 60px;
  object-fit: contain;
  padding: 8px;
  width: 88px;
}

.report-cover h2 {
  color: #fff;
  font-size: 28px;
  margin-bottom: 4px;
}

.report-cover .muted {
  color: #d7d7dc;
}

.report-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 18px 16px;
}

.report-metric {
  background: #fff;
  box-shadow: none;
  border-left: 4px solid var(--primary);
  padding: 16px;
}

.report-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-metric strong {
  display: block;
  font-size: 25px;
  margin: 8px 0 3px;
}

.report-metric small {
  color: var(--muted);
}

.report-metric.empty-metric {
  background: #fbfcfd;
}

.report-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin: 0 18px 14px;
}

.report-card {
  box-shadow: none;
  padding: 16px;
}

.report-output-panel > .report-card {
  margin: 0 18px 18px;
}

.report-visuals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 18px 14px;
}

.report-visual-card {
  box-shadow: none;
  padding: 16px;
}

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

.report-card-head h3 {
  margin: 0;
}

.report-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-mini-funnel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.report-mini-funnel div {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 86px;
  padding: 10px;
}

.report-mini-funnel strong {
  color: var(--primary-dark);
  display: block;
  font-size: 19px;
  margin-bottom: 4px;
}

.report-mini-funnel span,
.report-bar-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.report-bars {
  display: grid;
  gap: 10px;
}

.report-bar-row {
  display: grid;
  gap: 6px;
}

.report-bar-row div {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.report-bar-row strong {
  font-size: 13px;
}

.report-bar-row i {
  background: #f1f1f1;
  border-radius: 999px;
  display: block;
  height: 10px;
  overflow: hidden;
}

.report-bar-row b {
  background: linear-gradient(90deg, var(--primary), #252326);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.report-empty-chart {
  align-items: end;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  height: 120px;
}

.report-empty-chart span {
  background: #f1f1f1;
  border-radius: 8px 8px 0 0;
}

.report-empty-chart span:nth-child(1) {
  height: 45%;
}

.report-empty-chart span:nth-child(2) {
  height: 72%;
}

.report-empty-chart span:nth-child(3) {
  height: 58%;
}

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

.report-step-list span {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 750;
  padding: 10px;
}

.report-copy {
  display: grid;
  gap: 10px;
}

.report-copy p {
  margin: 0;
}

.report-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.report-list li {
  line-height: 1.35;
}

.report-plan {
  display: grid;
  gap: 8px;
}

.report-plan article {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  padding: 10px;
}

.report-plan strong {
  color: var(--primary-dark);
}

.report-plan span {
  color: var(--text);
}

.report-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-found-data {
  display: grid;
  gap: 8px;
}

.report-found-row {
  align-items: center;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.report-found-row span {
  color: var(--muted);
  font-weight: 750;
}

.report-extra {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
}

.report-extra h4 {
  font-size: 14px;
  margin: 0;
}

.report-source-row,
.report-person-row {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.report-source-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.report-person-row {
  display: grid;
  gap: 3px;
}

.report-person-row span {
  color: var(--muted);
  font-size: 12px;
}

.adm-file {
  display: grid;
  gap: 8px;
}

.adm-file img {
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  width: 100%;
}

.current-file {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.current-file a {
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
}

.compact-deal-card {
  cursor: pointer;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.compact-deal-card h3 {
  font-size: 14px;
  line-height: 1.25;
  margin-bottom: 3px;
}

.compact-deal-card p,
.compact-deal-card .card-actions {
  margin: 0;
}

.deal-mini-meta {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.deal-mini-meta span {
  background: #eef3f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 7px;
}

.deal-daily-log {
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.deal-daily-log h3 {
  font-size: 14px;
  margin: 0;
}

.deal-daily-log article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.deal-daily-log article strong {
  color: var(--primary-dark);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.deal-daily-log article p {
  margin: 0;
}

.sync-note {
  background: #dcf8e7;
  border: 1px solid #8bdbaa;
  border-radius: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 0;
  padding: 8px;
}

.task-card.is-done {
  background: #f5fbf7;
}

.task-description {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  line-height: 1.35;
  margin: 8px 0;
  padding: 9px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.quick-actions .small-button {
  min-height: 34px;
}

.editorial-head,
.editorial-period-bar,
.editorial-card-top,
.editorial-client-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.editorial-head {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.editorial-view-switch {
  background: #ededee;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 3px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
}

.editorial-view-button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  min-height: 34px;
  padding: 0 13px;
  white-space: nowrap;
}

.editorial-view-button.active {
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(37, 35, 38, 0.09);
  color: var(--text);
}

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

.editorial-summary article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
}

.editorial-summary article.pending {
  background: #fff4f3;
  border-color: #f6bbb5;
}

.editorial-summary article.done {
  background: #edf9f2;
  border-color: #a9dfbf;
}

.editorial-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.editorial-summary strong {
  font-size: 24px;
}

.editorial-summary .pending strong {
  color: var(--red);
}

.editorial-summary .done strong {
  color: var(--green);
}

.editorial-period-bar {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  margin-bottom: 16px;
  padding: 13px 0;
}

.editorial-period-bar h2 {
  text-transform: capitalize;
}

.editorial-period-actions {
  align-items: center;
  display: flex;
  gap: 7px;
}

.editorial-period-actions[hidden] {
  display: none;
}

.editorial-workspace {
  min-width: 0;
}

.editorial-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
}

.editorial-card {
  background: #fff4f3;
  border: 1px solid #f5b5af;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 14px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.editorial-card:hover {
  box-shadow: 0 10px 25px rgba(37, 35, 38, 0.09);
  transform: translateY(-1px);
}

.editorial-card.is-done {
  background: #edf9f2;
  border-color: #9edbb7;
  border-left-color: var(--green);
}

.editorial-card.is-overdue {
  border-color: #e9827a;
}

.editorial-card.just-completed {
  animation: editorial-success 780ms ease both;
}

@keyframes editorial-success {
  0% { box-shadow: 0 0 0 0 rgba(22, 131, 79, 0.35); transform: scale(1); }
  45% { box-shadow: 0 0 0 10px rgba(22, 131, 79, 0.08); transform: scale(1.012); }
  100% { box-shadow: 0 0 0 0 rgba(22, 131, 79, 0); transform: scale(1); }
}

.editorial-card-top {
  align-items: flex-start;
}

.editorial-card-top > div {
  min-width: 0;
}

.editorial-card-top strong,
.editorial-card-top span {
  display: block;
}

.editorial-card-top strong {
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.editorial-card-top > div > span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.editorial-card-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 6px;
}

.editorial-card-meta span:not(:last-child)::after {
  color: #b8b8bc;
  content: "\00b7";
  margin-left: 6px;
}

.editorial-channel {
  color: var(--text);
  font-weight: 800;
}

.editorial-attachment {
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.editorial-done-button {
  background: #fff;
  border: 1px solid #efa8a2;
  border-radius: 7px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  min-height: 34px;
  padding: 0 10px;
  width: 100%;
}

.editorial-done-button.done {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.editorial-card.compact {
  gap: 8px;
  padding: 10px;
}

.editorial-card.compact .editorial-card-top {
  align-items: flex-start;
  display: grid;
}

.editorial-card.compact .badge {
  justify-self: start;
}

.editorial-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(205px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.editorial-day {
  background: #f0f1f2;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 340px;
  padding: 10px;
}

.editorial-day.is-today,
.editorial-month-day.is-today {
  border-color: var(--primary);
  box-shadow: inset 0 3px 0 var(--primary);
}

.editorial-day-head {
  align-items: center;
  border-bottom: 1px solid #d7d7da;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 2px 2px 9px;
  text-transform: capitalize;
}

.editorial-day-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.editorial-day-head strong {
  font-size: 18px;
}

.editorial-day-posts {
  display: grid;
  gap: 9px;
}

.editorial-day-empty {
  color: #a0a0a5;
  font-size: 12px;
  padding: 8px 2px;
}

.editorial-month-weekdays,
.editorial-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(165px, 1fr));
  min-width: 1155px;
}

.editorial-month-weekdays {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.editorial-month-weekdays span {
  padding: 8px;
}

.editorial-workspace:has(.editorial-month) {
  overflow-x: auto;
  padding-bottom: 8px;
}

.editorial-month {
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.editorial-month-day {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 185px;
  padding: 8px;
}

.editorial-month-day.is-outside {
  background: #f1f1f2;
}

.editorial-month-day-number {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.editorial-month-posts {
  display: grid;
  gap: 7px;
}

.editorial-month-posts .editorial-done-button {
  min-height: 30px;
}

.editorial-client-groups {
  display: grid;
  gap: 24px;
}

.editorial-client-group {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.editorial-client-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.editorial-client-head {
  margin-bottom: 11px;
}

.editorial-client-head h3 {
  font-size: 16px;
  margin: 0;
}

.editorial-client-head span {
  color: var(--muted);
  font-size: 12px;
}

.editorial-empty {
  min-height: 150px;
  place-items: center;
  display: grid;
  text-align: center;
}

.editorial-creative-preview {
  align-items: center;
  background: #f5f6f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 10px;
}

.editorial-creative-preview img {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
  width: 96px;
}

.editorial-creative-preview strong,
.editorial-creative-preview a {
  display: block;
}

.editorial-creative-preview a {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 750;
  margin-top: 5px;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.finance-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  padding: 18px;
}

.finance-header,
.finance-legend,
.finance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.finance-header {
  margin-bottom: 14px;
}

.finance-legend {
  justify-content: flex-end;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.finance-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.legend-dot.unpaid {
  background: #ffe08a;
}

.legend-dot.charged {
  background: #b9e3ff;
}

.legend-dot.paid {
  background: #9be4b8;
}

.finance-summary {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.finance-pill {
  display: grid;
  gap: 2px;
  min-width: 150px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.finance-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.finance-pill strong {
  font-size: 18px;
}

.finance-months {
  display: grid;
  grid-template-columns: repeat(12, minmax(76px, 1fr));
  gap: 8px;
}

.month-cell {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 86px;
  padding: 9px;
  display: grid;
  align-content: space-between;
  text-align: left;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(37, 35, 38, 0.04);
}

.month-cell.unpaid {
  background: #fff3bf;
  border-color: #ffd666;
}

.month-cell.charged {
  background: #dff0ff;
  border-color: #94d2ff;
}

.month-cell.paid {
  background: #dcf8e7;
  border-color: #8bdbaa;
}

.month-cell.active {
  outline: 3px solid rgba(240, 68, 77, 0.28);
  box-shadow: 0 10px 22px rgba(37, 35, 38, 0.12);
  transform: translateY(-1px);
}

.month-cell strong {
  font-size: 13px;
}

.month-cell span {
  color: rgba(37, 35, 38, 0.7);
  font-size: 12px;
  font-weight: 750;
}

.month-cell small {
  font-size: 11px;
  color: rgba(37, 35, 38, 0.66);
}

.finance-forecast {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

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

.forecast-head h3 {
  margin-bottom: 2px;
}

.forecast-total {
  text-align: right;
}

.forecast-total span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 750;
}

.forecast-total strong {
  color: var(--primary);
  font-size: 22px;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(72px, 1fr));
  gap: 8px;
}

.forecast-cell {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 9px;
}

.forecast-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.forecast-cell strong {
  font-size: 13px;
}

.month-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

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

.month-history-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto minmax(250px, auto);
  align-items: center;
  gap: 12px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.month-history-row span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.history-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 6px;
}

.history-actions .small-button {
  min-height: 32px;
  padding: 0 8px;
}

.history-actions .active-status {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.prospect-search-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.prospect-search-panel h2 {
  margin: 0 0 14px;
}

.prospect-search-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 0.8fr 0.8fr;
  gap: 12px;
}

.prospect-actions {
  margin-top: 14px;
}

.prospect-table-wrap {
  margin-top: 14px;
}

.table-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 260px;
}

.diagnostic-box {
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  max-height: 64vh;
  overflow: auto;
}

.diagnostic-box h3 {
  margin: 14px 0 8px;
}

.diagnostic-box h3:first-child {
  margin-top: 0;
}

.diagnostic-box ul {
  margin: 0 0 8px;
  padding-left: 20px;
}

.diagnostic-box li {
  margin: 6px 0;
}

.full-modal-action {
  width: 100%;
  justify-content: center;
}

.modal-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.diagnostic-box code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}

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

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

.budget-grid strong,
.budget-grid span {
  display: block;
}

.budget-grid strong {
  color: var(--primary);
  font-size: 18px;
  margin-bottom: 8px;
}

.budget-grid span {
  color: var(--text);
  font-size: 13px;
  margin-bottom: 4px;
}

.budget-grid p {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.22);
  width: min(760px, calc(100vw - 28px));
  padding: 0;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

#modalForm {
  padding: 20px;
}

.modal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 18px;
}

.field {
  display: grid;
  gap: 6px;
}

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

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

menu {
  margin: 0;
  padding: 0;
  justify-content: flex-end;
}

.empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

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

  .nav-item {
    text-align: center;
    padding: 10px 8px;
  }

  .metrics,
  .dashboard-grid,
  .cards-grid,
  .editorial-summary,
  .adm-board,
  .prospect-search-grid,
  .daily-strip,
  .finance-months,
  .forecast-grid,
  .month-detail-summary,
  .report-metrics,
  .report-grid,
  .report-fields {
    grid-template-columns: 1fr 1fr;
  }

  .month-history-row {
    grid-template-columns: 1fr;
  }

  .daily-copy {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    padding: 0 0 14px;
  }
}

@media (max-width: 680px) {
  .app {
    padding: 18px;
  }

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

  .topbar-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .user-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  .metrics,
  .dashboard-grid,
  .cards-grid,
  .modal-fields,
  .prospect-search-grid,
  .budget-grid,
  .report-metrics,
  .report-grid,
  .report-fields,
  .daily-strip,
  .finance-months,
  .finance-header,
  .forecast-grid,
  .month-detail-summary {
    grid-template-columns: 1fr;
  }

  .editorial-summary {
    grid-template-columns: 1fr 1fr;
  }

  .editorial-head,
  .editorial-period-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .editorial-head > .primary-button {
    width: 100%;
  }

  .editorial-period-actions {
    justify-content: space-between;
  }

  .editorial-list {
    grid-template-columns: 1fr;
  }

  .finance-header,
  .finance-summary,
  .forecast-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .forecast-total {
    text-align: left;
  }
}

@media print {
  body.printing-report {
    background: #fff;
    display: block;
  }

  body.printing-report .sidebar,
  body.printing-report .topbar,
  body.printing-report .report-input-panel,
  body.printing-report .print-hide,
  body.printing-report .view:not(#reports) {
    display: none !important;
  }

  body.printing-report .app {
    padding: 0;
  }

  body.printing-report #reports,
  body.printing-report .report-output-panel {
    display: block !important;
  }

  body.printing-report .report-output-panel,
  body.printing-report .report-card,
  body.printing-report .report-metric {
    box-shadow: none;
  }

  body.printing-report .report-metrics {
    grid-template-columns: repeat(4, 1fr);
  }

  body.printing-report .report-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}
