:root {
  --bg: #f4f4f3;
  --card: #ffffff;
  --ink: #111111;
  --ink-2: #2a2a2a;
  --muted: #6b6b6b;
  --line: #e7e7e5;
  --line-2: #efeeec;

  /* People */
  --aladin: #c98a17;
  --aladin-bg: #fbe8c5;
  --shirin: #8a1f2b;
  --shirin-bg: #f4d0d4;
  --madeleine: #1f3b8a;
  --madeleine-bg: #d3dcf3;
  --alex: #1f5d3a;
  --alex-bg: #cfe7d7;

  /* Status */
  --st-validate: #b6791d;
  --st-validate-bg: #fbe8c5;
  --st-changes: #a86a00;
  --st-changes-bg: #fff4d6;
  --st-approved: #1f6f3b;
  --st-approved-bg: #d6efdc;
  --st-rejected: #a32028;
  --st-rejected-bg: #fbd7da;
  --st-posted: #1f4f8a;
  --st-posted-bg: #d8e3f3;

  /* Format / Platform */
  --fmt-bg: #fbe8c5;
  --fmt-fg: #8a5a14;
  --pf-instagram-bg: #ead8fb;
  --pf-instagram-fg: #5a2d8a;
  --pf-tiktok-bg: #111111;
  --pf-tiktok-fg: #ffffff;
  --pf-igtk-bg: #d6efdc;
  --pf-igtk-fg: #1f6f3b;

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #ebeae8;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.card {
  background: var(--bg);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sync-badge {
  background: #d6efdc;
  color: #1f6f3b;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 12.5px;
}
.sync-badge.syncing { background: #fff4d6; color: #a86a00; }
.sync-badge.error   { background: #fbd7da; color: #a32028; }

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 500;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-ghost   { background: #fff; border: 1px solid var(--line); }
.btn-ghost:hover { background: #fafaf9; }

.btn-icon {
  background: transparent; border: 0; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 6px 10px;
  border-radius: 8px;
}
.btn-icon:hover { background: rgba(0,0,0,0.05); }

.month-bar {
  background: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.month-bar strong { font-size: 16px; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav span { min-width: 96px; text-align: center; font-weight: 500; }

.view-switch {
  display: inline-flex;
  gap: 6px;
  background: transparent;
  margin-bottom: 14px;
}
.view-btn {
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
.view-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-num {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-total    { color: var(--ink); }
.kpi-validate { color: #d99417; }
.kpi-changes  { color: #d99417; }
.kpi-approved { color: #1f6f3b; }
.kpi-rejected { color: #a32028; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 6px;
}
.legend.legend-status { margin-bottom: 14px; }
.dot {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: -1px;
}
.dot-aladin    { background: var(--aladin); }
.dot-shirin    { background: var(--shirin); }
.dot-madeleine { background: var(--madeleine); }
.dot-alex      { background: var(--alex); }
.swatch {
  display: inline-block;
  width: 14px; height: 14px; border-radius: 4px;
  margin-right: 6px; vertical-align: -3px;
  border: 1px solid var(--line);
}
.sw-approved { background: var(--st-approved-bg); }
.sw-validate { background: var(--st-validate-bg); }
.sw-changes  { background: #fff4d6; border-color: #f0c860; }
.sw-rejected { background: var(--st-rejected-bg); }
.sw-posted   { background: var(--st-posted-bg); }

.view { background: #fff; border-radius: 14px; padding: 4px; }
.posts {
  width: 100%;
  border-collapse: collapse;
}
.posts thead th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--line-2);
}
.posts tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.posts tbody tr:last-child td { border-bottom: 0; }

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-aladin    { background: var(--aladin-bg);    color: var(--aladin); }
.tag-shirin    { background: var(--shirin-bg);    color: var(--shirin); }
.tag-madeleine { background: var(--madeleine-bg); color: var(--madeleine); }
.tag-alex      { background: var(--alex-bg);      color: var(--alex); }

.tag-format    { background: var(--fmt-bg); color: var(--fmt-fg); margin-right: 6px; }
.tag-platform-Instagram { background: var(--pf-instagram-bg); color: var(--pf-instagram-fg); }
.tag-platform-TikTok    { background: var(--pf-tiktok-bg);    color: var(--pf-tiktok-fg); }
.tag-platform-IGTK      { background: var(--pf-igtk-bg);      color: var(--pf-igtk-fg); }

.status {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.status-validate  { background: var(--st-validate-bg); color: var(--st-validate); }
.status-changes   { background: #fff4d6;               color: var(--st-changes); border: 1px solid #f0c860; }
.status-approved  { background: var(--st-approved-bg); color: var(--st-approved); }
.status-rejected  { background: var(--st-rejected-bg); color: var(--st-rejected); }
.status-posted    { background: var(--st-posted-bg);   color: var(--st-posted); }

.actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.act {
  border: 0; cursor: pointer; padding: 6px 10px;
  border-radius: 8px; font: inherit; font-weight: 500;
}
.act-approve { background: #d6efdc; color: #1f6f3b; }
.act-changes { background: #fff4d6; color: #a86a00; }
.act-reject  { background: #fbd7da; color: #a32028; }
.act-detail  { background: #fff; border: 1px solid var(--line); }
.act-rate    { background: #fbe8c5; color: #8a5a14; }
.act-edit    { background: #fff; border: 1px solid var(--line); }
.act-del     { background: #fff; border: 1px solid var(--line); padding: 6px 8px; }

.attach {
  margin-left: 6px;
  color: var(--muted);
  text-decoration: none;
}
.attach:hover { color: var(--ink); }

.empty-hint {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
}

/* Calendar */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
.cal-head {
  padding: 10px 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.cal-head > div { text-align: left; padding-left: 6px; }
.cal-body { padding: 4px; }
.cal-day {
  background: #fff;
  border-radius: 12px;
  min-height: 92px;
  padding: 10px 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-day.faded { opacity: 0.4; }
.cal-day .day-num { font-weight: 600; }
.cal-pill {
  display: block;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border: 1px solid transparent;
}
.cal-pill.status-changes { border-color: #f0c860; }
.cal-count {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  min-width: 20px; height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

/* Rule footer */
.rule {
  margin: 18px 0 0;
  background: #fff8e6;
  border-left: 4px solid #e6b53a;
  padding: 12px 14px;
  border-radius: 8px;
  color: #5b4a1a;
}

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-body .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.modal-body input,
.modal-body select,
.modal-body textarea {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.modal-body textarea { resize: vertical; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}
.muted { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
code {
  background: #f3f2f0;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
}

/* Toasts */
.toasts {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: pop 0.18s ease-out;
}
.toast.error { background: #a32028; }
.toast.success { background: #1f6f3b; }
@keyframes pop {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Settings FAB */
.settings-fab {
  position: fixed;
  bottom: 18px; left: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.settings-fab:hover { background: #fafaf9; }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 880px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .head { flex-direction: column; align-items: stretch; }
  .head-actions { justify-content: flex-end; }
  .posts thead { display: none; }
  .posts, .posts tbody, .posts tr, .posts td { display: block; width: 100%; }
  .posts tbody tr {
    background: #fff;
    border-radius: 10px;
    margin-bottom: 8px;
    padding: 6px 8px;
  }
  .posts tbody td { border: 0; padding: 6px 8px; }
  .posts tbody td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 110px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
  }
  .modal-body .row { grid-template-columns: 1fr; }
  .cal-day { min-height: 70px; }
}
