@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f1f0eb;
  --line: #e2e0d8;
  --line-strong: #cfccc1;
  --text: #1b1d1c;
  --muted: #62665f;
  --accent: #0e6655;
  --accent-strong: #0a5243;
  --accent-soft: #e0efea;
  --on-accent: #ffffff;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --mark: #ffe9a8;
  --shadow: 0 1px 2px rgb(30 30 20 / 5%), 0 10px 30px -14px rgb(30 30 20 / 16%);
  --radius: 14px;
  --radius-small: 9px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151716;
    --surface: #1d201f;
    --surface-2: #262a28;
    --line: #313633;
    --line-strong: #454b47;
    --text: #eceeeb;
    --muted: #a0a69f;
    --accent: #47b89f;
    --accent-strong: #62cdb5;
    --accent-soft: #1d3a33;
    --on-accent: #08231c;
    --danger: #f28b82;
    --danger-soft: #3b2120;
    --mark: #6b5a1c;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px -14px rgb(0 0 0 / 60%);
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }

a { color: var(--accent); }

button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.trap {
  position: absolute;
  left: -10000px;
}

/* Marca y enlaces */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
}

.brand-mark .icon { width: 19px; height: 19px; }

.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
}

.quiet-link .icon { width: 16px; height: 16px; }

.quiet-link:hover { color: var(--text); }

.quiet-link.centered { display: flex; justify-content: center; margin-top: 20px; }

/* Botones */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms;
}

.button .icon { width: 18px; height: 18px; }

.button.primary { background: var(--accent); color: var(--on-accent); }

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

.button.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}

.button.secondary:hover { background: var(--surface-2); }

.button.danger { background: var(--danger); color: var(--surface); }

.button.wide { width: 100%; }

.button:disabled { opacity: .65; cursor: progress; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-small);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms, color 120ms;
}

.icon-button:hover { background: var(--surface-2); color: var(--text); }

.icon-button.danger:hover { background: var(--danger-soft); color: var(--danger); }

.icon-button.small { width: 30px; height: 30px; }

.icon-button.small .icon { width: 16px; height: 16px; }

/* Parte pública */

.public-shell {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}

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

.public-main {
  flex: 1;
  padding-top: clamp(8px, 6vh, 56px);
}

.intro { margin-bottom: 22px; }

.intro h1 {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.intro p {
  margin-top: 8px;
  color: var(--muted);
}

.composer {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.composer:focus-within { border-color: var(--line-strong); }

.composer textarea {
  display: block;
  width: 100%;
  min-height: 170px;
  padding: 18px 18px 8px;
  border: 0;
  outline: 0;
  resize: vertical;
  background: none;
  font-size: 17px;
  line-height: 1.55;
}

.composer textarea::placeholder { color: var(--muted); }

.location-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: calc(100% - 28px);
  margin: 6px 14px 4px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.location-chip > .icon { width: 16px; height: 16px; color: var(--accent); }

.attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  list-style: none;
}

.attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg);
}

.attachment img,
.attachment > .icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 6px;
  object-fit: cover;
}

.attachment > .icon {
  padding: 11px;
  background: var(--surface-2);
  color: var(--muted);
}

.attachment.recorded {
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

.attachment.recorded audio,
.attachment.recorded video {
  flex: 1 1 100%;
  width: 100%;
  max-height: 260px;
  border-radius: 6px;
  background: var(--surface-2);
}

.recorder {
  margin: 6px 14px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg);
}

.recorder video {
  display: block;
  width: 100%;
  max-height: 340px;
  background: #000;
}

.recorder-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
}

.recorder-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 550;
}

.recorder-dot {
  display: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: recording-pulse 1.2s ease-in-out infinite;
}

.recorder-dot.active { display: block; }

.recorder-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.recorder-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@keyframes recording-pulse {
  50% { opacity: .3; }
}

.attachment-info {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.3;
}

.attachment-info strong,
.attachment-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-info strong { font-weight: 550; }

.attachment-info span { color: var(--muted); }

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
}

.tool {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-small);
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 120ms, color 120ms;
}

.tool:hover { background: var(--surface-2); color: var(--text); }

.tool:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }

.tool:disabled { cursor: progress; opacity: .7; }

.form-message {
  margin: 0 14px 10px;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 45%, var(--surface));
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  font: inherit;
  font-size: 12px;
}

.upload-progress {
  position: absolute;
  inset: auto 0 0;
  display: block;
  width: 100%;
  height: 3px;
  border: 0;
  background: transparent;
  appearance: none;
}

.upload-progress::-webkit-progress-bar { background: transparent; }

.upload-progress::-webkit-progress-value { background: var(--accent); }

.upload-progress::-moz-progress-bar { background: var(--accent); }

.footnote {
  margin-top: 14px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.sent {
  max-width: 420px;
  margin: 8vh auto 0;
  text-align: center;
}

.sent-mark {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.sent-mark .icon { width: 28px; height: 28px; }

.sent h1 {
  font-size: 26px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.sent p {
  margin: 8px 0 24px;
  color: var(--muted);
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.drop-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(560px, 100%);
  height: min(320px, 70vh);
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
}

.drop-target .icon { width: 32px; height: 32px; color: var(--accent); }

.drop-target strong { color: var(--text); font-size: 19px; font-weight: 650; }

/* Acceso y errores */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 16px;
}

.login-card {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 24px 0 18px;
  font-size: 22px;
  font-weight: 660;
  letter-spacing: -0.015em;
}

.login-card .form-message { margin: 0 0 16px; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 550;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--bg);
}

.error-card { text-align: center; }

.error-card h1 { margin: 6px 0 8px; }

.error-card p:not(.error-code) { margin-bottom: 20px; color: var(--muted); }

.error-code {
  color: var(--accent);
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Panel privado */

.panel {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  height: 100dvh;
}

.list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.list-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--line);
}

.list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.list-title form { margin: 0; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search > .icon {
  position: absolute;
  left: 11px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg);
  font-size: 16px;
}

.search input:focus { border-color: var(--accent); outline: 1px solid var(--accent); }

.list-count {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.note-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.note-item {
  position: relative;
  display: block;
  padding: 12px 14px 12px 22px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.note-item:hover { background: var(--surface-2); }

.note-item.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.note-item:focus-visible { outline-offset: -2px; }

.note-item.unread::before {
  content: "";
  position: absolute;
  top: 19px;
  left: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.note-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.note-item-date {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.note-item.unread .note-item-date { color: var(--text); font-weight: 600; }

.note-item-meta {
  display: inline-flex;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.note-item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.note-item-meta .icon { width: 14px; height: 14px; }

.note-item-preview {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.note-item-preview em { color: var(--muted); font-style: normal; }

mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--mark);
  color: inherit;
}

.list-empty {
  padding: 40px 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.load-more {
  display: block;
  padding: 14px;
  font-size: 14px;
  font-weight: 550;
  text-align: center;
  text-decoration: none;
}

.detail-pane {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  color: var(--muted);
  font-size: 15px;
}

.detail-empty .icon { width: 44px; height: 44px; stroke-width: 1.3; opacity: .55; }

.note { min-height: 100%; }

.note-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}

.back-button { display: none; margin-left: -8px; }

.note-heading { flex: 1; min-width: 0; }

.eyebrow {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.note-heading h1 {
  font-size: 16.5px;
  font-weight: 620;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.note-heading h1::first-letter { text-transform: uppercase; }

.note-actions { display: flex; gap: 2px; }

.note-content {
  max-width: 860px;
  padding: 24px 28px 48px;
}

.note-body {
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.note-section { margin-top: 30px; }

.note-section:first-child { margin-top: 0; }

.note-section h2 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.gallery-item {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-2);
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 160ms;
}

.gallery-item:hover img { transform: scale(1.025); }

.gallery-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: center;
  text-decoration: none;
}

.file-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.file-card + .file-card { margin-top: 10px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.file-icon { color: var(--accent); }

.file-info { flex: 1; min-width: 0; }

.file-info strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 580;
  font-variant-numeric: tabular-nums;
}

.file-info span {
  color: var(--muted);
  font-size: 13px;
}

.media-card { overflow: hidden; }

.media-card + .media-card { margin-top: 10px; }

.media-card video {
  display: block;
  width: 100%;
  max-height: 460px;
  background: #000;
}

.media-card audio {
  display: block;
  width: calc(100% - 28px);
  margin: 12px 14px 0;
}

.zip-warning {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

.storage-summary {
  display: block;
  width: 100%;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
}

.storage-summary:hover { background: var(--surface-2); color: var(--text); }

.storage-summary progress {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 6px;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface-2);
  appearance: none;
}

.storage-summary progress::-webkit-progress-bar { background: var(--line); }

.storage-summary progress::-webkit-progress-value { background: var(--accent); }

.storage-summary progress::-moz-progress-bar { background: var(--accent); }

.zip-contents {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.zip-contents summary {
  color: var(--muted);
  cursor: pointer;
}

.zip-contents ul {
  max-height: 260px;
  margin: 10px 0 0;
  padding: 0;
  overflow-y: auto;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  list-style: none;
}

.zip-contents li { padding: 2px 0; overflow-wrap: anywhere; }

dialog { color: inherit; }

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(10 12 11 / 92%);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop { background: transparent; }

.lightbox img {
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  object-fit: contain;
}

.lightbox .icon-button {
  position: absolute;
  z-index: 1;
  width: 46px;
  height: 46px;
  background: rgb(255 255 255 / 12%);
  color: #fff;
}

.lightbox .icon-button:hover { background: rgb(255 255 255 / 24%); }

.lightbox-close { top: 14px; right: 14px; }

.lightbox-nav { top: 50%; translate: 0 -50%; }

.lightbox-nav.previous { left: 14px; }

.lightbox-nav.next { right: 14px; }

.lightbox.single .lightbox-nav { display: none; }

.confirm-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop { background: rgb(0 0 0 / 45%); }

.confirm-dialog h2 {
  font-size: 18px;
  font-weight: 650;
}

.confirm-dialog p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 15px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Móvil y tabletas */

@media (max-width: 820px) {
  .panel { display: block; height: 100dvh; }

  .list-pane { height: 100dvh; border-right: 0; }

  .detail-pane { display: none; height: 100dvh; }

  .panel.showing-note .list-pane { display: none; }

  .panel.showing-note .detail-pane { display: block; }

  .back-button { display: inline-grid; }

  .note-header { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }

  .note-content { padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }

  .desktop-only { display: none; }

  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  .composer-footer { justify-content: stretch; }

  .composer-footer .button { width: 100%; }
}

@media (max-width: 480px) {
  .tools { grid-template-columns: 1fr 1fr; }

  .attachments { grid-template-columns: 1fr; }

  .file-row { flex-wrap: wrap; }

  .file-row .button { width: 100%; }

  .file-info { flex-basis: calc(100% - 40px); }

  .file-row .desktop-only { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
