:root {
  --ink: #202025;
  --muted: #65656e;
  --paper: #f5f5f7;
  --line: #e8e7eb;
  --green: #970025;
  --lime: #f8edf0;
  --surface: #fff;
  --control: #f4f4f6;
  --sidebar: 224px;
  --shadow: 0 1px 2px #24202c08, 0 8px 24px #24202c06;
  color-scheme: light;
}

body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

aside {
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  padding: 28px 17px 22px;
  overflow-y: auto;
  z-index: 2;
}

.brand {
  padding: 9px 9px 21px;
  border-bottom: 1px solid var(--line);
}

.brand img { max-width: 174px; }
.brand small, .studio-label {
  color: var(--green);
  font: 650 10px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.brand small { margin-top: 11px; }

aside .workspace {
  margin: 25px 11px 8px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .12em;
}

nav button {
  margin: 3px 0;
  padding: 12px 10px;
  border: 0;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 550;
}

nav button.active {
  border: 0;
  color: var(--green);
  background: var(--lime);
  font-weight: 680;
}

nav b:not(:empty) {
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--green);
  background: #f4e8ec;
  line-height: 1.5;
}

.side-bottom {
  position: static;
  margin-top: auto;
  padding: 22px 9px 0;
}

main {
  max-width: 1830px;
  margin-left: var(--sidebar);
  padding: 26px clamp(20px, 2.6vw, 44px) 40px;
}

.topline {
  min-height: 40px;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-bottom: 15px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .075em;
}

.studio-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.demo, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e8e6e9;
  border-radius: 999px;
  padding: 5px 10px;
  color: #575461;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.utility-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 11px;
  background: var(--surface);
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.utility-link:hover { background: var(--lime); }
.heading { gap: 18px; margin: 27px 0 24px; }
h1, h2, h3 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 650;
}
h1 {
  margin: 0 0 6px;
  font-size: clamp(31px, 3.1vw, 47px);
  line-height: 1.08;
  letter-spacing: -.047em;
}
h2 { font-size: 20px; line-height: 1.22; letter-spacing: -.025em; }
h3 { font-size: 17px; line-height: 1.25; letter-spacing: -.015em; }
.heading p { font-size: 14px; }

button, input, select, textarea { border-radius: 10px; }
button {
  min-height: 38px;
  padding: 8px 13px;
  font-weight: 600;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
button:hover { background: #f1eff3; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.primary { box-shadow: 0 1px 2px #5e001d25; }
.primary:hover { background: #780020; border-color: #780020; }
.heading .primary { flex-shrink: 0; padding-inline: 16px; }

.stats { gap: 11px; margin-bottom: 23px; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding: 14px 15px 13px;
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.stat span:first-child { color: var(--ink); font-weight: 650; font-size: 12px; }
.stat strong {
  margin: 0;
  font: 650 29px/1.08 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}
.stat:nth-child(2) { border-color: #efdee4; background: #fcf6f8; }

.toolbar { gap: 7px; margin-bottom: 12px; }
.toolbar h2 { padding-right: 10px; font-size: 19px; }
.toolbar select { width: auto; max-width: 190px; }
.toolbar button, .toolbar select { min-height: 38px; font-size: 12px; }
#prev, #next { min-width: 40px; }
.calendar { border-radius: 17px; box-shadow: var(--shadow); }
.week { grid-template-columns: repeat(7, minmax(122px, 1fr)); min-width: 854px; }
.day { min-width: 0; min-height: 350px; padding: 10px 7px 7px; }
.day.today { background: #fcf8fa; }
.date {
  min-height: 32px;
  gap: 5px;
  margin: 0 1px 12px;
  padding: 0 2px 5px;
  font-weight: 680;
  letter-spacing: .095em;
}
.date b {
  display: grid;
  place-items: center;
  min-width: 26px;
  min-height: 26px;
  font: 640 17px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
}
.day.today .date b { min-width: 28px; min-height: 28px; padding: 0 5px; font-size: 15px; }
.empty { padding: 14px 6px; border-color: #e5e3e8; border-radius: 9px; color: var(--muted); }

.post {
  min-width: 0;
  margin-bottom: 8px;
  border: 1px solid #e8e6eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px #23212a0c;
  color: var(--ink);
}
button.post { min-height: 0; }
.post:hover { border-color: #d9d5dd; box-shadow: 0 3px 10px #23212a10; }
.post .thumb { height: clamp(72px, 6.8vw, 115px); }
.post-body { padding: 9px 8px 10px; }
.post small { margin-bottom: 4px; font-size: 10px; font-weight: 650; line-height: 1.3; }
.post strong {
  margin-bottom: 6px;
  font: 650 13px/1.26 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
.format { margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 500; }
.tag {
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--lime);
  font: 640 9px/1.35 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.tag.pending { background: #fff2d9; color: #72500f; }
.tag.draft { background: #efedf1; color: #5f5767; }

.post-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 8px 8px;
  border-top: 1px solid var(--line);
}

.post-now, .post-edit {
  min-height: 31px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

.post-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  background: var(--green);
  color: #fff;
}
.post-now:hover { background: #780020; }
.post-edit { color: var(--green); background: var(--lime); }
.post-edit:hover { background: #f1dce3; }
.post > .post-edit {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  background: #fff;
  color: inherit;
}
.post > .post-edit:hover { background: #fbfafc; }
.post > .post-edit:focus-visible { outline-offset: -2px; }

.lower, .client-grid, .list-grid { gap: 14px; }
.panel, .client-card, .connection-card { border-radius: 16px; box-shadow: var(--shadow); }
.panel { padding: 20px; }
.client-card .panel { border-radius: 0; box-shadow: none; }
.client-card .thumb { height: 154px; }
.row { gap: 10px; }
.note { font-size: 12px; }
.source-link { text-underline-offset: .18em; }
.profile-body .toolbar { align-items: center; }
.profile-body .toolbar .source-link { margin-top: 0; }

dialog {
  max-height: 92dvh;
  border-radius: 23px;
  box-shadow: 0 24px 76px #21152040;
}
dialog::backdrop { background: #27212466; backdrop-filter: blur(5px); }
.modal-head, .modal-foot { background: #fff; }
.modal-head { gap: 14px; padding: 19px 25px; }
.modal-head button { min-width: 38px; padding: 7px; }
.modal-foot { align-items: center; flex-wrap: wrap; padding: 14px 25px; }
.editor { gap: 22px; padding: 23px 25px; }
.editor label { margin-bottom: 6px; font-size: 12px; color: var(--ink); font-weight: 600; }
.field { min-width: 0; margin-bottom: 14px; }
input, select, textarea { min-height: 40px; padding: 9px 11px; }
.preview-wrap { padding: 19px; border-radius: 15px; background: var(--control); }
.preview { max-width: 390px; border-radius: 14px; box-shadow: var(--shadow); }
.preview-media { height: auto; aspect-ratio: 4 / 3; }
.preview-copy { font-size: 13px; }
.modal-foot .post-now { flex: 0 0 auto; min-height: 38px; padding-inline: 13px; font-size: 13px; }
#publishDialog { max-width: 760px; }
.publish-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: start;
  padding: 24px 25px;
}
.publish-preview img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 13px; }
.publish-preview .studio-label { margin-bottom: 7px; }
#publishCaption { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.toast { border-radius: 13px; box-shadow: 0 10px 30px #16131b2e; }
footer { font-size: 10px; letter-spacing: .04em; }

@media (max-width: 1160px) {
  :root { --sidebar: 188px; }
  aside { padding-inline: 13px; }
  main { padding-inline: 20px; }
  .client-grid, .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  aside { position: static; width: 100%; padding: 14px 16px 11px; border: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; border: 0; }
  .brand img { width: 168px; }
  .brand small { display: block; margin-top: 4px; font-size: 9px; }
  aside .workspace, .side-bottom { display: none; }
  nav { display: flex; gap: 4px; margin: 12px 0 0; padding: 3px; overflow-x: auto; border-radius: 12px; background: var(--control); }
  nav button { flex: 1 0 auto; width: auto; min-height: 36px; margin: 0; padding: 7px 10px; white-space: nowrap; }
  nav button.active { background: white; box-shadow: 0 1px 4px #27212e18; }
  nav b { float: none; margin-left: 3px; }
  main { margin: 0; padding: 17px 16px 27px; }
  .topline { min-height: 34px; padding-bottom: 10px; }
  .heading { margin: 20px 0 17px; }
  .stats { margin-bottom: 17px; }
  .calendar { overflow: visible; }
  .week { display: block; min-width: 0; }
  .day {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 208px), 1fr));
    gap: 8px;
    min-height: 0;
    padding: 10px 11px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .day:first-child { border-radius: 16px 16px 0 0; }
  .day:last-child { border-radius: 0 0 16px 16px; }
  .date { grid-column: 1 / -1; justify-content: flex-start; min-height: 25px; margin: 0; padding: 0; gap: 8px; }
  .date b { min-height: 23px; }
  .day.today .date b { min-height: 24px; min-width: 24px; }
  .day .empty { padding: 5px 0; border: 0; text-align: left; }
  .day .post { margin: 0; }
  .day .post .thumb { height: 115px; }
  .day .post-body { padding-inline: 11px; }
  .day .post strong { font-size: 14px; }
  .day .post-actions { padding-inline: 10px; }
  .post-now, .post-edit { min-height: 36px; }
}

@media (max-width: 560px) {
  .heading { flex-wrap: wrap; gap: 12px; }
  .heading h1 { font-size: 32px; }
  .heading p { font-size: 13px; }
  .heading .primary { min-height: 42px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .stat { padding: 10px 11px; }
  .stat strong { font-size: 25px; }
  .stat span:first-child { font-size: 11px; }
  .toolbar h2 { width: 100%; }
  .toolbar select { flex: 1; max-width: 100%; min-width: 88px; }
  .lower, .client-grid, .list-grid, .connection-grid, .editor, .publish-preview { grid-template-columns: minmax(0, 1fr); }
  .editor, .publish-preview { gap: 15px; padding: 15px; }
  .modal-head, .modal-foot { padding-inline: 15px; }
  .modal-foot button { min-height: 42px; }
  .preview-wrap { padding: 13px; }
  .toast { right: 12px; bottom: 12px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
