*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #f5f4f0; --surface: #fff; --surface2: #f1efe8;
    --border: rgba(0,0,0,0.1); --border-md: rgba(0,0,0,0.18);
    --text: #1a1a18; --text-muted: #6b6a64; --text-hint: #9c9a92;
    --green: #0f6e56; --green-bg: #e1f5ee;
    --red: #a32d2d; --red-bg: #fcebeb;
    --blue: #185fa5; --blue-bg: #e6f1fb;
    --radius: 8px; --radius-lg: 12px;
    --font: system-ui, -apple-system, sans-serif;
}
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 210px; flex-shrink: 0; background: var(--surface); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 10; }
.sidebar-brand { padding: 18px 20px 14px; font-size: 13px; font-weight: 500; border-bottom: 0.5px solid var(--border); color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; }
.sidebar-nav { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.nav-item { display: block; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; color: var(--text-muted); text-decoration: none; cursor: pointer; }
.nav-item:hover, .nav-item.active { background: var(--surface2); color: var(--text); }
.nav-item.active { font-weight: 500; }
/* Submenu indicator — nav items that open a plugin sub-nav */
.nav-item--has-sub { display: flex; align-items: center; justify-content: space-between; }
.nav-item-arrow { font-size: 14px; color: var(--text-hint); transition: color 0.15s; flex-shrink: 0; }
.nav-item--has-sub:hover .nav-item-arrow,
.nav-item--has-sub.active .nav-item-arrow { color: var(--text-muted); }

.sidebar-footer { padding: 14px 10px; border-top: 0.5px solid var(--border); }
.logout-btn { background: none; border: none; font-size: 13px; color: var(--text-muted); cursor: pointer; padding: 6px 12px; border-radius: var(--radius); width: 100%; text-align: left; }
.logout-btn:hover { background: var(--surface2); }
.main-content { flex: 1; min-width: 0; overflow-x: auto; }
.page-body { padding: 28px 32px; width: 100%; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-header h1 { font-size: 20px; font-weight: 500; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--text-muted); text-decoration: underline; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 0.5px solid var(--border-md); background: var(--surface); color: var(--text); font-size: 13px; font-family: var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface2); }
.btn-primary { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn-primary:hover { opacity: .85; background: var(--text); }
.link-btn { background: none; border: none; font-size: 12px; color: var(--text-muted); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; font-family: var(--font); }
.link-btn:hover { color: var(--text); }
.link-btn.danger { color: var(--red); }
.input { padding: 7px 10px; border-radius: var(--radius); border: 0.5px solid var(--border-md); background: var(--surface); color: var(--text); font-size: 13px; font-family: var(--font); width: 100%; }
.input:focus { outline: none; border-color: var(--text); }
.input-select { width: auto; cursor: pointer; }
.input-textarea { resize: vertical; min-height: 80px; }
.form-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px; }
.form-section-title { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 0.5px solid var(--border); padding-bottom: 10px; margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.field-hint { font-size: 11px; color: var(--text-hint); }
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle { width: 36px; height: 20px; cursor: pointer; accent-color: var(--green); }
.toggle-label { font-size: 13px; cursor: pointer; }
.table-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 10px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; table-layout: auto; white-space: nowrap; }
.table th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 500; color: var(--text-muted); background: var(--surface2); border-bottom: 0.5px solid var(--border); text-transform: uppercase; letter-spacing: .04em; }
.table td { padding: 11px 14px; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface2); }
.table .actions { display: flex; gap: 10px; align-items: center; }
.table-footer { font-size: 12px; color: var(--text-hint); padding: 2px 0 10px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-active { background: var(--green-bg); color: var(--green); }
.badge-inactive { background: var(--surface2); color: var(--text-muted); }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; border: 0.5px solid transparent; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.alert-error { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
.empty-state { padding: 40px; text-align: center; color: var(--text-hint); }
.bold { font-weight: 500; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.embed-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 0.5px solid var(--border); }
.embed-row:last-child { border-bottom: none; }
.embed-slot-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.embed-slot-row:last-child { border-bottom: none; }
.embed-slot-info { display: flex; align-items: center; gap: 4px; }


/* ── Collapsible admin sections ──────────────────────────────────────────────
   Wrap any form-card in <details class="admin-section"> with a <summary>.
   localStorage persists open/closed state per section ID.
   ─────────────────────────────────────────────────────────────────────────── */
details.admin-section { margin-bottom: 12px; }
details.admin-section > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    list-style: none;
    user-select: none;
    color: var(--text);
}
details.admin-section > summary::-webkit-details-marker { display: none; }
details.admin-section[open] > summary {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom-color: transparent;
}
details.admin-section > summary .section-chevron {
    font-size: 11px;
    color: var(--text-hint);
    transition: transform .15s;
    flex-shrink: 0;
}
details.admin-section[open] > summary .section-chevron { transform: rotate(180deg); }
details.admin-section > .section-body {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 16px;
}
/* When a form-card is the direct child of section-body, remove its own border/radius */
details.admin-section > .section-body > .form-card {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
}

