/* ============================================================
   Thumb Track — Global Styles
   ============================================================ */

:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface2: #f8f9fa;
    --border: #e1e4e8;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --shadow: 0 2px 8px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
    --radius: 14px;
    --radius-sm: 8px;
    --nav-height: 60px;
    --grid-cols: 5;
    --cell-gap: 10px;
}

/* Flat UI 24-color palette */
:root {
    --c1:  #1abc9c; --c2:  #16a085;
    --c3:  #2ecc71; --c4:  #27ae60;
    --c5:  #3498db; --c6:  #2980b9;
    --c7:  #9b59b6; --c8:  #8e44ad;
    --c9:  #34495e; --c10: #2c3e50;
    --c11: #f1c40f; --c12: #f39c12;
    --c13: #e67e22; --c14: #d35400;
    --c15: #e74c3c; --c16: #c0392b;
    --c17: #ecf0f1; --c18: #bdc3c7;
    --c19: #95a5a6; --c20: #7f8c8d;
    --c21: #fd79a8; --c22: #e84393;
    --c23: #6c5ce7; --c24: #a29bfe;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

/* ============================================================
   Auth Pages
   ============================================================ */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}
.auth-logo i {
    font-size: 2.5rem;
    color: var(--primary);
    transform: rotate(-45deg);
    display: inline-block;
}
.auth-logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 8px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success  { background: var(--success); color: #fff; }
.btn-ghost    { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-icon     { padding: 8px; border-radius: 50%; }
.btn-full     { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }
.btn-sm       { padding: 6px 12px; font-size: 0.82rem; }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 3px solid var(--danger); }
.alert-success { background: #dcfce7; color: #166534; border-left: 3px solid var(--success); }

/* ============================================================
   App Layout
   ============================================================ */
body.app-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    box-shadow: var(--shadow);
}
.app-nav .nav-logo {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.02em;
    color: var(--primary);
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.app-nav .nav-logo i { transform: rotate(-45deg); display: inline-block; }
.app-nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
}
.app-nav a:hover, .app-nav a.active {
    background: var(--bg);
    color: var(--primary);
}

.app-main {
    flex: 1;
    padding: 20px 16px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================
   Pin Grid
   ============================================================ */
.grid-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.grid-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    flex: 1;
}

#pin-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    gap: var(--cell-gap);
    align-items: start;
}

.pin-item {
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 4px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
    position: relative;
    min-height: 80px;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s, opacity .15s;
    overflow: hidden;
    aspect-ratio: 1;
    --fs: 1;
}
.pin-item.fs-large { --fs: 1.3; }
.pin-item.fs-xl    { --fs: 1.7; }
.pin-item.fs-xxl   { --fs: 2.2; }

/* Visual feedback while holding */
.pin-item.holding {
    transform: scale(.9);
    opacity: .75;
}

/* Multi-cell sizes */
.pin-item[data-sw="2"] { grid-column: span 2; aspect-ratio: 2/1; }
.pin-item[data-sw="3"] { grid-column: span 3; aspect-ratio: 3/1; }
.pin-item[data-sw="4"] { grid-column: span 4; aspect-ratio: 4/1; }
.pin-item[data-sh="2"] { grid-row: span 2; }
.pin-item[data-sh="3"] { grid-row: span 3; }
.pin-item[data-sh="4"] { grid-row: span 4; }
/* Tall narrow pins: let grid row height control the size, not aspect-ratio */
.pin-item[data-sw="1"][data-sh="2"],
.pin-item[data-sw="1"][data-sh="3"],
.pin-item[data-sw="1"][data-sh="4"] { aspect-ratio: unset; }
/* Square multi-cell pins */
.pin-item[data-sw="2"][data-sh="2"] { aspect-ratio: 1; }
.pin-item[data-sw="3"][data-sh="3"] { aspect-ratio: 1; }
.pin-item[data-sw="4"][data-sh="4"] { aspect-ratio: 1; }

.pin-item:active { transform: scale(.93); }

.pin-icon {
    font-size: calc(1.6rem * var(--fs));
    line-height: 1;
    pointer-events: none;
    flex-shrink: 0;
}
.pin-item[data-sw="2"] .pin-icon,
.pin-item[data-sh="2"] .pin-icon { font-size: calc(2rem * var(--fs)); }
.pin-item[data-sw="3"] .pin-icon,
.pin-item[data-sh="3"] .pin-icon { font-size: calc(2.6rem * var(--fs)); }
.pin-item[data-sw="4"] .pin-icon,
.pin-item[data-sh="4"] .pin-icon { font-size: calc(3.2rem * var(--fs)); }

.pin-name {
    font-size: calc(0.72rem * var(--fs));
    font-weight: 700;
    text-align: center;
    pointer-events: none;
    line-height: 1.2;
    width: 100%;
    padding: 0 6px;
    /* Elegant overflow: max 2 lines with ellipsis */
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-break: break-word;
}
/* 1×1 pins: single line only */
.pin-item[data-sw="1"][data-sh="1"] .pin-name {
    -webkit-line-clamp: 1;
}
.pin-item[data-sw="2"] .pin-name,
.pin-item[data-sh="2"] .pin-name { font-size: calc(0.85rem * var(--fs)); }
.pin-item[data-sw="3"] .pin-name,
.pin-item[data-sh="3"] .pin-name { font-size: calc(1rem * var(--fs)); }

.pin-category-dot {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: .7;
}
.pin-category-dot.good    { background: #22c55e; }
.pin-category-dot.bad     { background: #ef4444; }
.pin-category-dot.neutral { display: none; }

/* Daily press badge */
.pin-daily-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: rgba(0,0,0,.35);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

/* Pressed flash */
.pin-item.pressed {
    animation: pressFlash .3s ease;
}
@keyframes pressFlash {
    0%   { transform: scale(.85); opacity: .7; }
    60%  { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

/* Edit mode wiggle */
.pin-item.wiggle {
    animation: wiggle .4s infinite alternate;
}
@keyframes wiggle {
    from { transform: rotate(-2deg) scale(.97); }
    to   { transform: rotate(2deg) scale(1.03); }
}

/* Add pin button */
.add-pin-btn {
    min-height: 80px;
    aspect-ratio: 1;
    border-radius: var(--radius);
    border: 2px dashed var(--border);
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    transition: all .15s;
}
.add-pin-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59,130,246,.05);
}
.add-pin-btn i { font-size: 1.2rem; }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.modal-overlay.open {
    display: flex;
    animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Centered modal variant */
.modal-overlay.modal-center {
    align-items: center;
    padding: 16px;
}
.modal-overlay.modal-center .modal {
    border-radius: var(--radius);
    max-height: 80vh;
    padding-bottom: 0;
}
.modal-overlay.modal-center .modal-handle { display: none; }

.modal {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 0 0 env(safe-area-inset-bottom);
    animation: slideUp .2s ease;
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.modal-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
}
.modal-header {
    display: flex;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; flex: 1; }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
    justify-content: flex-end;
}

/* ============================================================
   Color Picker
   ============================================================ */
.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .1s, border-color .1s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--text); transform: scale(1.15); }

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}
.color-picker-row label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.color-picker-row input[type="color"] {
    width: 40px; height: 40px;
    padding: 2px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

/* Pin preview */
.pin-preview-wrap {
    display: flex;
    justify-content: center;
    margin: 12px 0 4px;
}
#pin-preview {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: var(--shadow);
    transition: background .2s;
}
#pin-preview { --fs: 1; }
#pin-preview.fs-large { --fs: 1.3; }
#pin-preview.fs-xl    { --fs: 1.7; }
#pin-preview.fs-xxl   { --fs: 2.2; }
#pin-preview .pin-icon { font-size: calc(1.8rem * var(--fs)); }
#pin-preview .pin-name {
    font-size: calc(0.7rem * var(--fs));
    font-weight: 700;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    width: 100%;
    padding: 0 4px;
    text-align: center;
}

/* Category selector */
.category-select {
    display: flex;
    gap: 8px;
}
.cat-btn {
    flex: 1;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.cat-btn.selected-good    { border-color: var(--success); background: #dcfce7; color: #166534; }
.cat-btn.selected-neutral { border-color: var(--text-muted); background: #f1f5f9; color: var(--text); }
.cat-btn.selected-bad     { border-color: var(--danger); background: #fee2e2; color: #991b1b; }

/* Size selector */
.size-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.size-btn {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 8px 4px;
    transition: all .15s;
    color: var(--text-muted);
}
.size-btn.selected { border-color: var(--primary); background: rgba(59,130,246,.1); color: var(--primary); }

/* ============================================================
   Long Press Popup
   ============================================================ */
.pin-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}
.pin-detail-swatch {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}
.pin-detail-info h3 { font-size: 1.1rem; font-weight: 700; }
.pin-detail-info .category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 4px;
}
.badge-good    { background: #dcfce7; color: #166534; }
.badge-neutral { background: #f1f5f9; color: #64748b; }
.badge-bad     { background: #fee2e2; color: #991b1b; }
.pin-detail-actions {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    flex-wrap: wrap;
}

/* ============================================================
   Metrics Modal
   ============================================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.metric-card {
    background: var(--surface2);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}
.metric-card .val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}
.metric-card .lbl {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 4px;
}
.metric-card.full { grid-column: span 2; }
.metrics-footer-info {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Pin detail meta row */
.pin-detail-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 20px 12px;
    align-items: center;
}
.pin-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .8rem;
    color: var(--text-muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
}
.pin-meta-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ============================================================
   Tracking Page
   ============================================================ */
.tracking-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface2);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}
.tracking-tab {
    flex: 1;
    padding: 7px 4px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    transition: all .15s;
}
.tracking-tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.tracking-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.tracking-nav h3 {
    font-size: 1rem;
    font-weight: 700;
}

/* Calendar grid */
.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-dow-header {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 4px 0;
}
.cal-day {
    background: var(--surface);
    border-radius: 8px;
    min-height: 64px;
    padding: 4px;
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
    transition: border-color .1s;
}
.cal-day:hover { border-color: var(--primary); }
.cal-day.today { border-color: var(--primary); background: rgba(59,130,246,.04); }
.cal-day.other-month { opacity: .4; }
.cal-day-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    display: block;
}
.cal-day.today .cal-day-num { color: var(--primary); }
.cal-events {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 3px;
}
.cal-event-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Week / day views */
.cal-week-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cal-week-row {
    display: grid;
    grid-template-columns: 48px repeat(7, 1fr);
    gap: 4px;
    align-items: start;
}
.cal-week-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: right;
    padding-right: 6px;
    padding-top: 4px;
}
.cal-week-cell {
    background: var(--surface);
    border-radius: 6px;
    min-height: 48px;
    border: 1px solid var(--border);
    padding: 4px;
}
.cal-event-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
    cursor: pointer;
}

/* List view */
.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-date-group h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.log-entry-swatch {
    width: 32px; height: 32px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.log-entry-info { flex: 1; }
.log-entry-info .name { font-weight: 700; font-size: 0.9rem; }
.log-entry-info .time { font-size: 0.78rem; color: var(--text-muted); }
.log-entry-delete { color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 4px; font-size: 1rem; }
.log-entry-delete:hover { color: var(--danger); }

/* Pin filter chips */
.pin-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.filter-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: .6;
    transition: opacity .15s, border-color .15s;
}
.filter-chip.active { opacity: 1; border-color: rgba(0,0,0,.2); }

/* ============================================================
   Trash Page
   ============================================================ */
.trash-list { display: flex; flex-direction: column; gap: 8px; }
.trash-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.trash-item-swatch {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    opacity: .6;
}
.trash-item-info { flex: 1; }
.trash-item-info .name { font-weight: 700; }
.trash-item-info .meta { font-size: 0.8rem; color: var(--text-muted); }
.trash-item-actions { display: flex; gap: 6px; }

/* ============================================================
   Misc / Utilities
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 0.95rem; }

.section-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
    margin-top: 16px;
}

.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* Spinner */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notification */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 20px;
    border-radius: 99px;
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 9999;
    transition: transform .25s ease;
    white-space: nowrap;
    pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Responsive */
@media (max-width: 400px) {
    :root { --grid-cols: 4; --cell-gap: 8px; }
    .app-main { padding: 14px 10px; }
    .auth-container { padding: 28px 20px; }
}

/* SortableJS ghost/drag */
.sortable-ghost { opacity: .3; }
.sortable-drag  { opacity: .9; box-shadow: var(--shadow-lg) !important; transform: scale(1.05) !important; }

/* ============================================================
   Font Size Buttons
   ============================================================ */
.font-size-btns {
    display: flex;
    gap: 6px;
}
.fs-btn {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 8px 4px;
    transition: all .15s;
    color: var(--text-muted);
}
.fs-btn.selected {
    border-color: var(--primary);
    background: rgba(59,130,246,.1);
    color: var(--primary);
}
.fs-btn:disabled, .fs-btn.fs-btn-disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}
.fs-hint {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* ============================================================
   Show Name Toggle
   ============================================================ */
.pin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: .9rem;
    font-weight: 500;
}
.pin-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-track {
    width: 38px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}
.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.pin-toggle input:checked + .toggle-track { background: var(--primary); }
.pin-toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }

/* ============================================================
   Emoji Picker
   ============================================================ */
.emoji-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.emoji-trigger-btn {
    width: 52px;
    height: 52px;
    font-size: 1.7rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .15s;
    line-height: 1;
}
.emoji-trigger-btn:hover { border-color: var(--primary); }
.emoji-trigger-btn.empty::after {
    content: '😀';
    font-size: 1.4rem;
    opacity: .3;
}
.emoji-input-hint {
    flex: 1;
    font-size: .82rem;
    color: var(--text-muted);
}
em-emoji-picker {
    width: 100%;
    --border-radius: 8px;
    --font-family: inherit;
}

/* ============================================================
   Amount Section (pin form)
   ============================================================ */
.amount-section {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.amount-row {
    display: flex;
    gap: 12px;
}

/* Small modal variant */
.modal.modal-sm {
    max-width: 340px;
}

/* ============================================================
   Amount Metrics Section
   ============================================================ */
.amount-metrics-section {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}
.amount-metrics-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.amount-metrics-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 16px;
}
.amt-tab {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.amt-tab.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.amount-metrics-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
