:root {
  --orange: #ff6a00;
  --orange-dark: #d95700;
  --ink: #111111;
  --muted: #6d6862;
  --paper: #fffdfa;
  --cream: #f3efe8;
  --line: #ded8cf;
  --success: #18794e;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(19, 13, 8, .12);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(255, 106, 0, .45); outline-offset: 3px; }
.eyebrow { margin: 0 0 .45rem; color: var(--orange-dark); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.loading-page, .login-page { min-height: 100svh; display: grid; place-items: center; padding: 1.25rem; }
.loading-page { gap: .75rem; align-content: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-card { width: min(440px, 100%); padding: clamp(1.5rem, 6vw, 3rem); border-top: 5px solid var(--orange); background: var(--paper); box-shadow: var(--shadow); }
.login-card > img { width: 76px; height: 74px; margin-bottom: 1.5rem; object-fit: cover; }
.login-card h1 { margin: 0 0 2rem; font: 600 clamp(2rem, 7vw, 3rem)/1.05 Georgia, serif; }
.login-card h1 + .auth-intro { margin-top: -1rem; }
.auth-intro { margin-bottom: 1.5rem; color: var(--muted); }
label { display: grid; gap: .45rem; color: #3f3b37; font-size: .88rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 48px; padding: .75rem .85rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); outline: 2px solid rgba(255, 106, 0, .16); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 5.2rem; }
.password-field button { position: absolute; top: 50%; right: .45rem; min-height: 36px; padding: .35rem .55rem; border: 0; border-radius: 6px; background: #eee9e2; color: #3f3b37; font-size: .78rem; font-weight: 800; transform: translateY(-50%); }
.login-card form { display: grid; gap: 1.1rem; }
.primary-button, .secondary-button, .danger-button { min-height: 46px; padding: .72rem 1rem; border: 1px solid transparent; border-radius: 8px; font-weight: 800; }
.primary-button { background: var(--orange); color: #17100b; }
.primary-button:hover { background: #ff7b1c; }
.secondary-button { border-color: var(--line); background: #fff; color: var(--ink); }
.danger-button { border-color: #ffd2cc; background: #fff4f2; color: var(--danger); }
button:disabled { cursor: wait; opacity: .58; }
.text-button, .back-link { border: 0; background: transparent; color: var(--orange-dark); font-weight: 750; text-decoration: none; }
.back-link { display: inline-block; margin-top: 1.5rem; }
.auth-back { padding: 0; }
.auth-switch { min-height: auto; padding: .2rem; border: 0; background: transparent; color: var(--orange-dark); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.form-message { min-height: 1.4em; margin: 0; color: var(--danger); font-size: .86rem; }
.form-message.is-success { color: var(--success); }
.admin-layout { min-height: 100svh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 270px; display: flex; flex-direction: column; padding: 1.2rem; background: #090909; color: #fff; }
.brand-row { display: flex; align-items: center; gap: .8rem; padding-bottom: 1.1rem; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand-row img { width: 48px; height: 46px; object-fit: cover; }
.brand-row div { display: grid; }
.brand-row strong { font-family: Georgia, serif; font-size: 1.15rem; }
.brand-row span, .sidebar-footer span { color: rgba(255,255,255,.56); font-size: .78rem; }
.sidebar nav { display: grid; gap: .2rem; margin: 1.3rem 0 auto; }
.sidebar nav button { min-height: 44px; padding: .65rem .8rem; border: 0; border-radius: 7px; background: transparent; color: rgba(255,255,255,.72); text-align: left; }
.sidebar nav button:hover, .sidebar nav button.is-active { background: rgba(255,106,0,.16); color: #fff; }
.sidebar nav button.is-active { box-shadow: inset 3px 0 var(--orange); }
.sidebar-footer { display: grid; gap: .55rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.13); }
.sidebar-footer .text-button { width: fit-content; padding: 0; }
.menu-toggle { display: none; }
.workspace { min-height: 100svh; margin-left: 270px; padding: clamp(1.3rem, 4vw, 3.5rem); }
.workspace-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.workspace-header h1 { margin: 0; font: 600 clamp(2.2rem, 5vw, 4rem)/1 Georgia, serif; }
.workspace-header a { color: var(--orange-dark); font-weight: 800; text-decoration: none; }
.notice { margin: 0 0 1rem; padding: .9rem 1rem; border-left: 4px solid var(--success); background: #ecfdf3; color: #11643f; }
.notice.is-error { border-color: var(--danger); background: #fff1f0; color: var(--danger); }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-toolbar p { margin: 0; color: var(--muted); }
.section-intro { max-width: 72ch; }
.content-list { display: grid; gap: .7rem; }
.content-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.content-card.is-inactive { opacity: .68; }
.content-card-main { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: center; }
.content-card-main.no-media { grid-template-columns: 1fr; }
.content-card img, .content-card video { width: 86px; height: 68px; border-radius: 7px; object-fit: cover; background: #ddd; }
.content-card h2 { margin: 0; font-size: 1rem; }
.content-card p { margin: .25rem 0 0; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.meta-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: .2rem .55rem; border-radius: 999px; background: #eee9e2; color: #514b45; font-size: .72rem; font-weight: 800; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.featured { background: #fff0e5; color: #a34200; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.card-actions button { min-height: 38px; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #302c28; font-size: .82rem; font-weight: 750; }
.card-actions button:hover { border-color: var(--orange); }
.card-actions .delete-action { color: var(--danger); }
.empty-state { padding: 3rem 1.3rem; border: 1px dashed #c9c0b5; border-radius: 10px; background: rgba(255,255,255,.48); color: var(--muted); text-align: center; }
.settings-card { max-width: 840px; padding: clamp(1.1rem, 4vw, 2rem); border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.settings-card form, .editor-fields { display: grid; gap: 1.1rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: grid; gap: .45rem; }
.field-label-row { display: flex; align-items: center; gap: .35rem; }
.field-label-row label { display: block; }
.toggle-field { display: flex; align-items: flex-start; gap: .7rem; }
.toggle-field > label { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .7rem; flex: 1; }
.toggle-field input { width: 20px; min-height: 20px; accent-color: var(--orange); }
.toggle-copy { display: grid; gap: .2rem; }
.help-wrap { position: relative; display: inline-flex; align-items: center; }
.help-button { display: inline-grid; width: 30px; min-width: 30px; height: 30px; min-height: 30px; place-items: center; padding: 0; border: 1px solid #cbbfb2; border-radius: 50%; background: #fff8f1; color: var(--orange-dark); font-size: .82rem; font-weight: 900; line-height: 1; }
.help-button:hover, .help-button[aria-expanded="true"] { border-color: var(--orange); background: #fff0e5; }
.help-popover { position: absolute; z-index: 40; top: calc(100% + .5rem); left: 0; width: max-content; max-width: min(320px, calc(100vw - 2rem)); padding: .7rem .8rem; border: 1px solid #493b31; border-radius: 8px; background: #17110d; color: #fff; box-shadow: 0 12px 30px rgba(19, 13, 8, .2); font-size: .8rem; font-weight: 500; line-height: 1.45; opacity: 0; pointer-events: none; visibility: hidden; }
.help-popover::before { position: absolute; top: -.35rem; left: .8rem; width: .65rem; height: .65rem; border-top: 1px solid #493b31; border-left: 1px solid #493b31; background: #17110d; content: ''; transform: rotate(45deg); }
.help-wrap:hover .help-popover, .help-wrap:focus-within .help-popover, .help-wrap.is-open .help-popover { opacity: 1; pointer-events: auto; visibility: visible; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.social-settings { display: grid; gap: 1rem; margin: .4rem 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: 9px; }
.social-settings legend { padding: 0 .45rem; color: var(--orange-dark); font-size: .74rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.hint { margin: -.2rem 0 0; color: var(--muted); font-size: .8rem; font-weight: 400; }
.settings-actions { display: flex; justify-content: flex-end; margin-top: .5rem; }
.agenda-connection { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.1rem; margin-bottom:1rem; border:1px solid var(--line); border-radius:10px; background:#fffaf4; }
.agenda-connection p { margin:.35rem 0 0; color:var(--muted); }
.agenda-connection-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.6rem; }
.agenda-connection-actions .delete-action { color:var(--danger); }
.agenda-actions { display:flex; flex-wrap:wrap; gap:.6rem; margin:-.4rem 0 1rem; }
.agenda-list .content-card-main { min-height: 90px; }
.agenda-list .content-card-main p { margin:.25rem 0; }
@media (max-width:620px) { .agenda-connection { align-items:stretch; flex-direction:column; } .agenda-connection-actions { flex-direction:column; } .agenda-connection button { width:100%; } }
.future-feature { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; }
.future-feature svg { width: 38px; color: var(--orange-dark); }
.future-feature h2 { margin: 0; font: 600 clamp(1.25rem, 3vw, 1.7rem)/1.2 Georgia, serif; }
.future-feature p { margin: .7rem 0 0; color: var(--muted); }
.editor-dialog { width: min(680px, calc(100% - 2rem)); max-height: calc(100svh - 2rem); padding: 0; border: 0; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.editor-dialog::backdrop { background: rgba(0,0,0,.66); }
.editor-dialog form { display: grid; max-height: calc(100svh - 2rem); }
.editor-dialog header, .editor-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.editor-dialog footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.editor-dialog h2 { margin: 0; font: 600 1.7rem Georgia, serif; }
.editor-fields { overflow-y: auto; padding: 1.3rem; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #eee9e2; font-size: 1.5rem; }
.editor-dialog .form-message { padding: 0 1.3rem 1rem; }
.file-preview { width: 100%; max-height: 280px; object-fit: contain; border-radius: 8px; background: #111; }

@media (max-width: 900px) {
  .sidebar { position: sticky; inset: 0; width: 100%; padding: .8rem 1rem; }
  .brand-row { padding: 0; border: 0; }
  .sidebar nav { display: none; margin: .8rem 0; padding-top: .8rem; border-top: 1px solid rgba(255,255,255,.13); }
  .sidebar nav.is-open { display: grid; }
  .sidebar-footer { display: none; }
  .menu-toggle { position: absolute; top: 1rem; right: 1rem; display: block; min-height: 38px; padding: .4rem .7rem; border: 1px solid rgba(255,255,255,.28); border-radius: 7px; background: transparent; color: #fff; }
  .workspace { margin-left: 0; padding: 1.25rem; }
  .workspace-header { align-items: flex-start; }
}

@media (max-width: 620px) {
  .workspace-header { display: grid; }
  .section-toolbar { align-items: stretch; flex-direction: column; }
  .section-toolbar .primary-button { width: 100%; }
  .content-card { grid-template-columns: 1fr; }
  .card-actions { justify-content: flex-start; }
  .content-card-main { grid-template-columns: 72px minmax(0, 1fr); }
  .content-card img, .content-card video { width: 72px; height: 62px; }
  .field-grid { grid-template-columns: 1fr; }
  .help-popover { max-width: min(300px, calc(100vw - 2rem)); }
  .future-feature { grid-template-columns: 1fr; }
  .editor-dialog footer { display: grid; grid-template-columns: 1fr 1fr; }
}
