:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #fff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --blue: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    'Apple Color Emoji',
    'Segoe UI Emoji';
  background: var(--bg);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

.auth-wrap {
  max-width: 980px;
  margin: 48px auto;
  padding: 0 16px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

@media (max-width: 760px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.auth-card h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.captcha-block {
  display: grid;
  gap: 8px;
}

.captcha-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.captcha-prompt {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.captcha-refresh {
  white-space: nowrap;
}

.header {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.header-inner {
  width: 100%;
  margin: 0;
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.title {
  font-weight: 700;
  font-size: 16px;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.user-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}

.control {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font-size: 13px;
}

.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  font-size: 13px;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial,
    'Noto Sans', 'Liberation Sans', sans-serif;
  resize: vertical;
}

.button {
  height: 36px;
  border: 1px solid #111827;
  border-radius: 8px;
  padding: 0 12px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: #111827;
  border-color: var(--border);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  width: 100%;
  margin: 0;
  padding: 0 16px 12px;
  color: #b91c1c;
  font-size: 13px;
}

.main {
  width: 100%;
  margin: 0;
  padding: 16px;
  display: block;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-title {
  font-weight: 700;
  font-size: 14px;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  vertical-align: top;
}

.table th {
  background: #f9fafb;
  position: sticky;
  top: 0;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable::after {
  content: '<>';
  margin-left: 6px;
  font-size: 11px;
  color: #cbd5e1;
}

.table th.sortable[data-active='true'][data-dir='asc']::after {
  content: '^';
  color: var(--blue);
}

.table th.sortable[data-active='true'][data-dir='desc']::after {
  content: 'v';
  color: var(--blue);
}

.table th.actions-col,
.table td.actions-col {
  width: 88px;
  min-width: 88px;
  text-align: center;
}

.row-button {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

.row-button:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  color: #111827;
  background: #f9fafb;
}

.badge.nuevo {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.badge.interesante {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.badge.solicitud {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.badge.conversacion {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.badge.archivado {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pageinfo {
  font-size: 12px;
  color: var(--muted);
  min-width: 100px;
  text-align: center;
}

.detail {
  padding: 14px;
  font-size: 13px;
}

.detail-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}

.detail-title {
  font-weight: 700;
  font-size: 14px;
}

.detail-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.detail-links {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}

.detail-links a {
  color: var(--blue);
  text-decoration: none;
}

.detail-links a:hover {
  text-decoration: underline;
}

.section {
  margin-top: 14px;
}

.section-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.pre {
  margin: 0;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 960px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

.list {
  margin: 0;
  padding-left: 18px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  width: 34px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.icon-btn:hover:not(:disabled) {
  background: #f8fafc;
}

.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-btn.interesting {
  border-color: #fda4af;
  color: #be123c;
}

.icon-btn.archive {
  border-color: #cbd5e1;
  color: #334155;
}

.icon-btn.interesting svg path {
  fill: currentColor;
  stroke: none;
}

.settings-wrap {
  width: 100%;
  margin: 0;
  padding: 14px 16px 0;
}

.settings-inner {
  width: 100%;
}

.settings-grid {
  padding: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

@media (max-width: 960px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  z-index: 1;
}

