:root { --bg:#f5f3ef; --card:#fff; --ink:#2b2420; --muted:#7a6f66; --line:#e5ddd1; --accent:#7a1f1f; --accent2:#d9932b; --ok:#2f7a3a; --err:#b42318; }
* { box-sizing: border-box; }
body { margin:0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 20px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.admin { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #241a17; color: #d9cfc4; flex: none; padding: 18px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: block; color: #fff; text-decoration: none; font-weight: 700; padding: 0 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand small { display: block; font-weight: 400; color: #a99c90; font-size: .8rem; }
.sidebar nav a { display: block; padding: 8px 20px; color: #d9cfc4; text-decoration: none; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar h6 { margin: 18px 20px 6px; font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: #8d7f73; }
.badge { background: var(--accent2); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .75rem; margin-left: 6px; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar form { margin: 0; }
.spacer { flex: 1; }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; }
.content { padding: 28px; max-width: 1100px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; margin-bottom: 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.1); }
.btn-light { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--err); }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.danger { color: var(--err) !important; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-ok { background: #e8f5ea; color: var(--ok); border: 1px solid #bfe3c5; }
.alert-error { background: #fdecea; color: var(--err); border: 1px solid #f5c2bd; }
.form .field { margin-bottom: 18px; }
.form label, .login-box label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=password], input:not([type]), textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent2); border-color: transparent; }
input[type=color] { width: 70px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
label.check.small { font-weight: 400; display: inline-flex; }
.narrow { max-width: 520px; }
.actions { position: sticky; bottom: 0; background: #fff; padding: 14px 0 0; border-top: 1px solid var(--line); margin-top: 10px; }
.image-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.image-field .thumb { width: 180px; height: 120px; border-radius: 8px; border: 1px dashed var(--line); background: #faf7f2 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: .85rem; flex: none; }
.image-controls { flex: 1; min-width: 240px; display: grid; gap: 8px; }
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #faf7f2; }
tr.unread td { font-weight: 700; }
td.indent { padding-left: 40px; }
td.indent::before { content: "↳ "; color: var(--muted); }
.row-actions { white-space: nowrap; display: flex; gap: 12px; align-items: center; }
.row-actions form { margin: 0; }
.mini-thumb { display: block; width: 72px; height: 48px; border-radius: 6px; background: linear-gradient(135deg, #7a1f1f, #d9932b) center/cover; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; text-decoration: none; color: var(--muted); }
.stat b { display: block; font-size: 2rem; color: var(--accent); }
.quick { margin: 0; padding-left: 20px; line-height: 2; }
.inline-upload { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inline-upload label { margin: 0; font-weight: 600; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.media-item { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.media-item .thumb, .picker .thumb { aspect-ratio: 4/3; border-radius: 6px; background: #eee center/cover no-repeat; margin-bottom: 6px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-body { background: #faf7f2; border-radius: 8px; padding: 16px; margin: 16px 0; white-space: normal; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 2000; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; width: min(900px, 100%); max-height: 85vh; overflow: auto; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; margin-bottom: 14px; }
.picker button { border: 2px solid transparent; background: none; padding: 4px; border-radius: 8px; cursor: pointer; text-align: left; }
.picker button:hover { border-color: var(--accent2); }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: linear-gradient(135deg, #5a1414, #b5652a); }
.login-box { background: #fff; border-radius: 14px; padding: 32px; width: min(400px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-box h1 { margin-bottom: 4px; font-size: 1.4rem; }
.login-box label { margin-bottom: 14px; }
.login-box input { margin-top: 6px; }
.login-box .btn { width: 100%; margin-top: 6px; }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; z-index: 1000; transition: left .2s; }
  .nav-open .sidebar { left: 0; }
  .nav-toggle { display: block; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .topbar > span:not(.spacer) { display: none; }
}
