/* ==========================================================================
   ROAD MKT - ENTERPRISE STYLESHEET
   Version: 2.3 | Theme: Modern SaaS / Glassmorphism
   Architecture: Component-based, Mobile-first adaptable
   ========================================================================== */

:root {
    --primary: #007AFF;
    --primary-dark: #0056b3;
    --primary-light: #e0f2fe;
    --costco-red: #E31837;
    --costco-blue: #005DAB;
    --success: #10B981;
    --success-bg: #ecfdf5;
    --danger: #EF4444;
    --danger-bg: #fef2f2;
    --warning: #F59E0B;
    --bg-app: #f4f7f9;
    --card-bg: #ffffff;
    --sidebar-bg: #111827;
    --text-main: #111827;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; 
    background-color: var(--bg-app); margin: 0; height: 100vh; overflow: hidden; 
    color: var(--text-main); display: flex; flex-direction: column; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

#design-sig { font-size: 11px; font-weight: 800; color: var(--costco-red); text-transform: uppercase; letter-spacing: 0.5px; margin-right: 20px; opacity: 0.8; }

/* ==========================================================================
   GLOBAL LOADING STATES
   ========================================================================== */
@keyframes spin { 100% { transform: rotate(360deg); } }

#app-loader {
    position: fixed; inset: 0; background: var(--bg-app); z-index: 99999;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.4s ease;
}
.app-loader-spinner {
    width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite; margin-bottom: 20px;
}

button { font-family: 'Inter', sans-serif; outline: none; cursor: pointer; transition: all var(--transition-fast); }
button:active { transform: scale(0.97) !important; }
button:disabled { cursor: not-allowed; opacity: 0.6; }

.btn-mark { background: white; border: 1px solid var(--border); color: var(--text-muted); padding: 8px 18px; border-radius: 50px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.btn-mark:hover { background: #fffbeb; border-color: #fde047; color: #ca8a04; }
.btn-mark.active { background: var(--warning); border-color: var(--warning); color: white; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }

.comment-actions button { background: #f8fafc; border: 1px solid var(--border); color: var(--text-muted); border-radius: var(--radius-sm); padding: 6px 14px; font-size: 12px; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.comment-actions button:hover { background: white; border-color: var(--primary); color: var(--primary); box-shadow: 0 4px 10px rgba(0, 122, 255, 0.15); }

.btn-add, .btn-save-cols { background: var(--primary); color: white; border: none; padding: 12px 24px; border-radius: var(--radius-md); font-weight: 700; font-size: 13px; box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25); display: inline-flex; align-items: center; justify-content: center; }
.btn-add:hover, .btn-save-cols:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0, 122, 255, 0.35); }

/* ==========================================================================
   1. AUTHENTICATION & LOGIN (GLASSMORPHISM)
   ========================================================================== */
#login-overlay { 
    position: fixed; inset: 0; background-color: #0f172a; background-size: cover; 
    background-position: center; background-repeat: no-repeat; animation: wallpaperCycle 20s infinite alternate ease-in-out;
    z-index: 9999; display: flex; justify-content: center; align-items: center; transition: opacity 0.3s ease;
}
@keyframes wallpaperCycle {
    0%, 45% { background-image: url('https://www.foodandwine.com/thmb/hV7ICl7ROVz8AkfQqN7dAFSPCH0=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/What-Is-a-Costco-Business-Center-FT-BLOG0525-01-603be82f2a484a698ef00d4c639d050c.jpg'); }
    55%, 100% { background-image: url('https://blog.databid.com/hubfs/costco%20business%20center.jpg'); }
}
#login-overlay::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(0, 30, 60, 0.7) 0%, rgba(0, 10, 20, 0.85) 100%); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

.login-card { position: relative; width: 400px; background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--glass-border); padding: 45px 40px; border-radius: var(--radius-xl); box-shadow: var(--glass-shadow); text-align: center; box-sizing: border-box; animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeUp { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }

.login-brand { margin-bottom: 30px; }
.brand-main { font-size: 34px; font-weight: 800; color: var(--costco-blue); letter-spacing: -1.5px; }
.brand-sub { font-size: 11px; font-weight: 800; color: var(--costco-red); text-transform: uppercase; letter-spacing: 2.5px; margin-top: 4px; display: block; }
.avatar-box { width: 88px; height: 88px; margin: 0 auto 25px; border-radius: 50%; background: white; border: 3px solid rgba(255,255,255,0.8); box-shadow: 0 8px 24px rgba(0,0,0,0.12); overflow: hidden; }
.avatar-box img { width: 100%; height: 100%; object-fit: cover; }
.login-form { width: 100%; display: flex; flex-direction: column; align-items: center; }
.input-group { position: relative; margin-bottom: 20px; width: 100%; box-sizing: border-box; }
.input-group input { width: 100%; height: 56px; padding: 24px 16px 8px 16px; border: 1px solid rgba(0,0,0,0.08); border-radius: var(--radius-md); font-size: 15px; font-weight: 500; outline: none; transition: var(--transition-smooth); background: rgba(255,255,255,0.6); color: var(--text-main); box-sizing: border-box; }
.input-group input:focus { background: white; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15); }
.input-group label { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--text-muted); pointer-events: none; transition: var(--transition-smooth); font-weight: 500; }
.input-group input:focus ~ label, .input-group input:not(:placeholder-shown) ~ label { top: 14px; font-size: 10px; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

.btn-login { width: 100%; height: 56px; background: linear-gradient(135deg, var(--costco-blue) 0%, #00427a 100%); color: white; border: none; border-radius: var(--radius-md); font-weight: 700; font-size: 16px; margin-top: 10px; cursor: pointer; box-shadow: 0 8px 20px rgba(0, 93, 171, 0.25); display: flex; justify-content: center; align-items: center; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0, 93, 171, 0.35); }

.login-footer { margin-top: 25px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
#login-error { color: var(--costco-red); font-size: 13px; font-weight: 700; margin-top: 15px; min-height: 20px; }

/* ==========================================================================
   2. MAIN APPLICATION SHELL
   ========================================================================== */
#top-bar { height: 64px; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 25px; z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.app-logo { font-weight: 800; font-size: 20px; color: var(--costco-blue); letter-spacing: -0.5px; width: 120px;}
.bar-left, .bar-right { display: flex; align-items: center; }

.stats-ribbon { display: flex; align-items: center; background: var(--bg-app); padding: 6px 20px; border-radius: 50px; border: 1px solid var(--border); margin-left: 20px; }
.stat-item { display: flex; flex-direction: column; padding: 0 15px; }
.stat-lbl { font-size: 9px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 2px;}
.stat-val { font-size: 15px; font-weight: 800; color: var(--text-main); line-height: 1.1; }
.stat-val.highlight { color: var(--primary); }
.stat-divider { width: 1px; height: 24px; background: var(--border); }

#user-badge { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 12px; border-radius: 50px; position: relative; border: 1px solid transparent; }
#user-badge:hover { background: #f8fafc; border-color: var(--border); }
#user-badge img { width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.user-text { display: flex; flex-direction: column; text-align: left; }
#display-username { font-weight: 700; font-size: 14px; color: var(--text-main); }
#display-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600;}

#user-dropdown { position: absolute; top: calc(100% + 10px); right: 0; background: white; border: 1px solid var(--border); box-shadow: 0 20px 40px rgba(0,0,0,0.1); border-radius: var(--radius-md); width: 200px; display: none; overflow: hidden; animation: dropIn 0.2s ease forwards; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
#user-dropdown.show { display: block; }
.drop-item { padding: 14px 20px; font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition-fast); color: var(--text-main); display: block; text-decoration: none;}
.drop-item:hover { background: #f8fafc; color: var(--primary); }
.text-red { color: var(--costco-red); border-top: 1px solid var(--border); font-weight: 600; }
.text-red:hover { color: white; background: var(--costco-red); }

#search-wrapper { position: absolute; top: 85px; left: 25px; z-index: 50; }
.search-box { background: white; width: 360px; height: 52px; border-radius: var(--radius-md); display: flex; align-items: center; padding: 0 16px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); border: 1px solid rgba(0,0,0,0.05); transition: var(--transition-fast); }
.search-box:focus-within { box-shadow: 0 12px 40px rgba(0, 122, 255, 0.15); border-color: var(--primary); }
.search-box input { border: none; outline: none; width: 100%; margin-left: 12px; font-size: 15px; font-weight: 500;}
.search-icon { color: var(--text-muted); transition: var(--transition-fast); }
.search-box:focus-within .search-icon { color: var(--primary); }

.pac-container { z-index: 99999 !important; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: 0 15px 35px rgba(0,0,0,0.1); font-family: 'Inter', sans-serif; margin-top: 8px; padding: 8px 0; }
.pac-item { padding: 12px 16px; font-size: 13px; color: var(--text-muted); border-top: 1px solid transparent; transition: background 0.15s; cursor: pointer; }
.pac-item:hover { background-color: #f8fafc; }
.pac-item-query { font-size: 14px; font-weight: 700; color: var(--text-main); }
.pac-icon { display: none; }

/* ==========================================================================
   3. WORKSPACE & SIDEBAR
   ========================================================================== */
#workspace { display: flex; flex: 1; height: calc(100vh - 64px); position: relative; }
#map-container { flex: 1; position: relative; background: #e2e8f0; } 
#map { width: 100%; height: 100%; }

#sidebar { width: 420px; background: white; border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 20; box-shadow: -10px 0 40px rgba(0,0,0,0.04); }
.sidebar-header { padding: 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #fcfcfd;}
.sidebar-header h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--text-main); }
.badge-count { background: var(--primary-light); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 800; color: var(--primary-dark); }

#log-list { flex: 1; overflow-y: auto; padding: 20px; background: #f8fafc; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-light); font-weight: 500; font-size: 14px; }

.log-card { background: white; padding: 18px; border-radius: var(--radius-md); border: 1px solid var(--border); margin-bottom: 12px; position: relative; transition: var(--transition-fast); box-shadow: 0 2px 8px rgba(0,0,0,0.02); overflow: hidden; }
.log-card:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(0,0,0,0.06); border-color: #cbd5e1; }
.log-card.marked { border-left: 4px solid var(--warning); }
.log-name { font-weight: 800; font-size: 15px; color: var(--text-main); margin-bottom: 4px; }
.log-meta { font-size: 12px; color: var(--text-muted); font-weight: 500;}

.log-tools { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; opacity: 0; transition: var(--transition-fast); }
.log-card:hover .log-tools { opacity: 1; }
.tool-btn { border: 1px solid var(--border); background: white; width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted); display: flex; justify-content: center; align-items: center; transition: var(--transition-fast); font-size: 13px; }
.tool-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.tool-btn.del:hover { background: var(--danger); border-color: var(--danger); color: white; }

.sidebar-footer { padding: 24px; background: white; border-top: 1px solid var(--border); }
.btn-primary-block { width: 100%; padding: 16px; background: var(--success); color: white; border: none; border-radius: var(--radius-md); font-weight: 700; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 15px; transition: var(--transition-fast); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }
.btn-primary-block:hover { background: #0ea5e9; transform: translateY(-2px); box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3); }

.quick-links { display: flex; gap: 12px; margin-top: 15px; }
.link-btn { flex: 1; padding: 12px; text-align: center; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; text-decoration: none; transition: var(--transition-fast); display: flex; justify-content: center; align-items: center;}
.excel { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; } .excel:hover { background: #bbf7d0; transform: translateY(-1px); }
.maps { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;} .maps:hover { background: #fecaca; transform: translateY(-1px);}

/* ==========================================================================
   4. MODALS & FORMS
   ========================================================================== */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 2000; justify-content: center; align-items: center; }
.modal-panel { background: white; width: 850px; max-height: 90vh; display: flex; flex-direction: column; border-radius: var(--radius-xl); box-shadow: 0 30px 60px rgba(0,0,0,0.25); overflow: hidden; animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes scaleUp { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.modal-header { padding: 25px 35px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; background: #f8fafc; }
.modal-header h2 { margin: 0; font-size: 20px; font-weight: 800; color: var(--text-main); }
.meta-tags { display: flex; gap: 10px; margin-top: 8px; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; background: var(--border); padding: 4px 10px; border-radius: 6px; color: var(--text-muted); }
.tag.blue { background: var(--primary-light); color: var(--primary-dark); }
.close-icon { background: none; border: none; font-size: 28px; color: var(--text-light); cursor: pointer; transition: 0.2s; line-height: 1; padding: 0; }
.close-icon:hover { color: var(--danger); transform: rotate(90deg); }

.modal-body { padding: 35px; overflow-y: auto; flex: 1; background: white; }
.form-section { margin-bottom: 35px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--primary); font-weight: 800; margin-bottom: 20px; border-bottom: 1px solid #f1f5f9; padding-bottom: 8px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.field-box { display: flex; flex-direction: column; }
.field-box label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.field-box input, .field-box select { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: 'Inter', sans-serif; background: #f8fafc; outline: none; transition: var(--transition-fast); color: var(--text-main); }
.field-box input:focus, .field-box select:focus { background: white; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1); }

.checkbox-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; background: #f8fafc; padding: 20px; border-radius: var(--radius-md); border: 1px solid var(--border); margin-top: 20px; }
.check-box { font-size: 12px; font-weight: 600; display: flex; flex-direction: column; gap: 8px; color: var(--text-main);}

.modal-footer { padding: 25px 35px; border-top: 1px solid var(--border); background: #f8fafc; text-align: right; }
.btn-save-final { padding: 14px 35px; background: var(--primary); color: white; border: none; border-radius: var(--radius-md); font-weight: 700; cursor: pointer; font-size: 15px; box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25); transition: var(--transition-fast); display: inline-flex; justify-content: center; align-items: center; }
.btn-save-final:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0, 122, 255, 0.3); }

/* Alerts */
#alertModal .modal-panel { width: 550px; }
.fu-alert-item { padding: 24px; border-bottom: 1px solid #f1f5f9; transition: var(--transition-fast); }
.fu-alert-item:hover { background: #f8fafc; }
.fu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fu-biz-name { font-weight: 800; font-size: 16px; color: var(--text-main); }
.fu-action-btn { background: white; border: 1px solid var(--border); padding: 6px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; cursor: pointer; transition: 0.2s; color: var(--primary);}
.fu-action-btn:hover { background: var(--primary-light); border-color: var(--primary-light); transform: translateY(-1px); }
.fu-address { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; display: block; }
.fu-note-box { background: #fffbeb; border: 1px solid #fef08a; padding: 12px 16px; border-radius: var(--radius-sm); }
.fu-note-label { font-size: 10px; font-weight: 800; color: #b45309; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 4px; }
.fu-comment { font-size: 13px; color: #78350f; font-style: italic; line-height: 1.5; }

/* ==========================================================================
   4.5 MANAGE COMMENTS UI (Table Style)
   ========================================================================== */
.manager-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.02); overflow: hidden; }
.manager-list li { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 500; color: var(--text-main); transition: background var(--transition-fast); }
.manager-list li:last-child { border-bottom: none; }
.manager-list li:hover { background: #f8fafc; }
.manager-list li button { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; border-radius: var(--radius-sm); width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; font-weight: 800; font-size: 14px; cursor: pointer; transition: all 0.2s ease; }
.manager-list li button:hover { background: var(--danger); color: white; border-color: var(--danger); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2); }

/* ==========================================================================
   5. ADMIN DASHBOARD
   ========================================================================== */
#admin-dashboard { position: fixed; inset: 0; background: var(--bg-app); z-index: 3000; display: none; flex-direction: row; }

.dash-sidebar { width: 280px; background: var(--sidebar-bg); color: white; display: flex; flex-direction: column; padding: 30px 20px; box-shadow: 5px 0 20px rgba(0,0,0,0.1); z-index: 10;}
.dash-brand { font-size: 22px; font-weight: 800; margin-bottom: 40px; color: white; letter-spacing: -0.5px;}
.dash-user-card { display: flex; gap: 12px; align-items: center; padding: 16px; background: rgba(255,255,255,0.06); border-radius: var(--radius-md); margin-bottom: 35px; border: 1px solid rgba(255,255,255,0.05);}
.dash-avatar { width: 44px; height: 44px; background: #334155; border-radius: 50%; object-fit: cover; }
.dash-details { display: flex; flex-direction: column; }
#admin-name { font-weight: 700; font-size: 14px; color: #f8fafc;}
.role-pill { font-size: 10px; font-weight: 700; background: var(--primary); padding: 3px 8px; border-radius: 4px; display: inline-block; margin-top: 4px; align-self: flex-start; text-transform: uppercase; letter-spacing: 0.5px;}

.dash-menu { list-style: none; padding: 0; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 8px;}
.dash-menu li { padding: 14px 18px; cursor: pointer; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: #94a3b8; transition: var(--transition-fast); }
.dash-menu li:hover { background: rgba(255,255,255,0.05); color: white; }
.dash-menu li.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3); }

.btn-exit-dash { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); padding: 14px; border-radius: var(--radius-sm); cursor: pointer; width: 100%; font-weight: 700; transition: 0.2s;}
.btn-exit-dash:hover { background: var(--danger); color: white; border-color: var(--danger); }

.dash-main { flex: 1; padding: 50px 60px; overflow-y: auto; }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.tab-content.active { display: block; }
.page-title { margin-top: 0; font-size: 28px; color: var(--text-main); margin-bottom: 30px; font-weight: 800; letter-spacing: -0.5px;}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; margin-bottom: 40px; }
.dash-card { background: white; padding: 28px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: 0 4px 15px rgba(0,0,0,0.02); transition: var(--transition-smooth); overflow: hidden; }
.dash-card:hover { transform: translateY(-4px); box-shadow: 0 15px 30px rgba(0,0,0,0.06); border-color: #cbd5e1; }
.dash-card.stat { display: flex; align-items: center; gap: 24px; }
.stat-icon { width: 64px; height: 64px; border-radius: 16px; display: flex; justify-content: center; align-items: center; font-size: 28px; flex-shrink: 0; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary-dark); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-data { display: flex; flex-direction: column; }
.stat-data .label { font-size: 13px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-data .number { font-size: 32px; font-weight: 800; color: var(--text-main); line-height: 1; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-bottom: 30px; align-items: stretch; }
.admin-card { background: white; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.02); display: flex; flex-direction: column; height: 100%; box-sizing: border-box;}
.admin-card h3 { margin: 0 0 20px 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--primary); border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; }

.compact-field { margin-bottom: 16px; }
.compact-field label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;}
.compact-input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: var(--radius-sm); font-size: 13px; outline: none; transition: 0.2s; background: #f8fafc; color: var(--text-main); font-weight: 500; box-sizing: border-box;}
.compact-input:focus { background: white; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1); }

.cycle-row { display: flex; gap: 16px; margin-bottom: 16px; }
.cycle-col { flex: 1; min-width: 0; }
.action-row { margin-top: auto; display: flex; gap: 12px; padding-top: 16px; }

.btn-compact { flex: 1; height: 36px; font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); cursor: pointer; border: none; display: flex; align-items: center; justify-content: center; transition: var(--transition-fast); }
.btn-primary-soft { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #bae6fd; }
.btn-primary-soft:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-secondary-soft { background: white; color: var(--text-muted); border: 1px solid #cbd5e1; }
.btn-secondary-soft:hover { background: #f1f5f9; color: var(--text-main); }
.btn-danger-ghost { background: white; color: var(--danger); border: 1px solid #fecaca; padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; transition: 0.2s;}
.btn-danger-ghost:hover { background: var(--danger-bg); }

.status-badge { font-size: 12px; font-weight: 700; color: var(--success); background: var(--success-bg); padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid #d1fae5; }

.table-header { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr; font-weight: 800; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; padding: 14px 20px; background: #f8fafc; border-radius: var(--radius-md); margin-bottom: 12px; border: 1px solid var(--border);}
.user-row { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; align-items: center; font-size: 14px; transition: 0.2s;}
.user-row:hover { background: #f8fafc; }
.role-toggle-btn { background: #f1f5f9; border: 1px solid #cbd5e1; padding: 6px 12px; border-radius: 6px; font-size: 11px; font-weight: 700; cursor: pointer; color: var(--text-muted); transition: 0.2s;}
.role-toggle-btn:hover { background: white; border-color: var(--primary); color: var(--primary); }

.column-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 25px; }
.col-card { background: white; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; font-size: 13px; cursor: grab; user-select: none; transition: var(--transition-fast); box-shadow: 0 1px 3px rgba(0,0,0,0.02);}
.col-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.col-card:active { cursor: grabbing; background: #f8fafc; }
.col-card.over { border: 2px solid var(--primary); transform: scale(1.02); background: var(--primary-light); z-index: 10; }

.drag-handle { color: #94a3b8; font-size: 18px; cursor: grab; }
.col-name-edit { border: none; background: transparent; font-family: 'Inter', sans-serif; font-weight: 600; color: var(--text-main); font-size: 13px; width: 100%; padding: 4px 0; border-bottom: 1px solid transparent; transition: 0.2s; }
.col-name-edit:focus { outline: none; border-bottom: 1px solid var(--primary); }

.preview-container { margin-top: 35px; background: white; padding: 25px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: 0 4px 15px rgba(0,0,0,0.02);}
#preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#preview-table th { background: #f8fafc; padding: 12px; border: 1px solid var(--border); text-align: left; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
#preview-table td { padding: 12px; border: 1px solid var(--border); white-space: nowrap; color: var(--text-main); font-weight: 500;}


/* ==========================================================================
   6. MOBILE RESPONSIVE OPTIMIZATION
   ========================================================================== */
.mobile-handle-container { display: none; } 

@media (max-width: 768px) {
    html, body { overflow: hidden; position: fixed; width: 100%; height: 100%; overscroll-behavior: none; }

    #login-overlay { justify-content: center; padding-left: 0; }
    #workspace { flex-direction: column; }
    
    #top-bar { 
        position: fixed; top: 12px; left: 12px; right: 12px; 
        width: auto; height: auto; border: none; background: transparent; 
        padding: 0; box-shadow: none; pointer-events: none; z-index: 100;
    }
    .bar-left { display: none; }
    .bar-right { pointer-events: auto; position: absolute; top: 0; right: 0; }
    
    #user-badge { 
        background: white; box-shadow: 0 4px 15px rgba(0,0,0,0.15); 
        padding: 6px; border-radius: 50%; width: 44px; height: 44px; 
        justify-content: center; border: 1px solid rgba(0,0,0,0.05);
    }
    .user-text { display: none; }
    #user-dropdown { top: 56px; right: 0; width: 220px; }
    
    #search-wrapper { top: 12px; left: 12px; right: 70px; width: auto; z-index: 80;}
    .search-box { width: 100%; box-shadow: 0 4px 15px rgba(0,0,0,0.15); border-radius: 24px; height: 48px;}
    
    #sidebar { 
        position: fixed; bottom: 0; left: 0; right: 0; width: 100%; 
        height: auto; max-height: 85vh; 
        border-radius: 24px 24px 0 0; border-left: none; border-top: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 -10px 30px rgba(0,0,0,0.1); 
        transform: translateY(calc(100% - 150px)); 
        transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); 
        z-index: 1000; 
    }
    #sidebar.expanded { transform: translateY(0); }
    
    .mobile-handle-container { 
        display: flex; justify-content: center; padding: 12px; cursor: pointer; 
        background: white; border-radius: 24px 24px 0 0; flex-shrink: 0;
    }
    .mobile-handle { width: 48px; height: 6px; background: #e2e8f0; border-radius: 10px; }
    
    .sidebar-header { padding: 12px 24px; border-bottom: none; }
    #log-list { background: white; max-height: 55vh; }
    
    #entryModal { align-items: flex-end; padding: 0;}
    .modal-panel { width: 100%; border-radius: 24px 24px 0 0; max-height: 92vh; animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
    
    .grid-2, .grid-3, .checkbox-grid { grid-template-columns: 1fr; gap: 16px;}
    .span-2, .span-3 { grid-column: span 1; }
    
    #admin-dashboard { flex-direction: column; }
    .dash-sidebar { width: 100%; height: auto; padding: 16px; flex-direction: row; align-items: center; justify-content: space-between; overflow-x: auto; }
    .dash-brand { margin: 0; font-size: 18px; margin-right: 20px; }
    .dash-user-card { display: none; }
    .dash-menu { display: flex; gap: 8px; flex-direction: row;}
    .dash-menu li { white-space: nowrap; margin: 0; padding: 10px 16px; font-size: 13px; }
    .dash-main { padding: 20px; }
}

