/* ==========================================================================
   PostPilot — application stylesheet
   Identity: "Meadow & Ember" — deep forest green with a terracotta accent
   on warm paper. No purple. Modern, editorial, responsive. No build step.
   ========================================================================== */

:root {
  /* Brand — meadow / forest */
  --brand-50: #edf7f1;
  --brand-100: #d8efe3;
  --brand-200: #b4e0ca;
  --brand-300: #8fd6b5;
  --brand-400: #4fb98c;
  --brand-500: #2e9e74;
  --brand-600: #1f7f5c;
  --brand-700: #186449;
  --brand-800: #124e39;
  --brand-900: #0e3a2b;
  --brand-950: #0f2a21;

  /* Accent — ember / terracotta */
  --ember-50: #fcede6;
  --ember-100: #f9d9cc;
  --ember-400: #e8804f;
  --ember-500: #dd6033;
  --ember-600: #c24a22;

  /* Functional */
  --blue-50: #e8f1fa;
  --blue-500: #2f7dc0;
  --blue-600: #1f5f98;
  --green-50: #eaf7f0;
  --green-500: #2e9e6b;
  --green-600: #1f7f56;
  --red-50: #fbecea;
  --red-500: #d14b3f;
  --red-600: #b3382e;
  --amber-50: #fbf1da;
  --amber-500: #d89b2c;
  --amber-600: #a9761a;

  /* Warm neutrals */
  --paper: #f3f1ea;
  --surface: #ffffff;
  --ink-900: #16211d;
  --ink-800: #223029;
  --ink-700: #36443d;
  --ink-600: #4c5a53;
  --ink-500: #68766e;
  --ink-400: #93a099;
  --ink-300: #c4ccc5;
  --ink-200: #e0e5df;
  --ink-100: #edf0ea;
  --ink-50: #f3f1ea;

  /* Dark sidebar */
  --sidebar-bg: #0f2a21;
  --sidebar-bg-2: #0b211a;
  --sidebar-text: #aebfb5;
  --sidebar-muted: #6f8579;
  --sidebar-active: rgba(79, 185, 140, .16);
  --sidebar-active-text: #eaf6ef;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(22, 33, 29, .06), 0 1px 3px rgba(22, 33, 29, .05);
  --shadow: 0 6px 18px rgba(22, 33, 29, .08);
  --shadow-lg: 0 24px 50px rgba(15, 42, 33, .18);
  --border: 1px solid var(--ink-200);
  --sidebar-w: 264px;
  --transition: 160ms cubic-bezier(.4, 0, .2, 1);
  --grad: linear-gradient(135deg, var(--brand-500), var(--brand-800));

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-800);
  background-color: var(--paper);
  background-image:
    radial-gradient(900px 520px at 102% -12%, rgba(46, 158, 116, .10), transparent 60%),
    radial-gradient(720px 460px at -12% 0%, rgba(221, 96, 51, .07), transparent 58%);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  margin: 0; color: var(--ink-900);
  font-family: var(--font-display);
  letter-spacing: -.02em; line-height: 1.2;
}
p { margin: 0; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font: inherit; }
input, select, textarea, button { font-family: inherit; }

.muted { color: var(--ink-500); }
.small { font-size: 13px; }
.text-ok { color: var(--green-600) !important; }
.text-bad { color: var(--red-600) !important; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mobile-only { display: none; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--brand-900); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------- app shell ------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { flex: 1; padding: 28px clamp(16px, 3vw, 40px) 40px; max-width: 1500px; width: 100%; margin: 0 auto; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand { padding: 22px 20px 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 19px; color: #f2f8f4; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-name::after { content: ''; }
.brand-mark { display: inline-flex; filter: drop-shadow(0 6px 14px rgba(46, 158, 116, .45)); }
.sidebar-nav { padding: 8px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 16px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .11em; color: var(--sidebar-muted); font-weight: 700; font-family: var(--font-display); }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-weight: 500; transition: var(--transition);
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; color: var(--sidebar-muted); transition: var(--transition); }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item:hover i { color: var(--brand-300); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-active-text); font-weight: 600; }
.nav-item.active i { color: var(--brand-300); }
.nav-item.active::before { content: ''; position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 3px; background: var(--ember-500); }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; }
.user-chip-text strong { font-size: 14px; color: #f2f8f4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { color: var(--sidebar-muted); font-size: 12px; }
.sidebar-foot .btn-ghost { color: var(--sidebar-text); }
.sidebar-foot .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 3vw, 40px);
  background: rgba(243, 241, 234, .82); backdrop-filter: blur(12px);
  border-bottom: var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 20px; }
.topbar-title p { font-size: 13px; color: var(--ink-500); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: var(--border); background: var(--surface);
  color: var(--ink-600); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.icon-btn:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); text-decoration: none; }

.app-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 20px clamp(16px, 3vw, 40px); border-top: var(--border); color: var(--ink-400); font-size: 13px;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--ink-500); }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 42, 33, .5); z-index: 40; }

/* --------------------------------- cards --------------------------------- */
.card { background: var(--surface); border: var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: var(--border); }
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h3 i { color: var(--brand-600); }
.card-body { padding: 20px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; }
.page-greeting { font-size: 26px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px 20px; transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-200); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-brand { background: var(--brand-50); color: var(--brand-600); }
.stat-green { background: var(--green-50); color: var(--green-600); }
.stat-red { background: var(--red-50); color: var(--red-600); }
.stat-ember { background: var(--ember-50); color: var(--ember-600); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink-900); line-height: 1.1; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--ink-500); }

/* --------------------------------- lists --------------------------------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--ink-100); }
.list-item:last-child { border-bottom: none; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-title { font-weight: 600; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 13px; color: var(--ink-500); }
.list-icon { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--ink-100); font-size: 15px; }
.list-icon.ok { background: var(--green-50); color: var(--green-600); }
.list-icon.bad { background: var(--red-50); color: var(--red-600); }

/* --------------------------------- pills --------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-draft { background: var(--ink-100); color: var(--ink-600); }
.status-scheduled { background: var(--blue-50); color: var(--blue-600); }
.status-publishing { background: var(--amber-50); color: var(--amber-600); }
.status-published { background: var(--green-50); color: var(--green-600); }
.status-partial { background: var(--ember-50); color: var(--ember-600); }
.status-failed { background: var(--red-50); color: var(--red-600); }
.status-cancelled { background: var(--ink-100); color: var(--ink-400); }

/* -------------------------------- buttons -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; transition: var(--transition);
  background: var(--surface); color: var(--ink-700); white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-700); color: #fff; box-shadow: 0 6px 16px rgba(24, 100, 73, .26); }
.btn-primary:hover { background: var(--brand-800); box-shadow: 0 10px 24px rgba(24, 100, 73, .34); }
.btn-outline { border-color: var(--ink-300); color: var(--ink-700); background: var(--surface); }
.btn-outline:hover { border-color: var(--brand-400); color: var(--brand-700); background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--ink-600); border-color: transparent; }
.btn-ghost:hover { background: var(--ink-100); }
.sidebar .btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover { background: var(--red-600); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-block { width: 100%; }

.link-sm { font-size: 13px; font-weight: 600; }

/* --------------------------------- forms --------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-700); }
.label-row { display: flex; justify-content: space-between; align-items: center; }
.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--ink-300); border-radius: 10px;
  background: var(--surface); color: var(--ink-900); transition: var(--transition); font-size: 14px;
}
.input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(46, 158, 116, .16); }
.input.invalid { border-color: var(--red-500); }
.input-sm { padding: 7px 10px; font-size: 13px; }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.55; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2368766e' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.field-error { color: var(--red-600); font-size: 12.5px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 44px; }
.affix-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--ink-400); cursor: pointer; padding: 8px; border-radius: 8px; }
.affix-btn:hover { color: var(--brand-700); background: var(--brand-50); }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-700); cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--brand-600); }

.strength { display: flex; align-items: center; gap: 10px; }
.strength-bar { flex: 1; height: 6px; background: var(--ink-100); border-radius: 999px; overflow: hidden; }
.strength-bar i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
.strength-text { font-size: 12px; color: var(--ink-500); min-width: 64px; }

.segmented { display: flex; background: var(--ink-100); border-radius: 10px; padding: 4px; gap: 4px; }
.seg { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-500); cursor: pointer; transition: var(--transition); }
.seg input:checked + span { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 2px; }

.details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand-700); }
.details[open] summary { margin-bottom: 12px; }

/* -------------------------------- alerts --------------------------------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert-success { background: var(--green-50); color: var(--green-600); }
.alert-error { background: var(--red-50); color: var(--red-600); }
.alert-warning { background: var(--amber-50); color: var(--amber-600); }
.alert i { margin-top: 2px; }

/* ------------------------------- empty state ----------------------------- */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { width: 62px; height: 62px; border-radius: 18px; background: var(--brand-50); color: var(--brand-600); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px; }
.empty-state h3 { font-size: 17px; margin-bottom: 6px; }
.empty-state p { color: var(--ink-500); max-width: 380px; margin: 0 auto 18px; }
.empty-inline { display: flex; align-items: center; gap: 8px; padding: 22px; color: var(--ink-400); justify-content: center; background: var(--ink-50); border-radius: var(--radius); border: 1px dashed var(--ink-300); font-size: 14px; }

/* ------------------------------- toasts ---------------------------------- */
.toast-stack { position: fixed; right: 20px; top: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-lg); border-left: 4px solid var(--brand-500);
  font-size: 14px; animation: toast-in .28s cubic-bezier(.4, 0, .2, 1);
}
.toast span { flex: 1; }
.toast-success { border-left-color: var(--green-500); }
.toast-success > i { color: var(--green-500); }
.toast-error { border-left-color: var(--red-500); }
.toast-error > i { color: var(--red-500); }
.toast-warning { border-left-color: var(--amber-500); }
.toast-warning > i { color: var(--amber-500); }
.toast-close { border: none; background: transparent; color: var(--ink-400); cursor: pointer; padding: 2px; }
.toast-out { animation: toast-out .25s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(.96); } }

/* --------------------------------- modal --------------------------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 42, 33, .55); opacity: 0; transition: var(--transition); }
.modal.open .modal-backdrop { opacity: 1; }
.modal-panel { position: relative; background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(.98); opacity: 0; transition: var(--transition); }
.modal.open .modal-panel { transform: none; opacity: 1; }
.modal-lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: var(--border); }
.modal-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: var(--border); }

/* -------------------------------- media ---------------------------------- */
.upload-drop { border: 2px dashed var(--ink-300); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--ink-500); cursor: pointer; transition: var(--transition); margin-bottom: 16px; background: var(--ink-50); }
.upload-drop:hover { border-color: var(--brand-400); background: var(--brand-50); }
.upload-drop i { font-size: 26px; color: var(--brand-600); margin-bottom: 8px; display: block; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-tile { position: relative; border: 2px solid var(--ink-200); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--ink-50); aspect-ratio: 1; display: flex; flex-direction: column; transition: var(--transition); }
.media-tile:hover { border-color: var(--brand-400); }
.media-tile.selected { border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(46, 158, 116, .18); }
.media-tile input { position: absolute; opacity: 0; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; }
.media-video { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--ink-400); }
.media-name { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(15, 42, 33, .78); color: #fff; font-size: 11px; padding: 5px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-select { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-300); display: flex; align-items: center; justify-content: center; color: transparent; font-size: 11px; }
.media-tile.selected .media-select { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.media-selected { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--ink-100); border-radius: 999px; font-size: 13px; }
.chip-x { border: none; background: transparent; color: var(--ink-400); cursor: pointer; font-size: 16px; line-height: 1; }
.chip-x:hover { color: var(--red-500); }

/* ------------------------------- composer -------------------------------- */
.composer { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
.composer-main { display: flex; flex-direction: column; gap: 20px; }
.composer-side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 90px; }
.platform-picker { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.provider-row { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: var(--border); border-radius: var(--radius); transition: var(--transition); }
.provider-row.on { border-color: var(--brand-400); background: var(--brand-50); }
.provider-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.variants { display: flex; flex-direction: column; gap: 16px; }
.variant { border: var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--ink-50); }
.variant-head { display: flex; align-items: center; justify-content: space-between; }
.variant-provider { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.char-count { font-size: 12px; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--red-600); font-weight: 700; }
.variant-dest { margin: 0; }

/* -------------------------------- calendar ------------------------------- */
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-400); text-transform: uppercase; letter-spacing: .06em; padding: 8px 0; }
.calendar-cell { min-height: 112px; background: var(--surface); border: var(--border); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 5px; transition: var(--transition); }
.calendar-cell.other { background: var(--ink-50); opacity: .6; }
.calendar-cell.today { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(46, 158, 116, .14); }
.calendar-day { font-size: 12px; font-weight: 700; color: var(--ink-500); }
.calendar-event { font-size: 11px; padding: 3px 6px; border-radius: 6px; background: var(--brand-50); color: var(--brand-700); border-left: 3px solid var(--brand-500); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.draft { background: var(--ink-100); color: var(--ink-600); border-left-color: var(--ink-400); }
.calendar-event.published { background: var(--green-50); color: var(--green-600); border-left-color: var(--green-500); }
.calendar-event.failed { background: var(--red-50); color: var(--red-600); border-left-color: var(--red-500); }
.calendar-event.publishing { background: var(--amber-50); color: var(--amber-600); border-left-color: var(--amber-500); }
.calendar-cell.today .calendar-day { color: var(--brand-700); }

/* --------------------------------- tables -------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; padding: 12px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-400); border-bottom: var(--border); background: var(--ink-50); white-space: nowrap; font-family: var(--font-display); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
table.data tr:hover td { background: var(--brand-50); }
table.data .actions { display: flex; gap: 6px; justify-content: flex-end; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input { max-width: 280px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px 0 0; }
.pagination a, .pagination span { padding: 7px 12px; border-radius: 8px; border: var(--border); font-size: 13px; color: var(--ink-600); }
.pagination .active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.pagination .disabled { opacity: .45; pointer-events: none; }

/* ------------------------------ social cards ----------------------------- */
.connection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.connection-card { display: flex; flex-direction: column; gap: 14px; }
.connection-top { display: flex; align-items: center; gap: 12px; }
.connection-logo { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; background: var(--ink-100); }
.connection-name { font-weight: 700; font-family: var(--font-display); }
.dest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dest-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-600); }
.dest-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-500); }
.dest-dot.off { background: var(--ink-300); }

.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.provider-card { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; padding: 24px 18px; transition: var(--transition); }
.provider-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-200); }
.provider-card .connection-logo { width: 56px; height: 56px; font-size: 26px; }
.provider-card.disabled { opacity: .65; }

/* -------------------------------- billing -------------------------------- */
.billing-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.price-tag { font-size: 40px; font-weight: 800; color: var(--ink-900); font-family: var(--font-display); }
.price-tag small { font-size: 16px; color: var(--ink-500); font-weight: 500; }
.feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.feature-list li { display: flex; align-items: center; gap: 10px; }
.feature-list i { color: var(--brand-600); }

/* --------------------------------- admin --------------------------------- */
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 2px; }
.admin-tab { padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-500); white-space: nowrap; }
.admin-tab:hover { background: var(--ink-100); text-decoration: none; }
.admin-tab.active { background: var(--brand-50); color: var(--brand-700); }
.log-line { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.log-level { display: inline-block; width: 52px; font-weight: 700; text-transform: uppercase; font-size: 11px; }
.log-error { color: var(--red-600); }
.log-warn { color: var(--amber-600); }
.log-info { color: var(--ink-400); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-500); }
.kv dd { margin: 0; color: var(--ink-900); font-weight: 500; }

/* -------------------------------- auth ----------------------------------- */
.auth-body { background-color: var(--paper); min-height: 100vh; }
.auth-bg { position: fixed; inset: 0; z-index: -1; background:
  radial-gradient(1200px 620px at 8% -12%, rgba(46, 158, 116, .20), transparent 60%),
  radial-gradient(920px 520px at 112% 8%, rgba(221, 96, 51, .16), transparent 56%),
  radial-gradient(800px 500px at 50% 120%, rgba(24, 100, 73, .10), transparent 60%);
}
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 22px; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--ink-900); letter-spacing: -.02em; }
.auth-brand:hover { text-decoration: none; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 32px; display: flex; flex-direction: column; gap: 18px; animation: card-in .4s cubic-bezier(.4, 0, .2, 1); }
.auth-card h1 { font-size: 22px; }
.auth-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-50); color: var(--brand-600); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--ink-500); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.error-code { font-size: 72px; font-weight: 800; font-family: var(--font-display); color: var(--brand-700); line-height: 1; }
.error-title { font-size: 24px; }
.error-message { max-width: 420px; text-align: center; }
.error-actions { display: flex; gap: 10px; }

/* ------------------------------ account chips ---------------------------- */
.account-summary { display: flex; flex-wrap: wrap; gap: 12px; }
.account-chip { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border: var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 600; }
.account-chip strong { background: var(--brand-50); color: var(--brand-700); border-radius: 999px; padding: 1px 9px; font-size: 13px; }

/* ------------------------------ skeletons -------------------------------- */
.skeleton { background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-200) 37%, var(--ink-100) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ responsive ------------------------------- */
@media (max-width: 1200px) {
  .composer { grid-template-columns: 1fr; }
  .composer-side { position: static; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .billing-hero { grid-template-columns: 1fr; }
  .mobile-only { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-105%); transition: transform var(--transition); }
  .sidebar.open { transform: none; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-head h2, .page-greeting { font-size: 20px; }
  .auth-card { padding: 24px; }
  .toast-stack { left: 12px; right: 12px; max-width: none; }
  .calendar-cell { min-height: 84px; }
}

/* --------------------------- accessibility ------------------------------- */
:focus-visible { outline: 3px solid rgba(46, 158, 116, .55); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

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