:root {
  --bg: #f6f3ec;
  --surface: #fffdf7;
  --surface-soft: #f7f1e5;
  --text: #1f2a33;
  --muted: #6b7280;
  --line: #e2ddd1;
  --line-strong: #d4cab8;
  --primary: #c45b2c;
  --primary-press: #9f461f;
  --primary-soft: #fdeee7;
  --danger: #ad2f3d;
  --danger-press: #8e2430;
  --shadow-xs: 0 1px 2px rgba(31, 42, 51, 0.08);
  --shadow-sm: 0 14px 30px rgba(31, 42, 51, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Sora", "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 0%, #f9ebd5 0%, transparent 40%),
    radial-gradient(circle at 100% 14%, #f7dccd 0%, transparent 38%),
    linear-gradient(180deg, #fdf9f2 0%, var(--bg) 100%);
  color: var(--text);
}

.bg-shape {
  display: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  width: min(1220px, 94vw);
  margin: 1.75rem auto 2.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.05rem;
}

.login-card {
  width: min(520px, 100%);
  margin: 10vh auto;
}

.login-separator {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

.form-title {
  margin-top: 0.15rem;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.06rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #fff8f1 100%);
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.integrations-card {
  margin-bottom: 1rem;
}

.integration-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
  margin: 0.65rem 0;
}

.integration-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.52rem 0.62rem;
}

.integration-pill.connected {
  border-color: #2f8f57;
  background: #edf9f0;
}

.integration-pill.disconnected {
  border-color: #d6d4cc;
  background: #f8f8f5;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stack {
  display: grid;
  gap: 0.72rem;
}

.row {
  display: flex;
  gap: 0.6rem;
}

.between {
  justify-content: space-between;
}

.center {
  align-items: center;
}

label {
  display: grid;
  gap: 0.32rem;
  font-size: 0.92rem;
  color: #384452;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

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

input,
select,
textarea {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0.58rem 0.68rem;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #d28863;
  box-shadow: 0 0 0 3px rgba(196, 91, 44, 0.14);
}

textarea {
  resize: vertical;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  padding: 0.58rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
  box-shadow: var(--shadow-xs);
}

button:hover {
  background: var(--primary-press);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: var(--surface-soft);
  color: #42342d;
  border-color: var(--line);
}

button.secondary:hover {
  background: #edf2f6;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: var(--danger-press);
}

button.tiny {
  font-size: 0.8rem;
  padding: 0.34rem 0.62rem;
}

.error {
  color: #b22638;
  min-height: 1.2rem;
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.84rem;
}

.hidden {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin: 0.85rem 0 1rem;
}

.stat-pill {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 0.48rem 0.58rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.62rem;
  border-bottom: 1px solid #edf1f4;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5f6d7a;
  background: #f9fbfc;
}

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

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.42rem;
  margin-top: 0.75rem;
}

.calendar-head {
  font-size: 0.74rem;
  color: #70808f;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calendar-cell {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 112px;
  padding: 0.42rem;
  text-align: left;
  color: var(--text);
}

.calendar-cell.out-month {
  opacity: 0.46;
}

.calendar-cell.selected {
  border-color: #9cb3c5;
  box-shadow: inset 0 0 0 1px #9cb3c5;
}

.calendar-cell.today {
  background: #f0f6fb;
}

.calendar-day-number {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.calendar-count {
  display: inline-block;
  font-size: 0.72rem;
  color: #1f4f72;
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 0.14rem 0.45rem;
}

.calendar-count.empty {
  color: #8293a3;
  background: #f2f5f8;
}

.calendar-topics {
  margin-top: 0.35rem;
  display: grid;
  gap: 0.2rem;
}

.calendar-topic {
  font-size: 0.7rem;
  line-height: 1.2;
  color: #2c3c49;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-topic.more {
  color: #6f8090;
}

.calendar-day-list {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.calendar-day-list h4 {
  margin: 0 0 0.5rem;
}

.calendar-item-list {
  display: grid;
  gap: 0.45rem;
}

.calendar-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.48rem 0.62rem;
  background: #fff;
}

.media-list {
  display: grid;
  gap: 0.52rem;
}

.media-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.46rem;
  background: #fff;
}

.media-thumb {
  width: 88px;
  height: 88px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.media-item-meta {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

.media-main {
  display: inline-block;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  border: 1px solid #bfd0de;
  background: #ecf3f9;
  color: #2b4f6a;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 23, 33, 0.4);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(780px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 42px rgba(16, 24, 40, 0.16);
  padding: 1rem;
}

.modal-small {
  width: min(460px, 100%);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid transparent;
  padding: 0.2rem 0.52rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

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

.badge.draft {
  background: #fff5e8;
  color: #9a5a11;
  border-color: #f4dcc2;
}

.badge.scheduled,
.badge.approved {
  background: #ebf7ef;
  color: #276738;
  border-color: #c8e7d1;
}

.badge.publishing {
  background: #eaf2ff;
  color: #274f86;
  border-color: #c5d8f5;
}

.badge.published {
  background: #eef4ff;
  color: #2a4f86;
  border-color: #d1ddf5;
}

.badge.failed {
  background: #fff0f1;
  color: #8f2a36;
  border-color: #f2ccd1;
}

small.code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color: #5f6f7d;
  display: block;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-cell {
    min-height: 90px;
    padding: 0.34rem;
  }

  .calendar-count {
    font-size: 0.66rem;
  }

  .calendar-item-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .media-item {
    grid-template-columns: 1fr;
  }

  .media-thumb {
    width: 100%;
    height: 180px;
  }
}
