:root {
    --primary: #2F70BF;
    --primary-dark: #245a99;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --gray-900: #212529;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* Layout */
.app-header {
    background: white;
    color: var(--gray-900);
    padding: 0 2rem;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--gray-900);
    font-size: 1.1rem;
    font-weight: 600;
}

.header-brand:hover { color: var(--gray-900); }

.header-logo {
    height: 80px;
    width: auto;
}

.app-header nav { display: flex; align-items: center; gap: 1.5rem; }
.app-header nav a { color: var(--gray-600); text-decoration: none; font-size: 0.9rem; }
.app-header nav a:hover { color: var(--primary); }
.app-header .user-info { font-size: 0.85rem; color: var(--gray-600); }

.container { max-width: 1200px; margin: 2rem auto; padding: 0 1.5rem; }

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h2 { font-size: 1.15rem; font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover { background: var(--gray-50); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c82333; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #218838; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-200);
    color: var(--gray-800);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-600); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--gray-800);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47,112,191,0.15);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-expired { background: #d1ecf1; color: #0c5460; }

/* Login page */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-logo {
    display: block;
    width: 250px;
    margin: 0 auto 1rem;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.login-card p.subtitle {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-card form { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; padding: 0.7rem; }

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* Quantity input */
.qty-control {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.qty-control input[type="number"] {
    width: 70px;
    text-align: center;
    padding: 0.3rem;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.stat-card .label { font-size: 0.8rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; margin-top: 0.25rem; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal h3 { margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .app-header { padding: 0 1rem; }
    .container { padding: 0 1rem; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}
