/*
 * Relay dashboard styles.
 *
 * Every token below is lifted from the approved mockup's artboards, not
 * approximated: the navy sidebar, the gold accent, the ivory page, the card
 * border and radius, the platform and status chip pairs. Where the mockup used
 * inline styles per artboard, they are consolidated here once.
 */

:root {
  /* Surfaces */
  --page: #F6F5F1;
  --card: #FFFFFF;
  --card-border: #E4E0D5;
  --rule: #EFECE3;
  --sunken: #F1EFE8;

  /* Navy sidebar */
  --navy: #10192B;
  --navy-raised: #17233A;
  --navy-border: #28344C;
  --navy-rule: #22304A;

  /* Text */
  --ink: #171B22;
  --muted: #5B6472;
  --faint: #8B93A0;
  --on-navy: #B7BECB;

  /* Gold accent */
  --gold: #C9A227;
  --gold-bright: #E8C766;

  /* Semantic */
  --green: #2F8F5B;
  --green-bg: #E7F3EC;
  --green-border: #CBE6D6;
  --amber: #B8791E;
  --amber-bg: #FBF0DF;
  --amber-border: #EAD3A0;
  --red: #C1443B;
  --red-bg: #FBEAE8;
  --red-border: #F0CFCB;
  --blue: #3B6FA0;
  --blue-bg: #EAF0F8;

  --radius: 13px;
  --radius-sm: 9px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  margin: 0;
  font-weight: 600;
}

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}
button { cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D8D3C6; border-radius: 4px; }

/* Keyboard focus must stay visible — these are real controls, not a picture
   of controls, and the mockup's hover-only affordances are not enough. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- layout -------------------------------------------------------------- */

#root { height: 100%; }

.shell {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  justify-content: space-between;
  overflow-y: auto;
}

.sidebar-top { display: flex; flex-direction: column; gap: 22px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy);
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: 'Fraunces', Georgia, serif;
  color: var(--gold-bright);
  font-size: 14px; font-weight: 600;
}
.brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px; font-weight: 600; color: #fff;
}

.workspace {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  background: var(--navy-raised);
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy-border);
}
.workspace-icon {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--navy-border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.workspace-name {
  color: #fff; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workspace-sub { color: var(--faint); font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.navlink {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--on-navy);
  font-size: 13.5px;
  width: 100%;
  text-align: left;
  transition: background .12s ease, color .12s ease;
}
.navlink:hover { background: var(--navy-raised); color: #fff; }
.navlink.active {
  background: var(--navy-raised);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--gold);
}
.navlink svg { flex-shrink: 0; }

.sidebar-bottom { display: flex; flex-direction: column; gap: 10px; }

.role-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: #20242C;
  border: 1px solid #3A3F4A;
  color: var(--on-navy);
}
.role-badge[data-role="owner"]    { background: #2A2210; border-color: #6B5A20; color: var(--gold-bright); }
.role-badge[data-role="admin"]    { background: #1B2C42; border-color: #2E4A6B; color: #7FB1E0; }
.role-badge[data-role="editor"]   { background: #0F2A1C; border-color: #1F4A32; color: #6ECB98; }
.role-badge[data-role="approver"] { background: #2A2210; border-color: #6B5A20; color: var(--gold-bright); }

.user-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px;
  border-top: 1px solid var(--navy-rule);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy-border);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11.5px; font-weight: 600;
  flex-shrink: 0;
}
.user-name {
  color: #fff; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.main { flex-grow: 1; height: 100%; overflow-y: auto; }
.main-inner { padding: 26px 36px 60px; max-width: 1180px; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 23px; }
.page-sub { color: var(--faint); font-size: 13px; margin-top: 2px; }

/* --- cards --------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h2 { font-size: 16px; margin-bottom: 14px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: 1.6fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.stat { padding: 18px 20px; }
.stat-label { color: var(--faint); font-size: 12.5px; margin-bottom: 8px; }
.stat-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px; font-weight: 600;
}

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.row:first-of-type { border-top: none; }
.row-grow { flex-grow: 1; min-width: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- chips --------------------------------------------------------------- */

.chip {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
  white-space: nowrap;
}
.chip-lg { font-size: 11.5px; padding: 3px 10px; }

.pf-facebook  { background: #EAF0F8; color: #3B6FA0; }
.pf-instagram { background: #F7E4EC; color: #B0447A; }
.pf-pinterest { background: #FBEAE8; color: #C1443B; }
.pf-linkedin  { background: #E8ECEF; color: #2E4A6B; }
.pf-tiktok    { background: #EFEFEC; color: #171B22; }
.pf-youtube   { background: #FBEAE8; color: #C1443B; }
.pf-x         { background: #EFEFEC; color: #171B22; }

/* Channels badge: the same platform colours as a square with a letter.
   Deliberately not a brand logo. */
.pf-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.st-draft    { background: #EFEFEC; color: #5B6472; }
.st-pending  { background: var(--amber-bg); color: var(--amber); }
.st-approved { background: var(--green-bg); color: var(--green); }
.st-rejected { background: var(--red-bg); color: var(--red); }
.st-posted   { background: #EFEFEC; color: #5B6472; }
.st-expired  { background: #EFEFEC; color: #8B93A0; }

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--ink);
  transition: filter .12s ease;
}
.btn:hover:not(:disabled) { filter: brightness(.97); }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-approve { background: var(--green-bg); color: var(--green); border-color: transparent; }
.btn-reject  { background: var(--red-bg);  color: var(--red);  border-color: transparent; }
.btn-danger  { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* --- forms --------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.label { font-size: 12px; color: var(--faint); font-weight: 600; }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
}
.textarea { min-height: 84px; resize: vertical; }

.pchip {
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid var(--card-border);
  font-size: 12.5px;
  background: #fff;
  color: var(--muted);
}
.pchip[aria-pressed="true"] { border-width: 1px; font-weight: 600; }

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

/* --- notices ------------------------------------------------------------- */

.notice {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid transparent;
}
.notice-info    { background: var(--sunken); border-color: #D8D3C6; color: var(--muted); }
.notice-warn    { background: var(--amber-bg); border-color: var(--amber-border); color: #8A6415; }
.notice-error   { background: var(--red-bg); border-color: var(--red-border); color: #8A2E27; }
.notice-success { background: var(--green-bg); border-color: var(--green-border); color: #1F6B41; }

.empty {
  padding: 30px 0;
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
}
.empty svg { margin-bottom: 8px; }

/* Same empty-state pattern as the Approvals card, sized for a column: it has
   to sit inside 300px beside a hint and a header, so the full-size padding
   would overflow. */
.empty-sm {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11.5px;
  opacity: .75;
}
.empty-sm svg { margin-bottom: 4px; }

/* Shown-once secret: monospace, selectable, visually marked as fragile. */
.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: .5px;
  background: #fff;
  border: 1px dashed var(--amber-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  user-select: all;
  word-break: break-all;
}

/* --- toast --------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 60;
  max-width: 380px;
}
.toast {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 20px rgba(16, 25, 43, .22);
  animation: toast-in .16s ease;
}
.toast-error { background: #8A2E27; }
.toast-success { background: #1F6B41; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* --- modal --------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16, 25, 43, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 18px 50px rgba(16, 25, 43, .25);
}
.modal h2 { font-size: 17px; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }

/* --- login --------------------------------------------------------------- */

.login-wrap {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 50% -10%, #17233A 0%, var(--navy) 62%);
}
.login-card {
  width: 100%; max-width: 392px;
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 22px 60px rgba(8, 14, 26, .38);
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
}
.login-brand .brand-mark { background: var(--navy); }
.login-brand .brand-name { color: var(--ink); font-size: 22px; }
.login-card h1 { font-size: 21px; text-align: center; }
.login-card .page-sub { text-align: center; margin-bottom: 22px; }

/* --- comments ------------------------------------------------------------ */

.comment { display: flex; gap: 9px; padding: 7px 0; }
.comment-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: #EFEFEC; color: var(--muted);
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.comment-body { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.comment-author { color: var(--ink); font-weight: 600; }

/* --- content by status ---------------------------------------------------
   NOT a calendar. There is no scheduled_for field, so there is no schedule to
   render — these columns are the real lifecycle states. See rule 8. */

/* Equal width via minmax(0,1fr); equal height via a FIXED column height
   rather than grid stretch.

   Stretch alone made every column as tall as the fullest one, so ten approved
   drafts turned four near-empty columns into tall blank boxes — the row read
   as broken rather than composed. A fixed height caps the row and moves the
   overflow inside the column that actually has it. */
.statuses { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }

.status-col {
  background: var(--sunken);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 13px;
  /* Fixed, not min-height: every column is the same box whatever it holds. */
  height: 300px;
  display: flex;
  flex-direction: column;
}
.status-col-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
  font-size: 12.5px; font-weight: 600;
  margin-bottom: 2px;
  flex-shrink: 0;
}
.status-col-hint {
  font-size: 11px; color: var(--faint);
  margin-bottom: 10px;
  flex-shrink: 0;
}

/* The only scrolling region. min-height:0 is required — a flex child defaults
   to min-height:auto, which refuses to shrink below its content and would push
   the column past its fixed height instead of scrolling. */
.status-col-items {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* Room for the scrollbar so cards do not sit under it. */
  padding-right: 2px;
}
.status-col-items::-webkit-scrollbar { width: 5px; }
.status-col-items::-webkit-scrollbar-thumb { background: #D8D3C6; border-radius: 3px; }

/* Pinned under the scroll area, so "+4 more" stays visible while scrolling. */
.status-col-more {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--faint);
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--card-border);
}
.status-item {
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--card-border);
}
.status-item-text {
  font-size: 11.5px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- kill switch --------------------------------------------------------- */

.kill-card { display: flex; flex-direction: column; gap: 14px; }
.kill-live { background: var(--green-bg); border-color: var(--green-border); }
.kill-engaged { background: var(--red-bg); border-color: var(--red-border); }
.toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  text-align: left;
  width: 100%;
}
.toggle-track {
  width: 38px; height: 22px; border-radius: 99px;
  position: relative; flex-shrink: 0;
  transition: background .15s ease;
}
.toggle-knob {
  position: absolute; top: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: left .15s ease;
}

/* --- table --------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 12px;
  color: var(--faint);
  font-weight: 600;
  padding: 0 10px 10px 0;
}
.table td {
  padding: 12px 10px 12px 0;
  border-top: 1px solid var(--rule);
  font-size: 13.5px;
  vertical-align: middle;
}

.skeleton {
  background: linear-gradient(90deg, #EFECE3 25%, #F6F5F1 50%, #EFECE3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
  .shell { flex-direction: column; overflow: auto; }
  .sidebar {
    width: 100%; height: auto;
    flex-direction: row; align-items: center;
    justify-content: space-between;
    gap: 14px; padding: 12px 16px;
  }
  .sidebar-top { flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .workspace { display: none; }
  .main-inner { padding: 18px 16px 48px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .statuses { grid-template-columns: 1fr 1fr; }
}
