:root {
    --bg: #0f172a; --card: #1e293b; --text: #f8fafc;
    --primary: #0ea5e9; --success: #22c55e; --warn: #f59e0b;
    --urgent: #f97316; --danger: #ef4444; --gold: #fbbf24;
    --border: rgba(255,255,255,0.1); --edge-w: 6px;
}

.light-mode {
    --bg: #f1f5f9; --card: #ffffff; --text: #0f172a;
    --primary: #0284c7; --border: rgba(0,0,0,0.15);
}

body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); margin: 0; transition: 0.3s; min-height: 100vh; }
body.modal-open { overflow: hidden; }
.container { max-width: 900px; margin: auto; padding: 0 15px; }

/* --- LOGIN SCREEN --- */
#login-overlay { 
    position: fixed; inset: 0; 
    background: radial-gradient(circle at center, #1e3a8a 0%, #020617 100%); 
    display: flex; align-items: center; justify-content: center; 
    z-index: 9999; padding: 20px;
}
.login-card { 
    background: var(--card); padding: 40px; border-radius: 40px; 
    width: 100%; max-width: 400px; text-align: center; 
    border: 2px solid var(--primary); 
    box-shadow: 0 0 40px rgba(3, 105, 161, 0.4); 
    box-sizing: border-box;
}

.login-field-label {
    display: block; text-align: left; margin: 10px 0 5px 5px;
    font-size: 0.75rem; font-weight: 800; text-transform: uppercase;
    color: var(--primary); opacity: 0.9;
}

.pass-wrapper { 
    display: flex; align-items: center; 
    background: rgba(0,0,0,0.25); border: 1px solid var(--border); 
    border-radius: 12px; margin-bottom: 10px; padding-right: 12px; overflow: hidden;
}
.pass-wrapper .search-input { border: none !important; background: transparent !important; margin-bottom: 0 !important; flex: 1; }

.toggle-pass { 
    background: none; border: none; font-size: 1.2rem; cursor: pointer; 
    color: var(--primary); opacity: 0.8; display: flex; align-items: center; justify-content: center;
}

.login-options { 
    display: flex; align-items: center; justify-content: space-between; 
    margin: 5px 0 20px 5px; font-size: 0.85rem; 
}

.manual-link { 
    color: var(--primary); text-decoration: none; font-weight: 800; 
    font-size: 0.75rem; letter-spacing: 0.5px; opacity: 0.9; transition: 0.2s;
}
.manual-link:hover { opacity: 1; text-decoration: underline; }

.login-split { display: flex; gap: 10px; margin-top: 15px; width: 100%; justify-content: space-between; }
.login-split .top-btn { flex: 1; width: auto; }

.login-footer {
    margin-top: 25px; padding-top: 15px; border-top: 1px solid var(--border);
    font-size: 0.7rem; opacity: 0.6; line-height: 1.4;
}

.bling-logo { font-size: 110px; display: block; margin-bottom: 20px; filter: drop-shadow(0 0 15px var(--primary)); animation: gentle-swing 3s infinite ease-in-out; }
@keyframes gentle-swing { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }

/* --- LISTS & UI --- */
.top-bar { background: var(--card); border-bottom: 2px solid var(--primary); position: sticky; top: 0; z-index: 1000; padding: 10px 0; }
.top-content { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.tab-nav { display: flex; gap: 8px; margin: 20px 0; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 16px; border: 1px solid var(--border); }
.tab-btn { flex: 1; border: none; padding: 14px; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; font-weight: 800; opacity: 0.5; transition: 0.2s; }
.tab-btn.active { background: var(--primary); opacity: 1; color: #fff; box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3); }

.emp-card { background: var(--card); border-radius: 16px; margin-bottom: 12px; border: 1px solid var(--primary); overflow: hidden; }
.grad-header { padding: 10px 15px; display: flex; align-items: center; background: linear-gradient(90deg, rgba(3,105,161, 0.1) 0%, transparent 100%); border-left: var(--edge-w) solid var(--primary); }
.license-row { padding: 8px 15px; display: flex; align-items: center; border-bottom: 1px solid var(--border); gap: 15px; }
.row-info { flex: 1; font-weight: 600; min-width: 0; }
.row-actions { display: flex; align-items: center; gap: 20px; margin-left: auto; }

/* Groupless styling */
.header-groupless { border-color: #94a3b8; }
.header-groupless .grad-header { border-left-color: #94a3b8; }

.id-col { 
    font-family: 'Courier New', monospace; font-weight: 700; color: #38bdf8; 
    width: 65px; min-width: 65px; max-width: 65px; flex-shrink: 0; display: inline-block;
}

.gold-icon {
    color: var(--gold);
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
    font-style: normal;
    margin-right: 8px;
    font-size: 1.25rem;
    vertical-align: middle;
}

.type-icon { font-style: normal; margin-right: 8px; opacity: 0.7; }

@media (max-width: 600px) {
    .license-row { display: grid !important; grid-template-columns: 1fr auto; grid-template-areas: "info renew" "actions renew"; gap: 4px 10px; padding: 12px 15px; }
    .row-info { grid-area: info; }
    .row-actions { grid-area: actions; margin-left: 0; justify-content: flex-start !important; gap: 12px !important; }
    .renew-btn, .print-btn { grid-area: renew; align-self: center; }
}

.status-pill { display: inline-flex; align-items: center; justify-content: center; width: 85px; height: 24px; border-radius: 6px; font-size: 10px; font-weight: 800; text-align: center; border: 1px solid transparent; box-sizing: border-box; flex-shrink: 0; }
.pill-safe { border-color: var(--success); color: var(--success); background: transparent; }
.pill-warn { background: var(--warn); color: #000; } 
.pill-urgent { background: var(--urgent); color: #fff; } 
.pill-crit { background: var(--danger); color: #fff; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; z-index: 9000; padding: 40px 20px; }
.modal { background: var(--card); padding: 30px; border-radius: 30px; width: 100%; max-width: 650px; border: 3px solid var(--primary); max-height: 100%; overflow-y: auto; }
.modal-label { display: block; margin: 15px 0 5px 5px; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; opacity: 0.7; color: var(--primary); }

.selection-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.grid-opt { padding: 16px; border-radius: 12px; cursor: pointer; background: rgba(255,255,255,0.05); border: 2px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.grid-opt.selected { background: var(--primary) !important; color: white !important; border-color: var(--primary); }
.grid-opt-info { display: flex; flex-direction: column; gap: 4px; }

.top-btn { padding: 10px 14px; border-radius: 12px; border: none; cursor: pointer; font-weight: 700; background: var(--primary); color: #fff; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-edit { padding: 7px 14px; font-size: 0.85rem; background: rgba(255,255,255,0.1); border: 1px solid var(--border); color: inherit; cursor: pointer; border-radius: 8px; font-weight: 700; }
.renew-btn, .print-btn { display: flex; align-items: center; justify-content: center; color: #fff; border: none; border-radius: 12px; width: 45px; height: 45px; cursor: pointer; font-size: 1.3rem; }
.print-btn { background: var(--danger); margin-left: 8px; }

.badge { padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 900; text-transform: uppercase; margin-top: 6px; display: inline-block; width: fit-content; }
.badge-admin { background: linear-gradient(135deg, #fef08a, #eab308); color: #000; }
.badge-master { background: linear-gradient(135deg, #d8b4fe, #7e22ce); color: #fff; }

.hidden { display: none !important; }
.search-input { width: 100%; padding: 16px; margin-bottom: 10px; border-radius: 12px; border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: inherit; box-sizing: border-box; font-size: 1rem; }
