* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-container { width: 100%; max-width: 420px; padding: 20px; }

.login-card {
    background: #fff; border-radius: 16px; padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 { font-size: 28px; text-align: center; color: #1a1a2e; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; color: #666; font-size: 14px; margin-bottom: 24px; }

.login-info {
    margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee;
    font-size: 12px; color: #999; text-align: center;
}
.login-info p { margin-bottom: 2px; }

/* Navbar */
.navbar {
    background: #1a1a2e; padding: 0 24px; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); overflow-x: auto;
}

.nav-inner {
    max-width: 1400px; margin: 0 auto; display: flex;
    align-items: center; justify-content: space-between; min-height: 52px; gap: 12px;
}

.nav-brand { color: #fff; font-size: 18px; font-weight: 700; text-decoration: none; white-space: nowrap; }

.nav-menu { display: flex; list-style: none; gap: 2px; align-items: center; flex-wrap: wrap; }

.nav-menu a {
    color: #ccc; text-decoration: none; padding: 6px 10px; border-radius: 6px;
    font-size: 13px; font-weight: 500; transition: all 0.2s; white-space: nowrap;
}

.nav-menu a:hover, .nav-menu a.active { color: #fff; background: rgba(255,255,255,0.12); }

.nav-user { color: #999; font-size: 12px; padding: 0 6px; white-space: nowrap; }
.nav-logout { color: #ff6b6b !important; }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 20px;
}

.stat-card {
    background: #fff; border-radius: 10px; padding: 16px; text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); border-left: 4px solid #4361ee;
}

.stat-card.warning { border-left-color: #f72585; }
.stat-card.danger { border-left-color: #e63946; }
.stat-card.success { border-left-color: #2ec4b6; }
.stat-card.accent { border-left-color: #7209b7; }

.stat-number { display: block; font-size: 22px; font-weight: 700; color: #1a1a2e; }
.stat-label { display: block; font-size: 12px; color: #666; margin-top: 2px; }

/* Cards */
.card {
    background: #fff; border-radius: 10px; padding: 18px;
    margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card h2 { font-size: 16px; margin-bottom: 12px; color: #1a1a2e; }
.card h3 { font-size: 14px; margin: 12px 0 8px; color: #495057; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.card-header h2 { margin-bottom: 0; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Grid */
.row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 280px; }
.col-4 { flex: 0 0 calc(33.333% - 11px); min-width: 260px; }
.col-8 { flex: 0 0 calc(66.667% - 6px); min-width: 300px; }

/* Tables */
.table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}

.table th {
    background: #f8f9fa; text-align: left; padding: 8px 10px;
    font-weight: 600; color: #495057; border-bottom: 2px solid #dee2e6; white-space: nowrap;
}

.table td { padding: 8px 10px; border-bottom: 1px solid #eee; }
.table tbody tr:hover { background: #f8f9fa; }
.table tfoot td { font-weight: 600; border-top: 2px solid #dee2e6; }
.table-total td { background: #f8f9fa; }

.row-warning { background: #fffbf0 !important; }
.row-warning:hover { background: #fff7e0 !important; }

/* Badges */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 600; text-transform: lowercase;
}

.badge-active, .badge-completed, .badge-purchase { background: #d4edda; color: #155724; }
.badge-expired, .badge-cancelled { background: #f8d7da; color: #721c24; }
.badge-draft { background: #fff3cd; color: #856404; }
.badge-sale { background: #cce5ff; color: #004085; }
.badge-transfer { background: #e2d5f5; color: #5a2d82; }
.badge-adjustment { background: #fff3cd; color: #856404; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-paid { background: #d4edda; color: #155724; }
.badge-overdue { background: #f8d7da; color: #721c24; }
.badge-admin { background: #cce5ff; color: #004085; }
.badge-operator { background: #d4edda; color: #155724; }
.badge-viewer { background: #e2e3e5; color: #383d41; }

/* Buttons */
.btn {
    display: inline-block; padding: 7px 14px; border-radius: 6px; font-size: 13px;
    font-weight: 500; text-decoration: none; border: 1px solid transparent;
    cursor: pointer; transition: all 0.2s; background: #f0f2f5; color: #1a1a2e;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #4361ee; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-danger { background: #e63946; color: #fff; }
.btn-success { background: #2ec4b6; color: #fff; }
.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn-full { width: 100%; }
.btn-active { background: #4361ee; color: #fff; }

/* Forms */
.form { max-width: 100%; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #495057; margin-bottom: 3px; }

.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #ced4da;
    border-radius: 6px; font-size: 13px; font-family: inherit;
    transition: border-color 0.2s; background: #fff;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}

.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.form-inline {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
}

.form-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

.text-center { text-align: center; }
.text-muted { color: #999; }
.actions { white-space: nowrap; }
.danger { color: #e63946 !important; }
.success { color: #2ec4b6 !important; }

@media (max-width: 768px) {
    .nav-inner { flex-direction: column; height: auto; padding: 8px 0; }
    .nav-menu { justify-content: center; }
    .row { flex-direction: column; }
    .col-4, .col-8 { flex: 1; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: 0; }
    .form-inline { flex-direction: column; }
}
