/* Admin panel */
body.admin { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; background: var(--off-white); }
.admin-side { background: var(--black); color: #fff; padding: 28px 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.admin-brand { display: block; padding: 0 24px 24px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.04em; border-bottom: 1px solid rgba(255,255,255,.12); }
.admin-brand span { color: var(--gold); letter-spacing: 0.2em; margin-right: 8px; }
.admin-side nav { display: flex; flex-direction: column; padding: 16px 0; }
.admin-side nav a { padding: 10px 24px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,.75); border-left: 3px solid transparent; }
.admin-side nav a:hover { color: #fff; }
.admin-side nav a.active { color: var(--gold); border-left-color: var(--gold); }
.admin-side nav a.sub { padding-left: 40px; font-size: 12px; color: var(--gold); text-transform: none; letter-spacing: 0.06em; }
.admin-side-bottom { margin-top: auto; padding: 16px 24px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; display: flex; flex-direction: column; gap: 10px; }
.admin-side-bottom a { color: rgba(255,255,255,.75); }
.admin-side-bottom button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 8px; font: inherit; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; width: 100%; }
.admin-side-bottom button:hover { border-color: var(--gold); color: var(--gold); }

.admin-main { padding: 32px 40px 80px; max-width: 1300px; width: 100%; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-head h1 { font-size: 36px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-main .flash { margin: 0 0 20px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat { background: #fff; border: 1px solid var(--line); padding: 20px 22px; display: flex; flex-direction: column; border-top: 3px solid var(--black); transition: border-color .2s; }
.stat:hover { border-top-color: var(--gold); }
.stat-alert { border-top-color: var(--gold); }
.stat-n { font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1; }
.stat-l { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey); margin-top: 6px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); padding: 24px; margin-bottom: 20px; }
.panel h2 { font-size: 24px; margin-bottom: 14px; }
.panel h3 { font-size: 20px; margin-bottom: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; }
.list li:last-child { border-bottom: 0; }
.list li > a:first-child { font-weight: 500; }
.list .quote { width: 100%; margin: 4px 0; color: var(--ink); white-space: pre-line; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { display: inline; }
.more { display: inline-block; margin-top: 12px; color: var(--gold-dark); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }

.pill { display: inline-block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; padding: 3px 8px; border: 1px solid; margin-left: 6px; vertical-align: middle; }
.pill-published { color: #2a6b3c; border-color: #b6dcc3; background: #eef8f1; }
.pill-draft { color: var(--grey); border-color: var(--line); background: var(--off-white); }
.pill-gold { color: var(--gold-dark); border-color: var(--gold); background: var(--gold-light); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--grey); }
.tabs a.active, .tabs a:hover { color: var(--black); border-bottom-color: var(--gold); }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-size: 15px; }
.table th { text-align: left; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey); padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 500; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.row-title { font-weight: 500; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.row-actions form { display: inline; }

.comment-admin-list li { flex-direction: column; align-items: stretch; }
.comment-admin-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }

/* forms */
.stack label, .editor-side label:not(.check):not(.file-label) { display: block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 14px; }
.stack input, .editor-side input[type=text], .editor-side select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-size: 15px; text-transform: none; letter-spacing: 0; border: 1px solid var(--line); background: #fff; outline: none;
}
.stack input:focus, .editor-side input:focus, .editor-side select:focus, .title-input:focus, .excerpt-input:focus { border-color: var(--gold); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 10px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
.small { font-size: 13px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; }
.kv dt { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey); }
.kv dd { margin: 0; }
code { background: var(--off-white); padding: 1px 5px; font-size: 0.9em; }

/* editor */
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.editor-main { background: #fff; border: 1px solid var(--line); }
.title-input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 22px 24px; font-family: var(--serif); font-size: 34px; font-weight: 600; outline: none; }
.excerpt-input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 14px 24px; font: inherit; font-size: 16px; color: var(--grey); resize: vertical; outline: none; }
#editor { min-height: 480px; font-family: var(--sans); font-size: 17px; }
.ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); background: var(--off-white); position: sticky; top: 0; z-index: 5; }
.ql-container.ql-snow { border: 0; }
.ql-editor { padding: 24px; line-height: 1.7; }
.ql-editor h2 { font-family: var(--serif); font-size: 30px; }
.ql-editor h3 { font-family: var(--serif); font-size: 24px; }
.ql-editor blockquote { border-left: 2px solid var(--gold); font-family: var(--serif); font-size: 22px; font-style: italic; }
.ql-editor img { max-width: 100%; }
.ql-snow .ql-picker-label:hover, .ql-snow .ql-picker-label.ql-active, .ql-snow.ql-toolbar button:hover, .ql-snow.ql-toolbar button.ql-active { color: var(--gold-dark); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke, .ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--gold-dark); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--gold-dark); }

.cover-preview { aspect-ratio: 4/3; background: var(--off-white); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; overflow: hidden; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-label input { display: none; }
.file-label .btn { display: inline-block; }
.danger-zone { border-color: #eed7d4; }

/* login */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--off-white); }
.login-card { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--gold); padding: 44px 40px; width: 100%; max-width: 400px; text-align: center; }
.login-card h1 { font-size: 32px; margin: 12px 0 4px; }
.login-card label { display: block; text-align: left; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; margin: 18px 0 0; }
.login-card input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-size: 16px; border: 1px solid var(--line); outline: none; }
.login-card input:focus { border-color: var(--gold); }
.login-card .btn { width: 100%; margin-top: 24px; }
.login-card .flash { margin: 16px 0 0; text-align: left; }
.login-card .back { display: inline-block; margin-top: 20px; font-size: 13px; color: var(--grey); }

@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 0; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; padding: 0; }
  .admin-side nav a { padding: 8px 12px; border-left: 0; }
  .admin-brand { border: 0; padding: 8px 20px; }
  .admin-side-bottom { margin: 0; padding: 0 20px; flex-direction: row; border: 0; }
  .admin-main { padding: 20px; }
  .stats, .two-col, .editor-grid { grid-template-columns: 1fr; }
  .title-input { font-size: 26px; }
}
