/* ============================================================
   MailCleaner — App-style UI
   ============================================================ */

:root {
    --primary:      #4285f4;
    --primary-dark: #2b6fd6;
    --primary-light:#e8f0fe;
    --success:      #34a853;
    --warning:      #fbbc04;
    --danger:       #ea4335;
    --surface:      #ffffff;
    --bg:           #f5f7ff;
    --text:         #202124;
    --text-muted:   #5f6368;
    --border:       #e8eaed;
    --radius:       16px;
    --radius-sm:    10px;
    --header-h:     60px;
    --bottom-nav-h: 64px;
    --shadow:       0 2px 12px rgba(66,133,244,.10);
    --shadow-md:    0 4px 20px rgba(66,133,244,.15);
    --shadow-lg:    0 8px 32px rgba(66,133,244,.20);
    --transition:   .2s cubic-bezier(.4,0,.2,1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    min-height: 100dvh;
}

a { text-decoration: none; color: inherit; }

/* ============================================================
   APP HEADER (páginas internas)
   ============================================================ */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--primary);
    z-index: 100;
    box-shadow: 0 2px 8px rgba(66,133,244,.3);
    /* Safe area para notch */
    padding-top: env(safe-area-inset-top);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    padding: 0 16px;
}

.app-header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    letter-spacing: .3px;
    pointer-events: none;
}

.app-back-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    transition: background var(--transition);
}
.app-back-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

.app-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.5);
    cursor: pointer;
    transition: border-color var(--transition);
}
.app-avatar:hover { border-color: #fff; }

.app-header-left, .app-header-right {
    width: 50px;
    display: flex;
    align-items: center;
}
.app-header-right { justify-content: flex-end; }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 500;
    transition: color var(--transition);
    padding: 6px 0;
    position: relative;
}

.bottom-nav-item i {
    font-size: 1.35rem;
    line-height: 1;
    transition: transform var(--transition);
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 32px; height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* ============================================================
   MAIN CONTENT (páginas internas)
   ============================================================ */
.app-main {
    padding-top: calc(var(--header-h) + 16px);
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
    min-height: 100dvh;
}

/* ============================================================
   HERO (index.php)
   ============================================================ */
.hero-section {
    background: linear-gradient(160deg, #e8f0fe 0%, #ffffff 60%, #e6f4ea 100%);
    min-height: 100dvh;
    display: flex;
    align-items: center;
    padding: 2rem 0 5rem;
}

.hero-icon .icon-wrapper {
    width: 88px; height: 88px;
    background: var(--primary);
    border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    box-shadow: 0 8px 24px rgba(66,133,244,.35);
}

.hero-icon .icon-wrapper i { color: #fff; font-size: 2.4rem; }

.hero-title {
    font-size: clamp(1.9rem, 5vw, 3rem);
    line-height: 1.15;
    letter-spacing: -.5px;
}

.btn-hero {
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 600;
    box-shadow: 0 6px 24px rgba(66,133,244,.4);
    padding: .85rem 2.5rem !important;
    transition: transform var(--transition), box-shadow var(--transition);
}
.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(66,133,244,.5);
}

.feature-card {
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
    transition: transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md) !important;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border-radius: var(--radius) !important;
    border: none !important;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg) !important;
}

/* Dashboard action cards */
.action-card {
    cursor: pointer;
    overflow: hidden;
}

.action-card .card-body {
    padding: 1.5rem !important;
}

.action-icon-wrap {
    width: 56px; height: 56px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 1rem;
    transition: transform var(--transition);
}

.action-card:hover .action-icon-wrap { transform: scale(1.08); }

/* Recovery banner */
.recovery-card {
    background: linear-gradient(135deg, var(--primary) 0%, #1a56db 100%) !important;
    color: #fff !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg) !important;
}
.recovery-card .text-muted { color: rgba(255,255,255,.8) !important; }
.recovery-card h3 { color: #fff !important; }

/* Stats cards */
.stat-card { text-align: center; padding: 1.2rem 1rem; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; font-weight: 500; }
.stat-card.highlight .stat-value { color: var(--primary); }

/* ============================================================
   YEAR / SENDER / SPACE ITEMS
   ============================================================ */
.item-card {
    border-radius: var(--radius) !important;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1rem 1.2rem;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow var(--transition), transform var(--transition);
}
.item-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* Variante para tarjetas con chips de filtro */
.item-card--tall {
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
}
.item-card-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Toggle "Por tipo de archivo" */
.type-toggle-section {
    width: 100%;
}
.type-toggle-btn {
    display: flex;
    align-items: center;
    gap: .45rem;
    width: 100%;
    background: #f1f3f4;
    border: none;
    border-radius: 10px;
    padding: .42rem .75rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.type-toggle-btn:hover,
.type-toggle-btn.open {
    background: var(--primary-light);
    color: var(--primary);
}
.toggle-chevron {
    font-size: .7rem;
    transition: transform var(--transition);
}
.type-toggle-btn.open .toggle-chevron {
    transform: rotate(180deg);
}

/* Fila inferior: toggle "Por tipo" + botón Eliminar juntos */
.space-card-footer {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.space-card-footer .type-toggle-btn {
    flex: 1;
    min-width: 0;
}
.space-card-footer .btn-trash,
.space-card-footer .btn-delete {
    flex-shrink: 0;
}

/* Chips de tipo de archivo */
.type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .5rem 2px 0;
}
.type-chip {
    padding: .22rem .65rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    background: #f1f3f4;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    border: 1.5px solid transparent;
}
.type-chip:hover:not(.active) {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}
.type-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.chip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #c0392b;
    color: #fff;
    border-radius: 10px;
    font-size: .58rem;
    font-weight: 700;
    line-height: 1;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    margin-left: 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}
.type-chip.active .chip-badge {
    background: rgba(255,255,255,.35);
    color: #fff;
}

.year-badge {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    min-width: 54px;
    line-height: 1;
}

.sender-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Sender card — layout vertical (nombre completo + botones debajo) */
.sender-card {
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1rem 1.2rem;
    margin-bottom: .75rem;
    transition: box-shadow var(--transition), transform var(--transition);
}
.sender-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.sender-card-top {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: .75rem;
}

.sender-card-name {
    font-weight: 600;
    font-size: .95rem;
    line-height: 1.3;
    word-break: break-all;
    color: var(--text);
}

.sender-card-stats {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.email-count-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .28rem .4rem;
    margin-top: .35rem;
}

.email-count-highlight {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: .18rem .55rem;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0;
}

.email-count-label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text);
}

.email-count-meta {
    font-size: .74rem;
    color: var(--text-muted);
}

.dashboard-count-highlight {
    color: var(--primary);
    font-size: 2rem;
    line-height: 1;
}

.sender-card-actions {
    display: flex;
    gap: .5rem;
}
.sender-card-actions .btn-trash,
.sender-card-actions .btn-block {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .55rem .75rem;
}

.category-icon {
    width: 50px; height: 50px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.item-info { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.item-sub .email-count-row { margin-top: .25rem; }

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
    border-radius: 10px;
    font-weight: 600;
    font-size: .88rem;
    transition: all var(--transition);
    border: none;
}

.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-danger:hover, .btn-success:hover, .btn-warning:hover { transform: translateY(-1px); }

.btn-sm { border-radius: 8px; font-size: .8rem; }

.btn-trash {
    background: #fce8e6;
    color: var(--danger);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: .82rem;
    padding: .45rem 1rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition);
}
.btn-trash:hover { background: var(--danger); color: #fff; }

.btn-delete {
    background: #4a0000;
    color: #ffcdd2;
    border-radius: 10px;
    font-weight: 600;
    font-size: .82rem;
    padding: .45rem 1rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition);
    border: none;
}
.btn-delete:hover { background: #6d0000; color: #fff; transform: translateY(-1px); }

.btn-block {
    background: #fef3e2;
    color: #e37400;
    border-radius: 10px;
    font-weight: 600;
    font-size: .82rem;
    padding: .45rem 1rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition);
}
.btn-block:hover { background: #e37400; color: #fff; }

/* Etiqueta de categoría en suscripciones */
.cat-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 4px;
    margin-bottom: .5rem;
}

/* ============================================================
   SKELETON
   ============================================================ */
.skeleton-line {
    background: linear-gradient(90deg, #eef0f3 25%, #f7f8fa 50%, #eef0f3 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: 8px;
    display: block;
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-state {
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-align: center;
    color: var(--text);
}

.loading-state-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin: 0 auto .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    position: relative;
}

.loading-state-icon::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(66, 133, 244, .18);
    border-top-color: var(--primary);
    animation: loading-spin .85s linear infinite;
}

.loading-state-title {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .2rem;
}

.loading-state-text {
    font-size: .78rem;
    color: var(--text-muted);
    margin: 0 auto;
    max-width: 280px;
}

.loading-card-list {
    display: grid;
    gap: .75rem;
    margin-top: 1rem;
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
    border-radius: 20px !important;
    border: none !important;
    overflow: hidden;
}
.modal-backdrop { backdrop-filter: blur(4px); }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    width: min(360px, 90vw);
}

.app-toast {
    width: 100%;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    animation: toast-slide-up .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes toast-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   PAGE TRANSITION
   ============================================================ */
.page-enter {
    animation: page-fade-in .25s ease;
}
@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.letter-spacing-1 { letter-spacing: 1px; }
.fs-hero { font-size: clamp(2rem, 5vw, 3rem); }

/* Safe area padding */
.pb-safe { padding-bottom: env(safe-area-inset-bottom); }

/* Scrollbar fino */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5c8cc; border-radius: 4px; }

/* ============================================================
   MODO OSCURO
   ============================================================ */
[data-theme="dark"] {
    --primary:      #6aabff;
    --primary-dark: #4285f4;
    --primary-light:#1a2a42;
    --surface:      #1e1e2e;
    --bg:           #12121c;
    --text:         #e2e8f0;
    --text-muted:   #8a9ab0;
    --border:       #2a2a3c;
    --shadow:       0 2px 12px rgba(0,0,0,.4);
    --shadow-md:    0 4px 20px rgba(0,0,0,.5);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.6);
}
[data-theme="dark"] body                { background: var(--bg); color: var(--text); }
[data-theme="dark"] .card,
[data-theme="dark"] .item-card,
[data-theme="dark"] .sender-card        { background: var(--surface) !important; }
[data-theme="dark"] .modal-content      { background: var(--surface) !important; color: var(--text); }
[data-theme="dark"] .dropdown-menu      { background: #252535 !important; border-color: var(--border) !important; }
[data-theme="dark"] .dropdown-item      { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover{ background: var(--primary-light) !important; }
[data-theme="dark"] .dropdown-item-text { color: var(--text-muted) !important; }
[data-theme="dark"] .dropdown-divider   { border-color: var(--border); }
[data-theme="dark"] .btn-light          { background: #2a2a3c; color: var(--text); border-color: var(--border); }
[data-theme="dark"] .bottom-nav         { background: #1a1a2a; border-color: var(--border); }
[data-theme="dark"] .type-toggle-btn    { background: #2a2a3c; }
[data-theme="dark"] .type-chip          { background: #2a2a3c; color: var(--text-muted); }
[data-theme="dark"] .skeleton-line      {
    background: linear-gradient(90deg, #2a2a3c 25%, #3a3a4c 50%, #2a2a3c 75%);
    background-size: 200% 100%;
}
[data-theme="dark"] .loading-state      { background: var(--surface); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .input-group-text   { background: #2a2a3c !important; color: var(--text) !important; border-color: var(--border) !important; }
[data-theme="dark"] .text-muted         { color: var(--text-muted) !important; }
[data-theme="dark"] .text-dark          { color: var(--text) !important; }
[data-theme="dark"] .border-top         { border-color: var(--border) !important; }
[data-theme="dark"] .badge.bg-success-subtle { background: #1a3a2a !important; }
[data-theme="dark"] .progress           { background: #2a2a3c; }
[data-theme="dark"] .preview-item       { border-color: #3a3a4c; }

/* ============================================================
   ALMACENAMIENTO
   ============================================================ */
.storage-bar-wrap {
    height: 10px;
    border-radius: 8px;
    background: var(--border);
    overflow: hidden;
}
.storage-bar {
    height: 100%;
    border-radius: 8px;
    transition: width .8s cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   VISTA PREVIA EN MODAL
   ============================================================ */
.preview-item {
    font-size: .78rem;
    padding: .55rem .65rem;
    border-left: 3px solid var(--border);
    margin-bottom: .3rem;
    border-radius: 0 6px 6px 0;
    color: var(--text-muted);
    background: var(--bg);
}

.preview-subject {
    display: block;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-meta {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
    margin-top: .18rem;
    font-size: .7rem;
}

.preview-pill {
    border-radius: 999px;
    padding: .1rem .42rem;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}


/* ============================================================
   FRIENDLY SEARCH
   ============================================================ */
.search-helper-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.search-helper-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f3e8fd;
    color: #8430ce;
    font-size: 1.35rem;
}

.friendly-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.friendly-preset {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: .85rem;
    text-align: left;
    display: grid;
    gap: .25rem;
    color: var(--text);
}

.friendly-preset i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: .15rem;
}

.friendly-preset span {
    font-size: .9rem;
    font-weight: 700;
}

.friendly-preset small {
    color: var(--text-muted);
    font-size: .7rem;
}

.search-input-wrap {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--surface);
}

.advanced-search {
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: .85rem 1rem;
}

.advanced-search summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 700;
    list-style: none;
}

.advanced-search summary::-webkit-details-marker {
    display: none;
}

.result-focus-card {
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: 1.35rem;
    text-align: center;
    margin-bottom: 1rem;
}

.result-count-big {
    font-size: clamp(2.7rem, 11vw, 4.8rem);
    line-height: .95;
    font-weight: 800;
    color: var(--primary);
}

.result-label {
    color: var(--primary);
    font-size: .82rem;
    font-weight: 700;
    margin-top: .25rem;
}

.result-title {
    font-size: .95rem;
    font-weight: 700;
    margin-top: .8rem;
}

.result-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.result-actions .btn-trash {
    min-width: min(260px, 100%);
    padding: .75rem 1rem;
}

.advanced-guide {
    border-top: 1px solid var(--border);
    padding-top: .85rem;
}

.guide-example {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: var(--bg);
    padding: .6rem .7rem;
    margin-bottom: .45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    text-align: left;
}

.guide-example span {
    font-size: .76rem;
    font-weight: 600;
    color: var(--text);
}

.guide-example code {
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 8px;
    padding: .2rem .4rem;
    font-size: .68rem;
    white-space: nowrap;
}

[data-theme="dark"] .search-helper-card,
[data-theme="dark"] .friendly-preset,
[data-theme="dark"] .advanced-search,
[data-theme="dark"] .search-input-wrap {
    background: var(--surface);
}

/* ============================================================
   GUIDED CLEANING
   ============================================================ */
.guided-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.guided-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255,255,255,.18);
    font-size: 1.35rem;
}

.trust-strip {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .75rem .9rem;
    border-radius: 12px;
    background: #e6f4ea;
    color: #1e8e3e;
    font-size: .78rem;
    font-weight: 600;
}

.clean-levels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}

.clean-level-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    padding: .65rem .4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    box-shadow: var(--shadow);
}

.clean-level-btn span {
    font-size: .82rem;
    font-weight: 700;
}

.clean-level-btn small {
    font-size: .62rem;
    color: var(--text-muted);
}

.clean-level-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.clean-badge {
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: .62rem;
    font-weight: 700;
    padding: .25rem .5rem;
    white-space: nowrap;
}

.gmail-open-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .55rem .75rem;
}

.icon-soft-btn {
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.protected-box {
    padding: .85rem;
    border-radius: 12px;
    background: #e6f4ea;
}

.protected-list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.protected-chip {
    border: 0;
    border-radius: 999px;
    padding: .32rem .6rem;
    background: #fff;
    color: #1e8e3e;
    font-size: .72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

[data-theme="dark"] .trust-strip,
[data-theme="dark"] .protected-box {
    background: #1a3a2a;
    color: #7bd88f;
}

[data-theme="dark"] .protected-chip {
    background: #203d2d;
    color: #9cf0ae;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-hero {
    overflow: hidden;
    position: relative;
}

.about-icon {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fce8e6;
    color: var(--danger);
    font-size: 1.8rem;
}

.about-mini-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}

[data-theme="dark"] .about-icon {
    background: #3a2028;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 768px) {
    /* En escritorio, el bottom nav se oculta y se muestra sidebar */
    .bottom-nav { display: none; }
    .app-main { padding-bottom: 2rem; }

    #toast-container {
        bottom: 1.5rem;
        left: auto;
        right: 1.5rem;
        transform: none;
    }
}

@media (min-width: 1024px) {
    :root {
        --header-h: 64px;
    }

    body {
        background:
            linear-gradient(180deg, rgba(66,133,244,.06), transparent 280px),
            var(--bg);
    }

    .app-header-inner {
        max-width: 1180px;
        margin: 0 auto;
        padding: 0 28px;
    }

    .app-header-title {
        font-size: 1.12rem;
    }

    .app-main {
        padding-top: calc(var(--header-h) + 28px);
    }

    .app-main > .container-fluid {
        max-width: 860px !important;
    }

    .dashboard-shell {
        max-width: 1100px !important;
    }

    .dashboard-shell > .mb-4.pt-1 {
        margin-bottom: 1.25rem !important;
    }

    .dashboard-shell > .mb-4.pt-1 h2 {
        font-size: 1.55rem !important;
    }

    .dashboard-guided-link {
        display: block;
    }

    .guided-card {
        min-height: 112px;
        padding: 1.35rem 1.5rem;
    }

    .guided-card .fw-bold {
        font-size: 1.2rem;
    }

    .trust-strip {
        max-width: none;
    }

    #stats-cards .col-6 {
        width: 25%;
    }

    .dashboard-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .dashboard-actions > a {
        display: block;
    }

    .dashboard-actions .action-card {
        height: 100%;
        margin-bottom: 0 !important;
    }

    .dashboard-actions .action-card .card-body {
        min-height: 118px;
    }

    .dashboard-actions > a:last-child {
        grid-column: 1 / -1;
    }

    .sender-card,
    .item-card,
    .protected-box,
    .clean-levels,
    .trust-strip,
    .recovery-card,
    #total-card,
    #drive-trash-card {
        max-width: 820px;
        margin-left: auto;
        margin-right: auto;
    }

    .dashboard-shell .sender-card,
    .dashboard-shell .item-card,
    .dashboard-shell .protected-box,
    .dashboard-shell .trust-strip,
    .dashboard-shell .recovery-card,
    .dashboard-shell #total-card {
        max-width: none;
    }

    .sender-card-actions {
        justify-content: flex-end;
    }

    .sender-card-actions .btn-trash,
    .sender-card-actions .btn-block,
    .sender-card-actions .gmail-open-btn {
        flex: 0 0 150px;
    }

    .space-card-footer {
        justify-content: flex-end;
    }

    .space-card-footer .type-toggle-btn {
        max-width: 320px;
    }

    .space-card-footer .btn-trash,
    .space-card-footer .btn-delete {
        min-width: 150px;
    }

    .modal-dialog {
        max-width: 460px;
    }
}
