/* ================================================================
   JournalByTTS — mobile-shell.css
   Nuevos componentes del shell mobile (<1024px).
   No afecta layout desktop. No duplicar tokens de tokens.css.
   ================================================================ */

/* ── TOPBAR: overrides mobile ─────────────────────────────────── */
/* Ocultar en desktop */
.topbar-mobile-center      { display: none; }
.topbar-mobile-avatar-btn  { display: none; }

@media (max-width: 1023px) {
  /* Backdrop-blur para el topbar sticky */
  .topbar {
    background: rgba(250, 250, 247, 0.9);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    position: relative; /* para centrar el título con absolute */
    z-index: 100;
  }
  [data-theme="dark"] .topbar {
    background: rgba(11, 12, 14, 0.9);
  }

  /* Ocultar todos los items desktop del topbar */
  .topbar .mode-toggle-pill,
  .topbar .account-switcher,
  .topbar .lang-toggle-pill,
  .topbar .user-pill-wrap,
  .topbar .theme-toggle-btn,
  .topbar .topbar-sep,
  .topbar .topbar-brand-mobile,
  .topbar .topbar-page {
    display: none !important;
  }

  /* Título centrado en mobile */
  .topbar-mobile-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    white-space: nowrap;
  }
  .topbar-mobile-eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    line-height: 1;
  }
  .topbar-mobile-page {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
    margin-top: 1px;
  }

  /* Avatar button (derecha del topbar) */
  .topbar-mobile-avatar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--bg-elev);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    flex-shrink: 0;
  }
  .topbar-mobile-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .topbar-mobile-avatar-initial {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--ember-300) 0%, var(--ember-500) 60%, var(--ember-700) 100%);
  }

  /* Padding-bottom del contenido para no quedar bajo el tab bar */
  .content {
    padding-bottom: 80px !important;
  }
}

/* ── CONTEXT STRIP ────────────────────────────────────────────── */
.context-strip { display: none; }

@media (max-width: 1023px) {
  .context-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--divider);
    position: sticky;
    top: 56px;
    z-index: 99;
  }

  .ctx-account-pill {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--r-md);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: background var(--t-fast);
  }
  .ctx-account-pill:active { background: var(--bg-hover); }

  .ctx-account-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pos);
    flex-shrink: 0;
  }

  .ctx-account-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .ctx-account-firm {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ctx-account-size {
    display: block;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ctx-seg {
    display: flex;
    background: var(--bg-sunk);
    padding: 3px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    gap: 2px;
    flex-shrink: 0;
  }

  .ctx-seg-btn {
    padding: 5px 10px;
    border-radius: 7px;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-3);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
    line-height: 1;
  }
  .ctx-seg-btn.on {
    background: var(--bg-elev);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
  }
}

/* ── BOTTOM TAB BAR ───────────────────────────────────────────── */
.bottom-tabbar { display: none; }

@media (max-width: 1023px) {
  .bottom-tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 8px 8px env(safe-area-inset-bottom, 16px);
    min-height: 62px;
    background: rgba(250, 250, 247, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border);
  }
  [data-theme="dark"] .bottom-tabbar {
    background: rgba(11, 12, 14, 0.92);
  }

  .btt-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--ink-4);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-decoration: none;
    transition: color var(--t-fast);
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
  }
  .btt-tab.active { color: var(--ink); }

  .btt-tab--primary {
    background: var(--accent);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    margin-top: -10px;
    padding: 0;
    flex-direction: row;
    gap: 0;
    font-size: 0;
    box-shadow: 0 6px 14px rgba(232, 85, 43, 0.35);
    transition: background var(--t-fast), transform var(--t-fast);
    min-width: 48px;
    min-height: 48px;
  }
  .btt-tab--primary:active {
    background: var(--accent-hover);
    transform: scale(0.95);
  }

  .btt-icon { font-size: 18px; line-height: 1; }
  .btt-tab--primary .btt-icon { font-size: 20px; }
}

/* ── BOTTOM SHEET BASE ────────────────────────────────────────── */
.bottom-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 12, 14, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 200;
}
.bottom-sheet-backdrop.open {
  display: block;
  animation: bs-fade-in var(--t-base) var(--ease-out);
}
@keyframes bs-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  background: var(--bg);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  padding-top: 8px;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  max-height: 78dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--t-slow) var(--ease-out);
}
.bottom-sheet.open { transform: translateY(0); }

.bottom-sheet-grabber {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
  flex-shrink: 0;
}
.bottom-sheet-grabber::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.bottom-sheet-scroll {
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}

/* ── USER SHEET ───────────────────────────────────────────────── */
.us-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 18px 16px;
  flex-shrink: 0;
}

.us-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(232, 85, 43, 0.2);
}
.us-avatar img { width: 100%; height: 100%; object-fit: cover; }
.us-avatar-initial {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--ember-300) 0%, var(--ember-500) 60%, var(--ember-700) 100%);
}

.us-user-info { flex: 1; min-width: 0; }
.us-username {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  color: var(--ink);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.us-email {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.us-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
}

.us-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: 0 16px 8px;
}
.us-row--tappable { cursor: pointer; }
.us-row--tappable:active { background: var(--bg-hover); }

.us-row-label { flex: 1; min-width: 0; }
.us-row-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.us-row-sub {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

.us-seg {
  display: flex;
  background: var(--bg-sunk);
  padding: 3px;
  border-radius: 9px;
  gap: 2px;
  flex-shrink: 0;
}
.us-seg button {
  padding: 5px 9px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background var(--t-fast), color var(--t-fast);
}
.us-seg button.on {
  background: var(--bg-elev);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.us-theme-seg button { font-size: 14px; padding: 5px 10px; }

.us-divider {
  height: 1px;
  background: var(--divider);
  margin: 4px 16px 8px;
}

.us-menu-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast);
}
.us-menu-link:active { background: var(--bg-hover); }

.us-menu-icon {
  color: var(--ink-3);
  width: 17px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}
.us-menu-chev { margin-left: auto; color: var(--ink-4); font-size: 12px; }
.us-menu-link--danger { color: var(--neg); }
.us-menu-link--danger .us-menu-icon { color: var(--neg); }

/* ── ACCOUNTS SHEET ───────────────────────────────────────────── */
.as-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px 12px;
  flex-shrink: 0;
}
.as-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink);
  line-height: 1;
}
.as-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}
.as-new-btn { font-size: 12px !important; padding: 8px 12px !important; }

.as-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 10px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-shrink: 0;
}
.as-search-icon { color: var(--ink-3); font-size: 13px; }
.as-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 16px; /* 16px evita zoom en iOS al enfocar */
  color: var(--ink);
  outline: none;
}
.as-search-input::placeholder { color: var(--ink-4); }

.as-firm-label {
  padding: 8px 18px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

.as-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background var(--t-fast);
}
.as-account-row:active { background: var(--bg-hover); }
.as-account-row--selected { background: var(--accent-soft); }

.as-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.as-account-body { flex: 1; min-width: 0; }
.as-account-top { display: flex; align-items: center; gap: 6px; }
.as-account-size {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.as-account-login {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.as-account-bottom { margin-top: 4px; }
.as-phase-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-sunk);
  color: var(--ink-3);
}
.as-check { color: var(--accent); font-size: 14px; flex-shrink: 0; }
.as-empty, .as-loading {
  padding: 24px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}
