:root {
    --primary: #0f172a;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 48px;
}

.logo i { font-size: 28px; color: var(--accent); }

.nav { list-style: none; flex-grow: 1; }

.nav li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav li:hover { background-color: #f1f5f9; color: var(--text-main); }
.nav li.active { background-color: #eff6ff; color: var(--accent); }
.nav li i { font-size: 20px; }

.badge {
    margin-left: auto;
    background: var(--border);
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 12px;
}

.user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    font-weight: 600;
}
.avatar {
    width: 36px; height: 36px;
    background: var(--accent); color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* Main Content */
.content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 32px 48px;
    overflow-y: auto;
}

/* Search */
header { margin-bottom: 32px; }

.search-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 20px; top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    color: var(--text-muted);
}

#searchInput {
    width: 100%;
    padding: 20px 20px 20px 56px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    outline: none;
    transition: all 0.2s;
}

#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1); }

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}
.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.purple { background: #faf5ff; color: #a855f7; }

.stat-value { display: block; font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 14px; color: var(--text-muted); font-weight: 500; }

/* Table */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: #f8fafc;
    padding: 16px 24px;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-main);
    vertical-align: middle;
}

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

.client-name { font-weight: 600; display: block; margin-bottom: 4px; }
.contract-tag {
    display: inline-block;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.tag-serial, .tag-patr {
    font-family: monospace;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}
.tag-serial { background: #eff6ff; color: #1d4ed8; }
.tag-patr { background: #fdf2f8; color: #be185d; }
.empty-dash { color: #cbd5e1; }

.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s;
}

.btn-view:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #eff6ff;
}

.no-results, .loading {
    padding: 48px;
    text-align: center;
    color: var(--text-muted);
}
.no-results i { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* =========================================
   LOGIN OVERLAY
========================================= */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-card .logo {
    justify-content: center;
    font-size: 24px;
    margin-bottom: 24px;
}

.login-card h2 {
    color: var(--text-main);
    margin-bottom: 8px;
    font-size: 20px;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

.login-card .input-group {
    position: relative;
    margin-bottom: 16px;
}

.login-card .input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 20px;
}

.login-card input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    transition: all 0.2s ease;
    text-align: center;
    letter-spacing: 4px;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.login-error {
    color: #ef4444;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: left;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.login-btn:hover {
    background: var(--accent-hover);
}
