:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface: #fff;
  --ink: #20251f;
  --muted: #72786f;
  --border: #dedfd8;
  --accent: #3e6048;
  --accent-light: #edf2eb;
  --danger: #a53730;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); }
a { color: inherit; }
button, input, select { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 7px; padding: 10px 15px;
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none;
  font-size: 14px; line-height: 1.3; min-height: 40px; transition: background .15s;
}
button:hover, .button:hover { background: #f0f2ed; }
button:disabled { opacity: .45; cursor: default; }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
button.primary:hover { background: #304d38; }
button.danger { color: var(--danger); }
button.quiet { background: transparent; }
button.full { width: 100%; }
input:not([type="checkbox"]), select {
  width: 100%; border: 1px solid var(--border); border-radius: 7px;
  padding: 11px 12px; min-height: 43px; background: #fff; color: var(--ink);
}
input::placeholder { color: #959a91; }
input[type="file"] { padding: 10px 0; border: 0; background: transparent; }
input[type="file"]::file-selector-button { border: 1px solid var(--border); background: #fff; border-radius: 5px; padding: 8px 12px; margin-right: 12px; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { letter-spacing: -.03em; }
h3 { font-size: 16px; margin: 0; }
.muted, .hint { color: var(--muted); line-height: 1.6; }
.hint { font-size: 13px; margin: 8px 0 0; }
.brand { font-size: 27px; font-weight: 750; letter-spacing: -.05em; text-decoration: none; }
.brand span { color: var(--accent); font-size: 13px; vertical-align: middle; margin-left: 3px; }
.login-card {
  width: min(440px, calc(100% - 32px)); margin: 12vh auto 32px; background: #fff;
  border: 1px solid var(--border); border-radius: 14px; padding: 36px;
}
.login-card h1 { font-size: 28px; margin: 28px 0 12px; overflow-wrap: anywhere; }
.login-card form { margin-top: 24px; }
.login-card button { width: 100%; margin-top: 14px; }
.message { font-size: 14px; line-height: 1.5; color: var(--accent); min-height: 21px; margin: 18px 0 0; overflow-wrap: anywhere; }
.message.error { color: var(--danger); }
.admin-shell { max-width: 1460px; margin: 0 auto; }
.admin-header { padding: 22px 36px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.header-caption { display: inline-block; font-size: 14px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 20px; margin-left: 22px; }
.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 86px); }
.library { padding: 28px 22px; border-right: 1px solid var(--border); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.section-heading h1, .section-heading h2 { margin: 0; font-size: 21px; }
.count { background: #e6e9e2; padding: 4px 8px; border-radius: 5px; font-size: 12px; }
.library input[type="search"] { background: transparent; margin: 20px 0 12px; }
.presentation-list { display: grid; gap: 5px; }
.presentation-item { display: block; width: 100%; text-align: left; border-color: transparent; background: transparent; padding: 13px; overflow-wrap: anywhere; }
.presentation-item.selected { background: var(--accent-light); border-color: #c6d3c2; }
.presentation-item strong { display: block; font-size: 14px; margin-bottom: 7px; }
.presentation-item span { display: block; font-size: 12px; color: var(--muted); line-height: 1.5; }
.presentation-item small { display: block; font-size: 11px; margin-top: 8px; color: var(--accent); }
.library-empty { font-size: 13px; color: var(--muted); padding: 18px 12px; line-height: 1.7; }
.editor { padding: 36px; background: #fafbf8; min-width: 0; }
.welcome { padding: 100px 20px 70px; max-width: 570px; margin: 0 auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 700; color: var(--accent); }
.welcome h2 { font-size: clamp(28px, 3vw, 42px); line-height: 1.15; margin: 18px 0; }
.welcome .primary { margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.slug-field { display: flex; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.slug-field > span { padding-left: 12px; color: var(--muted); font-size: 14px; }
.slug-field input { border: 0; min-width: 0; }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; line-height: 1.5; margin: 24px 0; }
.upload-area { padding: 18px 20px; border: 1px dashed #bfc7b9; border-radius: 8px; background: #f3f6f0; margin: 22px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 26px; }
.preview-panel { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--border); }
.preview-panel .section-heading { margin-bottom: 0; }
.preview-canvas { display: flex; align-items: center; justify-content: center; background: #e9ece5; border-radius: 8px; overflow: hidden; margin-top: 18px; min-height: 100px; }
.preview-canvas img { display: block; max-width: 100%; max-height: 65vh; height: auto; }
.slide-controls { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 14px; font-variant-numeric: tabular-nums; font-size: 14px; }
.slide-controls button { min-width: 46px; }
.live-badge, .show-status { font-size: 12px; color: var(--accent); border-radius: 5px; background: var(--accent-light); padding: 6px 10px; white-space: nowrap; }
.live-badge::before { content: "● "; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.viewer-page { background: #e8eaee; }
.viewer-page.individual-view { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.viewer-page.individual-view .viewer-toolbar { flex-shrink: 0; }
.viewer-toolbar { position: sticky; top: 0; z-index: 3; background: rgba(255,255,255,.96); min-height: 56px; padding: 10px 18px; display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.view-title { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-toolbar button { font-size: 12px; min-height: 34px; padding: 7px 11px; }
.connection-status { font-size: 12px; color: var(--danger); }
.viewer { width: min(100%, 1200px); margin: 0 auto; padding: 12px 8px 24px; }
.viewer .slide { display: block; width: 100%; height: auto; margin: 0; background: white; scroll-margin-top: 65px; }
.viewer.individual { flex: 1; min-height: 0; width: 100%; max-width: none; padding: 0; display: flex; align-items: center; justify-content: center; }
.viewer.individual .slide { width: auto; height: 100%; max-width: 100%; object-fit: contain; background: transparent; }
.viewer-controls { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; gap: 18px; align-items: center; padding: 8px; background: rgba(255,255,255,.97); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 24px #0002; font-size: 14px; font-variant-numeric: tabular-nums; }
.viewer-controls button { width: 44px; }
.viewer-controls span { min-width: 55px; text-align: center; white-space: nowrap; }
.viewer-page.individual-view .viewer-controls { position: static; flex-shrink: 0; align-self: center; transform: none; margin: 12px auto 20px; }
.status { padding: 40px 20px; text-align: center; color: var(--muted); }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 240px minmax(0, 1fr); }
  .editor { padding: 26px; }
  .form-grid { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 640px) {
  .admin-header { padding: 16px 18px; }
  .header-caption { margin-left: 14px; padding-left: 14px; }
  .workspace { display: block; }
  .library { padding: 20px 18px; border-right: 0; border-bottom: 1px solid var(--border); }
  .presentation-list { max-height: 240px; overflow: auto; }
  .editor { padding: 24px 18px; }
  .welcome { padding: 35px 0; }
  .login-card { padding: 26px; margin-top: 8vh; }
  .viewer-toolbar { padding: 8px; gap: 8px; flex-wrap: wrap; }
  .view-title { min-width: 120px; }
  .connection-status { flex-basis: 100%; }
  .connection-status:empty { display: none; }
  .show-status { font-size: 10px; }
}
