[hidden] { display: none !important; }
:root { --bg:#eee9df; --panel:#fffdf9; --ink:#302d28; --muted:#7e776d; --line:#ddd5c9; --accent:#925b37; --accent-dark:#6f4125; --danger:#a54338; }
* { box-sizing: border-box; }
body { margin:0; min-height:100vh; background:var(--bg); color:var(--ink); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; }
button, input, textarea { font:inherit; }
button, .file-button { cursor:pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline:3px solid rgba(146,91,55,.22); outline-offset:2px; }
a { color:var(--accent-dark); }
button, .file-button, .top-actions a { border:1px solid var(--line); border-radius:7px; padding:9px 13px; background:var(--panel); color:var(--ink); text-decoration:none; }
button:hover, .file-button:hover { border-color:#bca78f; }
.primary { border-color:var(--accent); background:var(--accent); color:white; }
.primary:hover { border-color:var(--accent-dark); background:var(--accent-dark); }
.danger { color:var(--danger); border-color:#e2c4bf; }
.full { width:100%; }
.eyebrow { margin:0 0 5px; color:var(--accent); font-size:11px; letter-spacing:.14em; font-weight:700; }
.login-view { min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-card { width:min(100%,420px); padding:36px; border:1px solid rgba(121,96,66,.15); border-radius:14px; background:var(--panel); box-shadow:0 18px 60px rgba(68,51,34,.12); }
.login-card h1 { margin:0 0 10px; font-size:28px; }
.login-card > p:not(.eyebrow):not(.form-message) { color:var(--muted); line-height:1.7; }
.login-card a { display:block; margin-top:20px; text-align:center; font-size:14px; }
.form-message { min-height:22px; color:var(--danger); font-size:14px; }
label { display:block; margin:20px 0 8px; font-size:14px; font-weight:600; }
input, textarea { width:100%; border:1px solid var(--line); border-radius:7px; padding:11px 12px; background:#fff; color:var(--ink); }
input:focus, textarea:focus { border-color:#ac8869; }
textarea { resize:vertical; line-height:1.75; }
.admin-topbar { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:18px 26px; border-bottom:1px solid var(--line); background:rgba(255,253,249,.85); }
.admin-topbar h1 { margin:0; font-size:24px; }
.top-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.workspace { display:grid; grid-template-columns:320px minmax(0,1fr); min-height:calc(100vh - 85px); }
.sidebar { padding:24px 18px; border-right:1px solid var(--line); background:rgba(248,245,239,.7); }
.sidebar-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:18px; }
.sidebar-head h2 { margin:0; font-size:17px; }
.page-list { display:grid; gap:8px; }
.page-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:5px; align-items:center; border:1px solid transparent; border-radius:8px; }
.page-row.active { border-color:#ccb69e; background:#f3eadd; }
.page-select { display:grid; grid-template-columns:28px minmax(0,1fr); gap:7px; width:100%; padding:11px 8px; border:0; background:transparent; text-align:left; }
.page-number { color:var(--muted); font-size:12px; }
.page-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.order-buttons { display:flex; gap:2px; padding-right:5px; }
.order-buttons button { padding:4px 7px; border:0; background:transparent; color:var(--muted); }
.order-buttons button:disabled { opacity:.25; cursor:default; }
.empty-list { padding:24px 8px; color:var(--muted); text-align:center; font-size:14px; }
.editor { width:min(100%,850px); padding:32px clamp(22px,4vw,48px) 60px; }
.editor-head { display:flex; justify-content:space-between; gap:16px; align-items:start; margin-bottom:24px; }
.editor-head h2 { margin:0; font-size:26px; }
.save-state { color:var(--muted); font-size:13px; }
.media-section { margin-top:28px; padding:20px; border:1px solid var(--line); border-radius:10px; background:rgba(255,253,249,.65); }
.section-head { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.section-head h3 { margin:0 0 4px; font-size:16px; }
.section-head p { margin:0; color:var(--muted); font-size:12px; line-height:1.6; }
.file-button { display:inline-block; flex:0 0 auto; margin:0; font-size:14px; font-weight:400; }
.media-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:16px; }
.media-item { position:relative; min-width:0; }
.media-item img { display:block; width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:7px; background:#ece7de; }
.media-item button { position:absolute; top:6px; right:6px; padding:4px 8px; border:0; background:rgba(45,40,34,.82); color:white; }
.file-list, .link-editor-list { display:grid; gap:9px; margin-top:16px; }
.file-row { display:flex; align-items:center; gap:10px; min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:7px; background:white; }
.file-row span { flex:1; min-width:0; overflow-wrap:anywhere; }
.file-row button, .link-row button { flex:0 0 auto; padding:5px 8px; border:0; background:transparent; color:var(--danger); }
.link-row { display:grid; grid-template-columns:minmax(100px,.7fr) minmax(180px,1.3fr) auto; gap:8px; align-items:center; }
.link-row input { margin:0; }
.empty-media { color:var(--muted); font-size:13px; }
.editor-actions { display:flex; justify-content:space-between; gap:16px; margin-top:30px; }
.save-button { min-width:150px; }
.welcome-editor { align-self:center; justify-self:center; padding:40px; color:var(--muted); text-align:center; }
.welcome-editor h2 { color:var(--ink); }
.dialog-wrap { position:fixed; inset:0; z-index:30; display:grid; place-items:center; padding:20px; }
.dialog-backdrop { position:absolute; inset:0; width:100%; border:0; border-radius:0; background:rgba(45,40,34,.38); }
.dialog { position:relative; width:min(100%,460px); padding:28px; border-radius:12px; background:var(--panel); box-shadow:0 20px 70px rgba(0,0,0,.2); }
.dialog h2 { margin-top:0; }
.dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:26px; }
.toast { position:fixed; z-index:50; left:50%; bottom:28px; transform:translateX(-50%); max-width:calc(100vw - 40px); padding:11px 18px; border-radius:8px; background:rgba(45,40,34,.93); color:white; font-size:14px; }
@media (max-width:800px) {
    .admin-topbar { align-items:flex-start; padding:15px; }
    .admin-topbar h1 { font-size:21px; }
    .top-actions { justify-content:flex-end; gap:5px; }
    .top-actions button, .top-actions a { padding:7px 9px; font-size:12px; }
    .workspace { display:block; }
    .sidebar { border-right:0; border-bottom:1px solid var(--line); padding:16px 14px; }
    .page-list { display:flex; overflow-x:auto; padding-bottom:5px; }
    .page-row { flex:0 0 220px; }
    .editor { padding:24px 16px 45px; }
    .media-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .link-row { grid-template-columns:1fr; padding:10px; border:1px solid var(--line); border-radius:8px; }
    .link-row button { justify-self:end; }
    .section-head { align-items:flex-start; }
}
@media (max-width:480px) {
    .admin-topbar { display:block; }
    .top-actions { justify-content:flex-start; margin-top:12px; }
    .editor-actions { position:sticky; bottom:0; margin-left:-16px; margin-right:-16px; padding:12px 16px calc(12px + env(safe-area-inset-bottom)); background:rgba(238,233,223,.95); }
    .media-section { padding:15px; }
    .login-card { padding:28px 22px; }
}
