:root {
  --ink: #17231f;
  --muted: #68746f;
  --line: #e4e9e6;
  --soft: #f5f7f6;
  --paper: #ffffff;
  --sidebar: #10211b;
  --sidebar-soft: #1b342b;
  --accent: #4f8f73;
  --accent-dark: #32664f;
  --accent-soft: #e6f1ec;
  --warn: #b66a28;
  --danger: #b44f4f;
  --shadow: 0 10px 35px rgba(20, 45, 35, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--soft); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--soft); font-family: "DM Sans", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Manrope", sans-serif; letter-spacing: -0.025em; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; display: flex; flex-direction: column; background: var(--sidebar); color: #dce8e2; z-index: 30; }
.sidebar-head { height: 68px; padding: 0 18px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 9px; font: 700 18px "Manrope", sans-serif; }
.brand-glyph { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: white; font: 700 16px "Manrope"; }
.version { margin-left: auto; font-size: 10px; color: #789087; }
.workspace-block { padding: 18px 16px 12px; }
.eyebrow, .nav-section-label { display: block; color: #789087; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.eyebrow.accent { color: var(--accent); margin-bottom: 9px; }
.workspace-switcher { margin-top: 8px; display: flex; gap: 10px; align-items: center; padding: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); border-radius: 10px; }
.workspace-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; background: #345f4f; font-size: 12px; font-weight: 700; }
.workspace-switcher div { min-width: 0; display: grid; }
.workspace-switcher div span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; font-weight: 600; }
.workspace-switcher small { color: #779088; font-size: 10px; }
.sidebar-nav { padding: 5px 10px; overflow-y: auto; flex: 1; }
.nav-section-label { margin: 14px 10px 6px; }
.nav-link, .nav-details > summary { min-height: 39px; padding: 0 11px; display: flex; align-items: center; gap: 11px; border-radius: 8px; color: #aabdb5; font-size: 13px; font-weight: 500; list-style: none; }
.nav-details > summary::-webkit-details-marker { display:none; }
.nav-link:hover, .nav-details > summary:hover, .nav-link.active, .nav-details.active > summary { color: white; background: var(--sidebar-soft); }
.nav-icon { display: inline-grid; width: 18px; place-items: center; color: #7ca391; font-size: 16px; }
.nav-count { margin-left: auto; min-width: 19px; padding: 1px 6px; border-radius: 10px; color: #94aca2; background: rgba(255,255,255,.07); font-size: 10px; text-align: center; }
.nav-count.alert { color: white; background: var(--warn); }
.nav-submenu { padding: 5px 0 5px 24px; }
.nav-sublink { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 8px; border-radius: 7px; color: #91a79e; font-size: 12px; }
.nav-sublink:hover { background: rgba(255,255,255,.05); color: white; }
.platform-mark { display: inline-grid; place-items: center; width: 23px; height: 23px; flex: 0 0 23px; border-radius: 7px; color: white; background: #52615c; font-size: 10px; font-weight: 700; }
.platform-mark.x { background: #111; }
.platform-mark.linkedin { background: #0a66c2; }
.platform-mark.bluesky { background: #1684ff; }
.sidebar-user { min-height: 68px; padding: 12px 14px; display: flex; align-items: center; gap: 9px; border-top: 1px solid rgba(255,255,255,.08); }
.user-avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 32px; border-radius: 50%; background: #d7a16e; color: #31251a; font-size: 11px; font-weight: 700; }
.user-copy { min-width: 0; display: grid; flex: 1; }
.user-copy span, .user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy span { font-size: 12px; font-weight: 600; }
.user-copy small { color: #779088; font-size: 9px; }
.user-settings { color: #789087; }

.main { margin-left: 250px; min-height: 100vh; }
.topbar { height: 68px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.topbar > div { display: flex; align-items: center; gap: 10px; }
.page-title h1 { margin: 0; font-size: 16px; }
.page-content { max-width: 1380px; margin: 0 auto; padding: 30px 34px 60px; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.nav-toggle { position: fixed; opacity: 0; pointer-events: none; }
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 25px; }
.page-intro h1 { margin-bottom: 7px; font-size: clamp(26px, 3vw, 36px); }
.page-intro p { max-width: 670px; margin: 0; color: var(--muted); line-height: 1.55; }

.btn { min-height: 39px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font-size: 12px; font-weight: 700; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); border-color: #bfcac5; box-shadow: 0 4px 13px rgba(20,45,35,.08); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #efcccc; }
.btn.small { min-height: 31px; padding: 0 11px; font-size: 11px; }
.btn.google { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.card { background: white; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 1px 1px rgba(20,45,35,.02); }
.card-head { padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 15px; }
.card-body { padding: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { min-height: 120px; padding: 18px; display: flex; flex-direction: column; background: white; border: 1px solid var(--line); border-radius: 12px; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.stat-value { margin: 9px 0 2px; font: 700 30px "Manrope"; }
.stat-card small { margin-top: auto; color: #8a9691; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, .8fr); gap: 18px; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 20px; background: var(--soft); color: var(--muted); font-size: 10px; font-weight: 700; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #85918c; }
.status-badge.published, .status-badge.connected, .status-badge.approved { color: #317353; background: #e5f4eb; }
.status-badge.published .status-dot, .status-badge.connected .status-dot, .status-badge.approved .status-dot { background: #36a36c; }
.status-badge.failed, .status-badge.partially_failed, .status-badge.rejected, .status-badge.error { color: #a54646; background: #faeaea; }
.status-badge.failed .status-dot, .status-badge.partially_failed .status-dot, .status-badge.rejected .status-dot, .status-badge.error .status-dot { background: #c75d5d; }
.status-badge.scheduled, .status-badge.pending_approval { color: #8b5e22; background: #fff2dc; }
.status-badge.scheduled .status-dot, .status-badge.pending_approval .status-dot { background: #d49035; }
.platform-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; }

.post-list { display: grid; }
.post-row { padding: 15px 18px; display: grid; grid-template-columns: minmax(0, 1fr) 120px 120px; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.post-row:last-child { border-bottom: 0; }
.post-copy { min-width: 0; }
.post-copy p { margin: 0 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.post-copy small { color: var(--muted); }
.post-platforms { display: flex; gap: 5px; }
.post-platforms .platform-mark { width: 21px; height: 21px; flex-basis: 21px; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .65fr); gap: 20px; align-items: start; }
.form-card { padding: 22px; background: white; border: 1px solid var(--line); border-radius: 13px; }
.form-card h2 { margin-bottom: 15px; font-size: 15px; }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label, .field-label { color: #43514b; font-size: 11px; font-weight: 700; }
.input, input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"], select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #dce3df; border-radius: 9px; outline: none; color: var(--ink); background: white; transition: .15s; }
textarea { min-height: 190px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-help, .char-count { color: var(--muted); font-size: 10px; }
.char-count { text-align: right; }
.account-options { display: grid; gap: 8px; }
.account-option { padding: 10px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; }
.account-option input { width: auto; }
.account-option div { min-width: 0; display: grid; }
.account-option div span { font-size: 12px; font-weight: 600; }
.account-option small { color: var(--muted); }
.schedule-tabs { display: flex; padding: 3px; gap: 3px; background: var(--soft); border-radius: 9px; }
.schedule-tabs label { flex: 1; min-height: 32px; padding: 7px; border-radius: 7px; color: var(--muted); background: white; font-size: 11px; text-align: center; cursor: pointer; }
.schedule-tabs input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; }

.integration-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.integration-card { padding: 20px; background: white; border: 1px solid var(--line); border-radius: 13px; scroll-margin-top: 90px; }
.integration-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.integration-title { display: flex; align-items: center; gap: 10px; }
.integration-title h2 { margin: 0; font-size: 16px; }
.integration-card > p { margin: 14px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.connection-paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.connection-path { min-height: 125px; padding: 13px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; }
.connection-path h3 { margin: 0 0 5px; font-size: 12px; }
.connection-path p { color: var(--muted); font-size: 10px; line-height: 1.45; }
.connection-path .btn { margin-top: auto; }
.connected-accounts { margin-top: 14px; display: grid; gap: 8px; }
.connected-account { padding: 10px 12px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; }
.connected-account-copy { display: grid; flex: 1; }
.connected-account-copy span { font-size: 12px; font-weight: 600; }
.connected-account-copy small { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 12px; color: var(--muted); background: #fafbfa; text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; }

.calendar { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 13px; }
.calendar-head, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-head div { padding: 10px; color: var(--muted); background: #fafbfa; border-right: 1px solid var(--line); text-align: center; font-size: 10px; font-weight: 700; }
.calendar-day { min-height: 125px; padding: 8px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.calendar-day.muted { background: #fafbfa; color: #a7afac; }
.calendar-day-number { font-size: 11px; font-weight: 700; }
.calendar-post { margin-top: 6px; padding: 6px 7px; display: block; border-left: 3px solid var(--accent); border-radius: 5px; background: var(--accent-soft); font-size: 9px; line-height: 1.3; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.media-card { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 11px; }
.media-preview { height: 140px; display: grid; place-items: center; background: #edf1ef; color: var(--muted); overflow: hidden; }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-meta { padding: 10px; display: grid; }
.media-meta span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; font-weight: 600; }
.media-meta small { color: var(--muted); }
.dropzone { padding: 26px; border: 1px dashed #b8c6c0; border-radius: 10px; background: #fafcfa; text-align: center; }
.dropzone input { margin-top: 10px; }
.upload-preview-item { margin-top: 6px; color: var(--muted); font-size: 10px; }

.flash { margin-bottom: 16px; padding: 10px 13px; border-radius: 9px; color: #2e704f; background: #e6f4eb; font-size: 12px; }
.flash.error { color: #a24040; background: #faeaea; }
.empty-state { min-height: 310px; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: white; border: 1px solid var(--line); border-radius: 13px; }
.empty-state h1 { margin: 12px 0 6px; font-size: 18px; }
.empty-state p { max-width: 480px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-dark); font-size: 23px; }
.chart-wrap svg { display: block; width: 100%; height: auto; }

.public-shell { min-height: 100vh; background: white; }
.public-nav { max-width: 1180px; height: 76px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; }
.public-brand { color: var(--ink); }
.public-actions, .public-hero-actions { display: flex; gap: 9px; }
.public-hero { max-width: 920px; margin: 0 auto; padding: 110px 28px 100px; text-align: center; }
.public-hero h1 { max-width: 820px; margin: 12px auto 20px; font-size: clamp(42px, 7vw, 78px); line-height: 1.01; letter-spacing: -.06em; }
.public-hero p { max-width: 700px; margin: 0 auto 28px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.public-hero-actions { justify-content: center; margin-bottom: 25px; }
.public-hero small { color: #89948f; }
.public-features { max-width: 1120px; margin: 0 auto; padding: 0 28px 90px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.public-feature { padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; }
.feature-number { color: var(--accent); font: 700 11px ui-monospace, monospace; }
.public-feature h2 { margin: 30px 0 9px; font-size: 19px; }
.public-feature p { margin: 0; color: var(--muted); line-height: 1.55; }
.public-cta { max-width: 1120px; margin: 0 auto 70px; padding: 52px; display: flex; align-items: center; justify-content: space-between; gap: 30px; border-radius: 18px; color: white; background: var(--sidebar); }
.public-cta h2 { margin-bottom: 8px; font-size: 27px; }
.public-cta p { max-width: 700px; margin: 0; color: #9fb3aa; }
.public-footer { max-width: 1120px; margin: 0 auto; padding: 25px 28px 35px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); }
.public-footer span { font-weight: 700; }
.public-footer small { color: var(--muted); }

.auth-shell { min-height: 100vh; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: radial-gradient(circle at 50% 0, #e2eee8 0, #f6f8f7 43%); }
.auth-brand { display: flex; align-items: center; gap: 9px; font: 700 19px "Manrope"; }
.auth-card { width: min(420px, 100%); padding: 30px; background: white; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 5px; font-size: 22px; text-align: center; }
.auth-card > p { margin-bottom: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.auth-card form { display: grid; gap: 12px; }
.auth-card .btn.primary { width: 100%; }
.auth-card .btn.google { margin-bottom: 15px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 1px 0 14px; color: #9da7a3; font-size: 10px; }
.divider:before, .divider:after { content: ""; height: 1px; flex: 1; background: var(--line); }
.auth-foot { margin-top: 17px; color: var(--muted); font-size: 11px; text-align: center; }
.auth-foot a { color: var(--accent-dark); font-weight: 700; }

@media (max-width: 1000px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .form-grid { grid-template-columns: 1fr; }
  .connection-paths { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .main { margin-left: 0; }
  .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  .mobile-overlay { display: none; position: fixed; inset: 0; z-index: 29; background: rgba(5,15,11,.48); }
  .nav-toggle:checked ~ .mobile-overlay { display: block; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 18px; }
  .page-content { padding: 24px 17px 50px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .stats-grid, .integration-summary { grid-template-columns: 1fr; }
  .post-row { grid-template-columns: 1fr auto; }
  .post-row > :last-child { grid-column: 1 / -1; }
  .calendar { overflow-x: auto; }
  .calendar-head, .calendar-grid { min-width: 760px; }
  .public-nav { padding: 0 17px; }
  .public-hero { padding: 75px 18px 65px; }
  .public-features { grid-template-columns: 1fr; padding: 0 17px 55px; }
  .public-cta { margin: 0 17px 50px; padding: 30px; align-items: flex-start; flex-direction: column; }
  .public-footer { margin: 0 17px; padding-left: 0; padding-right: 0; flex-direction: column; gap: 7px; }
}
