:root {
  color-scheme: light;
  --ink: #23211d;
  --muted: #6d675f;
  --line: #ded8cd;
  --paper: #fcf7ec;
  --panel: #ffffff;
  --brand: #1d6f68;
  --brand-dark: #15514c;
  --accent: #b14d2f;
  --soft: #eef4e6;
  --shadow: 0 18px 50px rgba(44, 38, 28, 0.16);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(177, 77, 47, 0.10), transparent 30%),
    linear-gradient(135deg, #fffaf0 0%, var(--paper) 46%, #eef7ef 100%);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body.is-shutting-down {
  background: #050505;
  color: #f5f0e7;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.login-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  align-items: end;
  justify-items: start;
  padding: 1cm;
  background: url("/omslag-start.jpg") 68% center/cover no-repeat;
}

.login-shell::before {
  content: "";
  display: none;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(35, 33, 29, 0.02), rgba(35, 33, 29, 0.08)),
    radial-gradient(circle at 20% 82%, rgba(177, 77, 47, 0.10), transparent 32%);
  pointer-events: none;
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 10.5cm);
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.55cm;
  backdrop-filter: blur(8px);
}

.login-panel h1 {
  margin-bottom: 4px;
  font-size: 1.45rem;
  line-height: 1;
}

.login-panel .intro {
  margin-bottom: 0;
  font-size: 0.9rem;
  line-height: 1.3;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-title {
  font-size: 0.95rem;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(1.45rem, 2vw, 2.35rem);
  line-height: 0.95;
}

.intro {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.login-form label,
.admin-login-form label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.password-row,
.pin-code-fields,
.admin-code-row {
  display: grid;
  gap: 7px;
}

.admin-login-form {
  display: grid;
  grid-template-columns: max-content minmax(9.6rem, 1fr) 1.65rem max-content;
  align-items: center;
  justify-content: stretch;
  gap: 5px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.admin-code-row {
  display: contents;
}

.admin-login-form label {
  font-size: 0.68rem;
  font-weight: 650;
  opacity: 0.72;
}

.admin-login-form input {
  padding: 4px 5px;
  border-color: rgba(222, 216, 205, 0.72);
  font-size: 0.7rem;
}

.admin-password-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.65rem;
  height: 1.55rem;
  border: 1px solid rgba(222, 216, 205, 0.72);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--muted);
  padding: 0;
}

.admin-password-toggle svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-password-toggle[aria-pressed="true"] {
  border-color: var(--brand);
  color: var(--brand);
}

.admin-login-form .show-password-button {
  padding: 4px 6px;
  border-color: rgba(222, 216, 205, 0.72);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 0.95rem;
}

input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(29, 111, 104, 0.16);
}

.login-button {
  width: 100%;
  min-height: 38px;
  margin-top: 3px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  padding: 9px 12px;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
}

.primary-link {
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  padding: 12px 16px;
  text-decoration: none;
}

.login-button:hover,
.primary-link:hover {
  background: var(--brand-dark);
}

button.primary-link:disabled {
  cursor: default;
  opacity: 0.55;
}

button.primary-link:disabled:hover {
  background: var(--brand);
}

.show-password-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
  padding: 9px 11px;
  font-size: 0.9rem;
}

.show-password-button[aria-pressed="true"] {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.error {
  min-height: 24px;
  margin-bottom: 0;
  color: #9a2d22;
  font-size: 0.98rem;
  font-weight: 700;
}

.library {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  padding: 22px 28px 28px;
  background: #f7f1e6;
}

.topbar,
.tools,
.reader-layout {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
}

.topbar h1 {
  margin: 0;
}

.ghost-button,
.secondary-link,
.file-tab {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
  padding: 10px 13px;
  text-decoration: none;
}

button.secondary-link:disabled {
  cursor: default;
  opacity: 0.72;
}

.ghost-button:hover,
.secondary-link:hover,
.file-tab:hover {
  border-color: var(--brand);
}

.tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.index-heading {
  margin: 0;
  padding-left: 20px;
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.1;
}

.stats {
  color: var(--muted);
  font-weight: 700;
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(320px, 560px) minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
  height: 100%;
}

.kanalen-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 2px 8px 2px 0;
}

.kanaal-list-item {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  border-left: 5px solid transparent;
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
  min-height: 0;
  padding: 11px 15px 13px;
  text-align: left;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.2;
}

.kanaal-list-item:hover,
.kanaal-list-item.active {
  border-left-color: var(--brand);
  background: rgba(29, 111, 104, 0.10);
  color: var(--brand-dark);
}

.list-message {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 16px;
}

.reader-intro {
  display: grid;
  align-content: center;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 253, 248, 0.96), rgba(255, 253, 248, 0.76)),
    url("/omslag-start.jpg") right center/cover no-repeat;
  box-shadow: 0 10px 34px rgba(44, 38, 28, 0.10);
  padding: clamp(24px, 4vw, 56px);
}

.reader-intro.empty-preview {
  background: #fffdf8;
}

.reader-intro h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 4vw, 3.4rem);
}

.reader-intro p:last-child {
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.55;
}

.reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(35, 33, 29, 0.72);
}

.reader-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
}

.reader-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-height: 0;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.reader-header h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.1;
}

.reader-header .kicker {
  margin-bottom: 4px;
  font-size: 0.75rem;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.reader-actions .primary-link,
.reader-actions .secondary-link {
  min-height: 0;
  padding: 7px 10px;
  font-size: 0.82rem;
}

.icon-button {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 0;
}

.icon-button:hover {
  border-color: var(--brand);
}

.icon-button::before,
.icon-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  transform-origin: center;
}

.icon-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.icon-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.file-tabs {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.file-tab {
  white-space: nowrap;
  min-height: 0;
  padding: 6px 9px;
  font-size: 0.78rem;
}

.file-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #f5f0e7;
}

.empty-reader {
  position: absolute;
  inset: 150px 0 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.empty-reader.hidden {
  display: none;
}

@media (max-width: 900px) {
  .library {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 18px;
  }

  .topbar,
  .tools,
  .reader-header {
    align-items: stretch;
    flex-direction: column;
  }

  .reader-header {
    align-items: start;
    flex-direction: row;
  }

  .reader-layout {
    grid-template-columns: 1fr;
  }

  .kanalen-list {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    height: auto;
    max-height: none;
    padding-right: 0;
  }

  .reader-intro {
    height: auto;
    min-height: auto;
  }

  .reader-panel {
    width: 100%;
    height: 100vh;
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .login-shell {
    background: url("/omslag-start.jpg") 72% center/cover no-repeat;
    padding: 24px;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

  .login-panel {
    margin-top: 0;
    margin-right: 0;
    padding: 24px;
  }

  .reader-actions {
    justify-content: stretch;
  }

  .primary-link,
  .secondary-link {
    text-align: center;
  }
}
