:root {
    --bg: #efeae1;
    --paper: #fbf8f2;
    --ink: #221e1a;
    --muted: #6f675e;
    --line: #e3d9cc;
    --accent: #d4532b;
    --good: #1d6b45;
    --side: #221e1a;
    --shadow: 0 16px 40px rgba(34, 30, 26, 0.06);
    --serif: "Fraunces", Georgia, serif;
    --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px;
    flex: none;
    background: var(--side);
    color: #f4efe6;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    margin-bottom: 32px;
}
.brand strong { display: block; font-size: 18px; letter-spacing: -0.02em; }
.brand small { color: #c8bfb2; }
.mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #f4efe6;
    color: var(--side);
    font-family: var(--serif);
    font-weight: 640;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 10px;
    color: #e7e0d6;
}
.nav a.active, .nav a:hover { background: rgba(255, 250, 244, 0.08); color: white; }
.side-foot { margin-top: auto; display: grid; gap: 8px; }
.who { margin: 4px 0 0; color: #c8bfb2; font-size: 14px; }
.main { flex: 1; min-width: 0; }
.wrap { max-width: 1080px; padding: 36px 40px 80px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; margin: 0; }
h1 { font-size: 44px; line-height: 1.05; }
h2 { font-size: 28px; margin-bottom: 12px; }
h3 { font-size: 22px; }
.kicker {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}
.kicker a { color: inherit; text-decoration: none; }
.lede { font-size: 18px; color: var(--muted); max-width: 46rem; }
.wrap section { margin-top: 28px; }
.page-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 28px;
}
.hint { color: var(--muted); font-size: 14px; margin: 8px 0; }
.hint.good { color: var(--good); }
.meta { color: var(--muted); font-size: 14px; }

.btn {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 12px;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background: var(--ink); color: #fbf8f2; }
.btn-light { background: #f4efe6; color: var(--ink); }
.btn-ghost { border-color: var(--line); background: var(--paper); }
.btn-quiet { color: #c8bfb2; padding-inline: 0; }
.btn-approve { background: var(--good); color: white; }
.btn-danger { color: #9d2c2c; padding-inline: 0; }
.btn-facebook { background: #1877f2; color: #fff; }
.btn-facebook:hover { background: #166fe0; }
.btn-small { padding: 7px 10px; font-size: 14px; }
.btn:disabled, .is-busy { opacity: 0.6; pointer-events: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-actions.minor { margin-top: 8px; }

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: #eef3f8;
}
.flash-ok { background: #e5f2ea; }
.flash-err { background: #fdecec; }
.flash-info { background: #fff4e0; }

.hero { max-width: 720px; }
.steps { padding-left: 18px; color: var(--muted); }
.steps li { margin: 8px 0; }
.steps strong { color: var(--ink); }
.steps pre { margin: 8px 0 0; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}
.stats article {
    background: var(--paper);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}
.stats span {
    display: block;
    font-family: var(--serif);
    font-size: 36px;
    line-height: 1;
    margin-bottom: 6px;
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 32px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queue a {
    display: flex;
    gap: 10px;
    text-decoration: none;
    background: var(--paper);
    border-radius: 12px;
    padding: 10px 12px;
}
.fb-pages { margin-top: 8px; }
.fb-pages form { margin: 0; }
.fb-choice {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    text-align: left;
    background: var(--paper);
    border: 0;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.fb-choice strong { display: block; }
.fb-choice em { display: block; color: var(--muted); font-style: normal; font-size: 14px; margin-top: 2px; }
.fb-choice .btn { pointer-events: none; }
.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.user-list li {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 12px;
    align-items: center;
    background: var(--paper);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow);
}
.user-name em {
    display: block;
    color: var(--muted);
    font-style: normal;
    font-size: 13px;
}
.user-pass { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.user-pass input {
    flex: 1;
    min-width: 120px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 8px 10px;
}
.queue i, .page-card i {
    width: 12px;
    height: 12px;
    border-radius: 99px;
    flex: none;
    display: inline-block;
    margin-top: 6px;
}
.logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    background: #fff;
    flex: none;
    border: 1px solid var(--line);
}
.logo-lg { width: 88px; height: 88px; }
.brand-title { display: flex; gap: 16px; align-items: center; }
.brand-title .logo { width: 72px; height: 72px; }
.queue strong, .queue em { display: block; font-style: normal; }
.queue em { color: var(--muted); font-size: 13px; }
.empty, .empty-block {
    color: var(--muted);
    background: var(--paper);
    border-radius: 16px;
    padding: 18px;
}
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.page-card {
    background: var(--paper);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 8px;
}
a.page-card { color: inherit; text-decoration: none; }
.brand-card { border-top: 8px solid var(--p, var(--accent)); }
.brand-card:hover { transform: translateY(-1px); }
.page-card header { display: flex; gap: 10px; }
.page-card header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.stack { display: grid; gap: 16px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 14px; font-weight: 600; }
.field input, .field textarea, .field select {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: 12px;
    padding: 10px 12px;
}
.field textarea { resize: vertical; }
.color { height: 46px; padding: 6px; }
.slots {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    background: var(--paper);
}
.slots legend { padding: 0 6px; font-weight: 600; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    background: #fff;
}
.time-field { max-width: 180px; margin-top: 12px; }
.check { display: flex; gap: 8px; align-items: center; }
.help { color: var(--muted); }
.note {
    background: var(--paper);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.tablist {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.tablist button {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
}
.tablist button[aria-selected="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: #fbf8f2;
}
.settings-panel {
    background: var(--paper);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
}
.settings-panel[hidden],
[data-panel][hidden],
[data-settings-save][hidden] { display: none; }
.settings-panel .hint:first-child { margin-top: 0; }
.settings-panel > .btn { justify-self: start; }
.settings-panel pre,
.slots pre,
.note pre {
    white-space: pre-wrap;
    background: #221e1a;
    color: #f4efe6;
    border-radius: 12px;
    padding: 12px;
    overflow: auto;
}
.date-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    list-style: none;
}
.date-list li {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 13px;
}
.dropzone {
    position: relative;
    display: grid;
    gap: 4px;
    justify-items: center;
    text-align: center;
    border: 1.5px dashed var(--line);
    border-radius: 16px;
    background: var(--paper);
    padding: 28px 16px;
    cursor: pointer;
}
.dropzone strong { font-weight: 600; }
.dropzone em { color: var(--muted); font-style: normal; font-size: 14px; }
.dropzone.is-over {
    border-color: var(--accent);
    background: #fff;
}
.dropzone:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.dropzone-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.picked-files, .resource-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.picked-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.picked-files[hidden] { display: none; }
.picked-files li {
    display: grid;
    gap: 6px;
    align-content: start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px;
    font-size: 13px;
}
.picked-files img, .picked-files .file-mark {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    background: #e7e1d6;
}
.picked-files .file-mark {
    display: grid;
    place-items: center;
    font-weight: 650;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.picked-files .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.picked-files .file-size { color: var(--muted); }
.file-remove {
    justify-self: start;
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
}
.file-remove:hover { color: var(--ink); }
.resource-files a {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 13px;
    text-decoration: none;
}
.resource-files { margin-top: 10px; }
.resource-files a.with-thumb {
    display: grid;
    gap: 6px;
    width: 140px;
    border-radius: 12px;
    padding: 8px;
}
.resource-files img {
    width: 124px;
    height: 124px;
    object-fit: cover;
    border-radius: 8px;
    background: #e7e1d6;
}
.brief {
    background: var(--paper);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.filters a {
    text-decoration: none;
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    font-size: 14px;
}
.filters a.on { background: var(--ink); color: #fbf8f2; border-color: var(--ink); }

.post {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    background: var(--paper);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    scroll-margin-top: 16px;
}
.post:target { box-shadow: 0 0 0 2px var(--accent); }
.post-skipped { opacity: 0.72; }
.post-visual img, .missing-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    background: #e7e1d6;
}
.missing-image { display: grid; place-items: center; color: var(--muted); }
.post-body { display: grid; gap: 10px; align-content: start; }
.post-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.caption-read { white-space: pre-wrap; margin: 0; }
.badge {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 4px 8px;
    background: #fff4e0;
}
.badge-scheduled, .badge-published { background: #e5f2ea; color: var(--good); }
.badge-waiting { background: #eef3f8; }
.badge-skipped { background: #eeeae4; color: var(--muted); }
.upload { display: flex; gap: 8px; align-items: center; }
.upload input { max-width: 180px; font-size: 13px; }

.cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.cal-dow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 4px; }
.cal-day {
    min-height: 110px;
    background: var(--paper);
    border-radius: 12px;
    padding: 8px;
}
.cal-day.is-out { background: transparent; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.num { font-family: var(--serif); font-size: 18px; }
.chip {
    display: block;
    margin-top: 6px;
    text-decoration: none;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--p) 18%, white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chip-draft { outline: 1px dashed color-mix(in srgb, var(--p) 50%, white); }

.bare {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: min(440px, 100%);
    background: var(--paper);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow);
}
.login-card:has(.policy) { width: min(680px, 100%); }
.policy h2 { font-size: 22px; margin: 28px 0 8px; }
.policy p, .policy li { margin: 0 0 10px; }
.policy ul { margin: 0 0 10px; padding-left: 1.2em; }

@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { width: auto; height: auto; position: relative; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .side-foot { margin-top: 16px; }
    .wrap { padding: 24px 16px 64px; }
    h1 { font-size: 34px; }
    .page-head, .split, .grid-2, .post, .stats, .user-list li { grid-template-columns: 1fr; display: grid; }
    .stats { grid-template-columns: 1fr 1fr; }
    .cal-day { min-height: 72px; }
}
