:root {
  --ink: #f6f2ea;
  --muted: #b8c0c2;
  --paper: #fffaf0;
  --blue-950: #09161b;
  --blue-900: #0d2028;
  --blue-800: #132e38;
  --line: rgba(255, 255, 255, 0.13);
  --gold: #d9ad63;
  --active: #71c99a;
  --inactive: #d7796f;
  --pending: #d9ad63;
  --neutral: #95a4aa;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--blue-950);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 48px;
  padding: 56px;
  background:
    linear-gradient(90deg, rgba(9, 22, 27, 0.92), rgba(9, 22, 27, 0.72)),
    url("../assets/covers/LIB000001_milei-revolucion-no-vieron-venir-2025.jpg") center / cover;
}

.login-copy h1,
.topbar h1,
.note-header h2 {
  margin: 0;
  max-width: 760px;
  font-family: "Arial Narrow", "Segoe UI Condensed", "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0;
  line-height: 0.95;
}

.login-copy h1 {
  font-size: clamp(48px, 8vw, 104px);
}

.login-copy p {
  max-width: 560px;
  color: var(--muted);
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-box {
  padding: 28px;
  border: 1px solid var(--line);
  background: rgba(13, 32, 40, 0.9);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

.login-box label,
.field span,
.book-card label,
.search-box span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

select option {
  color: #101820;
}

button {
  border: 0;
  background: var(--ink);
  color: #10252d;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

.login-error {
  color: var(--inactive);
  margin-bottom: 0;
}

.app-shell {
  height: 100vh;
  overflow: hidden;
  padding: 22px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  align-items: end;
  gap: 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(19, 46, 56, 0.95), rgba(9, 22, 27, 0.88));
}

.topbar h1 {
  font-size: clamp(34px, 5vw, 64px);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.stat {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 26px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 12px;
  height: calc(100vh - 190px);
  min-height: 560px;
}

.sidebar,
.reader {
  border: 1px solid var(--line);
  background: rgba(13, 32, 40, 0.76);
}

.sidebar {
  padding: 16px;
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.book-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.book-card img {
  width: 104px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

.field {
  display: block;
  margin-bottom: 12px;
}

.notes-panel {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin-top: 18px;
}

.panel-title,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.notes-list {
  display: grid;
  min-height: 0;
  overflow: auto;
  gap: 8px;
  padding-right: 4px;
}

.note-item {
  width: 100%;
  min-height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  padding: 11px;
  font-weight: 400;
  text-align: left;
}

.note-item.is-selected {
  border-color: rgba(217, 173, 99, 0.8);
  background: rgba(217, 173, 99, 0.14);
}

.note-item-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 6px;
}

.note-item-title {
  display: block;
  flex: 1;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.source-type-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 102px;
}

.source-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.source-type-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-article {
  background: #3b82f6;
}

.icon-book {
  background: #7c3aed;
}

.icon-database {
  background: #0891b2;
}

.icon-dictionary,
.icon-document {
  background: #64748b;
}

.icon-law {
  background: #b45309;
}

.icon-lock {
  background: #475569;
}

.icon-newspaper {
  background: #2563eb;
}

.icon-reference {
  background: #d97706;
}

.icon-social {
  background: #db2777;
}

.icon-video {
  background: #dc2626;
}

.icon-web {
  background: #059669;
}

.note-item-excerpt {
  color: var(--muted);
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-weight: 400;
  line-height: 1.32;
}

.reader {
  overflow: auto;
}

.empty-state,
#noteView {
  padding: 28px;
}

.empty-state h2 {
  margin: 0;
  font-size: 42px;
}

.note-kicker {
  color: var(--muted);
  margin-bottom: 14px;
}

.note-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.note-header h2 {
  font-size: clamp(32px, 4vw, 56px);
}

.page-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  color: var(--gold);
  padding: 9px 12px;
  font-weight: 800;
}

.text-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}

h3 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
}

.note-text {
  margin: 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.62;
  white-space: pre-wrap;
}

.evidence-block,
.sources-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.evidence-links,
.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.evidence-figure {
  width: 100%;
  margin: 0;
}

.evidence-figure img {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.evidence-figure figcaption {
  margin-top: 8px;
  font-size: 13px;
}

a {
  color: #a7d8ff;
  overflow-wrap: anywhere;
}

.source-link {
  border-bottom: 1px solid rgba(167, 216, 255, 0.5);
  text-decoration: none;
}

.replacement-link {
  color: var(--gold);
  border-color: rgba(217, 173, 99, 0.75);
  font-weight: 800;
}

.sources-list {
  display: grid;
  gap: 10px;
}

.source-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
  padding: 14px;
}

.source-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.source-top h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

.source-meta {
  margin: 0 0 10px;
  color: var(--muted);
}

.status-wrap {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 150px;
  text-align: right;
}

.status {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.status-active,
.status-si {
  color: var(--active);
}

.status-inactive,
.status-no {
  color: var(--inactive);
}

.status-pending,
.status-pendiente {
  color: var(--pending);
}

.status-neutral,
.status-no_aplica {
  color: var(--neutral);
}

@media (max-width: 980px) {
  .login-shell,
  .topbar,
  .workspace,
  .text-grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    padding: 24px;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    height: auto;
    min-height: 0;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    max-height: 720px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 10px;
  }

  .book-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .book-card img {
    width: 82px;
  }

  .note-header,
  .source-top {
    display: block;
  }

  .page-pill,
  .status-wrap {
    display: inline-block;
    margin-top: 12px;
    min-width: 0;
    text-align: left;
  }
}
