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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #273548;
  --border: rgba(255,255,255,0.08);
  --text: #f1f5f9;
  --text2: #94a3b8;
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.15);
  --red: #ef4444;
  --green: #22c55e;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Screens ── */
.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.screen.active { display: flex; }

/* ── Auth ── */
.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 32px 24px;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.auth-logo svg { width: 48px; height: 48px; }

.auth-logo h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-logo span {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

.auth-form {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-form input:focus { border-color: var(--blue); }

.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.5; }

.auth-error {
  font-size: 13px;
  color: var(--red);
  text-align: center;
  min-height: 18px;
}

/* ── Main header ── */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.header-logo svg { width: 24px; height: 24px; }
.header-logo span { color: var(--text2); font-weight: 400; }

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

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:active { background: var(--surface2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Tabs ── */
.tabs {
  display: flex;
  padding: 12px 20px 0;
  gap: 4px;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 9px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  background: var(--blue-dim);
  color: var(--blue);
}

/* ── Capture panel ── */
.capture-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.capture-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px 20px;
}

.capture-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.capture-btn:active { background: var(--surface2); border-color: var(--blue); }
.capture-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.capture-text-wrap {
  padding: 0 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.capture-text-wrap textarea {
  width: 100%;
  min-height: 90px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}
.capture-text-wrap textarea:focus { border-color: var(--blue); }
.capture-text-wrap textarea::placeholder { color: var(--text2); }

.capture-send-row {
  display: flex;
  gap: 8px;
}

.board-picker {
  flex: 1;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  height: 44px;
}

.btn-send {
  padding: 0 20px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-send:active { opacity: 0.8; }

/* ── Inbox (bandeja) ── */
.inbox-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: calc(20px + var(--safe-bottom));
}

.inbox-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text2);
  font-size: 14px;
  text-align: center;
  padding: 40px 0;
}
.inbox-empty svg { width: 40px; height: 40px; opacity: 0.3; }

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.inbox-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.inbox-item-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--text2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inbox-item-icon img { width: 100%; height: 100%; object-fit: cover; }

.inbox-item-body { flex: 1; min-width: 0; }

.inbox-item-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
  margin-bottom: 3px;
}

.inbox-item-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.inbox-item-board {
  font-size: 11px;
  color: var(--blue);
  margin-top: 4px;
  font-weight: 500;
}

.inbox-item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.item-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.item-action-btn:active { background: var(--border); }
.item-action-btn.delete:active { background: rgba(239,68,68,0.15); color: var(--red); }
.item-action-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Link preview ── */
.link-preview-img {
  width: 100%;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 4px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(15,23,42,0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(12px);
  z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Hidden inputs ── */
input[type="file"] { display: none; }
