/* ============================================================
   Controle de Validade — Mobile App Design
   ============================================================ */

/* === VARIÁVEIS === */
:root {
    --primary:        #1565C0;
    --primary-2:      #1976D2;
    --primary-hover:  #0D47A1;
    --primary-light:  #E3F2FD;
    --danger:         #E53935;
    --danger-hover:   #C62828;
    --danger-light:   #FFEBEE;
    --warning:        #F57C00;
    --warning-light:  #FFF3E0;
    --success:        #2E7D32;
    --success-light:  #E8F5E9;
    --teal:           #00897B;
    --teal-light:     #E0F2F1;
    --gold:           #F9A825;
    --gold-light:     #FFF8E1;

    --bg:             #F0F4F8;
    --card-bg:        #ffffff;
    --app-header-bg:  #1565C0;
    --app-header-text:#ffffff;

    --text-main:      #1A1A2E;
    --text-secondary: #6B7280;
    --border:         #E5E7EB;

    --radius-sm:  0.375rem;
    --radius-md:  0.6rem;
    --radius-lg:  1rem;
    --radius-xl:  1.25rem;
    --radius-2xl: 1.5rem;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.15);

    --font: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

    /* App shell dimensions */
    --header-h:   60px;
    --bottomnav-h:68px;
}

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

html, body {
    height: 100%;
    overflow: hidden; /* prevent body scroll — inner scrolls */
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;          /* full device viewport */
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.15);
}

/* ============================================================
   APP HEADER  (top bar — like a native app)
   ============================================================ */
.app-header {
    flex-shrink: 0;
    height: var(--header-h);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(21,101,192,0.35);
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--app-header-text);
    letter-spacing: -0.01em;
    text-decoration: none;
}

.app-header-brand-icon {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: none;
    color: white;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.app-header-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Page title inside header (for inner pages) */
.app-header-title {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.app-header-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: none;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.app-header-back:hover { background: rgba(255,255,255,0.3); }

/* ============================================================
   SCROLLABLE CONTENT AREA
   ============================================================ */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: calc(var(--bottomnav-h) + 0.5rem);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.app-content::-webkit-scrollbar { display: none; }

/* ============================================================
   SECTION LABELS
   ============================================================ */
.section-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    margin-top: 1.1rem;
}

.section-label:first-child { margin-top: 0; }

/* ============================================================
   STAT CARDS (colorful — like the reference image)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    border-radius: var(--radius-lg);
    padding: 1rem 1rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
    transition: opacity 0.15s, transform 0.15s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -15%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    pointer-events: none;
}

.stat-card:hover { opacity: 0.9; transform: translateY(-2px); }

.stat-card.active-filter {
    outline: 3px solid rgba(255,255,255,0.6);
    outline-offset: -3px;
}

/* Card color themes */
.stat-card.card-green  { background: linear-gradient(135deg, #2E7D32, #43A047); }
.stat-card.card-yellow { background: linear-gradient(135deg, #F57F17, #FDD835); color: #333; }
.stat-card.card-red    { background: linear-gradient(135deg, #B71C1C, #E53935); }
.stat-card.card-blue   { background: linear-gradient(135deg, #0D47A1, #1976D2); }
.stat-card.card-gray   { background: linear-gradient(135deg, #546E7A, #78909C); }
.stat-card.card-gold   { background: linear-gradient(135deg, #E65100, #F57C00); }

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.15rem;
    opacity: 0.92;
}

/* ============================================================
   ALERT CARDS (Alertas Rápidos)
   ============================================================ */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: #F8FAFC; }

.alert-item-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.alert-item-icon.urgent   { background: var(--danger-light); color: var(--danger); }
.alert-item-icon.warning  { background: var(--warning-light); color: var(--warning); }
.alert-item-icon.expired  { background: #fce4ec; color: #880E4F; }
.alert-item-icon.ok       { background: var(--success-light); color: var(--success); }

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

.alert-item-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-item-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.05rem;
}

.alert-item-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-urgent  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-expired { background: #fce4ec; color: #880E4F; }
.badge-ok      { background: var(--success-light); color: var(--success); }

/* See-all link */
.see-all-row {
    display: flex;
    justify-content: flex-end;
    padding: 0.4rem 0 0.2rem;
}

.see-all-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

/* ============================================================
   QUICK ACTION BUTTONS
   ============================================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.quick-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.9rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
    text-align: center;
    line-height: 1.3;
}

.quick-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.quick-btn .qb-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.quick-btn.secondary {
    background: var(--card-bg);
    color: var(--primary);
    border: 2px solid var(--primary-light);
}

/* ============================================================
   CARDS (generic)
   ============================================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,0.04);
}

.card-header {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-grid   { display: grid; grid-template-columns: 1fr; gap: 0.875rem; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.875rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr; gap: 0.875rem; }

.form-group { margin-bottom: 0; }

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--card-bg);
    color: var(--text-main);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}

textarea.form-control {
    resize: vertical;
    min-height: 76px;
}

/* Search bar */
.search-bar-wrap {
    position: relative;
    margin-bottom: 1rem;
}

.search-bar-wrap .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-bar {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-2xl);
    font-size: 0.9rem;
    font-family: var(--font);
    background: var(--card-bg);
    color: var(--text-main);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.1);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary   { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(21,101,192,0.3); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-secondary {
    background: var(--bg);
    color: var(--text-main);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-success   { background: var(--success); color: white; }
.btn-success:hover { background: #1B5E20; }

.btn-sm  { padding: 0.4rem 0.875rem; font-size: 0.8rem; border-radius: var(--radius-md); }
.btn-lg  { padding: 0.8rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ============================================================
   FILTER ROW (horizontal chip filter)
   ============================================================ */
.filter-chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
    flex-shrink: 0;
    padding: 0.35rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.chip:hover   { border-color: var(--primary); color: var(--primary); }
.chip.active  { background: var(--primary); color: white; border-color: var(--primary); }
.chip.danger  { background: var(--danger); color: white; border-color: var(--danger); }
.chip.warning { background: var(--warning); color: white; border-color: var(--warning); }
.chip.success { background: var(--success); color: white; border-color: var(--success); }

/* Filters card */
.filters-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.filters-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filter-group label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   TABLE → CARD LIST on mobile
   ============================================================ */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: #F8FAFC;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    padding: 0.65rem 0.875rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-main);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }

/* Row status */
.row-vencido  { background: #fff1f1 !important; }
.row-urgent   { background: #fee2e2 !important; }
.row-warning  { background: #fffbeb !important; }

.row-vencido td, .row-urgent td { font-weight: 500; }

/* Product list cards (mobile-friendly) */
.product-card-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.product-card-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.product-card-item:last-child { border-bottom: none; }

.product-card-item.vencido  { border-left: 4px solid #991b1b; }
.product-card-item.urgente  { border-left: 4px solid var(--danger); }
.product-card-item.atencao  { border-left: 4px solid var(--warning); }
.product-card-item.ok       { border-left: 4px solid var(--success); }

.product-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.product-card-body { flex: 1; min-width: 0; }

.product-card-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card-meta {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

.product-card-right {
    text-align: right;
    flex-shrink: 0;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

.status-urgent  { background: var(--danger-light);  color: #b91c1c; }
.status-warning { background: var(--warning-light); color: #b45309; }
.status-ok      { background: var(--success-light); color: #047857; }
.status-expired { background: #fce4ec; color: #880E4F; }

/* ============================================================
   NF BADGE
   ============================================================ */
.nf-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: monospace;
    text-decoration: none;
}

/* ============================================================
   LEGEND
   ============================================================ */
.legend {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-secondary);
    align-items: center;
}

.legend-item { display: flex; align-items: center; gap: 0.35rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   NF ITEMS TABLE (nova_nota.php)
   ============================================================ */
.items-table-wrapper {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 0.875rem;
    overflow-x: auto;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

.items-table thead th {
    background: #F1F5F9;
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.items-table tbody td {
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.items-table tbody tr:last-child td { border-bottom: none; }

.items-table .form-control {
    border-color: transparent;
    background: transparent;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}

.items-table .form-control:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(21,101,192,0.12);
}

.btn-remove-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--danger-light);
    color: var(--danger);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}

.btn-remove-item:hover { background: var(--danger); color: white; }

.add-item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 2.75rem;
    margin-bottom: 0.75rem;
    display: block;
}

.empty-state p { margin-bottom: 1rem; font-size: 0.9rem; }

/* ============================================================
   NOTIFICATION TOAST
   ============================================================ */
.notification {
    position: fixed;
    bottom: calc(var(--bottomnav-h) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-xl);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    white-space: nowrap;
    max-width: calc(100% - 2rem);
    text-align: center;
}

.notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.notification.success { background: linear-gradient(135deg, var(--success), #4CAF50); }
.notification.error   { background: linear-gradient(135deg, var(--danger), #EF5350); }
.notification.info    { background: linear-gradient(135deg, var(--primary), #42A5F5); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end; /* bottom sheet style */
    justify-content: center;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
    padding: 0;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-overlay.open .modal { transform: translateY(0); }

/* Handle bar */
.modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 9999px;
    background: var(--border);
    margin: 0 auto 1.25rem;
}

.modal-lg { max-width: 480px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    background: var(--bg);
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s;
    line-height: 1;
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.modal-meta-item {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
}

.modal-meta-item .meta-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.1rem;
}

.modal-meta-item .meta-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

/* ============================================================
   BOTTOM NAVIGATION BAR
   ============================================================ */
.bottom-nav {
    flex-shrink: 0;
    height: var(--bottomnav-h);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 200;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    transition: color 0.15s;
    padding: 0.5rem 0.25rem;
    position: relative;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font);
}

.bottom-nav-item .nav-icon {
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.15s;
}

.bottom-nav-item:hover { color: var(--primary); }
.bottom-nav-item:hover .nav-icon { transform: translateY(-2px); }

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

.bottom-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}

/* ============================================================
   ALERT HELPERS
   ============================================================ */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 0.875rem;
    font-weight: 500;
}

.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: var(--primary-light); border: 1px solid #BBDEFB; color: #0D47A1; }

/* ============================================================
   PAGE HEADER (inner pages)
   ============================================================ */
.page-header {
    margin-bottom: 1rem;
}

.page-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.page-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================================
   FOOTER  (minimal inside scroll area)
   ============================================================ */
footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 1rem 0 0.5rem;
    margin-top: 0.5rem;
}

/* ============================================================
   DESKTOP fallback (when screen > 480px)
   ============================================================ */
@media (min-width: 481px) {
    .app-shell {
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
        height: calc(100dvh - 3rem);
        border-radius: var(--radius-2xl);
        overflow: hidden;
    }

    body {
        background: #CBD5E1;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        min-height: 100vh;
        overflow: auto;
    }
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-secondary); font-size: 0.8rem; }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.gap-row { display: flex; gap: 0.75rem; }
.gap-row > * { flex: 1; }
