:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --ink: #16201d;
  --muted: #66736d;
  --line: #dfe5df;
  --green: #2f6f4e;
  --mint: #d9efe0;
  --coral: #df6b57;
  --gold: #d59c31;
  --blue: #4d6f9f;
  --shadow: 0 18px 45px rgba(21, 36, 28, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #111916;
  color: #eef6ef;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--mint);
  color: #143321;
  border-radius: 8px;
  font-weight: 900;
}

.brand span,
.sidebar-panel span,
.eyebrow,
small {
  color: var(--muted);
  font-size: 0.78rem;
}

.brand span {
  display: block;
  color: #aab7af;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a {
  color: #cdd8d1;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 8px;
}

.nav-list a.active,
.nav-list a:hover {
  background: #24342d;
  color: #ffffff;
}

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid #2d3f36;
  border-radius: 8px;
  display: grid;
  gap: 8px;
}

.sidebar-panel span {
  color: #aab7af;
}

.workspace {
  padding: 30px;
  overflow: hidden;
}

.topbar,
.panel-header,
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  line-height: 0.95;
}

h2 {
  font-size: 1.2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.primary-btn,
.ghost-btn,
.idea-form button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-btn {
  background: var(--green);
  color: #fff;
}

.ghost-btn,
.idea-form button {
  background: var(--mint);
  color: #173d27;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats-grid article,
.panel,
dialog form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stats-grid article {
  padding: 18px;
  display: grid;
  gap: 7px;
}

.stats-grid strong {
  font-size: 2rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.wide-panel {
  grid-column: span 1;
}

select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.lane {
  background: #f7f9f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 320px;
  padding: 12px;
}

.lane h3 {
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.post-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  gap: 10px;
}

.post-card[data-channel="YouTube"] {
  border-left-color: var(--coral);
}

.post-card[data-channel="Telegram"] {
  border-left-color: var(--blue);
}

.post-card[data-channel="Blog"] {
  border-left-color: var(--gold);
}

.card-meta,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.card-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  min-width: 34px;
  height: 32px;
}

.calendar-list,
.idea-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.calendar-item,
.idea-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 4px;
}

.calendar-item time {
  color: var(--green);
  font-weight: 800;
}

.idea-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.idea-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.idea-item button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--coral);
  font-weight: 900;
}

.metrics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.bar-chart {
  height: 238px;
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 16px 12px 40px;
  border-radius: 8px;
  background: #f7f9f6;
  border: 1px solid var(--line);
}

.bar {
  flex: 1;
  min-width: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--green), #9ac9a7);
  position: relative;
}

.bar span {
  position: absolute;
  bottom: -24px;
  left: 0;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  font-size: 10px;
  color: var(--muted);
}

.insights {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.insights ul {
  padding-left: 18px;
  color: var(--muted);
}

#metrics {
  container-type: inline-size;
}

.metrics-layout > * {
  min-width: 0;
}

.insights {
  overflow-wrap: anywhere;
}

@container (min-width: 560px) {
  .metrics-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}

dialog {
  border: 0;
  background: transparent;
  width: min(480px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(17, 25, 22, 0.55);
}

dialog form {
  padding: 20px;
  display: grid;
  gap: 14px;
}

dialog label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

#closeDialog {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .stats-grid,
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid,
  .content-grid,
  .kanban,
  .metrics-layout {
    grid-template-columns: 1fr;
  }

  .idea-form {
    grid-template-columns: 1fr;
  }
}
 .workspace-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
 .workspace-tools input { flex: 1; min-width: 180px; }
 .workspace-tools button { padding: 10px 14px; cursor: pointer; }
 #notice { min-height: 22px; color: #25634c; }
 textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #cbd5d1; border-radius: 6px; font: inherit; resize: vertical; }
 .post-title { border: 0; background: transparent; padding: 0; text-align: left; font: inherit; font-weight: 700; cursor: pointer; }
 [hidden] { display: none !important; }
 .auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
 .auth-screen form { width: min(100%, 380px); display: grid; gap: 16px; }
 .auth-screen label { display: grid; gap: 6px; }
 .auth-screen input { padding: 12px; width: 100%; box-sizing: border-box; }
 #authError { color: #b42318; }
 .connections { padding: 16px 0; border-bottom: 1px solid #d5ded9; margin-bottom: 20px; }
 .connections h2 { font-size: 18px; }
 #integrationStatus { display: flex; flex-wrap: wrap; gap: 16px; }
 #publicationHistory { font-size: 13px; padding-left: 20px; }
 dialog { max-height: 90vh; overflow: auto; }

.studio-section { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 24px 0; min-width: 0; }
.studio-section button { min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.studio-section button:disabled { opacity: .5; cursor: default; }
.studio-section h3 { font-size: 16px; }
.studio-settings { margin: 18px 0; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.studio-settings summary { cursor: pointer; margin-bottom: 12px; }
.studio-fields, .studio-actions { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.studio-fields > label { display: grid; gap: 6px; flex: 1; min-width: 140px; }
.studio-fields input, .studio-fields select { width: 100%; min-width: 0; }
.studio-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 24px; margin-top: 20px; }
.studio-editor { display: grid; gap: 18px; min-width: 0; }
.studio-label { display: grid; gap: 6px; }
.studio-scenes { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.studio-scene { border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: grid; gap: 10px; background: white; }
.studio-scene small { overflow-wrap: anywhere; }
.studio-scene-header { display: flex; align-items: center; justify-content: space-between; }
.studio-scene input[type=file] { max-width: 100%; font-size: 13px; }
.scene-media { max-width: 100%; width: 160px; height: 90px; object-fit: contain; background: #101010; }
.studio-preview { align-self: start; min-width: 0; display: grid; gap: 14px; position: sticky; top: 20px; }
.studio-preview video { width: 100%; max-height: 600px; background: #101010; }
#studioEmptyPreview { aspect-ratio: 9 / 16; max-height: 440px; background: #e5eae7; display: grid; place-items: center; color: var(--muted); }
.studio-preview progress, .studio-editor audio { width: 100%; }
#studioNotice { overflow-wrap: anywhere; min-height: 40px; }
@media (max-width: 800px) { .studio-layout { grid-template-columns: 1fr; } .studio-preview { position: static; } .studio-fields { align-items: stretch; } }
.audience-section { grid-column: 1 / -1; min-width: 0; padding: 24px 0; border-top: 1px solid var(--line); }
.audience-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.audience-toolbar label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.audience-section button { min-height: 36px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.audience-section h3 { font-size: 16px; }
#audienceNotice { min-height: 24px; margin: 12px 0; color: var(--muted); }
.audience-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.audience-channel { border: 1px solid var(--line); border-radius: 6px; background: white; padding: 18px; min-width: 0; }
.audience-channel header { display: flex; justify-content: space-between; gap: 12px; }
.audience-channel strong { display: block; font-size: 30px; margin: 8px 0; }
.audience-channel p { margin: 8px 0; font-size: 13px; overflow-wrap: anywhere; }
.audience-channel details { margin-top: 14px; }
.audience-channel summary { cursor: pointer; }
.audience-channel form { display: grid; gap: 12px; margin-top: 12px; }
.audience-channel label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.audience-channel progress { width: 100%; height: 10px; accent-color: var(--green); }
.audience-error { color: #b42318; }
.audience-history { margin-top: 24px; overflow-x: auto; }
.audience-history table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.audience-history th, .audience-history td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.audience-spark { display: flex; height: 52px; gap: 3px; align-items: end; margin: 12px 0; }
.audience-spark span { flex: 1; background: var(--blue); min-width: 2px; }
.audience-channel[data-channel=Telegram] .audience-spark span { background: var(--green); }
.inbox-heading { margin-top: 28px; }
.inbox-filters { margin: 14px 0; }
.inbox-filters input { flex: 1; min-width: 150px; }
.inbox-layout { display: grid; grid-template-columns: minmax(200px, .8fr) minmax(0, 1.5fr); border-block: 1px solid var(--line); min-height: 340px; }
.inbox-threads { max-height: 620px; overflow-y: auto; border-right: 1px solid var(--line); }
.inbox-threads button { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px; overflow-wrap: anywhere; }
.inbox-threads button[aria-pressed=true] { background: var(--mint); }
.inbox-threads small { display: block; margin-top: 4px; }
.inbox-detail { padding: 18px; min-width: 0; }
#inboxMeta, #inboxCounts { color: var(--muted); font-size: 13px; }
.inbox-messages { max-height: 300px; overflow-y: auto; display: grid; gap: 12px; margin: 16px 0; }
.inbox-message { border-left: 3px solid var(--blue); padding: 8px 12px; background: white; white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-message[data-direction=out] { border-color: var(--green); background: #e6f1e9; }
.inbox-message small { display: block; }
.inbox-context { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 13px; overflow-wrap: anywhere; }
.inbox-context p { margin: 4px 0; }
#inboxHistory { margin-top: 12px; }
.inbox-detail form { display: grid; gap: 10px; margin-top: 16px; }
.inbox-detail form > label { display: grid; gap: 6px; }
#threadNotice { margin-top: 12px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 720px) { .audience-channels, .inbox-layout { grid-template-columns: 1fr; } .inbox-threads { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); } }

/* Creator Studio visual system — warm neutral soft glass. */
:root {
  --bg: #bfc5c3;
  --surface: #cdd2cf;
  --ink: #262e2b;
  --muted: #505c56;
  --line: #a5b0aa;
  --green: #a96c50;
  --mint: #e7dccd;
  --coral: #ad7057;
  --gold: #a58a58;
  --blue: #7a8b9b;
  --shadow: 0 4px 14px #263c3014;
  --soft-inset: inset 2px 2px 5px #66766c26, inset -1px -1px 3px #e0e5df55;
  --soft-glass: linear-gradient(145deg, #cfd4d0, #c5ccc7);
}
body { background: var(--bg); font-size: 14px; }
.app-shell { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: #b5beba; color: var(--ink); border-right: 1px solid var(--line); box-shadow: none; padding: 34px 20px; gap: 40px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { gap: 11px; }
.brand strong { font-size: 20px; letter-spacing: -.6px; }
.brand span { color: #8a8075; font-size: 9px; letter-spacing: 1.4px; text-transform: uppercase; margin-top: 6px; }
.brand-mark { width: 39px; height: 39px; color: #a96c50; background: var(--soft-glass); border: 1px solid #faf6ee; border-radius: 13px; box-shadow: var(--soft-inset); }
.nav-list { gap: 11px; }
.nav-list a { color: #746a60; border-radius: 14px; padding: 14px; font-size: 12px; line-height: 1.5; transition: background .15s,box-shadow .15s; }
.nav-list a.active { background: linear-gradient(145deg,#e9ddd0,#e1d1c1); color: #8b5b42; box-shadow: inset 3px 3px 7px #bfaf9c70,inset -3px -3px 7px #faf0e5; }
.nav-list a:hover { background: #e9e0d580; color: #865e49; box-shadow: 3px 3px 7px #c5bfb670,-3px -3px 7px #fbf7f0; }
.sidebar-panel { border-color: #faf3e7; border-radius: 20px; background: var(--soft-glass); box-shadow: var(--shadow); padding: 19px; font-size: 12px; line-height: 1.6; }
.sidebar-panel span { color: #94816b; font-size: 10px; }
.workspace { padding: 38px; min-width: 0; }
.topbar { margin-bottom: 30px; gap: 16px; }
.topbar > div { flex: 1; }
h1 { font-size: 33px; letter-spacing: -1.1px; line-height: 1.2; }
h2 { font-size: 17px; letter-spacing: -.3px; }
h3 { color: #635546; }
.eyebrow { font-size: 9px; letter-spacing: 1.3px; font-weight: 600; color: #99816a; margin-bottom: 9px; line-height: 1.6; }
button { font: inherit; color: #85664e; border: 1px solid #fff8ee; border-radius: 13px; background: var(--soft-glass); padding: 10px 15px; cursor: pointer; box-shadow: 4px 4px 9px #c7bdb070,-4px -4px 9px #fff9ef; transition: background .15s,box-shadow .15s; }
button:hover { background: #f2ece3; color: #795b45; }
button:active { box-shadow: var(--soft-inset); }
button:disabled { cursor: default; opacity: .55; }
.primary-btn,.ghost-btn,.idea-form button { border: 1px solid #fff5e8; border-radius: 14px; min-height: 43px; font-size: 12px; font-weight: 700; }
.primary-btn { background: linear-gradient(145deg,#bf8060,#a8684e); color: #fffaf3; border-color: #d4a289; box-shadow: 5px 5px 11px #bfb1a480,-5px -5px 11px #fff9ef,inset 0 1px 2px #e9bfaa70; }
.primary-btn:hover { background: linear-gradient(145deg,#c78b6b,#af7053); color: white; }
.primary-btn:active { background: #a96c50; box-shadow: inset 3px 3px 7px #8b5740,inset -2px -2px 5px #ce9c81; }
.ghost-btn,.idea-form button { background: var(--soft-glass); color: #8a694e; }
input,select,textarea { background: #e8e2d990; color: #605244; border: 1px solid #faf3e8; border-radius: 13px; box-shadow: var(--soft-inset); font: inherit; padding: 11px 13px; }
input::placeholder,textarea::placeholder { color: #928576; opacity: 1; }
select option { background: #efe9df; color: #605244; }
input[type=file] { padding: 9px; }
input[type=file]::file-selector-button { background: #e6d8c8; color: #836247; border: 0; border-radius: 8px; padding: 7px 10px; margin-right: 10px; cursor: pointer; }
input[type=checkbox],input[type=radio] { min-height: auto; accent-color: var(--green); box-shadow: none; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible { outline: 2px solid #a96c50; outline-offset: 3px; }
.stats-grid { gap: 21px; margin-bottom: 28px; }
.stats-grid article,.panel,dialog form,.audience-channel,.studio-scene { background: var(--soft-glass); border: 1px solid #fbf8f1b8; border-radius: 24px; box-shadow: var(--shadow); }
.stats-grid article { padding: 24px; gap: 11px; }
.stats-grid article > span { font-size: 11px; color: #827365; }
.stats-grid strong { font-size: 29px; color: #a86b50; }
.stats-grid article:nth-child(2) strong { color: #9a835a; }
.stats-grid article:nth-child(3) strong { color: #70816b; }
.stats-grid article:nth-child(4) strong { color: #8a7484; }
.stats-grid small { font-size: 10px; }
.content-grid { gap: 26px; }
.panel { padding: 25px; }
.panel-header { gap: 14px; }
.workspace-tools { gap: 13px; margin-bottom: 16px; }
.workspace-tools button { font-size: 12px; }
.connections { padding: 21px 24px; background: #e6e0d580; border: 1px solid #faf3e8; border-radius: 20px; box-shadow: var(--soft-inset); margin-bottom: 26px; }
.connections h2 { font-size: 14px; margin-bottom: 14px; }
#integrationStatus,#publicationHistory { font-size: 12px; color: #897663; line-height: 1.8; }
#notice { color: #817058; font-size: 12px; }
#notice:empty { min-height: 0; }
.kanban { gap: 15px; overflow-x: auto; padding: 4px 5px 15px; }
.lane { background: #ded8ce70; border: 1px solid #f6f0e5; border-radius: 19px; box-shadow: var(--soft-inset); padding: 15px; }
.lane h3 { font-size: 12px; margin-bottom: 16px; }
.post-card { background: var(--soft-glass); border: 1px solid #fff7ec; border-left: 3px solid var(--green); border-radius: 14px; padding: 15px; box-shadow: 3px 3px 8px #c4b9aa70,-3px -3px 8px #fbf4e9; }
.post-title { color: #5b4b3e; box-shadow: none; }
.post-title:hover,.idea-item button:hover { background: transparent; }
.card-actions button { background: var(--soft-glass); border-color: #faf2e5; border-radius: 9px; padding: 5px; }
.calendar-item,.idea-item,.insights { background: #ece6dc70; border-color: #f9f1e5; border-radius: 14px; box-shadow: var(--soft-inset); padding: 15px; }
.calendar-item time { color: #a47454; font-size: 12px; }
.idea-item button { box-shadow: none; }
.bar-chart { background: #dfd8cd80; border-color: #f9f1e5; border-radius: 18px; box-shadow: var(--soft-inset); }
.bar { background: linear-gradient(180deg,#b88362,#d3b494); border-radius: 7px 7px 0 0; }
.insights { font-size: 12px; line-height: 1.8; }
.studio-section,.audience-section { background: var(--soft-glass); border: 1px solid #fbf8f1b8; border-radius: 24px; box-shadow: var(--shadow); padding: 26px; }
.studio-section button,.audience-section button { border-radius: 12px; border-color: #faf1e3; }
.studio-settings { border-bottom-color: #d5c8b9; padding: 15px 0 20px; color: #8b725a; font-size: 12px; }
.studio-layout { gap: 26px; }
.studio-scene { padding: 19px; border-radius: 18px; }
.studio-label,.studio-fields label { font-size: 12px; color: #806b57; }
.studio-scenes { gap: 20px; }
.scene-media,.studio-preview video { border-radius: 13px; }
#studioEmptyPreview { background: linear-gradient(145deg,#e9e0d4,#ded0c0); border: 1px solid #f9f0e2; border-radius: 23px; box-shadow: var(--soft-inset); font-size: 12px; }
progress { accent-color: #a9805f; }
.audience-channel { padding: 23px; border-radius: 19px; }
.audience-channel strong { color: #9b7253; }
.audience-channel header { font-size: 12px; }
.audience-spark span { background: #b7947b; border-radius: 3px 3px 0 0; }
.audience-channel[data-channel=Telegram] .audience-spark span { background: #9baf96; }
.audience-channel progress { accent-color: #99aa85; }
.audience-history th,.audience-history td { border-bottom-color: #d5c7b5; color: #7f6c57; }
.inbox-layout { border-color: #d4c7b6; border-radius: 16px; overflow: hidden; box-shadow: var(--soft-inset); }
.inbox-threads { border-color: #d4c7b6; }
.inbox-threads button { box-shadow: none; border-bottom-color: #d9cdbd; }
.inbox-threads button[aria-pressed=true] { background: #e5d6c4; }
.inbox-message { background: #f0e8dc; border-color: #b6977d; border-radius: 11px; font-size: 13px; }
.inbox-message[data-direction=out] { background: #e2e6d9; border-color: #93a27b; }
.inbox-detail { background: #f1ebe26b; }
.auth-screen { background: radial-gradient(ellipse at top right,#eed9c24d,transparent 65%); }
.auth-screen form { background: var(--soft-glass); border: 1px solid #fbf6ec; border-radius: 26px; padding: 30px; width: min(100%,420px); box-shadow: var(--shadow); }
.auth-screen h1 { font-size: 29px; color: #a16e51; }
.auth-screen h2 { font-size: 16px; }
.auth-screen label { color: #82705d; font-size: 12px; }
dialog { border-radius: 24px; padding: 10px; }
dialog form { padding: 27px; gap: 17px; }
dialog::backdrop { background: #68524155; backdrop-filter: blur(5px); }
dialog label { font-size: 12px; color: #82705d; font-weight: 500; }
#closeDialog { background: var(--soft-glass); border-color: #fff6e9; border-radius: 50%; padding: 0; }
::selection { background: #dbc4aa; color: #513825; }
@media(max-width:1150px) {
  .app-shell { grid-template-columns: 215px minmax(0,1fr); }
  .workspace { padding: 28px; }
  .sidebar { padding: 27px 16px; }
  .content-grid { grid-template-columns: minmax(0,1fr); }
  .wide-panel { grid-column: auto; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:850px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; overflow: visible; gap: 22px; padding: 23px; }
  .nav-list { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
  .nav-list a { padding: 10px 8px; font-size: 11px; text-align: center; overflow-wrap: anywhere; }
  .sidebar-panel { display: none; }
  .studio-layout { grid-template-columns: 1fr; }
  .studio-preview { position: static; }
}
@media(max-width:720px) {
  .workspace { padding: 24px 17px; }
  .topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 17px; }
  .topbar > div { grid-column: 1 / -1; }
  .topbar h1 { font-size: 29px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
  .stats-grid article { padding: 19px; border-radius: 20px; }
  .stats-grid strong { font-size: 25px; }
  .panel,.studio-section,.audience-section { padding: 20px; border-radius: 21px; }
  .panel-header { gap: 13px; }
  .kanban { grid-template-columns: repeat(4,200px); }
  .studio-fields > label { min-width: 120px; }
  .connections { padding: 19px; }
  .metrics-layout,.content-grid { grid-template-columns: minmax(0,1fr); }
  .workspace-tools input { min-width: 0; flex-basis: 100%; width: 100%; }
}
@media(prefers-reduced-motion:reduce) { * { transition: none!important; scroll-behavior: auto!important; } }
.api-settings-section { grid-column: 1 / -1; min-width: 0; padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
#apiSettingsNotice { min-height: 24px; margin: 12px 0; overflow-wrap: anywhere; }
.api-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.api-settings-card { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.api-settings-card header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.api-settings-card h3 { font-size: 16px; }
.api-settings-card header span { font-size: 12px; color: var(--muted); }
.api-settings-card form { display: grid; gap: 16px; }
.api-key-field { display: grid; gap: 8px; font-size: 12px; min-width: 0; }
.api-key-field > input { min-width: 0; width: 100%; }
.api-clear { display: flex; align-items: center; gap: 8px; font-weight: normal; color: var(--muted); }
.api-clear input { min-height: 0; }
.api-card-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.api-check-result { min-height: 40px; margin-top: 16px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
#backendDiagnostics { margin-top: 16px; line-height: 1.6; }
/* Keep the soft surfaces without luminous white borders and highlights. */
.stats-grid article,.panel,.sidebar-panel,.brand-mark,.post-card,
.studio-section,.audience-section,.audience-channel,.studio-scene,
.connections,.lane,.bar-chart,.calendar-item,.idea-item,.insights,
.auth-screen form,dialog form,.api-settings-card {
  border-color: var(--line);
  box-shadow: var(--shadow);
}
button,.ghost-btn,.idea-form button,.card-actions button {
  border-color: var(--line);
  box-shadow: 0 2px 5px #263c3014;
  color: #384a40;
}
button:hover { background: #b9c5be; color: #23392b; }
.primary-btn,.primary-btn:hover { color: #fff; box-shadow: 0 2px 6px #263c3020; }
input,select,textarea,select option { background: #c2cbc5; border-color: var(--line); color: var(--ink); }
input::placeholder,textarea::placeholder { color: #56645b; }
.nav-list a { color: #38483e; }
.nav-list a.active,.nav-list a:hover { background: #a3b6a9; color: #203d2b; box-shadow: none; }
.eyebrow,.brand span,.sidebar-panel span,.stats-grid article > span,
.studio-label,.studio-fields label,.auth-screen label,
#integrationStatus,#publicationHistory { color: #4e5e53; }
.inbox-message,.inbox-detail { background: #c5cec8; }
.inbox-message[data-direction=out] { background: #b3c7b5; }
.brand strong,h1,h2 { letter-spacing: 0; }
@media (max-width: 800px) { .api-settings-grid { grid-template-columns: minmax(0, 1fr); } }

/* Low-glare graphite workspace. */
.ai-posts { grid-column: 1 / -1; }
#aiPostForm,.ai-post-preview { display: grid; gap: 14px; }
#aiPostForm label,.ai-post-preview label { display: grid; gap: 7px; min-width: 0; }
.ai-post-options { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.ai-post-options label:has(input[type=checkbox]) { display: flex; align-items: center; }
#aiPostForm textarea,#aiPostForm input[type=url],.ai-post-preview input,.ai-post-preview textarea { width: 100%; min-width: 0; }
.ai-post-preview { padding: 20px 0; border-top: 1px solid var(--line); }
.ai-post-preview p,#aiPostNotice { color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
#aiPostForm > button,#saveAiPosts { justify-self: start; }
.platform-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
.platform-stats article { min-width: 0; overflow-wrap: anywhere; }
.platform-stats dl { margin: 8px 0; }
.platform-stats dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.platform-stats dd { margin: 0; font-size: 22px; font-weight: 700; color: var(--green); }
.platform-stats p { font-size: 13px; line-height: 1.6; }
#platformStatsNotice { color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) { .platform-stats { grid-template-columns: minmax(0, 1fr); } }
:root {
  color-scheme: dark;
  --bg: #191b1c;
  --surface: #252b2bcc;
  --ink: #e1e5e3;
  --muted: #a4aeaa;
  --line: #c5dbd624;
  --green: #81b69a;
  --mint: #34473c;
  --coral: #d29485;
  --gold: #c5b178;
  --blue: #8eacc4;
  --shadow: 0 10px 28px #00000026, inset 0 1px 0 #ffffff0b;
  --soft-inset: inset 0 1px 3px #00000024;
  --soft-glass: linear-gradient(135deg, #d5e3df14, #25312f66);
}
body { background: linear-gradient(125deg, #172323, #22232a 52%, #18271f); background-attachment: fixed; color: var(--ink); }
.sidebar { background: #1c2524a6; color: var(--ink); }
.sidebar,.panel,.stats-grid article,.connections,.sidebar-panel,
.studio-section,.audience-section,.api-settings-card,.auth-screen form,dialog {
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.connections,.api-settings-card { background: var(--soft-glass); }
.brand strong,.post-title,h1,h2,h3,.audience-channel strong { color: var(--ink); }
.brand span,.eyebrow,.sidebar-panel span,.stats-grid article > span,
.studio-label,.studio-fields label,.auth-screen label,.studio-settings,
.audience-history th,.audience-history td,#integrationStatus,#publicationHistory,
#notice,.nav-list a,.calendar-item time { color: var(--muted); }
.nav-list a.active { background: #34473c; color: #c2dfcc; }
.nav-list a:hover { background: #2e3531; color: var(--ink); }
.lane,.bar-chart,.calendar-item,.idea-item,.insights,
.inbox-detail,#studioEmptyPreview { background: #18232055; border-color: var(--line); }
button,.ghost-btn,.idea-form button,.card-actions button,
.studio-section button,.audience-section button {
  background: #d4e4df12;
  color: #d7dfdb;
  border-color: #c5dbd633;
  box-shadow: none;
}
button:hover { background: #3d4642; color: #eef2ef; }
.primary-btn,.primary-btn:hover { background: #46785d; color: #f1f6f2; border-color: #639276; }
input,select,textarea { background: #10191866; color: var(--ink); border-color: #c5dbd62e; }
select option { background: #252b2b; color: var(--ink); }
input::placeholder,textarea::placeholder { color: #929e97; }
input[type=file]::file-selector-button { background: #36433b; color: #d9e5dc; }
.stats-grid strong { color: #94c6a7; }
.stats-grid article:nth-child(2) strong { color: #c5b178; }
.stats-grid article:nth-child(3) strong { color: #8eacc4; }
.stats-grid article:nth-child(4) strong { color: #c59eaf; }
.bar { background: #81ad97; }
.inbox-message { background: #2d3533; color: var(--ink); }
.inbox-message[data-direction=out],.inbox-threads button[aria-pressed=true] { background: #34473c; }
.auth-screen { background: var(--bg); }
.auth-screen h1,.brand-mark { color: #94c6a7; }
dialog { background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #00000080; }
[hidden] { display: none !important; }
.calendar-item .post-title { white-space: normal; overflow-wrap: anywhere; }
#aiImagePreview { display: block; width: min(100%, 420px); aspect-ratio: 1; object-fit: contain; margin-bottom: 12px; }
#aiImageDownload { color: var(--green); }
.queue-item { display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.queue-item button { justify-self: start; }
#scheduleControls { min-width: 0; padding: 16px; border: 1px solid var(--line); display: grid; gap: 12px; }
#scheduleControls input { min-width: 0; width: 100%; }
#scheduleQueue,#queueNotice { color: var(--muted); font-size: 13px; line-height: 1.6; }
.shorts-clip { display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.shorts-clip p { margin: 0; }
.shorts-clip button { justify-self: start; }
.shorts-clip video { width: min(100%, 300px); aspect-ratio: 9 / 16; background: #101010; }
.shorts-clip a { color: var(--green); }
#shortsTool .studio-fields { display: grid; padding-top: 16px; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; }
#shortsTool label:has(input[type=checkbox]) { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
#shortsTool label input[type=checkbox] { flex: 0 0 auto; width: auto; }
#shortsTool input[type=file],#shortsAnalyses { max-width: 100%; min-width: 0; }
@media (max-width: 600px) { #shortsTool .studio-fields { grid-template-columns: minmax(0,1fr); } }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible { outline-color: #94c6a7; }
@media (max-width: 600px) {
  .workspace,.panel,.studio-section,.audience-section,.studio-fields > label { min-width: 0; }
  input,select,textarea { font-size: 16px; max-width: 100%; }
  button,.nav-list a { min-height: 44px; }
  .nav-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
  dialog { width: calc(100% - 20px); max-width: 100%; max-height: 90dvh; }
  dialog form { padding: 16px; min-width: 0; grid-template-columns: minmax(0,1fr); }
  dialog label,dialog .dialog-header { min-width: 0; }
  dialog input,dialog select,dialog textarea { width: 100%; min-width: 0; }
  dialog textarea { resize: vertical; }
  #closeDialog { flex: 0 0 44px; width: 44px; height: 44px; }
  .panel-header { flex-wrap: wrap; }
}
