:root{
  --black:#100f0e;
  --black-2:#171513;
  --black-3:#211d19;
  --paper:#f0dec0;
  --paper-2:#f7ebd8;
  --ink:#251e18;
  --muted:#786b5d;
  --red:#be3033;
  --red-dark:#962426;
  --line:rgba(83,60,39,.18);
  --cream:#f4eee3;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;min-height:100%;background:var(--black)}
body{font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--cream)}
button,input,textarea{font:inherit}
button{cursor:pointer}
.admin-kicker{margin:0;color:#d63a3d;font-size:10px;font-weight:800;letter-spacing:.19em;line-height:1.2}

/* LOGIN */
.login-screen{
  min-height:100vh;
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:42px 24px;
  overflow:hidden;
  background:
    radial-gradient(circle at 50% 20%,rgba(190,48,51,.08),transparent 28%),
    repeating-linear-gradient(115deg,rgba(255,255,255,.012) 0 1px,transparent 1px 5px),
    var(--black);
}
.login-screen:before{
  content:"";
  position:absolute;
  width:620px;height:620px;border:1px solid rgba(190,48,51,.12);border-radius:50%;
  top:50%;left:50%;transform:translate(-50%,-47%);
  box-shadow:0 0 0 80px rgba(190,48,51,.018),0 0 0 160px rgba(190,48,51,.012);
  pointer-events:none;
}
.login-brand{position:absolute;top:32px;left:40px;display:flex;align-items:center;gap:14px}
.login-brand img{width:104px;height:auto}
.login-brand span{font-family:Georgia,"Times New Roman",serif;font-size:12px;letter-spacing:.14em;color:#cfc4b7}
.login-card{
  position:relative;z-index:1;
  width:min(540px,100%);
  padding:52px 52px 46px;
  text-align:center;
  background:rgba(20,18,16,.92);
  border:1px solid rgba(211,174,122,.22);
  box-shadow:0 30px 80px rgba(0,0,0,.38);
}
.login-card:before{
  content:"";
  position:absolute;left:50%;top:0;transform:translate(-50%,-1px);
  width:84px;height:3px;background:var(--red);
}
.login-card h1{
  margin:15px 0 16px;
  font-family:Georgia,"Times New Roman",serif;
  font-size:clamp(42px,5vw,60px);
  line-height:.98;font-weight:500;letter-spacing:-.035em;
}
.login-copy{max-width:410px;margin:0 auto 30px;color:#b9ad9f;font-size:15px;line-height:1.65}
.microsoft-button{
  width:100%;min-height:54px;
  display:flex;align-items:center;justify-content:center;gap:13px;
  border:0;background:#f4eee3;color:#1d1a17;
  font-weight:750;font-size:14px;
  transition:transform .15s ease,background .15s ease;
}
.microsoft-button:hover{background:#fff;transform:translateY(-1px)}
.microsoft-button:focus-visible{outline:3px solid rgba(190,48,51,.55);outline-offset:3px}
.ms-mark{width:20px;height:20px;display:grid;grid-template-columns:1fr 1fr;gap:2px}
.ms-mark i{display:block}
.ms-mark i:nth-child(1){background:#f25022}.ms-mark i:nth-child(2){background:#7fba00}
.ms-mark i:nth-child(3){background:#00a4ef}.ms-mark i:nth-child(4){background:#ffb900}
.login-authorized{margin:18px 0 0;color:#766b60;font-size:11px;line-height:1.5}
.auth-status{min-height:20px;margin:13px 0 0;color:#e9b7b7;font-size:12px;line-height:1.45}
.public-journal-link{position:absolute;bottom:30px;color:#7f7468;text-decoration:none;font-size:12px}
.public-journal-link:hover{color:#c8bcae}

/* STUDIO LAYOUT */
.studio-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:270px minmax(0,1fr);
  background:var(--paper);
  color:var(--ink);
}
.studio-sidebar{
  position:sticky;top:0;height:100vh;overflow:auto;
  display:flex;flex-direction:column;
  padding:26px 20px 20px;
  background:var(--black);
  color:var(--cream);
  border-right:1px solid rgba(255,255,255,.06);
}
.sidebar-brand{display:flex;align-items:center;gap:12px;padding:0 4px 22px;border-bottom:1px solid rgba(255,255,255,.08)}
.sidebar-brand img{width:92px;height:auto}
.sidebar-brand div{display:grid}
.sidebar-brand span{font-size:9px;letter-spacing:.18em;color:#d13a3c}
.sidebar-brand strong{font-family:Georgia,serif;font-size:25px;font-weight:500}
.sidebar-user{display:flex;gap:11px;align-items:center;margin:20px 0}
.user-avatar{
  width:38px;height:38px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:#302722;color:#f3e8d8;
  font-family:Georgia,serif;font-size:14px;
}
.sidebar-user div:last-child{display:grid;min-width:0}
.sidebar-user span{font-size:9px;color:#7e7469;letter-spacing:.08em;text-transform:uppercase}
.sidebar-user strong{margin-top:3px;font-size:11px;font-weight:600;color:#cfc4b7;overflow:hidden;text-overflow:ellipsis}
.new-entry-button{
  width:100%;min-height:43px;border:0;background:var(--red);color:white;
  font-weight:750;font-size:12px;
}
.new-entry-button:hover{background:#ca383b}
.entry-list-header{display:flex;align-items:center;justify-content:space-between;margin:26px 2px 10px}
.entry-list-header span{font-size:9px;font-weight:800;letter-spacing:.17em;color:#746a61}
.entry-list-header button{border:0;background:transparent;color:#8b7f74;font-size:18px}
.admin-post-list{display:grid;gap:6px}
.admin-post-item{
  width:100%;padding:11px 12px;border:1px solid transparent;background:transparent;color:#d9cec1;text-align:left;
  border-radius:3px;
}
.admin-post-item:hover,.admin-post-item.active{background:#1e1b18;border-color:#332c26}
.admin-post-item strong{display:block;font-family:Georgia,serif;font-size:14px;font-weight:500;line-height:1.25}
.admin-post-item span{display:flex;justify-content:space-between;gap:8px;margin-top:6px;color:#776d64;font-size:9px;text-transform:uppercase;letter-spacing:.08em}
.post-status.published{color:#d15759}.post-status.unpublished{color:#b39d82}
.admin-empty{padding:12px;color:#746a61;font-size:11px;line-height:1.5}
.sidebar-bottom{margin-top:auto;padding-top:24px;display:flex;justify-content:space-between;align-items:center;border-top:1px solid rgba(255,255,255,.08)}
.sidebar-bottom a,.sidebar-bottom button{border:0;background:transparent;color:#81766b;text-decoration:none;font-size:10px;padding:0}
.sidebar-bottom a:hover,.sidebar-bottom button:hover{color:#d6c9bb}

/* WORKSPACE */
.studio-workspace{min-width:0;background:linear-gradient(180deg,#ead5b2 0,#f0dec0 160px,#f0dec0 100%);min-height:100vh}
.studio-topbar{
  position:sticky;top:0;z-index:10;
  min-height:92px;padding:18px clamp(24px,4vw,54px);
  display:flex;align-items:center;justify-content:space-between;gap:24px;
  background:rgba(240,222,192,.96);
  backdrop-filter:blur(16px);
  border-bottom:1px solid rgba(74,52,32,.14);
}
.studio-topbar h1{margin:5px 0 0;font-family:Georgia,serif;font-size:28px;font-weight:500}
.topbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.status-pill{padding:7px 10px;border-radius:999px;background:#dfcaa9;color:#6b5a49;font-size:9px;font-weight:800;letter-spacing:.1em;text-transform:uppercase}
.status-pill.published{background:#d9e2ce;color:#48603c}
.status-pill.unpublished{background:#ddd6cc;color:#655f58}
.button{min-height:39px;border:0;padding:0 14px;font-size:11px;font-weight:800}
.button.ghost{background:transparent;border:1px solid #9f8b70;color:#44392f}
.button.dark{background:#2b241e;color:#fff}
.button.publish{background:var(--red);color:#fff}
.button:hover{filter:brightness(1.06)}

.editor-canvas{max-width:1020px;margin:0 auto;padding:44px clamp(24px,4vw,54px) 90px;display:grid;gap:24px}
.editor-primary,.editor-section{
  background:rgba(255,249,239,.68);
  border:1px solid var(--line);
  box-shadow:0 10px 30px rgba(89,61,32,.05);
}
.editor-primary{padding:34px clamp(24px,4vw,44px) 40px}
.editor-primary label,.editor-section label{display:grid;gap:8px}
.editor-primary label>span,.editor-section label>span,.image-copy>span,.body-label>span{font-size:10px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:#755f49}
.field-title input{
  width:100%;border:0;border-bottom:1px solid #bba27f;background:transparent;padding:4px 0 14px;
  font-family:Georgia,serif;font-size:clamp(34px,4vw,50px);line-height:1.06;color:#261f19;outline:none;
}
.field-title input:focus{border-bottom-color:var(--red)}
.field-excerpt{margin-top:28px}
.field-excerpt textarea{
  border:0;background:transparent;padding:0;resize:vertical;outline:none;
  font-family:Georgia,serif;font-size:18px;line-height:1.55;color:#58493b;
}
.field-excerpt small,.editor-section small{font-size:10px;color:#8b7965}
.field-excerpt>small{text-align:right}
.body-field{margin-top:30px;padding-top:26px;border-top:1px solid var(--line)}
.body-label{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.body-label small{color:#8d7964;font-size:10px}
#body_markdown{
  width:100%;min-height:430px;border:0;background:#fffaf2;padding:22px;resize:vertical;outline:none;
  color:#2e261f;font:17px/1.75 Georgia,serif;
  box-shadow:inset 0 0 0 1px rgba(94,68,43,.16);
}
#body_markdown:focus{box-shadow:inset 0 0 0 2px rgba(190,48,51,.32)}

.editor-section{padding:30px clamp(24px,4vw,40px)}
.section-heading{margin-bottom:25px}
.section-heading h2,.advanced-section h2{margin:5px 0 0;font-family:Georgia,serif;font-size:28px;font-weight:500}
.details-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.editor-section input,.editor-section textarea{
  width:100%;border:1px solid #c7b08d;background:#fffaf2;padding:12px;color:#2d251e;outline:none;
}
.editor-section input:focus,.editor-section textarea:focus{border-color:#a67f55;box-shadow:0 0 0 2px rgba(166,127,85,.1)}
.image-panel{display:grid;grid-template-columns:1fr 230px;gap:24px;align-items:center;margin:26px 0}
.image-copy{display:grid;gap:8px}
.upload-button{
  width:max-content;margin-top:10px;padding:11px 15px!important;
  background:#2c241e;color:#fff!important;font-size:11px!important;letter-spacing:0!important;text-transform:none!important;cursor:pointer;
}
.upload-button input{display:none}
.image-preview{height:145px;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#dfcaaa;border:1px dashed #b69c78;color:#8b765e;font-size:10px}
.image-preview img{width:100%;height:100%;object-fit:cover}

.advanced-section{padding:0;overflow:hidden}
.advanced-section summary{list-style:none;cursor:pointer;padding:26px 40px;display:flex;justify-content:space-between;align-items:center}
.advanced-section summary::-webkit-details-marker{display:none}
.summary-arrow{font-size:26px;color:#8d7357;transition:transform .2s ease}
.advanced-section[open] .summary-arrow{transform:rotate(45deg)}
.advanced-content{display:grid;gap:18px;padding:0 40px 34px;border-top:1px solid var(--line)}
.advanced-content>label:first-child{margin-top:26px}
.slug-field{display:flex;align-items:center;border:1px solid #c7b08d;background:#fffaf2}
.slug-field>span{padding-left:12px;color:#8b7965;font-size:11px;white-space:nowrap}
.slug-field input{border:0!important;background:transparent!important;box-shadow:none!important;padding-left:3px!important}

/* PREVIEW DRAWER */
.preview-drawer{
  position:fixed;z-index:40;top:0;right:0;width:min(620px,94vw);height:100vh;overflow:auto;
  background:#12100f;color:#f2e9dc;box-shadow:-30px 0 70px rgba(0,0,0,.38);
}
.preview-toolbar{
  position:sticky;top:0;z-index:2;padding:22px 26px;display:flex;align-items:center;justify-content:space-between;
  background:#12100f;border-bottom:1px solid #302820;
}
.preview-toolbar strong{font-family:Georgia,serif;font-size:22px;font-weight:500}
.preview-toolbar button{border:0;background:transparent;color:#cbbeb0;font-size:30px}
.preview-paper{min-height:calc(100vh - 78px);padding:52px clamp(28px,6vw,62px);background:#ead8ba;color:#271f18}
.preview-paper h1{margin:8px 0 16px;font-family:Georgia,serif;font-size:48px;font-weight:500;line-height:1}
.preview-paper .post-excerpt{font-family:Georgia,serif;font-size:19px;line-height:1.55;color:#665443}
.preview-paper .post-body{margin-top:34px;font-family:Georgia,serif;font-size:17px;line-height:1.75}
.preview-paper .post-body h2{font-size:30px;margin-top:34px}.preview-paper .post-body h3{font-size:24px}
.preview-paper blockquote{margin:30px 0;padding-left:18px;border-left:3px solid var(--red);font-style:italic}

.studio-toast{
  position:fixed;z-index:60;right:24px;bottom:24px;max-width:360px;
  padding:13px 16px;background:#211c18;color:#eee2d4;border-left:3px solid var(--red);
  box-shadow:0 18px 35px rgba(0,0,0,.24);font-size:12px;
}

@media(max-width:980px){
  .studio-shell{grid-template-columns:220px minmax(0,1fr)}
  .studio-topbar{align-items:flex-start;flex-direction:column}
  .topbar-actions{justify-content:flex-start}
}
@media(max-width:720px){
  .login-brand{left:24px;top:24px}
  .login-card{padding:42px 26px}
  .studio-shell{display:block}
  .studio-sidebar{position:relative;height:auto;max-height:none}
  .admin-post-list{max-height:220px;overflow:auto}
  .studio-topbar{position:relative}
  .editor-canvas{padding:26px 18px 60px}
  .details-grid,.image-panel{grid-template-columns:1fr}
  .image-preview{height:190px}
  .advanced-section summary,.advanced-content{padding-left:24px;padding-right:24px}
  .slug-field{display:grid}
  .slug-field>span{padding:10px 12px 0;white-space:normal}
}
