:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #243044;
  --muted: #718096;
  --line: #e6eaf0;
  --primary: #5b4a32;
  --primary-dark: #3f321f;
  --accent: #d8b77b;
  --sidebar: #211d17;
  --sidebar-muted: #aaa398;
  --success: #25804a;
  --danger: #b5473c;
  --shadow: 0 8px 24px rgba(25, 35, 52, .06);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 272px; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px 18px; background: var(--sidebar); color: #fff; box-shadow: 8px 0 28px rgba(0,0,0,.08); transition: transform .25s ease; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; min-width: 0; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-weight: 750; letter-spacing: -.01em; }
.brand-mark { display: grid; flex: 0 0 40px; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(145deg, #f0d6a4, #bd9350); color: var(--primary-dark); font-size: 14px; font-weight: 850; box-shadow: 0 5px 16px rgba(216,183,123,.2); }
.brand-copy { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small { display: block; margin-top: 2px; color: var(--sidebar-muted); font-size: 10px; font-weight: 450; letter-spacing: 0; }
.icon-button { display: inline-grid; place-items: center; border: 0; cursor: pointer; }
.sidebar-close { display: none; width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.08); color: #fff; font-size: 22px; }
.site-switcher { padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.055); }
.site-switcher label { display: block; margin-bottom: 7px; color: var(--sidebar-muted); font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.site-switcher select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.site-switcher a { display: inline-flex; align-items: center; gap: 5px; margin-top: 11px; color: #ecd29f; font-size: 12px; text-decoration: none; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 10px 12px; border-radius: 9px; color: #c9c4ba; text-decoration: none; font-size: 13px; font-weight: 550; transition: background .2s, color .2s, transform .2s; }
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(2px); }
.sidebar-nav a.active { background: linear-gradient(90deg, rgba(216,183,123,.2), rgba(216,183,123,.08)); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-icon { display: inline-grid; width: 22px; place-items: center; color: #d8b77b; font-size: 19px; line-height: 1; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 4px 0; border-top: 1px solid rgba(255,255,255,.11); }
.user-avatar { display: grid; flex: 0 0 34px; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #e8c98e; color: var(--primary-dark); font-size: 13px; font-weight: 800; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { color: #fff; font-size: 12px; }
.user-meta span { margin-top: 2px; color: var(--sidebar-muted); font-size: 10px; }
.sign-out { color: #d8b77b; font-size: 20px; text-decoration: none; }
.main { width: calc(100% - 272px); min-width: 0; margin-left: 272px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 22px; min-height: 84px; padding: 18px 38px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); box-shadow: 0 3px 16px rgba(25,35,52,.03); backdrop-filter: blur(12px); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 15px; min-width: 0; }
.menu-toggle { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--primary); font-size: 18px; }
.eyebrow { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.topbar h1 { margin: 2px 0 0; color: var(--ink); font-size: 24px; font-weight: 750; letter-spacing: -.025em; }
.global-search { position: relative; display: flex; align-items: center; }
.global-search > span { position: absolute; left: 12px; color: var(--muted); font-size: 20px; line-height: 1; }
.global-search input { width: 250px; height: 40px; padding: 8px 12px 8px 35px; border: 1px solid var(--line); border-radius: 9px; background: #f8f9fb; color: var(--ink); font: inherit; outline: 0; }
.global-search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(216,183,123,.18); }
.topbar-site-link { color: var(--primary); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 30px 38px 46px; }
.hero, .panel { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 26px 28px; }
.hero h2 { margin: 4px 0; color: var(--ink); font-size: 23px; letter-spacing: -.02em; }
.hero p, .panel p { margin: 5px 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 15px; margin-bottom: 22px; }
.stat { position: relative; overflow: hidden; padding: 18px 19px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.stat::after { position: absolute; right: -22px; bottom: -28px; width: 76px; height: 76px; border-radius: 50%; background: rgba(216,183,123,.13); content: ""; }
.stat span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; }
.stat strong { display: block; margin-top: 5px; color: var(--ink); font-size: 29px; line-height: 1.1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { margin-bottom: 20px; padding: 24px; }
.panel h2, .panel h3 { margin: 0 0 5px; color: var(--ink); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.quick-links { display: grid; gap: 12px; }
.quick-links a { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--primary); font-weight: 650; text-decoration: none; }
.quick-links a::after { content: "→"; }
.quick-links a:hover { border-color: var(--accent); background: #fffaf2; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; gap: 7px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; transition: .2s; }
.btn:hover { border-color: #cdb58d; color: var(--primary-dark); transform: translateY(-1px); }
.btn.primary { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 5px 12px rgba(97,77,49,.16); }
.btn.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); color: #fff; }
.btn.small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.filters label, .form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 750; }
.filters input, .filters select, .form-grid input, .form-grid select, .form-grid textarea, .login-card input { min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: span 2; }
.form-grid fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 14px; }
.checks { display: flex; gap: 15px; flex-wrap: wrap; }
.check { display: flex !important; align-items: center; gap: 7px !important; }
.actions { display: flex; align-items: center; gap: 10px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffdf9; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.badge { display: inline-block; padding: 4px 9px; border-radius: 20px; font-size: 10px; font-weight: 750; }
.badge.published { background: #e7f5eb; color: var(--success); }
.badge.draft { background: #f5ede1; color: #87613c; }
.tags { max-width: 210px; color: var(--muted); font-size: 11px; }
.empty { padding: 38px; color: var(--muted); text-align: center; }
.pagination { display: flex; gap: 5px; margin-top: 16px; }
.pagination a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); text-decoration: none; }
.pagination a.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.alert { margin-bottom: 16px; padding: 12px 15px; border-radius: 9px; border: 1px solid transparent; }
.alert.success { border-color: #c6e6cf; background: #effaf1; color: #27713d; }
.alert.error { border-color: #f0c9c4; background: #fff2f0; color: #8e3128; }
.alert.info { border-color: #c9ddec; background: #f1f7fc; color: #2d5877; }
.sidebar-backdrop { display: none; }
.login-page { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(circle at top right, #fff3d9, transparent 36%), var(--bg); }
.login-card { width: min(430px, calc(100% - 30px)); padding: 34px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 18px 50px rgba(25,35,52,.1); }
.login-card h1 { margin: 28px 0 5px; color: var(--ink); }
.login-card p { color: var(--muted); }
.login-card form { display: grid; gap: 15px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-weight: 650; }
.login-card .btn { width: 100%; margin-top: 5px; }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-grid; }
  .sidebar-backdrop { position: fixed; z-index: 30; inset: 0; background: rgba(20,18,14,.48); opacity: 0; pointer-events: none; display: block; transition: opacity .25s; }
  .sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .main { width: 100%; margin-left: 0; }
  .topbar, .content { padding-right: 24px; padding-left: 24px; }
}
@media (max-width: 720px) {
  .topbar { align-items: flex-start; padding-top: 15px; padding-bottom: 15px; }
  .topbar-actions { flex: 1; justify-content: flex-end; }
  .global-search input { width: 180px; }
  .topbar-site-link { display: none; }
  .content { padding: 20px 16px 34px; }
  .hero { align-items: flex-start; flex-direction: column; padding: 21px; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 560px) {
  .topbar-left { gap: 10px; }
  .topbar h1 { font-size: 20px; }
  .global-search { display: none; }
  .panel { padding: 18px; border-radius: 12px; }
  .panel-head { display: block; }
  .panel-head .btn { margin-top: 13px; }
  .form-grid { grid-template-columns: 1fr; gap: 15px; }
  .span-2 { grid-column: auto; }
  .filters { align-items: stretch; flex-direction: column; }
  .filters label, .filters input, .filters select, .filters .btn { width: 100%; }
  .actions { flex-wrap: wrap; }
}
