:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #687471;
  --line: #dfe5df;
  --green: #176f5b;
  --green-soft: #e5f4ef;
  --red: #b93838;
  --red-soft: #f8e6e2;
  --gold: #a86f11;
  --gold-soft: #fff1d2;
  --blue: #315c9a;
  --blue-soft: #e5eefb;
  --shadow: 0 20px 50px rgba(30, 42, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow-x: hidden;
}

html,
#app {
  overflow-x: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

aside {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 18px 22px;
  background: #102a2a;
  color: #f9fbf8;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

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

.brand strong {
  font-size: 18px;
  line-height: 1.12;
  letter-spacing: 0;
}

.brand span,
.guardrails span {
  color: rgba(249, 251, 248, 0.72);
  font-size: 13px;
}

.brand span {
  margin-top: 3px;
  line-height: 1.25;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(249, 251, 248, 0.78);
  text-align: left;
}

.nav-icon {
  display: none;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.guardrails {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

main {
  min-width: 0;
  padding: 64px 24px 24px;
  overflow-x: hidden;
}

.account-corner {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 40;
  max-width: min(460px, calc(100vw - 48px));
}

.sync-pill {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.panel {
  width: 100%;
  max-width: 100%;
  min-height: calc(100vh - 92px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-header.compact {
  align-items: center;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.workflow-stage {
  position: relative;
  display: grid;
  gap: 3px;
  min-height: 112px;
  padding: 14px 26px 14px 18px;
  overflow: hidden;
}

.workflow-stage:not(:last-child)::after {
  position: absolute;
  top: 0;
  right: -10px;
  z-index: 2;
  width: 24px;
  height: 100%;
  background: inherit;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  transform: skewX(-18deg);
  content: "";
}

.workflow-stage.active {
  background: var(--green-soft);
}

.workflow-stage strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.workflow-stage small,
.workflow-stage em,
.stage-label {
  position: relative;
  z-index: 3;
}

.stage-label {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.workflow-stage small {
  color: #3f4d49;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.workflow-stage em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  font-size: 17px;
}

.primary-action,
.secondary-action {
  min-height: 40px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
  white-space: normal;
}

.primary-action {
  border: 1px solid var(--green);
  background: var(--green);
  color: #ffffff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.primary-action.compact,
.secondary-action.compact {
  min-height: 36px;
  padding: 8px 12px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.account-chip {
  justify-content: space-between;
  gap: 12px;
  min-width: min(340px, calc(100vw - 48px));
  max-width: 100%;
  padding: 6px;
  border: 1px solid rgba(223, 229, 223, 0.92);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(30, 42, 38, 0.09);
  backdrop-filter: blur(14px);
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding-left: 4px;
}

.account-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #102a2a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.account-copy {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.auth-panel label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.auth-panel label span,
.auth-panel > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-email {
  display: block;
  max-width: min(32vw, 230px);
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-signout {
  flex: 0 0 auto;
  min-height: 34px;
  border-color: rgba(23, 111, 91, 0.24);
  color: #102a2a;
  font-weight: 850;
  white-space: nowrap;
}

.auth-panel input {
  width: min(260px, 58vw);
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.login-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(180deg, #f7faf7 0%, #eef4f1 100%);
}

.login-card {
  width: min(100%, 360px);
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(44, 62, 80, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
}

.login-brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(33, 79, 72, 0.2);
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 15px;
  line-height: 1.15;
}

.login-brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-heading {
  text-align: center;
}

.login-heading h1 {
  font-size: 18px;
}

.login-heading p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-option {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfb;
}

.login-option-header {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
}

.login-option-header strong,
.login-option-header small {
  display: block;
}

.login-option-header strong {
  font-size: 14px;
}

.login-option-header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.chevron {
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.login-option-body {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  display: grid;
  gap: 6px;
}

.login-form label span {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.login-form input[name="otp"] {
  text-align: center;
  font-size: 19px;
  letter-spacing: 0.28em;
}

.login-form p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.secondary-sign-in {
  display: grid;
  gap: 10px;
}

.install-hint {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 111, 91, 0.14);
  border-radius: 14px;
  background: var(--green-soft);
  text-align: center;
}

.install-hint span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.install-hint .text-action {
  min-height: 30px;
  color: var(--green);
}

.login-action {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
}

.dev-login-shell {
  background: linear-gradient(180deg, #f4f7fa 0%, #e9eef4 100%);
}

.dev-login-option {
  border-color: rgba(49, 92, 154, 0.22);
  background: var(--blue-soft);
}

.google-action {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #747775;
  border-radius: 4px;
  background: #ffffff;
  color: #1f1f1f;
  font-family: Roboto, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.google-action svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.text-action {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.primary-action:disabled,
.secondary-action:disabled,
.google-action:disabled,
.text-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.code-sent,
.auth-message {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
}

.code-sent,
.auth-message.success {
  border: 1px solid rgba(23, 111, 91, 0.18);
  background: var(--green-soft);
  color: #1d4b42;
}

.auth-message.error {
  border: 1px solid rgba(185, 56, 56, 0.22);
  background: var(--red-soft);
  color: #6f2525;
}

.code-sent span,
.auth-message span {
  color: inherit;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 28, 27, 0.42);
}

.modal-card {
  position: relative;
  width: min(100%, 360px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 28, 27, 0.24);
}

.modal-card h2 {
  padding-right: 36px;
  font-size: 20px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.install-steps {
  display: grid;
  gap: 10px;
}

.install-steps article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfb;
}

.install-steps strong {
  color: var(--ink);
  font-size: 14px;
}

.install-steps span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.orientation-notice {
  display: none;
}

.pwa-update-banner {
  position: fixed;
  right: 14px;
  bottom: 84px;
  left: 14px;
  z-index: 50;
  width: min(430px, calc(100% - 28px));
  display: grid;
  gap: 12px;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(23, 111, 91, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(26, 43, 42, 0.2);
}

@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  .orientation-notice {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 18px;
    background: #f6f7f4;
    color: var(--ink);
    text-align: center;
  }

  .orientation-notice > div {
    width: min(100%, 360px);
    display: grid;
    gap: 8px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 50px rgba(44, 62, 80, 0.12);
  }

  .orientation-notice strong {
    font-size: 20px;
  }

  .orientation-notice span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
  }
}

.pwa-update-banner strong,
.pwa-update-banner span {
  display: block;
}

.pwa-update-banner strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
}

.pwa-update-banner span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.pwa-update-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 900;
}

.pwa-update-actions {
  display: flex;
  gap: 10px;
  padding-right: 28px;
}

.backend-status,
.empty-state {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(49, 92, 154, 0.18);
  border-radius: 8px;
  background: var(--blue-soft);
  color: #274369;
}

.backend-status.ready {
  border-color: rgba(23, 111, 91, 0.18);
  background: var(--green-soft);
  color: #1d4b42;
}

.backend-status.error {
  border-color: rgba(185, 56, 56, 0.22);
  background: var(--red-soft);
  color: #6f2525;
}

.backend-status span,
.empty-state span {
  font-size: 13px;
  line-height: 1.4;
}

.empty-state {
  margin-bottom: 0;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

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

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

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

.work-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 2px;
}

.filter-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #40504c;
  font-size: 13px;
  font-weight: 900;
  white-space: normal;
}

.filter-chip span {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.filter-chip strong {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #eef3ef;
  color: var(--green);
  font-size: 12px;
}

.filter-chip.active {
  border-color: rgba(23, 111, 91, 0.38);
  background: var(--green);
  color: #ffffff;
}

.filter-chip.active strong {
  background: #f1b84b;
  color: #102a2a;
}

.work-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.work-card.expanded {
  border-color: rgba(23, 111, 91, 0.45);
  box-shadow: 0 14px 34px rgba(30, 42, 38, 0.08);
}

.queue-row,
.table-row {
  display: grid;
  align-items: center;
  width: 100%;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.queue-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  padding: 14px;
}

.queue-row.active,
.queue-row:hover,
.table-row:hover {
  background: #f8fcfa;
}

.program-id {
  color: var(--green);
  font-weight: 800;
}

.queue-mainline,
.queue-issue {
  min-width: 0;
}

.queue-mainline {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
}

.program-name {
  overflow: hidden;
  color: #26332f;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-issue {
  display: block;
}

.queue-issue strong {
  display: block;
}

.queue-next {
  color: #475550;
  font-size: 13px;
  font-weight: 800;
}

.queue-age {
  justify-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f4f6f3;
  color: #5d6966;
  font-size: 12px;
  font-weight: 900;
}

.open-cue,
.expand-cue {
  align-self: center;
  justify-self: end;
}

.open-cue {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef3ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.expand-cue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(23, 111, 91, 0.18);
  border-radius: 999px;
  background: #eef3ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.chevron-icon {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.queue-row.active .chevron-icon {
  transform: translateY(2px) rotate(225deg);
}

.work-card-detail {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
  background: #f8fcfa;
}

.card-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.context-block,
.email-shell.compact {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.context-block {
  padding: 16px;
}

.recommendation.inline {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--green-soft);
}

.recommendation.inline p {
  margin-bottom: 0;
}

.email-shell.compact textarea {
  min-height: 220px;
}

.email-shell.compact .button-row {
  padding: 0 14px 14px;
}

.queue-row small,
.profile-grid span,
.status-strip span,
.recommendation span,
.email-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.high,
.ec-review {
  background: var(--red-soft);
  color: var(--red);
}

.medium,
.waiting,
.run-of-show {
  background: var(--gold-soft);
  color: var(--gold);
}

.low,
.draft-ready {
  background: var(--green-soft);
  color: var(--green);
}

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

.profile-grid > div,
.status-strip > div,
.recommendation,
.email-shell,
.rule-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-grid > div,
.status-strip > div {
  padding: 14px;
}

.profile-grid strong,
.status-strip strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.next-action-band,
.review-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid rgba(23, 111, 91, 0.16);
  border-radius: 8px;
  background: var(--green-soft);
}

.next-action-band {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
}

.next-action-band span,
.review-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.next-action-band strong,
.review-summary strong {
  display: block;
  margin-top: 4px;
}

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

.conflict-warning,
.send-check,
.presence-note {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
}

.conflict-warning {
  border: 1px solid rgba(185, 56, 56, 0.22);
  background: var(--red-soft);
  color: #6f2525;
}

.send-check {
  border: 1px solid rgba(23, 111, 91, 0.16);
  background: var(--green-soft);
  color: #1d4b42;
}

.presence-note {
  border: 1px solid rgba(49, 92, 154, 0.18);
  background: var(--blue-soft);
  color: #274369;
}

.conflict-warning strong,
.conflict-warning span,
.send-check strong,
.send-check span,
.presence-note strong,
.presence-note span {
  display: block;
}

.conflict-warning span,
.send-check span,
.presence-note span {
  font-size: 13px;
  line-height: 1.4;
}

.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: #2d3835;
}

.recommendation {
  padding: 18px;
}

.recommendation p {
  margin: 10px 0 18px;
  color: #2d3835;
  line-height: 1.55;
}

.email-shell {
  overflow: hidden;
}

.email-meta {
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.8fr;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.email-meta strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

textarea {
  width: 100%;
  min-height: 280px;
  max-height: 420px;
  padding: 20px;
  border: 0;
  outline: 0;
  resize: vertical;
  color: var(--ink);
  line-height: 1.6;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

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

.table-row {
  grid-template-columns: 0.7fr 1fr 0.9fr 1.3fr 0.8fr;
  gap: 10px;
  padding: 14px;
}

.table-head {
  background: #eef3ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.rule-card {
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 16px;
}

.rule-card span {
  color: var(--muted);
}

.rule-card small {
  justify-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  font-weight: 800;
}

.program-search {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.program-list,
.inbox-list,
.draft-queue {
  display: grid;
  gap: 10px;
}

.program-row,
.inbox-row,
.draft-choice {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.program-row {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(180px, 0.8fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.program-row.active,
.program-row:hover,
.draft-choice.active,
.draft-choice:hover,
.inbox-row:hover {
  border-color: rgba(23, 111, 91, 0.45);
  background: #f8fcfa;
}

.program-row strong,
.program-row small,
.draft-choice strong,
.draft-choice span,
.draft-choice small,
.inbox-row strong,
.inbox-row small {
  display: block;
}

.program-row small,
.program-statuses,
.draft-choice small,
.inbox-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.program-statuses {
  display: grid;
  gap: 3px;
}

.program-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.program-actions small {
  color: var(--green);
  font-weight: 900;
}

.draft-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 18px;
}

.draft-choice {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.draft-choice span {
  font-weight: 800;
}

.inbox-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.inbox-summary > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.inbox-summary strong,
.inbox-summary span {
  display: block;
}

.inbox-summary strong {
  font-size: 28px;
}

.inbox-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inbox-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) minmax(110px, 0.6fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.inbox-time {
  color: var(--green);
  font-weight: 900;
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--green-soft);
}

.auth-card > *,
.otp-preview,
.member-row,
.audit-row {
  min-width: 0;
}

.auth-card p {
  margin: 8px 0 0;
  color: #34413d;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.otp-preview {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(23, 111, 91, 0.18);
  border-radius: 8px;
  background: #ffffff;
}

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

.otp-preview strong {
  overflow-wrap: anywhere;
}

.accountability-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(0, 1.35fr);
  gap: 18px;
}

.access-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.access-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.access-card summary::-webkit-details-marker {
  display: none;
}

.access-card summary strong,
.access-card summary small {
  display: block;
}

.access-card summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.summary-cue {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.access-card[open] .summary-cue {
  background: #eef3ef;
}

.access-card[open] .summary-cue::before {
  content: "Hide";
}

.access-card[open] .summary-cue {
  font-size: 0;
}

.access-card[open] .summary-cue::before {
  font-size: 12px;
}

.member-list,
.audit-list {
  display: grid;
  gap: 10px;
}

.access-summary {
  display: grid;
  gap: 3px;
  margin: 0 14px 12px;
  padding: 14px;
  border: 1px solid rgba(23, 111, 91, 0.16);
  border-radius: 8px;
  background: var(--green-soft);
}

.access-summary span {
  color: #40504c;
  font-size: 13px;
}

.member-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}

.member-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.member-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-chip span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.member-row,
.audit-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.member-row strong,
.member-row small {
  display: block;
}

.member-row small,
.audit-row small {
  color: var(--muted);
  font-size: 12px;
}

.audit-row {
  padding: 14px;
}

.audit-row > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.audit-row > div span {
  color: var(--green);
  font-weight: 800;
}

.audit-row p {
  margin: 8px 0;
  color: #2d3835;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1020px) {
  body {
    padding-bottom: 108px;
  }

  .shell {
    display: block;
    min-height: 0;
  }

  aside {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    height: 76px;
    min-height: 0;
    align-self: start;
    overflow: visible;
    padding: 13px 18px;
  }

  nav {
    position: fixed;
    right: auto;
    bottom: 10px;
    left: 50%;
    z-index: 20;
    display: grid;
    width: min(calc(100% - 20px), 520px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 22px;
    background: rgba(16, 42, 42, 0.94);
    box-shadow: 0 18px 48px rgba(16, 42, 42, 0.3);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
  }

  .nav-item {
    display: grid;
    place-items: center;
    gap: 5px;
    min-height: 58px;
    padding: 8px 6px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
  }

  .nav-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.82);
  }

  .nav-icon svg {
    width: 21px;
    height: 21px;
  }

  .nav-item.active {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  .nav-item.active .nav-icon {
    background: #f1b84b;
    color: #102a2a;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
  }

  .brand {
    align-items: flex-start;
  }

  .guardrails {
    display: none;
  }

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

  .detail-columns,
  .email-meta,
  .auth-card,
  .accountability-grid,
  .card-detail-grid,
  .next-action-band,
  .review-summary,
  .draft-layout,
  .program-row {
    grid-template-columns: 1fr;
  }

  .workflow-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line);
    background: #ffffff;
    gap: 0;
  }

  .workflow-stage {
    min-height: 92px;
    padding: 12px 22px 12px 14px;
    border: 0;
    border-radius: 0;
  }

  .workflow-stage.active {
    background: var(--green-soft);
  }

  .workflow-stage:not(:last-child)::after {
    display: block;
    right: -9px;
    width: 22px;
  }

  .workflow-stage strong {
    font-size: 26px;
  }

  .stage-label {
    font-size: 10px;
  }

  .workflow-stage small,
  .workflow-stage em {
    font-size: 11px;
  }
}

@media (max-width: 720px) {
  main,
  aside {
    padding: 16px;
  }

  main {
    padding-top: 14px;
  }

  .brand {
    margin-bottom: 8px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
  }

  .brand strong {
    font-size: 17px;
    line-height: 1.12;
  }

  .brand span {
    font-size: 12px;
  }

  .panel {
    min-height: auto;
    padding: 16px;
  }

  .panel-header,
  .section-title,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    width: 100%;
  }

  .account-corner {
    top: 14px;
    right: 16px;
    left: auto;
    max-width: min(360px, calc(100vw - 160px));
  }

  .account-chip {
    min-width: 0;
    width: 100%;
    padding: 5px;
    box-shadow: 0 8px 22px rgba(10, 28, 28, 0.22);
  }

  .auth-panel input {
    width: 100%;
  }

  .auth-panel button {
    width: auto;
  }

  .account-email {
    max-width: calc(100vw - 290px);
    text-align: left;
  }

  .sync-pill {
    width: 100%;
    text-align: center;
  }

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

  .profile-grid,
  .status-strip,
  .rules-grid,
  .inbox-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-card {
    padding: 14px;
    overflow: hidden;
  }

  .member-row,
  .audit-row > div {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .queue-row,
  .table-row,
  .inbox-row {
    grid-template-columns: 1fr;
  }

  .draft-panel .button-row {
    position: sticky;
    right: 0;
    bottom: 78px;
    left: 0;
    z-index: 8;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 30px rgba(30, 42, 38, 0.12);
  }

  .draft-panel .button-row .secondary-action {
    display: none;
  }

  .workflow-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line);
    background: #ffffff;
    gap: 0;
  }

  .workflow-stage {
    min-height: 82px;
    padding: 10px 19px 10px 12px;
    border: 0;
    border-radius: 0;
  }

  .workflow-stage.active {
    background: var(--green-soft);
  }

  .workflow-stage:not(:last-child)::after {
    display: block;
    right: -8px;
    width: 19px;
  }

  .workflow-stage strong {
    font-size: 23px;
  }

  .stage-label {
    font-size: 9px;
  }

  .workflow-stage small,
  .workflow-stage em {
    font-size: 10px;
  }

  .queue-row {
    gap: 8px;
    padding: 12px;
  }

  .work-card-detail {
    padding: 0 12px 12px;
  }

  .card-detail-grid {
    gap: 10px;
  }

  .email-shell.compact .button-row {
    position: static;
    padding: 0 12px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .email-shell.compact .button-row .secondary-action {
    display: inline-flex;
  }

  .queue-mainline {
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 8px;
  }

  .queue-mainline .pill {
    padding: 5px 8px;
    font-size: 11px;
  }

  .program-name {
    font-size: 14px;
  }

  .open-cue {
    justify-self: start;
  }

  .program-search {
    border-radius: 8px;
  }

  .program-actions {
    justify-items: start;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 420px) {
  .account-corner {
    max-width: calc(100vw - 150px);
  }

  .account-chip {
    gap: 6px;
  }

  .account-avatar {
    width: 28px;
    height: 28px;
  }

  .account-email {
    max-width: calc(100vw - 265px);
    font-size: 12px;
  }

  .account-signout {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .queue-mainline {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .program-name {
    grid-column: auto;
  }
}
