:root {
  --bg: #fffaf6;
  --surface: #ffffff;
  --surface-soft: #fff4ef;
  --surface-warm: #f8f1eb;
  --ink: #151c23;
  --text: #28313b;
  --muted: #716b66;
  --subtle: #a29b95;
  --line: #eadfd8;
  --line-strong: #ded0c6;
  --brand: #e34330;
  --brand-dark: #c83224;
  --brand-soft: #ffe5df;
  --green: #32a85d;
  --green-soft: #e8f8ec;
  --amber: #f09a2b;
  --amber-soft: #fff2df;
  --red: #e34330;
  --red-soft: #fee7e3;
  --blue: #3078d3;
  --blue-soft: #e9f1ff;
  --purple: #7257c5;
  --purple-soft: #f0ebff;
  --shadow: 0 18px 48px rgba(48, 34, 25, 0.1);
  --shadow-card: 0 10px 30px rgba(48, 34, 25, 0.07);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0, rgba(227, 67, 48, 0.08), transparent 34rem),
    linear-gradient(180deg, #fffdfb 0%, var(--bg) 50%, #fff 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.logged-out .system-shell {
  display: none;
}

body.logged-in .login-screen {
  display: none;
}

body.logged-out .login-screen {
  display: grid;
}

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

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.login-screen {
  min-height: 100vh;
  place-items: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(227, 67, 48, 0.12), transparent 30rem),
    radial-gradient(circle at 85% 80%, rgba(50, 168, 93, 0.08), transparent 28rem),
    linear-gradient(135deg, #fffdfb 0%, #fff6f0 100%);
  padding: 28px;
}

.login-card {
  display: grid;
  gap: 22px;
  width: min(100%, 880px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  padding: 30px;
  box-shadow: var(--shadow);
}

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

.login-brand img {
  width: 46px;
  height: 46px;
}

.login-brand strong,
.login-brand span,
.login-copy span,
.demo-role-card strong,
.demo-role-card small {
  display: block;
}

.login-brand strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.login-brand span,
.login-copy p,
.demo-role-card span,
.demo-role-card small {
  color: var(--muted);
}

.login-copy {
  display: grid;
  gap: 10px;
  max-width: 680px;
}

.login-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.02;
  letter-spacing: 0;
}

.login-copy p {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
}

.demo-role-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.demo-role-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  padding: 14px;
  text-align: left;
  box-shadow: 0 10px 24px rgba(48, 34, 25, 0.05);
}

.demo-role-card:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: #fff8f4;
  box-shadow: 0 18px 34px rgba(227, 67, 48, 0.11);
}

.demo-role-card strong {
  color: var(--ink);
  font-size: 14px;
}

.demo-role-card span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
}

.demo-role-card small {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  height: 100vh;
  grid-template-rows: auto 1fr auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  padding: 24px 16px;
  backdrop-filter: blur(18px);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-top: 44px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4c535b;
  cursor: pointer;
  padding: 0 13px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-item.is-role-hidden,
[data-view-jump].is-role-hidden,
.nav-item[hidden],
[data-view-jump][hidden] {
  display: none !important;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(90deg, #ffe4de, #fff0ec);
  color: var(--brand);
}

.nav-item:active {
  transform: translateY(1px);
}

.nav-item svg,
.icon-btn svg,
.primary-action svg,
.secondary-action svg,
.text-action svg,
.ghost-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.account-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(48, 34, 25, 0.05);
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #ffe2dd;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

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

.account-card strong {
  font-size: 14px;
}

.account-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.ghost-icon,
.icon-btn {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.icon-btn:hover,
.ghost-icon:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: minmax(300px, 430px) 1fr;
  align-items: center;
  gap: 24px;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 16px 28px;
  backdrop-filter: blur(18px);
}

.search-box,
.inline-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
}

.search-box svg,
.inline-search svg {
  width: 18px;
  color: var(--subtle);
}

.search-box input,
.inline-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

kbd {
  border-radius: 6px;
  background: #f5eee8;
  color: var(--muted);
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 700;
}

.topbar-actions,
.inline-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.filter-select select,
.small-select,
.asset-toolbar select,
.brief-form select,
.brief-form input,
.brief-form textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  padding: 0 12px;
  font-weight: 600;
}

.filter-select select {
  min-width: 178px;
}

.notification {
  position: relative;
}

.notification span {
  position: absolute;
  top: -7px;
  right: -6px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.primary-action,
.secondary-action,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.primary-action {
  border: 1px solid var(--brand);
  background: linear-gradient(180deg, #ef513f, #df3423);
  color: #fff;
  padding: 0 18px;
  box-shadow: 0 12px 24px rgba(227, 67, 48, 0.22);
}

.primary-action:hover {
  background: linear-gradient(180deg, #ff5a47, #d93021);
}

.primary-action.wide {
  width: 100%;
}

.wide {
  width: 100%;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 14px;
}

.secondary-action:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.button-count {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 0 7px;
  font-size: 12px;
  font-weight: 900;
}

.text-action {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0;
}

.content-area {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 24px 28px 42px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading {
  margin-bottom: 18px;
}

.page-heading.with-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(27px, 3vw, 34px);
  line-height: 1.08;
  letter-spacing: 0;
}

.page-heading p,
.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

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

.metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 124px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.metric-card span,
.calendar-metric span,
.asset-summary article span {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card small,
.calendar-metrics small,
.asset-summary small,
.muted {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--brand) !important;
}

.progress-ring {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, #fff 0 55%, transparent 57%),
    conic-gradient(var(--brand) calc(var(--value) * 1%), #f5e8df 0);
}

.metric-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 999px;
}

.metric-icon svg {
  width: 24px;
  height: 24px;
}

.metric-icon.danger {
  background: var(--red-soft);
  color: var(--brand);
}

.metric-icon.success {
  background: var(--green-soft);
  color: var(--green);
}

.metric-icon.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.panel,
.detail-panel,
.asset-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-card);
}

.panel {
  padding: 18px;
}

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

.panel-header.compact {
  align-items: center;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.85fr);
  gap: 18px;
  margin-bottom: 18px;
}

.map-content {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-warm);
}

.map-content img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.leaflet-map {
  width: 100%;
  height: 390px;
  border-radius: 8px;
  overflow: hidden;
  background: #f8f1eb;
  isolation: isolate;
}

.map-fallback {
  display: grid;
  height: 100%;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.map-fallback strong {
  color: var(--ink);
  font-size: 18px;
}

.leaflet-container {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.leaflet-tile {
  filter: saturate(0.82) contrast(0.96) brightness(1.03);
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 12px 24px rgba(48, 34, 25, 0.1) !important;
}

.leaflet-control-zoom a {
  border-color: var(--line) !important;
  color: var(--ink) !important;
  font-weight: 800;
}

.leaflet-control-attribution {
  border-top-left-radius: 8px;
  background: rgba(255, 255, 255, 0.82) !important;
  color: var(--muted);
  font-size: 10px;
}

.site-marker {
  display: grid;
  place-items: center;
  width: 38px !important;
  height: 38px !important;
  margin-left: -19px !important;
  margin-top: -19px !important;
  border: 4px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background: var(--marker-color, var(--brand));
  box-shadow:
    0 0 0 11px var(--marker-ring, rgba(227, 67, 48, 0.18)),
    0 14px 28px rgba(48, 34, 25, 0.18);
}

.site-marker span {
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.site-marker.success {
  --marker-color: var(--green);
  --marker-ring: rgba(50, 168, 93, 0.2);
}

.site-marker.warning {
  --marker-color: var(--amber);
  --marker-ring: rgba(240, 154, 43, 0.22);
}

.site-marker.danger {
  --marker-color: var(--brand);
  --marker-ring: rgba(227, 67, 48, 0.22);
}

.map-tooltip {
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 30px rgba(48, 34, 25, 0.12) !important;
  color: var(--text) !important;
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 10px !important;
}

.map-legend {
  position: absolute;
  left: 18px;
  top: 24px;
  z-index: 600;
  display: grid;
  gap: 12px;
  width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 13px;
  box-shadow: 0 12px 28px rgba(48, 34, 25, 0.08);
}

.map-legend span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
}

.green {
  background: var(--green);
}

.amber {
  background: var(--amber);
}

.red {
  background: var(--red);
}

.gray {
  background: #b9b3ae;
}

.activity-list,
.branch-stack,
.token-list,
#securityActivity {
  display: grid;
  gap: 10px;
}

.activity-item,
.branch-row,
.token-row,
.security-event {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.activity-item:last-child,
.branch-row:last-child,
.token-row:last-child,
.security-event:last-child {
  border-bottom: 0;
}

.status-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
}

.status-icon svg {
  width: 18px;
}

.status-icon.success {
  background: var(--green-soft);
  color: var(--green);
}

.status-icon.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-icon.danger {
  background: var(--red-soft);
  color: var(--brand);
}

.status-icon.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-icon.neutral {
  background: #f3efeb;
  color: var(--muted);
}

.activity-copy strong,
.branch-row strong,
.token-row strong,
.security-event strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.activity-copy span,
.branch-row span,
.token-row span,
.security-event span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.success,
.badge.success {
  background: var(--green-soft);
  color: #18813d;
}

.pill.warning,
.badge.warning {
  background: var(--amber-soft);
  color: #b56400;
}

.pill.danger,
.badge.danger {
  background: var(--red-soft);
  color: var(--brand);
}

.pill.info,
.badge.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.neutral,
.badge.neutral {
  background: #f3efeb;
  color: var(--muted);
}

.three-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.flow-steps span {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.flow-steps i {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-warm);
  color: var(--brand);
}

.flow-steps svg {
  width: 20px;
}

.flow-steps b {
  color: var(--ink);
}

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

.chart-img {
  width: 100%;
  min-height: 150px;
  border-radius: 8px;
  object-fit: contain;
}

.data-table {
  overflow: hidden;
}

.table-row,
.table-head {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 0.8fr 0.8fr 0.85fr 0.85fr auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 0 6px;
}

.table-head {
  min-height: 40px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-row:last-child {
  border-bottom: 0;
}

.content-thumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.content-thumb img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.content-thumb strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-thumb span,
.table-row > span {
  color: var(--muted);
  font-size: 12px;
}

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

.branch-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.branch-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.branch-card h2 {
  margin: 0;
  font-size: 18px;
}

.branch-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.branch-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.branch-stats span {
  border-radius: 8px;
  background: var(--surface-warm);
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.branch-stats strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.calendar-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 18px;
}

.calendar-metric {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon label" "icon value" "icon trend";
  align-items: center;
  gap: 4px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 18px;
  text-align: left;
}

.calendar-metric:hover,
.calendar-metric.active {
  background: linear-gradient(180deg, #fff8f4, #fff);
}

.calendar-metric.active {
  box-shadow: inset 0 3px 0 var(--brand);
}

.calendar-metric:last-child {
  border-right: 0;
}

.calendar-metrics i,
.calendar-metric > svg {
  grid-area: icon;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-warm);
  color: var(--brand);
}

.calendar-metrics strong {
  grid-area: value;
  font-size: 26px;
}

.calendar-status-legend {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 14px;
  margin: -4px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.calendar-status-legend strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.calendar-status-legend span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.calendar-status-legend ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calendar-status-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf7;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
  white-space: nowrap;
}

.calendar-status-legend small {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-warm);
  color: var(--muted);
  font-size: 11px;
}

.legend-dot,
.post-status-dot {
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 999px;
}

.legend-dot {
  width: 10px;
  height: 10px;
}

.legend-dot.success,
.post-status-dot.success {
  background: var(--green);
}

.legend-dot.warning,
.post-status-dot.warning {
  background: var(--amber);
}

.legend-dot.danger,
.post-status-dot.danger {
  background: var(--red);
}

.legend-dot.info,
.post-status-dot.info {
  background: var(--blue);
}

.legend-dot.neutral,
.post-status-dot.neutral {
  background: #9ca3af;
}

.empty-calendar-detail {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-calendar-detail svg {
  width: 42px;
  height: 42px;
  color: var(--brand);
}

.empty-calendar-detail strong {
  color: var(--ink);
  font-size: 16px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 294px;
  gap: 18px;
  min-width: 0;
}

.calendar-board {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: center;
  min-width: 0;
  color: var(--ink);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.week-days span.today {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  justify-self: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}

.schedule-grid {
  display: grid;
}

.schedule-row {
  display: grid;
  grid-template-columns: 150px repeat(7, minmax(0, 1fr));
  min-height: 112px;
  border-bottom: 1px solid var(--line);
}

.schedule-row:last-child {
  border-bottom: 0;
}

.row-label {
  display: grid;
  align-content: center;
  gap: 3px;
  border-right: 1px solid var(--line);
  padding: 12px 14px;
}

.row-label strong {
  font-size: 14px;
}

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

.day-cell {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  border-right: 1px dashed #f0e4db;
  padding: 8px;
}

.day-cell:last-child {
  border-right: 0;
}

.post-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 7px;
  align-content: start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 84px;
  border: 1px solid #f0d6cc;
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff8f4;
  cursor: pointer;
  padding: 9px 8px 9px 9px;
  text-align: left;
  overflow: hidden;
}

.post-card.tone-success {
  border-left-color: var(--green);
  background: #f8fff9;
}

.post-card.tone-warning {
  border-left-color: var(--amber);
  background: #fffaf0;
}

.post-card.tone-danger {
  border-left-color: var(--red);
  background: #fff5f3;
}

.post-card.tone-info {
  border-left-color: var(--blue);
  background: #f6f9ff;
}

.post-card.tone-neutral {
  border-left-color: #9ca3af;
  background: #fafafa;
}

.post-card:hover,
.post-card.active {
  border-color: var(--brand);
  border-left-color: var(--brand);
  box-shadow: 0 10px 18px rgba(227, 67, 48, 0.12);
}

.post-status-dot {
  grid-row: 1 / span 2;
  width: 9px;
  height: 9px;
  margin-top: 4px;
}

.post-card strong {
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.18;
  text-overflow: ellipsis;
}

.post-card small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-panel {
  align-self: start;
  padding: 16px;
}

.calendar-detail img,
.approval-preview img,
.asset-detail img,
.social-preview img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.calendar-detail h2,
.asset-detail h2 {
  margin: 10px 0 8px;
  font-size: 18px;
}

.detail-meta {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.detail-meta span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.detail-meta strong {
  color: var(--ink);
}

.checklist {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.checklist span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}

.checklist svg {
  width: 16px;
  color: var(--green);
}

.content-generator {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.template-control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 16px;
  align-items: end;
  margin: 14px 0 18px;
  border: 1px solid rgba(227, 67, 48, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff8f4, #fff);
  padding: 16px;
}

.template-control-panel h3,
.template-control-panel p {
  margin: 0;
}

.template-control-panel h3 {
  color: var(--ink);
  font-size: 17px;
}

.template-control-panel p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.template-controls {
  display: grid;
  gap: 10px;
}

.template-controls label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

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

.template-actions .secondary-action {
  min-width: 0;
}

.mode-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  box-shadow: var(--shadow-card);
}

.mode-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

.mode-switch button.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 18px rgba(227, 67, 48, 0.18);
}

.content-heading-actions {
  flex-wrap: wrap;
}

.mode-panel {
  display: none;
  gap: 14px;
}

.mode-panel.active {
  display: grid;
}

.workflow-stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 2px;
}

.workflow-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon title" "icon detail";
  align-items: center;
  gap: 1px 8px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  padding: 10px;
  text-align: left;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.workflow-step:hover {
  border-color: rgba(227, 67, 48, 0.45);
  transform: translateY(-1px);
}

.workflow-step > svg {
  grid-area: icon;
  display: grid;
  width: 18px;
  height: 18px;
  color: var(--muted);
  stroke-width: 2.2;
}

.workflow-step strong {
  grid-area: title;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
}

.workflow-step small {
  grid-area: detail;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-step.active {
  border-color: var(--brand);
  background: linear-gradient(180deg, #fff5f1, #fff);
  box-shadow: 0 12px 26px rgba(227, 67, 48, 0.1);
}

.workflow-step.active > svg {
  color: var(--brand);
}

.workflow-step.done > svg {
  color: var(--green);
}

.prompt-section {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfb;
  padding: 16px;
}

.prompt-section.compact {
  background: #fff8f4;
}

.prompt-section header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  align-items: start;
}

.prompt-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.prompt-section p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.prompt-section[data-workflow-step] {
  display: none;
}

.prompt-section[data-workflow-step].active-workflow-step {
  display: grid;
  animation: workflowFade 180ms ease;
}

@keyframes workflowFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.workflow-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.workflow-actions #promptStepHint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.workflow-actions .final-step {
  min-width: 230px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

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

.brief-form {
  display: grid;
  gap: 14px;
}

.brief-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.help-tooltip {
  position: relative;
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  cursor: help;
}

.help-tooltip svg {
  width: 16px;
  height: 16px;
}

.help-tooltip:hover,
.help-tooltip:focus-visible {
  color: var(--brand);
  outline: none;
}

.tooltip-panel {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: calc(100% + 8px);
  display: none;
  width: min(320px, 76vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-card);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 12px;
}

.help-tooltip:hover .tooltip-panel,
.help-tooltip:focus-visible .tooltip-panel,
.help-tooltip:focus-within .tooltip-panel {
  display: block;
}

.brief-form textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

.selection-block,
.asset-picker-stack,
.asset-picker-section {
  display: grid;
  gap: 10px;
}

.asset-picker-stack {
  gap: 14px;
}

.asset-picker-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.asset-picker-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.asset-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.asset-section-header strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.asset-section-header svg {
  width: 17px;
  height: 17px;
  color: var(--brand);
}

.asset-section-header p {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.selection-block > strong {
  color: var(--text);
  font-size: 13px;
}

.logo-options,
.reference-grid {
  display: grid;
  gap: 10px;
}

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

.logo-option,
.reference-card {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.logo-option {
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 10px;
}

.logo-option:hover,
.logo-option.active,
.reference-card:hover,
.reference-card.active {
  border-color: var(--brand);
  background: #fff6f2;
  box-shadow: 0 10px 22px rgba(227, 67, 48, 0.09);
}

.logo-option img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.logo-option span,
.reference-card span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

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

.reference-card {
  gap: 8px;
}

.reference-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
}

.upload-reference {
  width: fit-content;
}

.generator-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.generator-actions.workflow-hidden {
  display: none;
}

.preview-panel {
  position: static;
  max-height: none;
  overflow: visible;
}

.panel-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.generation-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f4;
  padding: 12px;
}

.generation-summary h3 {
  margin: 0;
  font-size: 14px;
}

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

.summary-grid span {
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 9px;
  font-size: 11px;
  line-height: 1.35;
}

.summary-grid strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
}

.generation-alert {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(240, 154, 43, 0.42);
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--ink);
  padding: 12px;
}

.generation-alert svg {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--amber);
}

.generation-alert strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.generation-alert p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.generation-alert.in-slide {
  margin-top: 10px;
}

.preview-carousel {
  display: grid;
  gap: 12px;
}

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

.carousel-topline span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.carousel-topline strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 15px;
}

.carousel-arrows {
  display: flex;
  gap: 8px;
}

.carousel-arrows button,
.native-post-head button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.carousel-arrows svg,
.native-post-head button svg {
  width: 17px;
  height: 17px;
}

.carousel-stage {
  min-height: 560px;
}

.preview-slide {
  display: none;
}

.preview-slide.active {
  display: block;
}

.carousel-dots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.carousel-dots button {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 4px;
  font-size: 10px;
  font-weight: 800;
}

.carousel-dots button.active {
  border-color: rgba(227, 67, 48, 0.7);
  background: #fff2ef;
  color: var(--brand);
}

.carousel-dots svg {
  width: 15px;
  height: 15px;
}

.platform-logo {
  position: relative;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 900;
  line-height: 1;
}

.platform-logo.small {
  width: 18px;
  height: 18px;
}

.facebook-logo {
  border-radius: 50%;
  background: #1877f2;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 25px;
  letter-spacing: 0;
  padding-top: 4px;
}

.platform-logo.small.facebook-logo {
  font-size: 15px;
  padding-top: 2px;
}

.instagram-logo {
  border-radius: 8px;
  background:
    radial-gradient(circle at 72% 20%, #ffd76a 0 9%, transparent 10%),
    radial-gradient(circle at 28% 90%, #833ab4 0 18%, transparent 45%),
    linear-gradient(135deg, #f58529 0%, #dd2a7b 48%, #8134af 78%, #515bd4 100%);
}

.platform-logo.small.instagram-logo {
  border-radius: 5px;
}

.instagram-logo::before,
.instagram-logo::after,
.instagram-logo > span {
  content: "";
  position: absolute;
  border: 2px solid #fff;
}

.instagram-logo::before {
  inset: 7px;
  border-radius: 6px;
}

.instagram-logo::after {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.instagram-logo > span {
  top: 8px;
  right: 8px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
}

.platform-logo.small.instagram-logo::before {
  inset: 4px;
  border-width: 1.5px;
  border-radius: 4px;
}

.platform-logo.small.instagram-logo::after {
  width: 4px;
  height: 4px;
  border-width: 1.5px;
}

.platform-logo.small.instagram-logo > span {
  top: 5px;
  right: 5px;
  width: 1px;
  height: 1px;
  border-width: 1px;
}

.native-post {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(48, 34, 25, 0.08);
  overflow: hidden;
}

.platform-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.platform-strip strong {
  color: var(--ink);
  font-size: 12px;
}

.facebook-strip {
  background: #f4f8ff;
}

.instagram-strip {
  background: #fff7fb;
}

.native-post-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.native-post-head img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  padding: 4px;
}

.native-post-head strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.native-post-head span {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.native-post-head span svg {
  width: 12px;
  height: 12px;
}

.native-post-copy {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.facebook-post .native-post-copy {
  padding: 0 12px 12px;
}

.native-post-media {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: #f4f1ef;
}

.social-preview .native-post-media {
  object-fit: contain;
}

.facebook-engagement {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}

.facebook-engagement span:first-child,
.facebook-actions,
.instagram-actions {
  display: flex;
  align-items: center;
}

.facebook-engagement span:first-child {
  gap: 3px;
}

.facebook-engagement svg {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.facebook-actions {
  justify-content: space-around;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

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

.facebook-actions svg,
.instagram-actions svg {
  width: 18px;
  height: 18px;
}

.facebook-comment {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  color: var(--muted);
  font-size: 12px;
}

.mini-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #ffe2dd;
  color: var(--brand);
  font-size: 10px;
  font-weight: 900;
}

.instagram-actions {
  justify-content: space-between;
  padding: 10px 12px 4px;
}

.instagram-actions span {
  display: flex;
  gap: 14px;
}

.instagram-likes,
.instagram-tags,
.instagram-meta,
.instagram-post .native-post-copy {
  margin: 0;
  padding: 0 12px;
  font-size: 12px;
  line-height: 1.45;
}

.instagram-likes {
  color: var(--ink);
  font-weight: 800;
}

.instagram-post .native-post-copy {
  margin-top: 5px;
}

.instagram-tags {
  margin-top: 4px;
  color: #2452a3;
  font-weight: 800;
}

.instagram-meta {
  padding-bottom: 12px;
  margin-top: 7px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0;
}

.compact-slide {
  min-height: 430px;
  align-content: start;
}

.prompt-slide {
  display: grid;
  gap: 10px;
  min-height: 520px;
}

.prompt-slide pre {
  max-height: 462px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
}

.draft-save-box {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(227, 67, 48, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fff8f4);
  padding: 12px;
}

.draft-save-box label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.draft-save-box textarea {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  resize: vertical;
  line-height: 1.42;
}

.draft-actions-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.draft-actions-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.drafts-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

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

.drafts-head h3,
.drafts-head p {
  margin: 0;
}

.drafts-head h3 {
  color: var(--ink);
  font-size: 15px;
}

.drafts-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.drafts-head > span {
  display: grid;
  min-width: 28px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.draft-list {
  display: grid;
  gap: 10px;
}

.draft-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.draft-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.draft-card strong,
.draft-card span,
.draft-card small {
  display: block;
}

.draft-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.draft-card span,
.draft-card small,
.draft-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.draft-card p {
  margin: 0;
}

.draft-card .secondary-action {
  justify-self: start;
  min-height: 34px;
}

.draft-card-expanded {
  grid-template-columns: minmax(0, 1fr);
}

.draft-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-drafts {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 14px;
  font-size: 12px;
  line-height: 1.4;
}

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

.prompt-output.warning {
  border-color: rgba(240, 154, 43, 0.42);
  background: var(--amber-soft);
}

.prompt-output strong {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
}

.prompt-output p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-height: 32px;
  border: 0;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

.social-preview {
  display: grid;
  gap: 14px;
}

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

.social-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
}

.social-head img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.social-head strong {
  font-size: 13px;
}

.social-card p {
  margin: 0;
  padding: 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.approval-tabs,
.sub-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  margin: 4px 0 18px;
}

.approval-tabs button,
.sub-tabs button {
  position: relative;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.approval-tabs button.active,
.sub-tabs button.active {
  color: var(--brand);
}

.approval-tabs button.active::after,
.sub-tabs button.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 99px;
  background: var(--brand);
  content: "";
}

.approval-tabs span {
  display: inline-grid;
  min-width: 23px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #f1ebe5;
  margin-left: 6px;
  font-size: 12px;
}

.approval-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.approval-flow span {
  position: relative;
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  padding-left: 42px;
}

.approval-flow b {
  position: absolute;
  left: 0;
  top: 2px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: #e6e1dc;
  color: var(--text);
}

.approval-flow span.active,
.approval-flow span.active b {
  color: var(--brand);
}

.approval-flow span.active b {
  background: var(--brand);
  color: #fff;
}

.approval-flow span.done b {
  background: #4e5660;
  color: #fff;
}

.approval-flow small {
  color: var(--muted);
}

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

.approval-list {
  display: grid;
  gap: 10px;
}

.approval-item {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.approval-item:hover,
.approval-item.active {
  border-color: var(--brand);
  background: #fff6f2;
}

.approval-item img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
}

.approval-item strong,
.asset-card strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.approval-item span,
.asset-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.approval-detail {
  display: grid;
  gap: 14px;
}

.approval-detail-grid {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 230px;
  gap: 14px;
}

.approval-copy,
.approval-checks,
.approval-info,
.conversation {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.approval-copy h3,
.approval-checks h3,
.approval-info h3,
.conversation h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.approval-copy p {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.comment {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  margin-top: 12px;
}

.comment .avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.comment strong {
  display: block;
  font-size: 12px;
}

.comment span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.comment-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.comment-box input {
  flex: 1;
  min-height: 38px;
  border: 0;
  outline: 0;
}

.approval-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
}

.approve-btn,
.change-btn,
.legal-btn {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.approve-btn {
  border: 1px solid #2da556;
  background: linear-gradient(180deg, #41bd67, #269c4e);
  color: #fff;
}

.change-btn {
  border: 1px solid #f3b66d;
  background: #fff8ed;
  color: #c76c00;
}

.legal-btn {
  border: 1px solid #ffc9c1;
  background: #fff6f4;
  color: var(--brand);
}

.asset-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 296px;
  gap: 18px;
}

.asset-summary {
  display: grid;
  align-self: start;
  gap: 12px;
}

.asset-summary article {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.asset-summary i {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}

.asset-summary strong {
  font-size: 22px;
}

.asset-browser {
  min-width: 0;
}

.asset-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px 130px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.icon-btn.active {
  border-color: var(--brand);
  background: #fff2ee;
  color: var(--brand);
}

.list-count {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

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

.asset-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 10px;
  text-align: left;
  box-shadow: 0 8px 18px rgba(48, 34, 25, 0.04);
}

.asset-card:hover,
.asset-card.active {
  border-color: var(--brand);
  box-shadow: 0 12px 28px rgba(227, 67, 48, 0.11);
}

.asset-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-warm);
}

.asset-detail .asset-hero {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f8f1eb;
}

.asset-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin: 14px 0;
}

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

.analytics-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.analytics-card strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
}

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

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

.security-main {
  overflow: hidden;
}

#securityTable,
.permission-matrix {
  overflow-x: auto;
}

.branch-governance-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.branch-governance-panel article {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid rgba(227, 67, 48, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff8f4, #fff);
  padding: 14px;
}

.branch-governance-panel i {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
}

.branch-governance-panel strong,
.branch-governance-panel span {
  display: block;
}

.branch-governance-panel strong {
  color: var(--ink);
  font-size: 14px;
}

.branch-governance-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.security-table,
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.security-table {
  min-width: 980px;
}

.matrix-table {
  min-width: 860px;
}

.security-table th,
.security-table td,
.matrix-table th,
.matrix-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

.security-table th,
.matrix-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.user-photo {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #f1ebe5;
  font-weight: 800;
}

.permission-matrix {
  margin-top: 18px;
}

.matrix-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.matrix-heading h2,
.matrix-heading p {
  margin: 0;
}

.matrix-heading h2 {
  color: var(--ink);
  font-size: 17px;
}

.matrix-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.scope-control {
  display: grid;
  gap: 8px;
}

.scope-control select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.branch-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 260px;
}

.branch-chip-list span {
  border-radius: 999px;
  background: #fff2ee;
  color: var(--brand);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.template-permission {
  display: block;
  max-width: 180px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.matrix-table td:not(:first-child),
.matrix-table th:not(:first-child) {
  text-align: center;
}

.matrix-ok {
  color: var(--green);
}

.matrix-no {
  color: #b4aca5;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
}

.ai-integration-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.ai-integration-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: var(--shadow-card);
}

.ai-integration-tabs button:hover,
.ai-integration-tabs button.active {
  border-color: var(--brand);
  background: linear-gradient(180deg, #fff7f3, #ffe8e1);
  color: var(--brand);
}

.ai-integration-tabs svg {
  width: 18px;
  height: 18px;
}

.ai-integration-tabs span {
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 4px 8px;
  font-size: 10px;
}

.ai-integration-panel {
  display: none;
}

.ai-integration-panel.active {
  display: block;
}

.settings-overview-card {
  min-height: 100%;
}

.coming-soon-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px dashed rgba(227, 67, 48, 0.36);
  border-radius: 8px;
  background: #fff8f4;
  padding: 16px;
}

.coming-soon-card > svg {
  width: 42px;
  height: 42px;
  color: var(--brand);
}

.coming-soon-card strong,
.coming-soon-card span {
  display: block;
}

.coming-soon-card strong {
  color: var(--ink);
  font-size: 14px;
}

.coming-soon-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.video-result-card {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid rgba(227, 67, 48, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fff8f4);
  padding: 14px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.video-result-card strong,
.video-result-card span {
  display: block;
}

.video-result-card strong {
  color: var(--ink);
  font-size: 14px;
}

.video-result-card span,
.video-result-card p {
  color: var(--muted);
}

.video-result-card ol {
  display: grid;
  gap: 6px;
  margin: 2px 0;
  padding-left: 20px;
}

.primary-action:disabled,
.secondary-action:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.bucket-panel {
  grid-column: 1 / -1;
}

.legal-rules-panel {
  grid-column: 1 / -1;
}

.legal-rule-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.legal-rule-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfb;
  padding: 14px;
}

.legal-rule-head,
.legal-rule-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.legal-rule-head strong,
.legal-rule-head span,
.legal-rule-actions small {
  display: block;
}

.legal-rule-head strong {
  color: var(--ink);
  font-size: 14px;
}

.legal-rule-head span,
.legal-rule-actions small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.legal-rule-card label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.legal-rule-card select,
.legal-rule-card input,
.legal-rule-card textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  padding: 0 11px;
  font-weight: 600;
}

.legal-rule-card textarea {
  min-height: 72px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.42;
}

.backend-status-card {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f4;
  padding: 12px;
}

.backend-status-card strong {
  color: var(--ink);
  font-size: 13px;
}

.backend-status-card span,
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.backend-status-card.connected {
  border-color: rgba(50, 168, 93, 0.28);
  background: var(--green-soft);
}

.backend-status-card.offline {
  border-color: rgba(240, 154, 43, 0.34);
  background: var(--amber-soft);
}

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

.bucket-asset-list article {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.bucket-asset-list img {
  width: 58px;
  height: 46px;
  border-radius: 7px;
  background: #fff8f4;
  object-fit: cover;
}

.bucket-asset-list strong,
.bucket-asset-list span {
  display: block;
}

.bucket-asset-list strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}

.bucket-asset-list span,
.empty-state {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  background: rgba(21, 28, 35, 0.36);
  padding: 20px;
}

.modal-backdrop.open {
  display: grid;
}

.modal-card {
  position: relative;
  width: min(100%, 480px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 6px 0 18px;
  font-size: 24px;
}

.drafts-modal-card {
  width: min(100%, 860px);
  max-height: min(780px, calc(100vh - 40px));
  overflow: auto;
}

.draft-detail-modal-card {
  width: min(100%, 1080px);
  max-height: min(840px, calc(100vh - 40px));
  overflow: auto;
}

.modal-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-right: 42px;
}

.modal-heading-row h2,
.modal-heading-row p {
  margin: 0;
}

.modal-heading-row h2 {
  color: var(--ink);
  font-size: 25px;
  line-height: 1.1;
}

.modal-heading-row p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.modal-draft-list {
  max-height: min(620px, calc(100vh - 210px));
  overflow: auto;
  padding-right: 4px;
}

.draft-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.draft-detail-media {
  display: grid;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f1ef;
  overflow: hidden;
}

.draft-detail-media img {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
}

.draft-detail-copy {
  display: grid;
  gap: 14px;
}

.draft-detail-copy label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.draft-detail-copy textarea {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}

.draft-detail-meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.draft-detail-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.draft-detail-actions .primary-action,
.draft-detail-actions .secondary-action {
  min-width: 0;
}

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

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 340px;
  transform: translateY(12px);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .metric-grid,
  .calendar-metrics,
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .three-grid,
  .asset-layout,
  .security-layout,
  .settings-grid,
  .content-generator,
  .calendar-layout,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

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

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

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

	  .branch-governance-panel {
	    grid-template-columns: 1fr;
	  }

	  .ai-integration-tabs {
	    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 920px) {
  .system-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 260px;
    transition: transform 0.2s ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-grid;
  }

  .topbar {
    grid-template-columns: auto 1fr;
  }

  .search-box {
    grid-column: 2;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .content-area {
    padding: 20px 16px 34px;
  }

  .page-heading.with-actions {
    display: grid;
  }

  .content-heading-actions,
  .content-heading-actions .secondary-action,
  .content-heading-actions .mode-switch {
    width: 100%;
  }

  .approvals-layout,
  .approval-detail-grid,
  .draft-detail-grid {
    grid-template-columns: 1fr;
  }

  .draft-detail-actions {
    grid-template-columns: 1fr;
  }

  .approval-actions {
    grid-template-columns: 1fr;
  }

  .asset-grid,
  .branch-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid.two,
  .form-grid.three,
  .reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-panel {
    overflow-x: auto;
  }

  .table-row,
  .table-head {
    min-width: 820px;
  }

  .calendar-status-legend {
    grid-template-columns: 1fr;
  }

  .calendar-status-legend ul {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .metric-grid,
  .calendar-metrics,
  .asset-summary,
  .asset-grid,
  .branch-board {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 12px;
    padding: 12px;
  }

  .filter-select select {
    min-width: 150px;
  }

  .primary-action {
    white-space: nowrap;
  }

  .calendar-toolbar,
  .schedule-row {
    grid-template-columns: 120px repeat(7, 110px);
    min-width: 900px;
  }

  .calendar-toolbar .week-days {
    grid-column: 2 / -1;
    grid-template-columns: repeat(7, 110px);
  }

  .calendar-board {
    overflow-x: auto;
  }

  .approval-flow {
    grid-template-columns: 1fr;
  }

  .asset-toolbar {
    grid-template-columns: 1fr;
  }

  .security-main,
  .security-activity {
    overflow-x: auto;
  }

  .mode-switch,
  .generator-actions {
    width: 100%;
  }

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

  .workflow-step {
    min-height: 52px;
  }

  .workflow-actions {
    grid-template-columns: 1fr;
  }

  .workflow-actions #promptStepHint {
    order: -1;
  }

  .workflow-actions .primary-action,
  .workflow-actions .secondary-action {
    width: 100%;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    padding: 18px;
  }

  .modal-heading-row {
    display: grid;
    padding-right: 38px;
  }

  .mode-switch button,
  .generator-actions .primary-action,
  .generator-actions .secondary-action {
    flex: 1;
  }

  .legal-rule-actions {
    display: grid;
    justify-items: stretch;
  }

  .login-card {
    padding: 22px;
  }

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

  .form-grid.two,
  .form-grid.three,
  .logo-options,
  .reference-grid,
  .bucket-asset-list,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .prompt-section {
    padding: 14px;
  }
}
