/* AI Social Media Manager — professional design system */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #f3efe6;
  --color-surface: #fffcf7;
  --color-ink: #1c2421;
  --color-muted: #5f6b66;
  --color-line: #d9d2c5;
  --color-accent: #0f766e;
  --color-accent-hover: #0b5f59;
  --color-accent-soft: #d7f0ec;
  --color-success: #2f6b4f;
  --color-warning: #9a6b16;
  --color-danger: #9b3b3b;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --space-1: 0.35rem;
  --space-2: 0.7rem;
  --space-3: 1.1rem;
  --space-4: 1.75rem;
  --space-5: 2.5rem;
  --shadow-soft: 0 10px 30px rgba(28, 36, 33, 0.06);
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }

body.theme-aismm {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e7f4f1 0%, transparent 55%),
    linear-gradient(180deg, #f7f3eb 0%, var(--color-bg) 40%, #efe8db 100%);
  min-height: 100vh;
}

body.theme-aismm a { color: var(--color-accent); text-decoration: none; }
body.theme-aismm a:hover { color: var(--color-accent-hover); }

/* Shell — mobile first */
body.theme-aismm header.app-header,
body.theme-aismm header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 252, 247, 0.96);
  border-bottom: 1px solid var(--color-line);
  backdrop-filter: blur(10px);
}

/* Do NOT force both headers visible — admin.css handles sm vs lg */
body.theme-aismm .header-lg {
  /* stays display:none until desktop media query in admin.css */
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
}

body.theme-aismm .header-sm {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  min-height: 3.5rem;
}

body.theme-aismm .header-sm > div {
  padding: 0;
}

body.theme-aismm .header-icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-ink);
  font-size: 1.55rem;
  line-height: 1;
  padding: 0.35rem 0.45rem;
  margin: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

body.theme-aismm .header-icon-btn:hover,
body.theme-aismm .header-icon-btn:focus-visible {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  outline: none;
}

body.theme-aismm .brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

body.theme-aismm .brand-lockup .brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-aismm .brand-lockup .brand-tag {
  font-size: 0.72rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-aismm .brand-lockup .brand-tag--desc {
  margin: 0.15rem 0 0;
  max-width: 28rem;
  white-space: normal;
  line-height: 1.35;
  font-size: 0.78rem;
  font-weight: 500;
}

body.theme-aismm .brand-lockup--sm {
  text-align: left;
  justify-self: start;
}

/* Header action cluster — consistent gap on all breakpoints */
body.theme-aismm .header-controls.top-rhs,
body.theme-aismm .top-rhs.header-controls {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end !important;
  flex-wrap: nowrap;
  gap: 0.85rem;
  margin-left: auto;
  min-width: 0;
}

body.theme-aismm .header-controls > * {
  flex: 0 0 auto;
  margin: 0 !important;
}

body.theme-aismm .header-controls .workspace-switcher {
  display: block;
  margin: 0;
  min-width: 0;
}

body.theme-aismm .header-controls .workspace-switcher select {
  display: block;
  width: auto;
  max-width: 11rem;
  min-height: 2.5rem;
  padding: 0.5rem 2.1rem 0.5rem 1rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-muted) 50%),
    linear-gradient(135deg, var(--color-muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) calc(50% - 0.15rem), calc(100% - 0.7rem) calc(50% - 0.15rem);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-ink);
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

body.theme-aismm .header-controls .workspace-switcher select:hover,
body.theme-aismm .header-controls .workspace-switcher select:focus {
  border-color: var(--color-accent);
  outline: none;
}

body.theme-aismm .header-cta {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 1.15rem !important;
  border-radius: 999px !important;
  font-size: 0.9rem !important;
  font-weight: 600;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  flex-shrink: 0;
}

body.theme-aismm .header-cta--sm {
  min-height: 2.15rem;
  padding: 0.4rem 0.85rem !important;
  font-size: 0.82rem !important;
}

/* Account menu trigger — ink icon so it stays visible on cream headers
   (overrides admin.css header { color: white } used by .tg mask icons) */
body.theme-aismm .header-account-btn.top-rhs-selector,
body.theme-aismm .header-account-btn,
body.theme-aismm .header-sm-actions .top-rhs-selector {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 !important;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: #fff;
  color: var(--color-ink) !important;
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}

body.theme-aismm .header-account-btn .tg,
body.theme-aismm .header-sm-actions .top-rhs-selector .tg {
  color: var(--color-ink) !important;
  background-color: currentColor;
  font-size: 1.2rem;
  width: 1.2rem;
  height: 1.2rem;
}

body.theme-aismm .header-account-btn:hover,
body.theme-aismm .header-account-btn:focus-visible,
body.theme-aismm .header-sm-actions .top-rhs-selector:hover,
body.theme-aismm .header-sm-actions .top-rhs-selector:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent) !important;
  background: var(--color-accent-soft);
  outline: none;
}

body.theme-aismm .header-account-btn:hover .tg,
body.theme-aismm .header-account-btn:focus-visible .tg,
body.theme-aismm .header-sm-actions .top-rhs-selector:hover .tg,
body.theme-aismm .header-sm-actions .top-rhs-selector:focus-visible .tg {
  color: var(--color-accent) !important;
}

body.theme-aismm .header-sm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.65rem;
}

body.theme-aismm .header-sm-actions .header-account-btn,
body.theme-aismm .header-sm-actions .top-rhs-selector {
  width: 2.15rem;
  height: 2.15rem;
}

body.theme-aismm .header-sm-actions .header-account-btn .tg,
body.theme-aismm .header-sm-actions .top-rhs-selector .tg {
  font-size: 1.05rem;
  width: 1.05rem;
  height: 1.05rem;
}

body.theme-aismm aside.app-sidebar,
body.theme-aismm aside {
  background: var(--color-surface);
  border-right: 1px solid var(--color-line);
  width: var(--sidebar-w);
  padding: 0.85rem 0 1.25rem;
}

body.theme-aismm .sidebar-workspace {
  margin: 0 0.85rem 0.85rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: #fff;
}

body.theme-aismm .sidebar-workspace__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.2rem;
}

body.theme-aismm .sidebar-workspace__name {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.25;
}

body.theme-aismm .sidebar-section-label {
  margin: 0.65rem 1rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

body.theme-aismm .side-nav-menu {
  list-style: none;
  margin: 0 0 0.15rem;
  padding: 0 0.65rem;
}

/* Override Trongate’s loose li padding — compact professional stack */
body.theme-aismm .side-nav-menu > li {
  padding: 0 !important;
  border-bottom: 0 !important;
  margin: 0 0 0.15rem;
}

body.theme-aismm .side-nav-menu > li:hover {
  background: transparent !important;
}

body.theme-aismm .side-nav-menu a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  font-weight: 500;
  font-size: 0.92rem;
  line-height: 1.2;
  transition: background 0.2s ease, color 0.2s ease;
}

body.theme-aismm .side-nav-menu a .nav-ico {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--color-line);
  flex-shrink: 0;
}

body.theme-aismm .side-nav-menu a:hover {
  background: rgba(15, 118, 110, 0.08);
  color: var(--color-accent);
}

body.theme-aismm .side-nav-menu a:hover .nav-ico,
body.theme-aismm .side-nav-menu a.active .nav-ico {
  background: var(--color-accent);
}

body.theme-aismm .side-nav-menu a.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
}

body.theme-aismm main {
  background: transparent;
  width: 100%;
  min-width: 0;
}

body.theme-aismm .center-stage {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-3) var(--space-4);
}

body.theme-aismm footer {
  background: transparent;
  border-top: 1px solid var(--color-line);
  color: var(--color-muted);
}

/* Mobile drawer */
body.theme-aismm .slide-nav {
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 8px 0 28px rgba(28, 36, 33, 0.18);
}

body.theme-aismm .slide-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.85rem 0.85rem 1.1rem;
  border-bottom: 1px solid var(--color-line);
  height: auto;
}

body.theme-aismm .slide-nav-header .brand-name {
  font-size: 1.1rem;
}

body.theme-aismm .slide-nav-close {
  color: var(--color-ink);
  left: 0;
  top: 0;
  font-size: 1.75rem;
}

body.theme-aismm .workspace-switcher--drawer {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.1rem 0.35rem;
}

body.theme-aismm .workspace-switcher--drawer label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
}

body.theme-aismm .workspace-switcher--drawer select {
  width: 100%;
}

body.theme-aismm .slide-nav-list a {
  color: var(--color-ink);
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 0 0.65rem;
  padding: 0.8rem 0.9rem;
}

body.theme-aismm .slide-nav-list a:hover,
body.theme-aismm .slide-nav-list a.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

body.theme-aismm #admin-settings-dropdown {
  background: var(--color-surface);
  border-color: var(--color-line);
  border-radius: var(--radius-sm);
  top: 3.6rem;
  right: 0.75rem;
}

/* Page patterns */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-line);
}

.page-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.page-header p {
  margin: 0.35rem 0 0;
  color: var(--color-muted);
  max-width: 42rem;
}

.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff !important;
}
.btn-primary:hover { background: var(--color-accent-hover); color: #fff !important; transform: translateY(-1px); }

.btn-secondary {
  background: transparent;
  color: var(--color-ink) !important;
  border: 1px solid var(--color-line);
}
.btn-secondary:hover { background: #fff; }

.btn-danger { background: var(--color-danger); color: #fff !important; }

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--shadow-soft);
}

.panel h2 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.panel__head h2 {
  margin: 0;
}

.panel__hint {
  margin: 0.25rem 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.panel__section {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-line);
}

.panel__section h3 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.panel__note {
  margin: var(--space-2) 0 0;
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.empty-state {
  padding: var(--space-4) var(--space-3);
  text-align: left;
  color: var(--color-muted);
}

.empty-state strong {
  display: block;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.empty-state .page-actions {
  margin-top: 1rem;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
}

.platform-badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: currentColor;
}

.check-grid {
  display: grid;
  gap: 0.55rem;
}

.check-grid label {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  font-weight: 550 !important;
  margin: 0;
  cursor: pointer;
}

.check-grid input {
  width: auto !important;
  margin: 0;
}

/* Trends radar */
.trends-refresh-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.trends-refresh-form input[type="text"] {
  min-width: 10rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  background: #fff;
}

.trends-meta { margin-bottom: var(--space-3); }

.trends-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: var(--space-2);
}

.trends-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.trend-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.trend-card__status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.trend-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.2;
}

.trend-card__tag {
  margin: 0.35rem 0 0;
  color: var(--color-accent);
  font-weight: 650;
}

.trend-card__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
  padding: 0.75rem 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
}

.trend-card__metric-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.2rem;
}

.trend-rel--high { color: var(--color-success); }
.trend-rel--mid { color: var(--color-warning); }
.trend-rel--low { color: var(--color-muted); }

.trend-card__angle {
  margin: 0;
  color: var(--color-ink);
  line-height: 1.5;
  font-size: 0.98rem;
}

.trend-card__hashtags {
  margin: 0.65rem 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.trend-card__actions {
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .trends-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  .trends-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.form-stack { display: grid; gap: var(--space-3); max-width: 640px; }
.form-stack label { display: grid; gap: 0.35rem; font-weight: 600; }
.form-stack input,
.form-stack textarea,
.form-stack select {
  width: 100%;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: #fff;
  color: var(--color-ink);
}
.form-stack textarea { min-height: 120px; resize: vertical; }

.mode-picker {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}
.mode-picker legend {
  font-weight: 700;
  padding: 0 0.35rem;
}
.mode-option {
  display: grid !important;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  font-weight: 500 !important;
  cursor: pointer;
}
.mode-option input {
  width: auto;
  margin-top: 0.25rem;
}
.mode-option strong { display: block; }
.mode-option small {
  display: block;
  color: var(--color-muted);
  font-weight: 500;
  margin-top: 0.15rem;
}

/* Kill Trongate blue table chrome inside the app shell */
body.theme-aismm table th {
  background-color: transparent;
  color: var(--color-muted);
}

body.theme-aismm table th,
body.theme-aismm table td {
  border-color: var(--color-line);
}

.table-clean {
  width: 100%;
  border-collapse: collapse;
}
.table-clean th,
.table-clean td {
  text-align: left;
  padding: 0.85rem 0.5rem;
  border: 0;
  border-bottom: 1px solid var(--color-line);
  vertical-align: top;
  background: transparent;
}
.table-clean th {
  color: var(--color-muted);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Professional data tables (override Trongate blue headers) */
.panel--flush { padding: 0; overflow: hidden; }
.panel--flush .empty-state { padding: var(--space-4) var(--space-3); }

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}

body.theme-aismm .data-table th,
body.theme-aismm .data-table td {
  border: 0;
  border-bottom: 1px solid var(--color-line);
  padding: 0.95rem 1.1rem;
  vertical-align: middle;
  text-align: left;
  background: transparent;
  color: inherit;
}

body.theme-aismm .data-table thead th {
  background: #f7f3ea;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

body.theme-aismm .data-table tbody tr {
  background: var(--color-surface);
  transition: background 0.15s ease;
}

body.theme-aismm .data-table tbody tr:nth-child(odd) {
  background: #fffcf7;
}

body.theme-aismm .data-table tbody tr:hover,
body.theme-aismm .data-table tbody tr:nth-child(odd):hover {
  background: #f3faf8;
}

body.theme-aismm .data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table__title {
  color: var(--color-ink) !important;
  font-weight: 650;
  text-decoration: none;
}
.data-table__title:hover { color: var(--color-accent) !important; }

.data-table__muted {
  color: var(--color-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.data-table__actions-col {
  width: 1%;
  white-space: nowrap;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-table {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--color-line);
  background: #fff;
  color: var(--color-ink) !important;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-table:hover {
  background: #f7f3ea;
  border-color: #cfc6b6;
}

.btn-table--primary {
  background: var(--color-accent-soft);
  border-color: transparent;
  color: var(--color-accent) !important;
}
.btn-table--primary:hover {
  background: #c5e8e2;
  color: var(--color-accent-hover) !important;
}

.btn-table--danger {
  background: #f8ecec;
  border-color: transparent;
  color: var(--color-danger) !important;
}
.btn-table--danger:hover {
  background: #f0d8d8;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}
.mode-badge--text {
  background: #ebe7df;
  color: var(--color-muted);
}
.mode-badge--image {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #eee8dc;
  color: var(--color-muted);
}
.status-chip.draft { background: #eee8dc; }
.status-chip.scripted,
.status-chip.queued,
.status-chip.generating { background: #f3e6c4; color: var(--color-warning); }

.lyrics-block {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--color-ink);
}
.status-chip.ready,
.status-chip.scheduled,
.status-chip.published { background: #dcecde; color: var(--color-success); }
.status-chip.failed { background: #f3d6d6; color: var(--color-danger); }

/* Library — unified media browser */
.library-panel {
  padding-top: 1rem;
}
.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-line);
}
.library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.library-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--color-ink) !important;
  font-size: 0.88rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.library-filter em {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  background: rgba(28, 36, 33, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}
.library-filter:hover {
  border-color: rgba(15, 118, 110, 0.4);
  color: var(--color-ink) !important;
}
.library-filter.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff !important;
}
.library-filter.is-active em {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.library-view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
}
.library-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--color-muted) !important;
  border-right: 1px solid var(--color-line);
}
.library-view-btn:last-child { border-right: 0; }
.library-view-btn:hover { color: var(--color-ink) !important; background: rgba(255,255,255,0.9); }
.library-view-btn.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent-hover) !important;
}
.library-view-ico {
  width: 0.9rem;
  height: 0.9rem;
  display: inline-block;
  position: relative;
}
.library-view-ico--grid {
  background:
    linear-gradient(var(--color-accent), var(--color-accent)) 0 0 / 40% 40% no-repeat,
    linear-gradient(var(--color-accent), var(--color-accent)) 100% 0 / 40% 40% no-repeat,
    linear-gradient(var(--color-accent), var(--color-accent)) 0 100% / 40% 40% no-repeat,
    linear-gradient(var(--color-accent), var(--color-accent)) 100% 100% / 40% 40% no-repeat;
  opacity: 0.85;
}
.library-view-ico--list {
  background:
    linear-gradient(var(--color-accent), var(--color-accent)) 0 15% / 100% 18% no-repeat,
    linear-gradient(var(--color-accent), var(--color-accent)) 0 50% / 100% 18% no-repeat,
    linear-gradient(var(--color-accent), var(--color-accent)) 0 85% / 100% 18% no-repeat;
  opacity: 0.85;
}

.library-type {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #e8f2ef;
  color: #0f5f58;
}
.library-type--image { background: #f0ebe0; color: #6d5730; }
.library-type--music { background: #ebe7f3; color: #4d3f6b; }
.library-type--speech { background: #e5eef3; color: #335466; }
.library-type--video { background: #e8f2ef; color: #0f5f58; }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-3);
}

.library-card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.library-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 14px 28px rgba(28, 36, 33, 0.08);
}
.library-card__media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: linear-gradient(160deg, #1c302c, #0f766e 55%, #c9e8e2);
  overflow: hidden;
  color: inherit !important;
}
.library-card--image .library-card__media {
  background: #ebe4d4;
}
.library-card--music .library-card__media {
  background: linear-gradient(155deg, #2a2438, #5c4d7a 55%, #d9d2ea);
}
.library-card--speech .library-card__media {
  background: linear-gradient(155deg, #1e2c35, #3d5f73 55%, #d2e2ea);
}
.library-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.library-card__placeholder {
  position: absolute;
  inset: 0;
}
.library-card--music .library-card__placeholder::before,
.library-card--speech .library-card__placeholder::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.6rem;
  height: 2.6rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: inset 0 0 0 8px rgba(255,255,255,0.12);
}
.library-card--music .library-card__placeholder::after {
  content: '';
  position: absolute;
  left: calc(50% + 0.15rem);
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.45rem 0 0.45rem 0.7rem;
  border-color: transparent transparent transparent #fff;
  transform: translate(-20%, -50%);
}
.library-card--speech .library-card__placeholder::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.9rem;
  height: 1.15rem;
  transform: translate(-50%, -55%);
  border: 2px solid #fff;
  border-radius: 999px 999px 40% 40%;
}
.library-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.4rem;
  height: 2.4rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.9);
}
.library-card__play::after {
  content: '';
  position: absolute;
  left: 52%;
  top: 50%;
  transform: translate(-30%, -50%);
  border-style: solid;
  border-width: 0.4rem 0 0.4rem 0.65rem;
  border-color: transparent transparent transparent #fff;
}
.library-card__media .library-type {
  position: absolute;
  left: 0.65rem;
  top: 0.65rem;
  background: rgba(255, 252, 247, 0.94);
}
.library-card__body {
  padding: 0.85rem 0.9rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.library-card__body h3 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
}
.library-card__body h3 a {
  color: var(--color-ink) !important;
}
.library-card__body h3 a:hover { color: var(--color-accent) !important; }
.library-card__body p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.84rem;
}
.library-card__actions {
  display: flex;
  gap: 0.85rem;
  margin-top: auto;
  padding-top: 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.library-list-wrap { margin: 0 -0.15rem; }
.library-list__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit !important;
  min-width: 0;
}
.library-list__title strong {
  display: block;
  color: var(--color-ink);
  font-size: 0.95rem;
}
.library-list__title em {
  display: block;
  font-style: normal;
  color: var(--color-muted);
  font-size: 0.82rem;
  margin-top: 0.1rem;
}
.library-list__thumb {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #1c302c, #0f766e);
}
.library-list__thumb--image { background: #ebe4d4; }
.library-list__thumb--music { background: linear-gradient(155deg, #2a2438, #5c4d7a); }
.library-list__thumb--speech { background: linear-gradient(155deg, #1e2c35, #3d5f73); }
.library-list__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-detail {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 800px) {
  .library-detail {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: start;
  }
}
.library-detail__preview {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #12221f;
  border: 1px solid var(--color-line);
}
.library-detail__preview--image { background: #ebe4d4; }
.library-detail__preview--music,
.library-detail__preview--speech { background: var(--color-surface); padding: 1.25rem; }
.library-detail__preview video,
.library-detail__preview img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #0d1715;
}
.library-detail__preview--image img { background: #ebe4d4; }
.library-detail__audio {
  display: grid;
  gap: 1rem;
  justify-items: center;
}
.library-detail__audio-mark {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: linear-gradient(155deg, #2a2438, #5c4d7a);
  position: relative;
}
.library-detail__audio-mark--speech {
  background: linear-gradient(155deg, #1e2c35, #3d5f73);
}
.library-detail__audio-mark::after {
  content: '';
  position: absolute;
  left: 52%;
  top: 50%;
  transform: translate(-30%, -50%);
  border-style: solid;
  border-width: 0.55rem 0 0.55rem 0.85rem;
  border-color: transparent transparent transparent #fff;
}
.library-detail__audio audio { width: min(420px, 100%); }
.library-detail__aside h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.library-detail__aside p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.library-publish-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: -0.35rem 0 1.1rem;
}
.library-publish-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-muted) !important;
  background: rgba(255,255,255,0.45);
  border: 1px solid transparent;
}
.library-publish-filter em {
  font-style: normal;
  font-size: 0.74rem;
  color: var(--color-muted);
}
.library-publish-filter:hover {
  color: var(--color-ink) !important;
  border-color: var(--color-line);
}
.library-publish-filter.is-active {
  color: var(--color-accent-hover) !important;
  background: var(--color-accent-soft);
  border-color: rgba(15, 118, 110, 0.25);
}

.publish-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #ece7dc;
  color: #6a5a3a;
}
.publish-tag--not_scheduled { background: #ece7dc; color: #6a5a3a; }
.publish-tag--scheduled { background: #e4eef8; color: #2f5678; }
.publish-tag--published { background: #dcecde; color: var(--color-success); }
.publish-tag--failed { background: #f3d6d6; color: var(--color-danger); }
.publish-tag--on-media {
  position: absolute;
  right: 0.65rem;
  top: 0.65rem;
  background: rgba(255, 252, 247, 0.95);
}

.platform-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}
.platform-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(28, 36, 33, 0.06);
  color: var(--color-ink);
}

.library-detail-grid {
  align-items: start;
}
.publish-timeline {
  display: grid;
  gap: 0.85rem;
}
.publish-timeline__item {
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.5);
}
.publish-timeline__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.publish-timeline__head time {
  font-size: 0.86rem;
  color: var(--color-muted);
}
.publish-timeline__caption {
  margin: 0.55rem 0 0;
  color: var(--color-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.insight-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-top: 0.7rem;
}
.insight-mini {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--color-line);
  font-size: 0.8rem;
  color: var(--color-muted);
}
.insight-mini strong {
  color: var(--color-ink);
  font-size: 0.84rem;
}

.insight-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}
.insight-summary__card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.insight-summary__card em {
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.insight-summary__card strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--color-ink);
}

.insight-platform-grid {
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 720px) {
  .insight-platform-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.insight-platform-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.55);
}
.insight-platform-card h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.insight-stat-list {
  margin: 0;
  display: grid;
  gap: 0.45rem;
}
.insight-stat-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
}
.insight-stat-list dt {
  color: var(--color-muted);
  font-weight: 500;
}
.insight-stat-list dd {
  margin: 0;
  font-weight: 700;
  color: var(--color-ink);
}

.studio-progress {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px dashed var(--color-line);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.55);
}
.studio-progress[data-polling-active="true"] {
  animation: pulseSoft 1.6s ease-in-out infinite;
}
@keyframes pulseSoft {
  0%, 100% { border-color: var(--color-line); }
  50% { border-color: var(--color-accent); }
}

.workspace-switcher select {
  border: 1px solid var(--color-line);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  background: #fff;
  font: inherit;
  font-size: 0.92rem;
}

.flash-message {
  background: var(--color-accent-soft);
  border: 1px solid #b7ddd6;
  color: var(--color-accent);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}

/* —— Custom confirm / alert dialogs —— */
body.aismm-dialog-open {
  overflow: hidden;
}

.aismm-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.aismm-dialog[hidden] {
  display: none !important;
}

.aismm-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 40, 36, 0.45);
  backdrop-filter: blur(2px);
}

.aismm-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(26rem, 100%);
  padding: 1.35rem 1.3rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(20, 40, 36, 0.12);
  background: #fffdf8;
  box-shadow: 0 18px 48px rgba(18, 40, 36, 0.18);
  animation: aismmDialogIn 160ms ease-out;
}

.aismm-dialog__title {
  margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--color-ink, #142824);
}

.aismm-dialog__body {
  margin: 0.65rem 0 0;
  color: var(--color-muted, #5c6b66);
  font-size: 0.98rem;
  line-height: 1.5;
}

.aismm-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1.25rem;
}

.aismm-dialog__actions .btn-primary,
.aismm-dialog__actions .btn-secondary,
.aismm-dialog__actions .btn-danger {
  min-width: 6.5rem;
}

@keyframes aismmDialogIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .aismm-dialog__panel { animation: none; }
}

/* Mobile-first page content tweaks (default) */
.page-header h1 { font-size: 1.65rem; }
.panel-grid { grid-template-columns: 1fr; }
.page-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
}
.page-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.page-actions .btn-primary,
.page-actions .btn-secondary,
.page-actions .btn-danger {
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 8.5rem;
  text-align: center;
  justify-content: center;
}

.form-stack { max-width: 100%; }
.center-stage { overflow-x: clip; }

.data-table-wrap {
  -webkit-overflow-scrolling: touch;
  margin: 0;
}

body.theme-aismm .data-table th,
body.theme-aismm .data-table td {
  padding: 0.75rem 0.8rem;
  font-size: 0.92rem;
}

.table-actions {
  gap: 0.35rem;
}

.btn-table {
  padding: 0.32rem 0.6rem;
  font-size: 0.76rem;
}

.mode-picker { gap: 0.55rem; }
.mode-option { gap: 0.6rem; }

@media (max-width: 700px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .library-view-toggle { align-self: flex-start; }
}

@media (max-width: 479.98px) {
  .page-actions .btn-primary,
  .page-actions .btn-secondary,
  .page-actions .btn-danger {
    flex: 1 1 100%;
  }

  body.theme-aismm .data-table thead th {
    font-size: 0.7rem;
  }

  .status-chip,
  .mode-badge {
    font-size: 0.72rem;
  }
}

@media (min-width: 700px) and (max-width: 1099.98px) {
  .panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-actions .btn-primary,
  .page-actions .btn-secondary,
  .page-actions .btn-danger {
    flex: 0 1 auto;
  }
}

/*
  App shell breakpoints (never applied to .landing-body, .aismm-login, or .legal-body):
  - Phones & tablets: < 1100px → header-sm + drawer
  - Laptops: ≥ 1100px → header-lg + sidebar
  - Large desktops: ≥ 1440px → wider content band
  - Ultra-wide: ≥ 1920px → max content width

  Trongate admin.css switches at 900px; we keep the compact shell until 1100px.
*/

/* Keep compact shell on tablets (overrides admin.css 900px desktop switch) */
@media (min-width: 900px) and (max-width: 1099.98px) {
  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) header {
    grid-column: auto !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-sm {
    display: grid !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-lg {
    display: none !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) aside {
    display: none !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) main,
  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) footer {
    grid-row: auto !important;
    grid-column: auto !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .footer-sm {
    display: flex !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .footer-lg {
    display: none !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .slide-nav {
    display: block !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .nav-overlay {
    display: block !important;
  }
}

/* Laptop / desktop shell — 1100px and up */
@media (min-width: 1100px) {
  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: auto 1fr auto;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) header {
    grid-column: 1 / -1;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-sm {
    display: none !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-lg {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.4rem;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-lg .brand-name {
    font-size: 1.25rem;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) aside {
    display: block !important;
    grid-row: 2;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) main {
    grid-row: 2;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) footer {
    grid-column: 1 / -1;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .footer-sm {
    display: none !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .footer-lg {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .slide-nav,
  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .nav-overlay {
    display: none !important;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .center-stage {
    padding: var(--space-4) var(--space-4) var(--space-5);
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) #admin-settings-dropdown {
    top: 3.25rem;
    right: 1.25rem;
  }

  .page-header {
    flex-direction: row;
    align-items: flex-end;
  }

  .page-header h1 { font-size: 2rem; }

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

  .page-actions {
    width: auto;
  }

  .page-actions .btn-primary,
  .page-actions .btn-secondary,
  .page-actions .btn-danger {
    flex: 0 0 auto;
  }
}

/* Large desktops — 1440px+ */
@media (min-width: 1440px) {
  :root {
    --sidebar-w: 270px;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-lg {
    padding: 0.95rem 1.75rem;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-lg .brand-name {
    font-size: 1.3rem;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .center-stage {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-4) 1.75rem var(--space-5);
  }

  .page-header h1 { font-size: 2.1rem; }

  .panel-grid {
    gap: var(--space-4);
  }
}

/* Ultra-wide — 1920px+ */
@media (min-width: 1920px) {
  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .center-stage {
    max-width: 1400px;
    padding-left: 2.25rem;
    padding-right: 2.25rem;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .header-lg {
    padding-left: 2.25rem;
    padding-right: 2.25rem;
  }
}

/* —— Billing / credits —— */
body.theme-aismm .header-credits {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(20, 40, 36, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--color-ink, #142824);
  text-decoration: none;
  font-size: 0.86rem;
  line-height: 1.2;
}
body.theme-aismm .header-credits:hover {
  border-color: rgba(20, 40, 36, 0.28);
  background: #fff;
}
body.theme-aismm .header-credits__label {
  color: var(--color-muted, #5c6b66);
  font-weight: 500;
}
body.theme-aismm .header-credits strong {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
body.theme-aismm .header-credits--sm {
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
}

.billing-balance-grid {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 800px) {
  .billing-balance-grid {
    grid-template-columns: 1.2fr 1fr 1.2fr;
  }
}
.billing-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted, #5c6b66);
}
.billing-balance {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.billing-stat {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.billing-meta {
  margin: 0.35rem 0 0;
  color: var(--color-muted, #5c6b66);
  font-size: 0.92rem;
}
.billing-cost-list {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  color: var(--color-ink, #142824);
}
.billing-cost-list li { margin: 0.2rem 0; }

.billing-plans {
  display: grid;
  gap: 1rem;
}
@media (min-width: 900px) {
  .billing-plans {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.billing-plan {
  padding: 1rem 1rem 1.1rem;
  border: 1px solid rgba(20, 40, 36, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}
.billing-plan--active {
  border-color: rgba(20, 90, 70, 0.35);
  background: rgba(220, 236, 222, 0.45);
}
.billing-plan h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}
.billing-plan-price {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
}
.billing-plan-price span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-muted, #5c6b66);
}
.billing-plan ul {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  font-size: 0.92rem;
}
.billing-plan li { margin: 0.25rem 0; }

.billing-grant-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.billing-grant-row .btn-secondary {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
}
.billing-pack-meta {
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.8;
}
.billing-custom-grant label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.billing-custom-grant__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.billing-custom-grant input[type="number"] {
  max-width: 160px;
}
.billing-delta-neg { color: var(--color-danger, #a33); font-weight: 600; }
.billing-delta-pos { color: var(--color-success, #1f6b3a); font-weight: 600; }

.studio-quality-options {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.studio-quality-options legend {
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.studio-quality-option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(20, 40, 36, 0.12);
  border-radius: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.55);
}
.studio-quality-option span {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.studio-quality-option em {
  font-style: normal;
  color: var(--color-muted, #5c6b66);
  font-size: 0.9rem;
}
.studio-quality-option.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.studio-quality-option:has(input:checked) {
  border-color: rgba(20, 90, 70, 0.4);
  background: rgba(220, 236, 222, 0.4);
}

/* Video length decision tree */
.duration-chooser {
  display: grid;
  gap: 0.85rem;
  margin: 0.25rem 0 1.15rem;
  padding: 1rem 1rem 1.05rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-accent-soft) 18%, var(--color-surface));
}
.duration-chooser__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-ink);
}
.duration-chooser__note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-muted);
}
.duration-chooser__tree {
  display: grid;
  gap: 0.75rem;
}
.duration-chooser__tree label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}
.duration-chooser__lengths {
  margin: 0;
  padding: 0;
  border: 0;
}
.duration-chooser__lengths legend {
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding: 0;
}
.duration-chooser__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.duration-pill {
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}
.duration-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.duration-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.duration-pill:has(input:checked) span {
  border-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-line));
  background: color-mix(in srgb, var(--color-accent-soft) 45%, #fff);
}
.duration-chooser__hint {
  margin: 0.55rem 0 0;
  font-size: 0.84rem;
  color: var(--color-muted);
  line-height: 1.4;
}
@media (min-width: 720px) {
  .duration-chooser__tree {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
  }
}

/* Studio hub — create options */
.studio-campaign-picker {
  margin-bottom: 1.25rem;
}
.studio-campaign-form {
  margin: 0;
}
.studio-campaign-label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  max-width: 36rem;
}
.studio-campaign-label select {
  width: 100%;
}
.studio-campaign-active {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  color: var(--color-ink);
}
.studio-campaign-active--none {
  color: var(--color-muted);
}

.studio-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.studio-kicker a {
  color: inherit;
  font-weight: 600;
}
.studio-kicker a:hover {
  color: var(--color-accent);
}

.studio-hub {
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 720px) {
  .studio-hub {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}
@media (min-width: 1100px) {
  .studio-hub {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.studio-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  color: inherit !important;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.studio-option:hover {
  border-color: rgba(15, 118, 110, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(28, 36, 33, 0.08);
  color: inherit !important;
}
.studio-option__mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--color-accent-soft);
  position: relative;
}
.studio-option__mark::after {
  content: '';
  position: absolute;
  inset: 0.7rem;
  border-radius: 3px;
  background: var(--color-accent);
  opacity: 0.85;
}
.studio-option--image .studio-option__mark { background: #ebe4d4; }
.studio-option--image .studio-option__mark::after { background: #8a7348; }
.studio-option--motion .studio-option__mark { background: #e4ebe8; }
.studio-option--motion .studio-option__mark::after {
  background: #3d6b5a;
  border-radius: 50%;
}
.studio-option--music .studio-option__mark { background: #e8e4f0; }
.studio-option--music .studio-option__mark::after { background: #5c4d7a; }
.studio-option--speech .studio-option__mark { background: #e4edf2; }
.studio-option--speech .studio-option__mark::after { background: #3d5f73; }
.studio-option--refresh .studio-option__mark { background: #e7efe8; }
.studio-option--refresh .studio-option__mark::after { background: #3d6b4f; }
.studio-option--character .studio-option__mark { background: #efe8e4; }
.studio-option--character .studio-option__mark::after { background: #7a5340; }
.studio-option--featured {
  border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent) 12%, transparent);
}
.studio-option__badge {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.studio-option__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.studio-option__meta {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.studio-option__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-ink);
}
.studio-option__desc {
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--color-muted);
}
.studio-option__go {
  font-size: 1.25rem;
  color: var(--color-accent);
  opacity: 0.7;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.studio-option:hover .studio-option__go {
  opacity: 1;
  transform: translateX(3px);
}

.studio-recent-grid {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 800px) {
  .studio-recent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.studio-recent-col h3 {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.studio-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.studio-recent-list a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.45);
  color: inherit !important;
}
.studio-recent-list a:hover {
  border-color: var(--color-line);
  background: #fff;
}
.studio-recent-list span {
  font-weight: 600;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-recent-list em {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--color-muted);
}

/* —— Coach (unified workspace shell) —— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Coach: lock viewport so only the message pane scrolls */
body.theme-aismm:has(.coach-page) {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.theme-aismm main:has(.coach-page) {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4.75rem);
  height: calc(100dvh - 4.75rem);
  max-height: calc(100dvh - 4.75rem);
}

body.theme-aismm .center-stage:has(.coach-page) {
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  padding-top: 0.65rem;
  padding-bottom: max(0.45rem, env(safe-area-inset-bottom, 0px));
}

body.theme-aismm:has(.coach-page) > footer {
  display: none !important;
}

.coach-page {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.coach-page__header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.coach-page__intro {
  min-width: 0;
  flex: 1 1 auto;
}

.coach-page__intro .studio-kicker {
  margin: 0;
}

.coach-page__intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.15;
  color: var(--color-ink);
}

.coach-page__intro p:not(.studio-kicker) {
  display: none;
  margin: 0.3rem 0 0;
  color: var(--color-muted);
  max-width: 40rem;
  font-size: 0.92rem;
  line-height: 1.4;
}

.coach-page__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.coach-page__actions .btn-primary,
.coach-page__actions .btn-secondary {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 2.45rem;
  justify-content: center;
  text-align: center;
  padding-inline: 0.85rem;
}

.coach-page__studio {
  display: none;
}

.coach-chats-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.coach-chats-toggle .coach-rail__badge {
  margin: 0;
}

/* One shell: history rail + conversation */
.coach-shell {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.coach-rail,
.coach-stage {
  min-width: 0;
  min-height: 0;
}

.coach-rail-backdrop {
  display: none;
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(28, 36, 33, 0.28);
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: pointer;
}

.coach-shell.is-rail-open .coach-rail-backdrop {
  display: block;
}

.coach-rail {
  display: none;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem;
  background: color-mix(in srgb, var(--color-accent-soft) 22%, var(--color-surface));
  border-bottom: 1px solid var(--color-line);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  max-height: min(58vh, 22rem);
  box-shadow: 0 10px 28px rgba(28, 36, 33, 0.12);
}

.coach-shell.is-rail-open .coach-rail {
  display: flex;
  overflow: hidden;
}

.coach-shell.is-rail-open .coach-thread-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
}

.coach-rail__head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 0 0 auto;
}

.coach-rail__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.coach-rail__title-row h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.2;
}

.coach-rail__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.coach-rail__head > p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.coach-rail__empty {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.8rem;
  border: 1px dashed var(--color-line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.4);
  color: var(--color-muted);
  font-size: 0.88rem;
}

.coach-rail__empty strong {
  color: var(--color-ink);
}

.coach-thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  gap: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.coach-thread-list li {
  flex: 0 0 auto;
  width: min(14rem, 76vw);
}

.coach-thread-link {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  width: 100%;
  min-height: 3.2rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.55);
  color: inherit !important;
  text-decoration: none !important;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.coach-thread-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.coach-thread-link:hover {
  background: #fff;
  border-color: var(--color-line);
}

.coach-thread-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-accent) 50%, transparent);
  outline-offset: 2px;
}

.coach-thread-link.is-active {
  background: #fff;
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--color-line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.coach-thread-link.is-active::before {
  background: var(--color-accent);
}

.coach-thread-link__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 0.2rem;
}

.coach-thread-link__meta {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--color-muted);
  padding-left: 0.2rem;
}

.coach-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--color-surface);
  grid-column: 1;
  grid-row: 1;
}

.coach-stage__top {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem 0.65rem;
  border-bottom: 1px solid var(--color-line);
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--color-surface) 92%, #fff);
}

.coach-stage__meta {
  min-width: 0;
}

.coach-stage__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coach-stage__sub {
  margin: 0.2rem 0 0;
  color: var(--color-muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coach-stage__tools {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  align-items: center;
}

.coach-campaign-form {
  flex: 1 1 auto;
  min-width: 0;
}

.coach-campaign-form label {
  display: block;
}

.coach-campaign-form select {
  width: 100%;
  min-height: 2.35rem;
}

.coach-stage__tools .btn-table {
  flex: 0 0 auto;
  white-space: nowrap;
}

.coach-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1rem 1.15rem;
  background:
    radial-gradient(700px 220px at 100% 0%, color-mix(in srgb, var(--color-accent-soft) 28%, transparent), transparent 70%);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--color-accent) 35%, var(--color-line)) transparent;
}

.coach-messages::-webkit-scrollbar {
  width: 8px;
}

.coach-messages::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--color-accent) 30%, var(--color-line));
  border-radius: 999px;
}

.coach-messages::-webkit-scrollbar-track {
  background: transparent;
}

.coach-bubble {
  max-width: min(100%, 42rem);
  width: fit-content;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-line);
  background: #fff;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 1px 0 rgba(28, 36, 33, 0.03);
}

.coach-bubble > strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.coach-bubble__body,
.coach-bubble p {
  margin: 0;
  color: var(--color-ink);
  line-height: 1.65;
  font-size: 0.96rem;
}

.coach-bubble__body strong {
  display: inline;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
  color: inherit;
  margin: 0;
  font-weight: 700;
}

.coach-bubble--user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--color-accent) 10%, #fff);
  border-color: color-mix(in srgb, var(--color-accent) 28%, var(--color-line));
  max-width: min(92%, 36rem);
}

.coach-bubble--assistant {
  align-self: flex-start;
  width: 100%;
  max-width: min(100%, 48rem);
}

.coach-bubble--pending p {
  color: var(--color-muted);
  font-style: italic;
}

.coach-empty {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.85rem;
  padding: 1rem 0.85rem 0;
  overflow: hidden;
}

.coach-empty__copy {
  max-width: 36rem;
  flex: 0 0 auto;
}

.coach-empty h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.5vw, 1.55rem);
  line-height: 1.2;
}

.coach-empty__copy p {
  margin: 0.4rem 0 0;
  color: var(--color-muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.coach-empty .coach-starters {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-content: flex-start;
}

.coach-empty .coach-composer {
  margin-top: auto;
  margin-inline: -0.85rem;
  margin-bottom: 0;
}

.coach-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.coach-starter {
  appearance: none;
  border: 1px solid var(--color-line);
  background: #fff;
  color: var(--color-ink);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  min-height: 2.7rem;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s ease, background 0.15s ease;
  flex: 1 1 100%;
}

.coach-starter:hover {
  border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-line));
  background: color-mix(in srgb, var(--color-accent-soft) 35%, #fff);
}

.coach-composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  padding: 0.7rem 0.85rem 0.8rem;
  border-top: 1px solid var(--color-line);
  background: color-mix(in srgb, var(--color-surface) 96%, #fff);
  flex: 0 0 auto;
  z-index: 2;
}

.coach-composer textarea {
  width: 100%;
  resize: none;
  min-height: 3.1rem;
  max-height: 22vh;
  font: inherit;
  font-size: 16px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
}

.coach-composer__actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}

.coach-composer__hint {
  flex: 1 1 auto;
  font-size: 0.78rem;
  color: var(--color-muted);
  min-width: 0;
}

.coach-composer__actions .btn-primary {
  flex: 0 0 auto;
  min-width: 5.5rem;
  min-height: 2.45rem;
  justify-content: center;
}

@media (min-width: 600px) {
  .coach-starter {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .coach-page__intro p:not(.studio-kicker) {
    display: block;
  }

  .coach-page__header {
    align-items: flex-end;
  }

  .coach-page__studio {
    display: inline-flex;
  }

  .coach-composer textarea {
    min-height: 3.6rem;
  }
}

/* Desktop: rail beside conversation inside one shell */
@media (min-width: 900px) {
  body.theme-aismm main:has(.coach-page) {
    height: calc(100vh - 6.25rem);
    height: calc(100dvh - 6.25rem);
    max-height: calc(100dvh - 6.25rem);
  }

  .coach-chats-toggle,
  .coach-rail-backdrop,
  .coach-shell.is-rail-open .coach-rail-backdrop {
    display: none !important;
  }

  .coach-shell {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
  }

  .coach-rail {
    display: flex;
    position: static;
    max-height: none;
    box-shadow: none;
    border-bottom: 0;
    border-right: 1px solid var(--color-line);
    padding: 1rem 0.9rem;
    height: 100%;
    z-index: auto;
  }

  .coach-stage {
    height: 100%;
    grid-column: auto;
    grid-row: auto;
  }

  .coach-thread-list {
    flex: 1 1 auto;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    gap: 0.35rem;
    min-height: 0;
  }

  .coach-thread-list li {
    width: 100%;
  }

  .coach-stage__top {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.25rem;
  }

  .coach-stage__title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .coach-stage__tools {
    width: auto;
    justify-content: flex-end;
  }

  .coach-campaign-form {
    flex: 0 1 13rem;
  }

  .coach-messages {
    padding: 1.15rem 1.35rem;
  }

  .coach-composer {
    padding: 0.95rem 1.25rem 1.15rem;
  }

  .coach-composer textarea {
    font-size: inherit;
    min-height: 4.4rem;
    resize: vertical;
  }

  .coach-composer__actions .btn-primary {
    min-width: 7.5rem;
  }

  .coach-empty {
    padding: 1.5rem 1.35rem 0;
  }

  .coach-empty .coach-composer {
    margin-inline: -1.35rem;
  }

  .coach-starter {
    flex: 0 1 auto;
    max-width: 22rem;
  }
}

@media (min-width: 1100px) {
  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body):has(.coach-page) {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) main:has(.coach-page) {
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }

  body.theme-aismm:not(.landing-body):not(.aismm-login):not(.legal-body) .center-stage:has(.coach-page) {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    height: 100%;
    max-height: 100%;
  }

  .coach-shell {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }
}

@media (min-width: 1440px) {
  .coach-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .coach-bubble--assistant {
    max-width: min(100%, 52rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .coach-starter,
  .coach-thread-link {
    transition: none;
  }
}

/* —— Public legal pages (Terms / Privacy) —— */
body.theme-aismm.legal-body {
  display: block !important;
  min-height: 100vh;
  min-height: 100dvh;
}

.legal-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 252, 247, 0.96);
  border-bottom: 1px solid var(--color-line);
  backdrop-filter: blur(10px);
}

.legal-top__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-ink) !important;
  text-decoration: none !important;
  min-width: 0;
}

.legal-top__mark {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--color-accent);
  flex-shrink: 0;
}

.legal-top__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
}

.legal-top__nav a {
  color: var(--color-muted) !important;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none !important;
}

.legal-top__nav a:hover,
.legal-top__nav a[aria-current="page"] {
  color: var(--color-accent) !important;
}

.legal-top__nav a.legal-top__cta,
a.legal-top__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-accent-hover);
  background: var(--color-accent);
  color: #fff !important;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(28, 36, 33, 0.08);
}

.legal-top__nav a.legal-top__cta:hover,
a.legal-top__cta:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff !important;
}

.legal-page {
  width: 100%;
  padding: 1.25rem 1rem 2.5rem;
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom, 0px));
}

.legal-page__inner {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
}

.legal-page h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.5vw, 2.35rem);
  line-height: 1.15;
  color: var(--color-ink);
}

.legal-page__meta {
  margin: 0.4rem 0 0;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.legal-doc {
  margin-top: 1.25rem;
  padding: 1.15rem 1.1rem;
}

.legal-doc h2 {
  margin: 1.35rem 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-ink);
}

.legal-doc h2:first-of-type {
  margin-top: 1rem;
}

.legal-doc p,
.legal-doc li {
  color: var(--color-ink);
  line-height: 1.65;
  font-size: 0.98rem;
}

.legal-doc p {
  margin: 0 0 0.65rem;
}

.legal-doc ul {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}

.legal-doc li + li {
  margin-top: 0.35rem;
}

.legal-page__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  margin: 1.25rem 0 0;
  font-size: 0.95rem;
}

@media (max-width: 559.98px) {
  .legal-top {
    padding: 0.7rem 0.85rem;
  }

  .legal-top__nav {
    width: 100%;
    justify-content: flex-start;
  }

  .legal-top__cta {
    margin-left: auto;
  }

  .legal-doc {
    padding: 1rem 0.9rem;
  }
}

@media (min-width: 720px) {
  .legal-top {
    padding: 0.85rem 1.5rem;
  }

  .legal-page {
    padding: 1.75rem 1.5rem 3rem;
  }

  .legal-doc {
    padding: 1.5rem 1.6rem;
  }
}

@media (min-width: 1100px) {
  .legal-page__inner {
    max-width: 52rem;
  }

  .legal-top {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .legal-page {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* —— Merch Studio —— */
.studio-option--merch .studio-option__mark { background: #ebe6df; }
.studio-option--merch .studio-option__mark::after {
  background: #6b5344;
  clip-path: polygon(20% 15%, 80% 15%, 90% 40%, 80% 85%, 20% 85%, 10% 40%);
}

.merch-products__grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}
.merch-product-chip {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface) 92%, #ebe6df);
  cursor: pointer;
  font-weight: 500;
}
.merch-product-chip input { margin-top: 0.2rem; }
.merch-product-chip strong { display: block; font-size: 0.95rem; }
.merch-product-chip small {
  display: block;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.merch-source__modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.merch-source__mode {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.merch-studio-grid {
  align-items: start;
}
.merch-artwork {
  width: min(280px, 100%);
  border-radius: 12px;
  background: #111;
  display: block;
}
.merch-mockup-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
}
.merch-mockup {
  margin: 0;
}
.merch-mockup__stage {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.55), transparent 45%),
    linear-gradient(165deg, #f5f0e8, #e4ddd2);
}
.merch-mockup__body {
  position: absolute;
  inset: 12% 18% 10%;
  background: var(--merch-body, #222);
  border-radius: 8% 8% 6% 6% / 6% 6% 4% 4%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.merch-mockup__body--hoodie {
  inset: 16% 16% 8%;
  border-radius: 18% 18% 8% 8% / 12% 12% 6% 6%;
}
.merch-mockup__body--hoodie::before {
  content: "";
  position: absolute;
  left: 28%;
  right: 28%;
  top: -10%;
  height: 22%;
  background: var(--merch-accent, #1a222b);
  border-radius: 50% 50% 40% 40%;
}
.merch-mockup__body--tote {
  inset: 22% 20% 8%;
  border-radius: 4%;
}
.merch-mockup__body--tote::before,
.merch-mockup__body--tote::after {
  content: "";
  position: absolute;
  top: -14%;
  width: 14%;
  height: 18%;
  border: 3px solid var(--merch-accent, #c9bfad);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.merch-mockup__body--tote::before { left: 18%; }
.merch-mockup__body--tote::after { right: 18%; }
.merch-mockup__body--mug {
  inset: 18% 22% 16% 18%;
  border-radius: 8% / 6%;
}
.merch-mockup__body--mug::after {
  content: "";
  position: absolute;
  right: -22%;
  top: 28%;
  width: 28%;
  height: 36%;
  border: 6px solid var(--merch-accent, #c8ccd0);
  border-left: 0;
  border-radius: 0 50% 50% 0;
}
.merch-mockup__body--cap {
  inset: 28% 16% 36%;
  border-radius: 50% 50% 40% 40% / 60% 60% 40% 40%;
}
.merch-mockup__body--cap::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: -18%;
  height: 28%;
  background: var(--merch-accent, #142820);
  border-radius: 40%;
}
.merch-mockup__print {
  position: absolute;
  display: grid;
  place-items: center;
  z-index: 2;
  pointer-events: none;
}
.merch-mockup__print img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
.merch-mockup figcaption {
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.merch-mockup figcaption strong { font-size: 0.92rem; }
.merch-mockup figcaption span {
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.35;
}
.merch-baked-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}
.merch-baked {
  margin: 0;
}
.merch-baked img {
  width: 100%;
  border-radius: 12px;
  background: #efeae2;
  display: block;
}
.merch-baked figcaption {
  margin-top: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.merch-print-notes {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-body, inherit);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--color-ink);
}

/* —— Image formats (single / carousel / story) —— */
.image-format {
  margin: 0;
  padding: 0;
  border: 0;
}
.image-format__options {
  display: grid;
  gap: 0.55rem;
}
@media (min-width: 720px) {
  .image-format__options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.image-format__option {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface) 94%, #e8efe9);
  cursor: pointer;
  font-weight: 500;
}
.image-format__option input { margin-top: 0.2rem; }
.image-format__option strong { display: block; font-size: 0.95rem; }
.image-format__option em {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}
.image-format__carousel {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.85rem;
}
.brief-field__head,
.image-format__products-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}
.brief-field__head .btn-secondary,
.image-format__products-head .btn-secondary {
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}
.brief-field__hint {
  display: block;
  margin-top: 0.35rem;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--color-muted);
  line-height: 1.4;
}
#suggest-brief-status {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}
#create-brief-field.textarea-compact {
  min-height: 5.5rem;
  max-height: 10rem;
}
.image-format__hint {
  display: block;
  margin-top: 0.35rem;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--color-muted);
  line-height: 1.4;
}
.form-stack textarea.textarea-compact,
textarea.textarea-compact {
  min-height: 0;
  height: auto;
  padding: 0.55rem 0.75rem;
  line-height: 1.4;
  max-height: 7.5rem;
  resize: vertical;
}
#product_lines_field.textarea-compact {
  min-height: 4.25rem;
  max-height: 7.5rem;
}
#suggest-product-lines-status {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

/* Create-form footer — paired actions with clear hierarchy */
.form-stack > .form-actions,
.form-actions {
  margin-top: 0.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--color-line);
  display: grid;
  gap: 0.65rem;
}
.form-actions__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.form-actions__primary {
  flex: 0 1 auto;
  min-width: 9.5rem;
  min-height: 2.6rem;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--color-accent) 35%, transparent);
}
.form-actions__primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-accent) 22%, transparent);
}
.form-actions__cancel {
  flex: 0 0 auto;
  min-width: 8.25rem;
  min-height: 2.6rem;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  background: #fff;
  color: var(--color-ink) !important;
  border: 1px solid var(--color-line);
  font-weight: 600;
}
.form-actions__cancel:hover {
  background: color-mix(in srgb, var(--color-bg) 55%, #fff);
  border-color: color-mix(in srgb, var(--color-ink) 18%, var(--color-line));
  color: var(--color-ink) !important;
}
.form-actions__note {
  margin: 0;
  max-width: 28rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-muted);
  line-height: 1.45;
}
@media (max-width: 520px) {
  .form-actions__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }
  .form-actions__primary,
  .form-actions__cancel {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
}
.image-slides-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  margin-top: 0.75rem;
}
.image-slide-card {
  margin: 0;
}
.image-slide-card__hit {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: zoom-in;
  overflow: hidden;
  line-height: 0;
}
.image-slide-card__hit:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.image-slide-card__hit:hover img {
  transform: scale(1.02);
}
.image-slide-card__hit--single {
  width: min(360px, 100%);
  margin-top: 0.5rem;
}
.image-slide-card__hit--single img {
  aspect-ratio: auto;
  max-height: 420px;
  object-fit: contain;
}
.image-slide-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: #111;
  display: block;
  transition: transform 0.18s ease;
}

/* —— Image lightbox —— */
body.aismm-lightbox-open {
  overflow: hidden;
}
.aismm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.aismm-lightbox[hidden] {
  display: none !important;
}
.aismm-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 22, 20, 0.78);
  backdrop-filter: blur(3px);
}
.aismm-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(52rem, 100%);
  max-height: min(92vh, 900px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.35rem;
}
.aismm-lightbox__figure {
  margin: 0;
  min-width: 0;
  text-align: center;
}
.aismm-lightbox__img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(78vh, 820px);
  margin: 0 auto;
  border-radius: 12px;
  background: #0f1614;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.aismm-lightbox__caption {
  margin: 0.75rem 0 0;
  color: #f3f0ea;
  font-weight: 600;
  font-size: 0.95rem;
}
.aismm-lightbox__counter {
  margin: 0.25rem 0 0;
  color: rgba(243, 240, 234, 0.7);
  font-size: 0.8rem;
  font-weight: 500;
}
.aismm-lightbox__close,
.aismm-lightbox__nav {
  border: 0;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.aismm-lightbox__close:hover,
.aismm-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
}
.aismm-lightbox__close {
  position: absolute;
  top: -0.35rem;
  right: 0.15rem;
  z-index: 2;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.5rem;
  line-height: 1;
}
.aismm-lightbox__nav {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}
.aismm-lightbox__nav[hidden] {
  visibility: hidden;
}
@media (max-width: 640px) {
  .aismm-lightbox__panel {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .aismm-lightbox__nav--prev,
  .aismm-lightbox__nav--next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
  }
  .aismm-lightbox__nav--prev { left: 0.25rem; }
  .aismm-lightbox__nav--next { right: 0.25rem; }
}
.image-slide-card figcaption {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.82rem;
}
.image-slide-card figcaption span {
  color: var(--color-muted);
  line-height: 1.3;
}
