:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --sidebar: #17201e;
  --text: #17211f;
  --muted: #68736f;
  --line: #dce3e0;
  --line-strong: #c8d2ce;
  --accent: #0b7958;
  --accent-strong: #07583f;
  --accent-soft: #e4f3ed;
  --blue: #2563a6;
  --blue-soft: #e7f0fa;
  --warning: #9a5a14;
  --warning-soft: #fff3df;
  --danger: #b63d35;
  --shadow: 0 12px 35px rgba(17, 42, 35, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button,
label[for="videoInput"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.upload-zone:focus-within {
  outline: 3px solid rgba(37, 99, 166, 0.25);
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 30px;
  height: 100vh;
  padding: 26px 18px 20px;
  background: var(--sidebar);
  color: #f7fbf9;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: #148363;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-heading h3,
.utility-bar h3,
.utility-bar p,
.progress-strip p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p {
  margin-top: 3px;
  color: rgba(247, 251, 249, 0.62);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 46px;
  border: 0;
  padding: 0 12px;
  background: transparent;
  color: rgba(247, 251, 249, 0.68);
  text-align: left;
  cursor: pointer;
}

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

.nav-icon {
  color: rgba(247, 251, 249, 0.44);
  font-size: 11px;
  font-weight: 800;
}

.nav-count {
  min-width: 34px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.runtime-panel {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.04);
}

.runtime-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.runtime-panel p {
  margin: 9px 0 12px;
  color: rgba(247, 251, 249, 0.62);
  font-size: 12px;
  line-height: 1.65;
}

.text-action {
  border: 0;
  padding: 0;
  background: transparent;
  color: #83d5b9;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.legal-links {
  display: flex;
  gap: 12px;
  padding: 0 3px;
}

.legal-links a {
  color: rgba(247, 251, 249, 0.48);
  font-size: 10px;
  text-decoration: none;
}

.legal-links a:hover {
  color: #fff;
}

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

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

.topbar h2 {
  max-width: 760px;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.15;
}

.eyebrow,
.progress-kicker {
  margin-bottom: 6px !important;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view-subtitle {
  max-width: 720px;
  margin-top: 8px !important;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.mode-badge,
.state-pill,
.subtle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.mode-badge.cloud {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.runtime-panel.cloud {
  border-color: rgba(131, 213, 185, 0.36);
  background: rgba(20, 131, 99, 0.12);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.status-dot.local {
  background: #e7a340;
  box-shadow: 0 0 0 3px rgba(231, 163, 64, 0.15);
}

.app-view[hidden] {
  display: none;
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(390px, 0.9fr) minmax(430px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.composer,
.preview-panel,
.queue-panel,
.progress-strip {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
  line-height: 1.5;
}

.setup-banner.ready {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.setup-banner strong {
  flex: 0 0 auto;
}

.setup-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.setup-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 86px;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.setup-step-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #202a27;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.setup-step strong,
.setup-step p {
  display: block;
  margin: 0;
}

.setup-step p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.setup-step a,
.setup-state {
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.setup-state.complete {
  border-color: #b9d9cb;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.setup-step a:hover {
  text-decoration: underline;
}

.meta-account-panel {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(220px, 0.8fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 15px;
  border: 1px solid #aabfce;
  background: var(--blue-soft);
}

.meta-account-panel[hidden] {
  display: none;
}

.meta-account-panel > div:first-child {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 5px 8px;
  align-items: center;
}

.meta-account-panel p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.meta-account-panel select {
  margin: 0;
}

.composer,
.preview-panel {
  min-height: 690px;
  padding: 20px;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.section-heading,
.section-heading > div,
.actions-row,
.queue-item,
.utility-bar,
.account-card header,
.account-card footer,
.library-item,
.history-item {
  display: flex;
  align-items: center;
}

.section-heading,
.actions-row,
.queue-item,
.utility-bar,
.account-card footer,
.library-item,
.history-item {
  justify-content: space-between;
  gap: 14px;
}

.section-heading > div {
  gap: 10px;
}

.section-heading h3,
.utility-bar h3 {
  font-size: 17px;
}

.section-heading.compact {
  margin-top: -2px;
}

.step-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
}

.subtle-label {
  min-height: 28px;
  background: var(--surface-soft);
  color: var(--muted);
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 162px;
  padding: 22px;
  border: 2px dashed #b7c7c1;
  background: var(--surface-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone.dragover,
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--accent);
  font-size: 25px;
  font-weight: 400;
}

.upload-title {
  font-size: 18px;
  font-weight: 850;
}

.upload-note {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.video-preview-wrap {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: #111;
  color: #fff;
}

.video-preview-wrap[hidden] {
  display: none;
}

.video-preview-wrap video {
  width: 150px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}

.video-meta {
  min-width: 0;
}

.video-meta strong,
.video-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

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

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

label {
  color: #2c3733;
  font-size: 13px;
  font-weight: 800;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0 11px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 76px;
  padding-top: 11px;
  resize: vertical;
  line-height: 1.45;
}

.section-divider {
  height: 1px;
  background: var(--line);
}

fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.choice-box label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: #f1f4f2;
  cursor: pointer;
}

.choice-box label:has(input:checked) {
  border-color: #9fc7b8;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.choice-box label.deferred {
  opacity: 0.52;
  cursor: not-allowed;
}

.choice-box label.deferred input {
  cursor: not-allowed;
}

.choice-box input {
  accent-color: var(--accent);
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
}

.platform-dot.facebook { background: #1877f2; }
.platform-dot.instagram { background: #d9468d; }
.platform-dot.youtube { background: #ff0033; }
.platform-dot.tiktok { background: #161616; }
.platform-dot.whatsapp { background: #17a766; }

.platform-settings {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fafbfb;
}

.platform-settings-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-settings-heading strong {
  font-size: 13px;
}

.platform-settings-heading span:last-child {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-row label,
.consent-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 9px;
  background: #eef2f0;
  font-size: 12px;
  cursor: pointer;
}

.toggle-row input,
.consent-row input {
  accent-color: var(--accent);
}

.consent-row {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  line-height: 1.45;
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0 15px;
  font-weight: 850;
  cursor: pointer;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover,
.secondary-action:hover {
  filter: brightness(0.94);
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.secondary-action {
  background: #1d2c28;
  color: #fff;
}

.ghost-action {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

.ghost-action:hover {
  background: var(--surface-soft);
}

.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-intro {
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.ai-analysis-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  flex-wrap: wrap;
}

.ai-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f8f7;
  color: var(--muted);
  font-size: 12px;
}

.ai-status.ready {
  border-color: #b9d9cb;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.ai-status.working {
  border-color: #d8c98f;
  background: #fff9df;
  color: #705e17;
}

.analysis-summary {
  flex: 1 1 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.state-pill.neutral {
  background: #edf1ef;
  color: var(--muted);
}

.state-pill.ready {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.copy-grid {
  display: grid;
  gap: 10px;
  max-height: 790px;
  overflow: auto;
  padding-right: 3px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.copy-card,
.account-card {
  border: 1px solid var(--line);
  background: #fff;
}

.copy-card {
  padding: 14px;
}

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

.platform-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-name {
  font-size: 14px;
  font-weight: 900;
}

.tone-label {
  color: var(--muted);
  font-size: 11px;
}

.copy-actions {
  display: flex;
  gap: 6px;
}

.icon-text-button {
  min-height: 29px;
  border: 1px solid var(--line);
  padding: 0 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.copy-card input,
.copy-card textarea {
  margin: 0 0 8px;
}

.copy-card input {
  font-weight: 850;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.copy-tags {
  min-height: 38px;
  font-size: 12px;
}

.tag-empty {
  color: var(--muted);
  font-size: 11px;
}

.tag {
  padding: 4px 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.queue-panel {
  margin-top: 18px;
  padding: 20px;
}

.queue-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.queue-item {
  min-height: 68px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--surface-soft);
}

.queue-item-main {
  min-width: 0;
}

.queue-item strong,
.queue-item span {
  display: block;
}

.queue-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.queue-state {
  min-width: 112px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.queue-result {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.queue-result a {
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
}

.queue-result a:hover {
  text-decoration: underline;
}

.queue-result-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.history-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.history-platforms.compact {
  justify-content: flex-end;
  max-width: 360px;
  margin-top: 0;
}

.platform-result {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  background: #f6f8f7;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.platform-result .result-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a7b0ad;
}

.platform-result.published {
  border-color: #b9d9cb;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.platform-result.published .result-dot {
  background: var(--accent);
}

.platform-result.processing {
  border-color: #c7d8eb;
  background: var(--blue-soft);
  color: var(--blue);
}

.platform-result.processing .result-dot {
  background: var(--blue);
}

.platform-result.failed {
  border-color: #ecc5c2;
  background: #fff0ef;
  color: var(--danger);
}

.platform-result.failed .result-dot {
  background: var(--danger);
}

.view-task-events {
  width: fit-content;
  margin-top: 7px;
}

.task-event-list {
  display: grid;
  gap: 0;
  margin-top: 7px;
  border-top: 1px solid var(--line);
}

.task-event-list[hidden] {
  display: none;
}

.task-event {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 5px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

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

.task-event small {
  grid-column: 2;
  line-height: 1.45;
}

.queue-task-actions {
  display: flex;
  gap: 6px;
}

.queue-error {
  margin-top: 5px !important;
  color: var(--danger) !important;
  font-size: 11px !important;
}

.progress-strip {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(260px, 1fr) minmax(300px, 1.2fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
  padding: 20px;
}

.progress-strip strong {
  display: block;
  font-size: 17px;
}

.progress-strip p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.storage-usage {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-weight: 750;
}

.diagnostics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.diagnostics-strip > div {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
}

.diagnostics-strip > div:last-child {
  border-right: 0;
}

.diagnostics-strip span,
.diagnostics-strip strong {
  display: block;
}

.diagnostics-strip span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.diagnostics-strip strong {
  font-size: 13px;
}

.diagnostics-strip strong.warning {
  color: var(--danger);
}

.progress-track {
  height: 8px;
  background: #e7ecea;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease;
}

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

.account-card {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 17px;
}

.account-card header {
  gap: 11px;
}

.account-mark,
.dialog-platform-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #232b29;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.account-card h3 {
  margin: 0;
  font-size: 16px;
}

.account-card header span:last-child {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.account-description {
  margin: 16px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.account-card footer {
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.connection-state.connected {
  color: var(--accent);
}

.utility-bar {
  margin-bottom: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-strong);
}

.utility-bar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.compact-select {
  width: auto;
  min-width: 150px;
  margin: 0;
}

.library-list,
.history-list {
  display: grid;
  gap: 9px;
}

.library-item,
.history-item {
  min-height: 76px;
  border: 1px solid var(--line);
  padding: 13px;
  background: #fff;
}

.file-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-right: 12px;
  background: #242d2a;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.library-content,
.history-content {
  min-width: 0;
  flex: 1;
}

.library-content strong,
.history-content strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-content span,
.history-content span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.library-actions {
  display: flex;
  gap: 7px;
}

.account-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.login-dialog {
  width: min(430px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.login-dialog::backdrop {
  background: rgba(12, 20, 18, 0.78);
}

.login-dialog form {
  display: grid;
  gap: 15px;
  padding: 28px;
}

.login-dialog h2,
.login-dialog p {
  margin: 0;
}

.login-dialog .brand-mark {
  margin-bottom: 3px;
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
}

.account-dialog::backdrop {
  background: rgba(12, 20, 18, 0.63);
}

.account-dialog form {
  position: relative;
  padding: 26px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}

.dialog-platform-mark {
  margin-bottom: 16px;
}

.account-dialog h2 {
  margin: 0;
  font-size: 24px;
}

.dialog-description {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.requirement-box {
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.requirement-box ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.demo-warning {
  margin: 14px 0;
  padding: 10px 12px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
  line-height: 1.5;
}

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(390px, calc(100vw - 32px));
  padding: 12px 15px;
  background: #18211f;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 1180px) {
  .task-layout {
    grid-template-columns: 1fr;
  }

  .composer,
  .preview-panel {
    min-height: auto;
  }

  .account-grid {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }

  .progress-strip {
    grid-template-columns: 1fr 1fr;
  }

  .progress-strip p {
    grid-column: 1 / -1;
  }
}

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

  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    height: auto;
    gap: 16px;
    padding: 16px;
  }

  .nav-list {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    overflow-x: auto;
  }

  .nav-item {
    grid-template-columns: 1fr;
    gap: 2px;
    min-height: 56px;
    text-align: center;
  }

  .nav-icon,
  .nav-count {
    display: none;
  }

  .runtime-panel {
    display: none;
  }

  .workspace {
    padding: 20px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .primary-action {
    margin-left: auto;
  }
}

@media (max-width: 620px) {
  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }

  .nav-item {
    min-width: 0;
  }

  .workspace {
    padding: 14px;
  }

  .brand {
    padding: 0;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .topbar-actions,
  .actions-row,
  .utility-bar,
  .queue-item,
  .history-item {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-badge {
    justify-content: center;
  }

  .topbar-actions .primary-action,
  .primary-action,
  .secondary-action,
  .ghost-action {
    width: 100%;
    margin-left: 0;
  }

  .composer,
  .preview-panel,
  .queue-panel {
    padding: 15px;
  }

  .field-grid.two-columns,
  .account-grid,
  .progress-strip,
  .setup-steps {
    grid-template-columns: 1fr;
  }

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

  .diagnostics-strip > div:nth-child(2) {
    border-right: 0;
  }

  .diagnostics-strip > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .task-event {
    grid-template-columns: 1fr;
  }

  .task-event small {
    grid-column: 1;
  }

  .setup-step {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .setup-step a,
  .setup-state {
    grid-column: 2;
  }

  .meta-account-panel {
    grid-template-columns: 1fr;
  }

  .progress-strip p {
    grid-column: auto;
  }

  .video-preview-wrap {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .video-preview-wrap video {
    width: 104px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .queue-state {
    text-align: left;
  }

  .queue-result {
    justify-items: start;
  }

  .queue-result-links {
    justify-content: flex-start;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }
}
