@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');

:root {
  color-scheme: dark;
  --bg: #090908;
  --surface: #111110;
  --surface-2: #171715;
  --surface-3: #1f1e1b;
  --ink: #f5f1e9;
  --muted: #9f9a90;
  --faint: #68645e;
  --line: #2b2925;
  --line-bright: #45413b;
  --red: #e52231;
  --red-bright: #ff4350;
  --red-dark: #7a1119;
  --gold: #d2a94c;
  --green: #49bc7d;
  --blue: #5da5e8;
  --radius: 12px;
  --sans: "Manrope", system-ui, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --mono: "DM Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--sans); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.noise {
  position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.eyebrow { margin: 0 0 8px; color: var(--red-bright); font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.wordmark { font-size: 18px; font-weight: 800; letter-spacing: -.035em; }
.wordmark span { color: var(--red-bright); letter-spacing: -.06em; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; overflow: hidden; }
.auth-shell::before { content: "SNS"; position: fixed; left: 50%; top: 49%; transform: translate(-50%,-50%); color: transparent; -webkit-text-stroke: 1px #1d1b18; font: 800 min(47vw,680px)/.8 var(--sans); letter-spacing: -.12em; z-index: -1; }
.auth-shell::after { content: ""; position: fixed; width: 540px; height: 540px; border-radius: 50%; background: rgba(229,34,49,.12); filter: blur(160px); left: calc(50% - 270px); top: calc(50% - 270px); z-index: -1; }
.login-card { width: min(100%, 500px); background: rgba(17,17,16,.93); border: 1px solid var(--line-bright); border-radius: 18px; padding: 38px; box-shadow: 0 34px 100px #000; backdrop-filter: blur(20px); }
.login-card .wordmark { margin-bottom: 62px; }
.login-card h1 { margin: 0; font: italic 700 47px/.98 var(--serif); letter-spacing: -.045em; }
.login-copy { margin: 20px 0 32px; color: var(--muted); line-height: 1.65; }
.login-form { display: grid; gap: 16px; }
.login-form label:not(.remember), .field { display: grid; gap: 8px; color: #c9c4ba; font: 600 12px/1.2 var(--sans); letter-spacing: .02em; }
.remember { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.access-note { margin: 20px 0 0; color: var(--faint); font: 400 10px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.form-error { margin: 0; color: #ff7b84; font-size: 13px; }

input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #0b0b0a; color: var(--ink); outline: 0; transition: border-color .16s, box-shadow .16s, background .16s;
}
input, select { min-height: 43px; padding: 0 12px; }
textarea { resize: vertical; padding: 12px; line-height: 1.55; }
input:hover, textarea:hover, select:hover { border-color: var(--line-bright); }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229,34,49,.12); background: #0e0e0d; }
input:disabled, textarea:disabled, select:disabled { opacity: .62; cursor: not-allowed; }
input[type="checkbox"] { appearance: none; width: 17px; min-height: 17px; height: 17px; padding: 0; border-radius: 4px; flex: 0 0 auto; }
input[type="checkbox"]:checked { background: var(--red); border-color: var(--red); box-shadow: inset 0 0 0 3px #161514; }

.button { display: inline-flex; min-height: 41px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 0 16px; cursor: pointer; text-decoration: none; font-size: 12px; font-weight: 800; letter-spacing: .015em; transition: transform .12s, background .12s, border-color .12s, opacity .12s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button-primary { background: var(--red); color: #fff; box-shadow: 0 7px 24px rgba(229,34,49,.2); }
.button-primary:hover:not(:disabled) { background: var(--red-bright); }
.button-secondary { background: var(--surface-2); border-color: var(--line-bright); color: var(--ink); }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { background: var(--surface-3); border-color: #5a554d; }
.button-danger { border-color: #612027; background: transparent; color: #ff7880; }
.button-danger:hover:not(:disabled) { background: #351418; }
.button-quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.button-wide { width: 100%; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 11px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: pointer; font-size: 20px; }
.icon-button:hover { background: var(--surface-3); border-color: var(--line-bright); }
.text-button { padding: 0; border: 0; background: transparent; color: var(--red-bright); cursor: pointer; font: 500 10px/1 var(--mono); text-transform: uppercase; }

.desk { min-height: 100vh; }
.topbar { height: 64px; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(9,9,8,.93); backdrop-filter: blur(18px); }
.brand-lockup, .topbar-actions { display: flex; align-items: center; gap: 14px; }
.environment { border-left: 1px solid var(--line-bright); padding-left: 14px; color: var(--faint); font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.health { color: var(--muted); font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.health i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.health.ready i { background: var(--green); box-shadow: 0 0 10px var(--green); }
.current-user { color: var(--muted); font-size: 12px; }

.desk-grid { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 300px minmax(0,1fr); }
.rail { position: sticky; top: 64px; height: calc(100vh - 64px); border-right: 1px solid var(--line); background: #0d0d0c; padding: 24px 16px 20px; overflow: hidden; display: flex; flex-direction: column; }
.rail-heading { display: flex; align-items: start; justify-content: space-between; padding: 0 4px; }
.rail h2, .calendar-header h2, .queue-header h2 { margin: 0; font: 700 28px/1 var(--serif); letter-spacing: -.035em; }
.search-field { margin-top: 22px; }
.search-field input { min-height: 38px; background: #090908; font-size: 12px; }
.status-filters { display: grid; grid-template-columns: repeat(4,1fr); gap: 3px; margin: 14px 0; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.filter { min-width: 0; border: 0; border-radius: 5px; background: transparent; color: var(--faint); padding: 8px 3px; cursor: pointer; font-size: 9px; font-weight: 700; }
.filter b { display: block; margin-top: 4px; color: inherit; font: 500 9px/1 var(--mono); }
.filter.active { background: var(--surface-3); color: var(--ink); }
.article-list { overflow: auto; margin: 0 -8px; padding: 0 8px 20px; scrollbar-width: thin; scrollbar-color: var(--line-bright) transparent; }
.article-card { width: 100%; display: block; position: relative; border: 0; border-bottom: 1px solid #201f1c; background: transparent; color: inherit; text-align: left; padding: 16px 10px 16px 13px; cursor: pointer; }
.article-card::before { content: ""; position: absolute; inset: 10px auto 10px 0; width: 2px; background: transparent; border-radius: 4px; }
.article-card:hover { background: #121210; }
.article-card.active { background: #171613; }
.article-card.active::before { background: var(--red); }
.article-card-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--faint); font: 500 9px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.article-card h3 { margin: 0; font-size: 13px; line-height: 1.42; letter-spacing: -.012em; }
.article-card p { margin: 8px 0 0; color: var(--faint); font-size: 10px; }
.list-empty { color: var(--faint); padding: 36px 10px; font-size: 12px; line-height: 1.6; text-align: center; }

.workspace { min-width: 0; background: var(--bg); }
.view-tabs { height: 53px; display: flex; align-items: stretch; gap: 24px; padding: 0 32px; border-bottom: 1px solid var(--line); }
.view-tab { position: relative; border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 0; font: 700 11px/1 var(--sans); }
.view-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.view-tab.active { color: var(--ink); }
.view-tab.active::after { background: var(--red); }
.view-panel { padding: 30px 32px 70px; }
.empty-state { min-height: calc(100vh - 230px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-number { color: #201e1a; font: 700 120px/.8 var(--serif); }
.empty-state h2 { margin: -15px 0 8px; font: italic 700 30px/1.15 var(--serif); }
.empty-state p { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.editor-header { min-height: 78px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); padding-bottom: 24px; }
.editor-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.editor-title-line h2 { margin: 0; max-width: 750px; font: 700 28px/1.1 var(--serif); letter-spacing: -.035em; }
.editor-meta { margin: 8px 0 0; color: var(--faint); font: 400 10px/1.4 var(--mono); }
.editor-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.status-pill { display: inline-flex; align-items: center; min-height: 22px; border-radius: 99px; padding: 0 8px; font: 500 9px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--line-bright); color: var(--muted); }
.status-scheduled { color: #efc86b; border-color: #69552a; background: #241d0d; }
.status-publishing { color: #84bffc; border-color: #27537d; background: #102337; }
.status-published { color: #7ee0a7; border-color: #28633f; background: #10291a; }
.status-failed { color: #ff858d; border-color: #682d32; background: #2b1215; }
.status-archived { opacity: .65; }
.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 36px; padding-top: 28px; }
.article-form { display: grid; gap: 20px; min-width: 0; }
.field > span { display: flex; align-items: center; justify-content: space-between; }
.field em { color: var(--faint); font: 400 9px/1 var(--mono); text-transform: uppercase; }
.field-title input { min-height: 54px; font: 600 18px/1.2 var(--sans); }
.field-row { display: grid; grid-template-columns: minmax(0,2fr) minmax(150px,1fr); gap: 14px; }
.slug-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: #0b0b0a; overflow: hidden; }
.slug-input:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229,34,49,.12); }
.slug-input input { min-width: 60px; border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 0 4px; }
.slug-input small { color: var(--faint); font: 400 10px/1 var(--mono); }
.slug-input small:first-child { padding-left: 11px; }
.slug-input small:last-child { padding-right: 11px; }
.counter { margin-top: -24px; padding: 0 10px 9px 0; pointer-events: none; text-align: right; color: var(--faint); font: 400 9px/1 var(--mono); }
.body-field textarea { min-height: 520px; font: 400 13px/1.75 var(--mono); tab-size: 2; }
.publish-panel { border-left: 1px solid var(--line); padding-left: 26px; }
.panel-section { padding: 0 0 24px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.panel-section h3 { margin: 0 0 17px; font: 700 18px/1.1 var(--serif); }
.timezone-note, .channel-note { margin: 8px 0 0; color: var(--faint); font-size: 10px; line-height: 1.5; }
.section-heading { display: flex; align-items: start; justify-content: space-between; }
.channel-list { display: grid; gap: 8px; }
.channel-option { display: grid; grid-template-columns: 17px 1fr auto; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #0d0d0c; cursor: pointer; }
.channel-option:hover { border-color: var(--line-bright); }
.channel-option strong { font-size: 11px; }
.channel-mode { color: var(--faint); font: 500 8px/1 var(--mono); text-transform: uppercase; }
.channel-mode.auto { color: var(--green); }
.publish-actions { display: grid; gap: 9px; border-bottom: 0; }
.distribution-results h3 { margin-bottom: 12px; }
.distribution-job { padding: 10px 0; border-top: 1px solid var(--line); }
.distribution-job:first-of-type { border-top: 0; }
.distribution-job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; }
.distribution-job small { color: var(--faint); font: 400 8px/1 var(--mono); text-transform: uppercase; }
.distribution-job p { margin: 8px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.distribution-job-actions { display: flex; gap: 12px; }
.distribution-job button, .distribution-job a { border: 0; padding: 0; background: none; color: var(--red-bright); cursor: pointer; font: 500 9px/1 var(--mono); text-decoration: none; text-transform: uppercase; }

.calendar-header, .queue-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.calendar-actions { display: flex; align-items: center; gap: 8px; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.calendar-weekdays { border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface); }
.calendar-weekdays span { padding: 10px 12px; color: var(--faint); font: 500 9px/1 var(--mono); text-transform: uppercase; }
.calendar-grid { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.calendar-day { min-height: 132px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px; background: #0b0b0a; }
.calendar-day.outside { background: #090908; color: #494641; }
.calendar-day.today { box-shadow: inset 0 0 0 1px var(--red); }
.day-number { display: block; margin-bottom: 9px; font: 500 10px/1 var(--mono); }
.calendar-item { width: 100%; display: block; border: 0; border-left: 2px solid var(--gold); border-radius: 3px; margin: 5px 0; padding: 6px 7px; background: #211c10; color: #ddd5c4; cursor: pointer; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 9px; }
.calendar-item.published { border-color: var(--green); background: #102319; }
.calendar-item.failed { border-color: var(--red); background: #291316; }
.calendar-item:hover { filter: brightness(1.25); }
.queue-header > p { max-width: 300px; margin: 0; color: var(--faint); font-size: 11px; text-align: right; }
.queue-list { border-top: 1px solid var(--line); }
.queue-row { display: grid; grid-template-columns: 130px minmax(0,1fr) 180px 90px; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); padding: 17px 8px; }
.queue-time { color: #d5cec3; font: 500 10px/1.5 var(--mono); }
.queue-copy h3 { margin: 0; font-size: 13px; }
.queue-copy p { margin: 5px 0 0; color: var(--faint); font-size: 10px; }
.queue-channels { display: flex; flex-wrap: wrap; gap: 5px; }
.channel-chip { border: 1px solid var(--line); border-radius: 99px; padding: 4px 6px; color: var(--muted); font: 500 8px/1 var(--mono); text-transform: uppercase; }

.preview-dialog { width: min(920px,calc(100% - 32px)); height: min(900px,calc(100vh - 40px)); padding: 0; border: 1px solid var(--line-bright); border-radius: 14px; background: #0b0b0a; color: var(--ink); box-shadow: 0 40px 100px #000; }
.preview-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(6px); }
.preview-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(11,11,10,.94); color: var(--faint); font: 500 10px/1 var(--mono); text-transform: uppercase; }
.article-preview { width: min(720px,calc(100% - 40px)); margin: 0 auto; padding: 70px 0 100px; }
.article-preview h1 { margin: 14px 0 22px; font: italic 700 clamp(38px,7vw,65px)/1 var(--serif); letter-spacing: -.045em; }
.preview-summary { margin: 0 0 20px; color: #cec7bc; font-size: 20px; line-height: 1.5; }
.preview-byline { border-bottom: 1px solid var(--line); margin: 0 0 34px; padding-bottom: 24px; color: var(--faint); font: 400 10px/1.4 var(--mono); text-transform: uppercase; }
.article-preview figure { margin: 0 0 35px; }
.article-preview img { display: block; width: 100%; max-height: 450px; border-radius: 10px; object-fit: cover; }
.preview-body { font: 17px/1.75 Georgia,serif; }
.preview-body h1, .preview-body h2, .preview-body h3 { margin: 1.8em 0 .6em; font-family: var(--sans); line-height: 1.12; }
.preview-body h2 { font-size: 29px; }
.preview-body p { margin: 0 0 1.35em; }
.preview-body blockquote { border-left: 3px solid var(--red); margin: 2em 0; padding-left: 1.2em; color: #cbc5ba; }
.preview-body code { border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); padding: .1em .3em; font-size: .85em; }
.preview-body a { color: var(--red-bright); }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; width: min(370px,calc(100% - 36px)); }
.toast { border: 1px solid var(--line-bright); border-left: 3px solid var(--green); border-radius: 8px; background: #171715; box-shadow: 0 12px 42px #000; padding: 13px 14px; color: #ddd8cf; font-size: 12px; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) {
  .desk-grid { grid-template-columns: 250px minmax(0,1fr); }
  .editor-layout { grid-template-columns: minmax(0,1fr); }
  .publish-panel { border-left: 0; border-top: 1px solid var(--line); padding: 26px 0 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
  .panel-section { min-width: 0; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 62px; padding: 12px 16px; }
  .health, .current-user, .environment { display: none; }
  .desk-grid { display: block; }
  .rail { position: static; width: 100%; height: auto; max-height: 330px; border-right: 0; border-bottom: 1px solid var(--line); }
  .article-list { max-height: 180px; }
  .view-tabs { padding: 0 18px; overflow-x: auto; }
  .view-panel { padding: 24px 18px 50px; }
  .editor-header, .calendar-header, .queue-header { align-items: flex-start; flex-direction: column; }
  .editor-actions { width: 100%; }
  .editor-actions .button { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
  .publish-panel { grid-template-columns: 1fr; }
  .calendar-weekdays span { padding: 8px 3px; text-align: center; font-size: 8px; }
  .calendar-day { min-height: 82px; padding: 5px; }
  .calendar-item { padding: 4px; font-size: 0; height: 11px; }
  .queue-row { grid-template-columns: 90px minmax(0,1fr); }
  .queue-channels, .queue-row > .status-pill { grid-column: 2; }
  .login-card { padding: 28px 22px; }
  .login-card h1 { font-size: 39px; }
}
