:root {
  color-scheme: light dark;
  --bg: #f7f7f8;
  --panel: #ffffff;
  --text: #161616;
  --muted: #656565;
  --line: #d7d7dc;
  --button: #ececf0;
  --button-hover: #d9d9df;
  --accent: #176b57;
  --accent-hover: #115342;
  --danger: #b3261e;
  --input: #ffffff;
  --shadow: rgba(0, 0, 0, 0.08);
}

@font-face {
  font-family: "Fraunces News";
  src: url("/static/fonts/Fraunces144pt-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Albert Sans";
  src: url("/static/fonts/AlbertSans-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Albert Sans";
  src: url("/static/fonts/AlbertSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Albert Sans";
  src: url("/static/fonts/AlbertSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --panel: #070707;
    --text: #f3f3f3;
    --muted: #a2a2a2;
    --line: #292929;
    --button: #151515;
    --button-hover: #252525;
    --accent: #2d9b7d;
    --accent-hover: #237e66;
    --danger: #ff7a70;
    --input: #030303;
    --shadow: rgba(255, 255, 255, 0.08);
  }
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8;
  --panel: #ffffff;
  --text: #161616;
  --muted: #656565;
  --line: #d7d7dc;
  --button: #ececf0;
  --button-hover: #d9d9df;
  --accent: #176b57;
  --accent-hover: #115342;
  --danger: #b3261e;
  --input: #ffffff;
  --shadow: rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --panel: #070707;
  --text: #f3f3f3;
  --muted: #a2a2a2;
  --line: #292929;
  --button: #151515;
  --button-hover: #252525;
  --accent: #2d9b7d;
  --accent-hover: #237e66;
  --danger: #ff7a70;
  --input: #030303;
  --shadow: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Albert Sans", Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.logo {
  display: block;
}

.logo img {
  display: block;
  height: auto;
}

.auth-logo img {
  width: 220px;
  max-width: 100%;
}

.topbar-logo img {
  width: 136px;
}

html[data-theme="light"] .logo source,
html[data-theme="dark"] .logo source {
  display: none;
}

html[data-theme="dark"] .logo img {
  content: url("/static/images/nada-horizontal-blanco.png");
}

html[data-theme="light"] .logo img {
  content: url("/static/images/nada-horizontal-negro.png");
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px var(--shadow);
  color: var(--text);
  min-height: 34px;
  padding: 7px 12px;
  cursor: pointer;
}

button:hover {
  background: var(--button-hover);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px var(--shadow);
}

button.active,
button.primary {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px var(--shadow);
  color: #ffffff;
}

button.active:hover,
button.primary:hover {
  background: var(--accent-hover);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  padding: 8px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.check-label,
.current-toggle,
.article-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-label input,
.current-toggle input {
  width: auto;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.error {
  color: var(--danger);
  min-height: 20px;
  margin: 0;
}

.app-view {
  height: 100vh;
  display: grid;
  grid-template-rows: 46px 1fr;
}

.app-view.presenter-mode {
  height: auto;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 0 12px 0 18px;
}

.brand {
  font-weight: 700;
}

.topbar nav {
  display: flex;
  gap: 8px;
}

.layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 24%) 5px minmax(360px, 1fr) 5px minmax(190px, 22%);
}

.pane {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  overflow: auto;
}

.pane-head {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 0 10px 0 18px;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.pane-head h2 {
  margin: 0;
  font-size: 15px;
}

.head-actions {
  display: flex;
  gap: 8px;
}

.resizer {
  background: var(--line);
  cursor: col-resize;
  min-width: 5px;
}

.resizer:hover,
.resizer.dragging {
  background: var(--accent);
}

.news-list,
.notes-list {
  display: grid;
}

.notes-list {
  align-content: start;
}

.news-item {
  text-align: left;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
  padding: 13px 12px 13px 18px;
  min-height: 44px;
}

.news-item:hover,
.news-item.selected,
.news-item.current {
  background: var(--button);
  box-shadow: none;
}

.news-item strong,
.news-item span,
.archive-pill {
  display: block;
}

.news-item strong {
  font-family: "Albert Sans", Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.15;
}

.news-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.presenting-label b {
  color: var(--danger);
}

.news-item.archived strong {
  color: var(--muted);
}

.archive-pill {
  width: fit-content;
  background: var(--button);
  color: var(--muted);
  border-radius: 8px;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
  padding: 4px 6px;
}

.content {
  border: 0;
}

.empty-state {
  padding: 16px;
  color: var(--muted);
}

.article-controls {
  padding: 12px 16px 0;
}

.current-toggle {
  color: var(--muted);
}

.read-view {
  padding: 16px;
  line-height: 1.55;
}

.presenter-mode .topbar {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}

.presenter-mode .layout {
  display: block;
}

.presenter-mode .navigator,
.presenter-mode .notes,
.presenter-mode .resizer,
.presenter-mode .content .pane-head,
.presenter-mode .article-controls {
  display: none;
}

.presenter-mode .content {
  max-width: 920px;
  margin: 0 auto;
  min-height: calc(100vh - 46px);
  background: var(--panel);
}

.presenter-mode .read-view {
  padding: 42px 28px 72px;
}

.read-view h1 {
  margin: 0 0 20px;
  font-family: "Fraunces News", Georgia, serif;
  font-size: 52px;
  font-weight: 600;
  line-height: 0.92;
}

.read-links {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin: 0 0 14px;
}

.read-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  background: #d9efe6;
  color: #123b31;
  border: 0;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1.2;
  text-decoration: none;
  word-break: break-all;
}

.read-link img {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.read-link span {
  min-width: 0;
}

.read-link:hover {
  background: #c5e5d8;
}

html[data-theme="dark"] .read-link {
  background: #16362d;
  color: #d8f1e8;
}

html[data-theme="dark"] .read-link img {
  filter: invert(1);
}

html[data-theme="dark"] .read-link:hover {
  background: #1f463b;
}

.read-body img {
  display: block;
  max-width: min(100%, 600px);
  border-radius: 16px;
}

.read-body iframe {
  max-width: 100%;
}

.editor {
  height: calc(100% - 48px);
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto auto;
  gap: 10px;
  padding: 10px;
}

.links-head,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.links-list {
  display: grid;
  gap: 8px;
}

.link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.body-label {
  display: block;
}

#newsBody {
  min-height: 260px;
  resize: none;
  line-height: 1.45;
}

#newsBody.drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.preview {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  line-height: 1.55;
}

.preview img {
  display: block;
  max-width: min(100%, 600px);
  border-radius: 16px;
}

.preview iframe {
  max-width: 100%;
}

.notes {
  display: grid;
  grid-template-rows: 48px 1fr auto;
}

.note {
  display: grid;
  justify-items: start;
  gap: 1px;
  margin: 10px 10px 10px 18px;
}

.note-chip {
  display: block;
  width: fit-content;
  max-width: 100%;
  border-radius: 8px;
  padding: 10px;
  margin: 0;
  white-space: pre-wrap;
}

.note-color-sage {
  background: #eef0d0;
  color: #30320e;
}

.note-color-mint {
  background: #d9efe6;
  color: #123b31;
}

.note-color-sky {
  background: #dcecf8;
  color: #143247;
}

.note-color-lavender {
  background: #e8e0f4;
  color: #35264a;
}

.note-color-rose {
  background: #f4dfe7;
  color: #4c1f32;
}

.note-color-peach {
  background: #f6e1d2;
  color: #4b2a16;
}

.note-color-butter {
  background: #f5edc8;
  color: #443809;
}

.note-color-stone {
  background: #e7e3dc;
  color: #34302a;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  flex-wrap: nowrap;
  white-space: nowrap;
}

.note-meta small,
.delete-note {
  display: inline;
  margin: 0;
  white-space: nowrap;
}

.note-dot {
  color: var(--text);
}

.delete-note {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
}

.delete-note:hover {
  background: transparent;
  color: var(--danger);
  text-decoration: underline;
}

.note-form {
  border-top: 1px solid var(--line);
  padding: 10px 10px 10px 18px;
  display: grid;
  gap: 8px;
}

.note-form textarea {
  min-height: 82px;
  resize: vertical;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: block;
  background: var(--bg);
}

.settings-panel {
  width: 100%;
  min-height: 100vh;
  background: var(--panel);
}

.settings-head {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.settings-head h2 {
  margin: 0;
}

.settings-section {
  max-width: 700px;
  margin: 0 auto;
  display: grid;
  border-bottom: 1px solid var(--line);
}

.settings-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 12px;
  font-weight: 700;
}

.settings-section-toggle:hover {
  background: var(--button);
  box-shadow: none;
}

.settings-section-icon {
  color: var(--muted);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.settings-section-body {
  padding: 0 12px 16px;
}

.password-form {
  display: grid;
  gap: 10px;
  max-width: 420px;
}

.settings-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
}

.color-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.color-choice {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  text-transform: capitalize;
}

.color-choice:hover,
.color-choice.selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (max-width: 820px) {
  .app-view {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    height: auto;
    min-height: 46px;
    flex-wrap: wrap;
    padding: 8px 10px;
  }

  .layout {
    display: block;
  }

  .pane {
    min-height: 280px;
    border-bottom: 1px solid var(--line);
  }

  .resizer {
    display: none;
  }

  .title-row,
  .link-row {
    grid-template-columns: 1fr;
  }

  #newsBody {
    min-height: 280px;
  }
}
