/* ── Design tokens — FIFA World Cup 2026 ──────────────────────────────────── */
:root {
    --primary: #0B2265;
    --primary-light: #1a3a8f;
    --accent: #00A651;
    --accent-dark: #007A3D;
    --orange: #F5C518;
    --purple: #6a0dad;
    --blue: #1565c0;
    --red: #D4001A;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --border: #dde3ec;
    --text: #1a2332;
    --text-muted: #8293a8;
    --input-bg: #ffffff;
    --sidebar-w: 210px;
    --header-h: 54px;
    --radius: 10px;
}

[data-theme="dark"] {
    --bg: #080d18;
    --card-bg: #0f1626;
    --border: #1e2a40;
    --text: #e2e8f0;
    --text-muted: #8293a8;
    --input-bg: #0f1626;
    --blue: #5c9ef0;
    --accent: #00c860;
    --orange: #F5C518;
    --purple: #b57bee;
    --red: #ff4d6a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { max-width: 100%; overflow-x: hidden; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); transition: background 0.2s, color 0.2s; max-width: 100%; overflow-x: hidden; }
button, a { touch-action: manipulation; }
.hidden { display: none !important; }

/* ── Auth ─────────────────────────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, #0B2265 0%, #1a3a8f 40%, #0d6b3a 100%); }
.auth-card { background: var(--card-bg); border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.auth-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.auth-title { font-size: 22px; font-weight: 700; text-align: center; color: var(--primary); }
.auth-subtitle { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 24px; }
.auth-error { background: #ffebee; color: #c62828; border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.auth-form label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; margin-top: 14px; }
.auth-form input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; outline: none; background: var(--input-bg); color: var(--text); transition: border 0.2s; }
.auth-form input:focus { border-color: var(--primary); }
.auth-link { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-link a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-wrapper { display: grid; grid-template-rows: var(--header-h) 1fr; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }

.app-header { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(90deg, #0B2265 0%, #1a3a8f 50%, #0B2265 100%); color: white; padding: 0 14px; height: var(--header-h); box-shadow: 0 2px 12px rgba(0,0,0,0.3); position: sticky; top: 0; z-index: 100; gap: 8px; overflow: hidden; }
.header-brand { font-size: 17px; font-weight: 700; letter-spacing: -0.4px; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow: hidden; }

.sidebar { background: var(--card-bg); border-right: 1px solid var(--border); overflow-y: auto; padding: 14px 0; }
.sidebar-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 0 14px 8px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 9px 14px; text-decoration: none; color: var(--text); transition: background 0.15s; }
.sidebar-user:hover { background: var(--bg); }
.sidebar-user.active { background: #fce4ec; border-right: 3px solid var(--primary); }
[data-theme="dark"] .sidebar-user.active { background: #2a1520; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-info .username { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .completion { font-size: 11px; color: var(--text-muted); }

.layout-body { display: contents; }
.main-content { overflow-y: auto; padding: 18px 20px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary { background: var(--primary); color: white; border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-block { width: 100%; margin-top: 16px; padding: 12px; font-size: 16px; }

.btn-edit { background: rgba(255,255,255,0.14); color: white; border: 1.5px solid rgba(255,255,255,0.35); border-radius: 7px; padding: 5px 11px; font-size: 12px; cursor: pointer; transition: background 0.2s; white-space: nowrap; }
.btn-edit:hover, .btn-edit.active { background: rgba(255,255,255,0.26); border-color: white; }
.icon-btn { background: none; border: none; color: white; font-size: 18px; cursor: pointer; padding: 4px 6px; border-radius: 6px; transition: background 0.15s; }
.icon-btn:hover { background: rgba(255,255,255,0.15); }
.viewing-label { font-size: 13px; color: rgba(255,255,255,0.85); white-space: nowrap; }

/* Notification */
.notif-wrapper { position: relative; }
.notif-btn { background: none; border: none; color: white; font-size: 20px; cursor: pointer; position: relative; padding: 4px 6px; }
.badge { position: absolute; top: -1px; right: -3px; background: #f44336; color: white; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 5px; min-width: 16px; text-align: center; }
.notif-panel { position: absolute; right: 0; top: 38px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.15); width: 270px; z-index: 200; padding: 14px; }
.notif-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.notif-empty { font-size: 13px; color: var(--text-muted); }
.notif-item { font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }

.user-chip { display: flex; align-items: center; gap: 6px; font-size: 13px; color: white; min-width: 0; }
.user-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.user-avatar-sm { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.logout-link { color: rgba(255,255,255,0.65); font-size: 11px; text-decoration: none; margin-left: 2px; flex-shrink: 0; }
.logout-link:hover { color: white; }

/* ── Album header ─────────────────────────────────────────────────────────── */
.album-header { margin-bottom: 18px; }
.album-title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.album-title-row h2 { font-size: 18px; font-weight: 700; color: var(--primary); }
.header-controls { display: flex; gap: 8px; flex-wrap: wrap; }

.sort-controls, .view-controls { display: flex; gap: 3px; }
.sort-btn { background: var(--bg); border: 1.5px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.sort-btn:hover { border-color: var(--primary); color: var(--primary); }
.sort-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* Search bar */
.search-bar { position: relative; margin-bottom: 10px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; }
.search-bar input { width: 100%; padding: 8px 36px 8px 32px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--input-bg); color: var(--text); outline: none; transition: border 0.2s; }
.search-bar input:focus { border-color: var(--primary); }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer; padding: 2px 6px; }

/* Stats chips */
.stats-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chip { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.chip-blue { background: #e3f2fd; color: var(--blue); }
.chip-orange { background: #fff3e0; color: var(--orange); }
.chip-purple { background: #f3e5f5; color: var(--purple); }
.chip-green { background: #e8f5e9; color: var(--accent-dark); }
[data-theme="dark"] .chip-blue { background: #1a2a3a; }
[data-theme="dark"] .chip-orange { background: #2a1f0a; }
[data-theme="dark"] .chip-purple { background: #20102a; }
[data-theme="dark"] .chip-green { background: #0d1f0f; }

.progress-container { background: var(--border); border-radius: 8px; height: 9px; overflow: hidden; margin-bottom: 5px; }
.progress-bar { background: var(--accent); height: 100%; border-radius: 8px; transition: width 0.4s ease; }
.progress-label { font-size: 12px; color: var(--text-muted); }

/* ── Missing list view ────────────────────────────────────────────────────── */
.missing-view { margin-bottom: 16px; }
.missing-view-title { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.missing-list { display: flex; flex-direction: column; gap: 6px; }
.missing-row { display: flex; align-items: baseline; gap: 10px; background: var(--card-bg); border-radius: 8px; padding: 8px 12px; border: 1px solid var(--border); flex-wrap: wrap; }
.missing-country { font-size: 13px; font-weight: 700; color: var(--primary); white-space: nowrap; display: flex; align-items: center; gap: 5px; min-width: 160px; }
.flag-img-sm { width: 16px; height: auto; border-radius: 2px; }
.missing-nums { font-size: 13px; color: var(--text-muted); flex: 1; }

/* ── Country card ─────────────────────────────────────────────────────────── */
.country-card { background: var(--card-bg); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border-left: 4px solid var(--primary); }
.country-card.hidden-card { display: none; }
.country-header { display: flex; align-items: center; padding-bottom: 0; cursor: pointer; user-select: none; gap: 6px; }
.country-header:hover { opacity: 0.85; }
.country-chevron { font-size: 9px; color: var(--text-muted); flex-shrink: 0; }
.country-name { font-weight: 700; font-size: 14px; color: var(--primary); display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.flag-img { width: 20px; height: auto; border-radius: 2px; flex-shrink: 0; }
.flag-emoji { font-size: 18px; }
.country-meta { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.country-count { font-size: 11px; background: var(--bg); padding: 2px 7px; border-radius: 10px; font-weight: 700; color: var(--text-muted); }
.btn-repetidas { background: none; border: 1.5px solid var(--border); border-radius: 5px; font-size: 11px; padding: 2px 7px; cursor: pointer; color: var(--text-muted); transition: all 0.15s; white-space: nowrap; }
.btn-repetidas:hover, .btn-repetidas.open { background: #fff3e0; border-color: var(--orange); color: var(--orange); }
[data-theme="dark"] .btn-repetidas:hover, [data-theme="dark"] .btn-repetidas.open { background: #2a1f0a; }

/* Sticker grid */
.stickers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 5px; margin-top: 10px; }
.sticker { display: flex; align-items: center; justify-content: center; height: 34px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; font-weight: 700; color: #bbb; cursor: default; user-select: none; transition: all 0.15s; position: relative; }
.sticker.checked { background: var(--accent); color: white; border-color: var(--accent-dark); }
.sticker.wished { background: #fff8e1; border-color: #fbc02d; color: #f9a825; }
.sticker.wished::after { content: '⭐'; position: absolute; top: -5px; right: -5px; font-size: 9px; }
[data-theme="dark"] .sticker.wished { background: #2a200a; border-color: #f9a825; color: #f9a825; }
.sticker.editable { cursor: pointer; }
.sticker.editable:hover:not(.checked):not(.wished) { background: #e8f5e9; border-color: var(--accent); color: var(--accent-dark); }
.sticker.wish-mode-on { cursor: pointer; }
.sticker.wish-mode-on:not(.checked):hover { background: #fff8e1; border-color: #fbc02d; color: #f9a825; }

/* Repetidas */
.repetidas-section { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.rep-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 5px; }
.rep-item { display: flex; flex-direction: column; align-items: center; background: var(--bg); border: 1.5px solid var(--border); border-radius: 7px; padding: 5px 3px; gap: 3px; }
.rep-item.has-stock { border-color: var(--orange); background: #fff8f0; }
.rep-item.i-need { border-color: var(--accent); background: #e8f5e9; }
[data-theme="dark"] .rep-item.has-stock { background: #2a1f0a; }
[data-theme="dark"] .rep-item.i-need { background: #0d1f0f; }
.rep-num { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.rep-item.has-stock .rep-num { color: var(--orange); }
.rep-item.i-need .rep-num { color: var(--accent-dark); }
.rep-controls { display: flex; align-items: center; gap: 3px; }
.rep-btn { width: 20px; height: 20px; border: none; border-radius: 4px; background: var(--border); font-size: 15px; line-height: 1; cursor: pointer; font-weight: 700; color: var(--text); transition: background 0.15s; }
.rep-btn:hover { background: var(--text-muted); color: white; }
.rep-qty, .rep-qty-view { font-size: 13px; font-weight: 700; min-width: 16px; text-align: center; color: var(--orange); }
.btn-trade-sm { background: var(--primary); color: white; border: none; border-radius: 4px; font-size: 11px; padding: 2px 5px; cursor: pointer; }
.btn-trade-sm:hover { background: var(--primary-light); }
.btn-trade-need { background: var(--accent) !important; }
.btn-trade-need:hover { background: var(--accent-dark) !important; }
.rep-item.i-need .rep-num { color: var(--accent-dark); }
.need-badge { font-size: 9px; font-weight: 800; text-transform: uppercase; color: white; background: var(--accent-dark); border-radius: 4px; padding: 1px 4px; }
.wish-badge { font-size: 9px; font-weight: 700; color: #f9a825; background: #fff8e1; border-radius: 4px; padding: 1px 4px; }
[data-theme="dark"] .wish-badge { background: #2a200a; }

/* ── Match finder ─────────────────────────────────────────────────────────── */
.matches-section { margin-top: 20px; margin-bottom: 4px; }
.section-toggle-btn { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--text); width: 100%; text-align: left; transition: background 0.15s; }
.section-toggle-btn:hover { background: var(--bg); }
.match-count { color: var(--text-muted); font-weight: 400; }
.matches-body { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.match-card { background: var(--card-bg); border-radius: var(--radius); border: 1.5px solid var(--border); padding: 12px 14px; }
.match-card.match-mutual { border-color: var(--accent); }
.match-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.user-avatar-sm-inline { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.mutual-badge { background: #e8f5e9; color: var(--accent-dark); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
[data-theme="dark"] .mutual-badge { background: #0d1f0f; }
.match-row { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; align-items: flex-start; }
.match-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; padding-top: 2px; }
.match-stickers { display: flex; flex-wrap: wrap; gap: 4px; }
.match-trade-btn { margin-top: 6px; }

/* ── Trades ───────────────────────────────────────────────────────────────── */
.trades-section { margin-top: 28px; border-top: 2px solid var(--border); padding-top: 20px; }
.section-title { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 14px; }
.trades-subtitle { font-size: 13px; font-weight: 700; color: var(--text-muted); margin: 14px 0 7px; }
.trades-empty { color: var(--text-muted); font-size: 14px; padding: 12px 0; }

.trade-card { background: var(--card-bg); border-radius: var(--radius); border: 1.5px solid var(--border); padding: 12px 14px; margin-bottom: 8px; }
.trade-card.trade-past { opacity: 0.72; }
.trade-header { display: flex; align-items: center; gap: 7px; font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.trade-date { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.trade-items { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 7px; }
.trade-col { display: flex; flex-direction: column; gap: 4px; }
.trade-col-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.trade-chip { background: #e3f2fd; color: var(--blue); border-radius: 10px; padding: 2px 7px; font-size: 11px; font-weight: 700; display: inline-block; }
.trade-chip.muted { background: var(--bg); color: var(--text-muted); }
[data-theme="dark"] .trade-chip { background: #1a2a3a; }
.trade-note { font-size: 12px; color: var(--text-muted); font-style: italic; margin: 3px 0 7px; }
.trade-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.trade-waiting { font-size: 12px; color: var(--text-muted); font-style: italic; }
.btn-finalize { background: var(--accent); color: white; border: none; border-radius: 6px; padding: 5px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-finalize:hover { background: var(--accent-dark); }
.btn-archive { background: none; border: 1.5px solid var(--border); color: var(--text-muted); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-archive:hover { border-color: #f44336; color: #f44336; }
.btn-past-trades { background: none; border: 1.5px solid var(--border); border-radius: 6px; padding: 7px 14px; font-size: 12px; cursor: pointer; color: var(--text-muted); margin-top: 10px; }
.btn-past-trades:hover { background: var(--bg); }
.past-trades-section { margin-top: 10px; }
.trade-status-chip { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.trade-status-chip.completed { background: #e8f5e9; color: var(--accent-dark); }
.trade-status-chip.archived { background: var(--bg); color: var(--text-muted); }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 16px; }
.modal-box { background: var(--card-bg); border-radius: 14px; padding: 24px; width: 480px; max-width: 100%; position: relative; max-height: 85vh; overflow-y: auto; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.modal-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.modal-hint code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-family: monospace; }
.modal-section { margin-bottom: 14px; }
.modal-section label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }
.label-hint { font-weight: 400; }
.trade-want-label { font-size: 14px; font-weight: 700; background: #e3f2fd; color: var(--blue); padding: 7px 11px; border-radius: 7px; }
[data-theme="dark"] .trade-want-label { background: #1a2a3a; }
.offer-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 180px; overflow-y: auto; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px; background: var(--bg); }
.offer-item { display: inline-flex; align-items: center; gap: 4px; background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 12px; transition: all 0.15s; color: var(--text); }
.offer-item:hover { border-color: var(--orange); }
.offer-item.selected { background: #fff3e0; border-color: var(--orange); color: var(--orange); font-weight: 700; }
.offer-item.suggested { border-color: var(--accent); }
.offer-item.suggested::before { content: '⭐ '; }
[data-theme="dark"] .offer-item.selected { background: #2a1f0a; }
.modal-input { width: 100%; padding: 8px 11px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 13px; outline: none; background: var(--input-bg); color: var(--text); }
.modal-input:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Bulk entry */
.bulk-mode-toggle { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.mode-option { flex: 1; display: flex; align-items: center; gap: 10px; border: 2px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: all 0.15s; background: var(--bg); }
.mode-option:has(input:checked) { border-color: var(--primary); background: #eef2ff; }
[data-theme="dark"] .mode-option:has(input:checked) { background: #1a2040; }
.mode-option input[type=radio] { display: none; }
.mode-icon { font-size: 22px; flex-shrink: 0; }
.mode-option strong { display: block; font-size: 13px; color: var(--text); }
.mode-option small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.bulk-textarea { width: 100%; height: 120px; border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: monospace; resize: vertical; outline: none; background: var(--input-bg); color: var(--text); margin-top: 10px; }
.bulk-textarea:focus { border-color: var(--primary); }
.bulk-preview { margin-top: 10px; background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 13px; max-height: 150px; overflow-y: auto; }
.bulk-preview-row { padding: 2px 0; }
.bulk-ok { color: var(--accent-dark); }
.bulk-trading { color: var(--orange); }
.bulk-err { color: #f44336; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: #323232; color: white; padding: 11px 18px; border-radius: 8px; font-size: 13px; z-index: 600; box-shadow: 0 4px 14px rgba(0,0,0,0.3); animation: slideIn 0.25s ease; max-width: calc(100vw - 48px); }
[data-theme="dark"] .toast { background: #3a3f4a; }
@keyframes slideIn { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Hamburger button ─────────────────────────────────────────────────────── */
.hamburger { display: none; flex-direction: column; justify-content: space-between; width: 28px; height: 20px; background: none; border: none; cursor: pointer; padding: 0; flex-shrink: 0; }
.hamburger span { display: block; height: 2px; background: white; border-radius: 2px; transition: all 0.2s; }
.header-left { display: flex; align-items: center; gap: 10px; }
.brand-text { display: inline; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 149; }
.sidebar-backdrop.visible { display: block; }
.sidebar-header { display: none; justify-content: space-between; align-items: center; padding: 14px 14px 6px; }
.sidebar-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px; }

/* ── Sidebar actions ──────────────────────────────────────────────────────── */
.sidebar-actions { border-top: 1px solid var(--border); margin-top: 12px; padding: 12px 0 8px; }
.sidebar-actions-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 0 14px 8px; }
.sidebar-action-btn { display: flex; align-items: center; width: 100%; padding: 11px 16px; background: none; border: none; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; transition: background 0.15s; gap: 8px; }
.sidebar-action-btn:hover { background: var(--bg); }
.sidebar-action-btn.active { color: var(--primary); background: #eef2ff; }
[data-theme="dark"] .sidebar-action-btn.active { background: #1a2040; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    /* Layout */
    .app-wrapper { grid-template-columns: 1fr; grid-template-rows: var(--header-h) 1fr; }
    .layout-body { display: flex; flex-direction: column; overflow: hidden; height: calc(100dvh - var(--header-h)); }
    .main-content { padding: 12px 12px 100px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

    /* Header */
    .hamburger { display: flex; }
    .header-edit-group { display: none; }
    .viewing-label { display: none; }
    .brand-text { font-size: 13px; }
    .user-chip-name { display: none; }
    .logout-link { display: none; }
    .icon-btn { font-size: 16px; padding: 3px 5px; }
    .notif-btn { font-size: 18px; }
    .header-actions { gap: 6px; flex-shrink: 0; }

    /* Sidebar as drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 260px;
        z-index: 150;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
        padding-top: 0;
        overflow-y: auto;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-header { display: flex; }
    .sidebar-title { padding: 0; }

    /* Stickers — larger touch targets */
    .stickers-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
    .sticker { height: 44px; font-size: 14px; border-radius: 8px; }

    /* Repetidas */
    .rep-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
    .rep-item { padding: 7px 4px; gap: 5px; }
    .rep-btn { width: 26px; height: 26px; font-size: 17px; }
    .rep-qty, .rep-qty-view { font-size: 15px; min-width: 20px; }
    .btn-trade-sm { padding: 4px 8px; font-size: 12px; }

    /* Cards */
    .country-card { padding: 10px 12px; margin-bottom: 8px; }
    .country-name { font-size: 13px; }
    .country-count { font-size: 11px; }
    .btn-repetidas { font-size: 11px; padding: 3px 8px; }

    /* Stats chips */
    .stats-chips { gap: 4px; }
    .chip { font-size: 11px; padding: 3px 8px; }

    /* Search */
    .search-bar input { font-size: 16px; } /* prevents iOS zoom on focus */

    /* Sort/view controls */
    .header-controls { gap: 6px; }
    .sort-btn { font-size: 11px; padding: 4px 8px; }

    /* Modals — bottom sheet on mobile */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-box {
        border-radius: 20px 20px 0 0;
        padding: 16px 20px 32px;
        width: 100%;
        max-width: 100%;
        max-height: 88dvh;
    }
    .modal-handle { width: 40px; height: 4px; background: var(--border); border-radius: 4px; margin: 0 auto 16px; }
    .modal-close { top: 16px; right: 16px; }
    .modal-input { font-size: 16px; } /* prevents iOS zoom */
    .bulk-textarea { font-size: 16px; }

    /* Offer list in modal */
    .offer-list { max-height: 160px; }
    .offer-item { padding: 8px 10px; font-size: 13px; }

    /* Toast */
    .toast { bottom: 90px; left: 16px; right: 16px; text-align: center; }

    /* Trade cards */
    .trade-actions { gap: 10px; }
    .btn-finalize, .btn-archive { padding: 9px 16px; font-size: 13px; }

    /* Missing view */
    .missing-row { padding: 8px 10px; }
    .missing-country { min-width: 130px; font-size: 12px; }

    /* Album header */
    .album-title-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    .album-title-row h2 { font-size: 16px; }
    .header-controls { width: 100%; justify-content: space-between; }
    .sort-controls, .view-controls { flex: 1; }
    .sort-btn { flex: 1; text-align: center; font-size: 11px; padding: 5px 4px; }
    .stats-chips { gap: 4px; }
    .chip { font-size: 10px; padding: 3px 7px; }
}

/* Very small screens */
@media (max-width: 360px) {
    .stickers-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
    .sticker { height: 40px; }
    .chip { font-size: 10px; padding: 2px 6px; }
}
