/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f5f7fa; color: #333; line-height: 1.6; -webkit-text-size-adjust: 100%; }

/* ===== NAVBAR ===== */
.navbar { background: #fff; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 100; }
.navbar .brand { font-size: 1.2rem; font-weight: 700; color: #2563eb; text-decoration: none; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a { text-decoration: none; color: #64748b; padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: 0.85rem; transition: all 0.2s; white-space: nowrap; }
.nav-links a:hover { background: #f0f4ff; color: #2563eb; }
.nav-links a.active { background: #2563eb; color: #fff; }

/* Hamburger Menu */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; border-radius: 8px; }
.hamburger:hover { background: #f0f4ff; }
.hamburger span { display: block; width: 24px; height: 3px; background: #2563eb; margin: 4px 0; border-radius: 2px; transition: all 0.3s; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== CONTAINER ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 15px; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 1.5rem; color: #1e293b; }

/* ===== CARDS ===== */
.card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 16px; }
.card h3 { font-size: 1rem; color: #475569; margin-bottom: 12px; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid; }
.stat-card.blue { border-left-color: #2563eb; }
.stat-card.green { border-left-color: #10b981; }
.stat-card.red { border-left-color: #ef4444; }
.stat-card.purple { border-left-color: #8b5cf6; }
.stat-card.orange { border-left-color: #f59e0b; }
.stat-card .label { font-size: 0.8rem; color: #64748b; margin-bottom: 4px; }
.stat-card .value { font-size: 1.3rem; font-weight: 700; color: #1e293b; word-break: break-word; }
.stat-card .sub { font-size: 0.75rem; color: #94a3b8; margin-top: 4px; }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.85rem; color: #475569; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: 1rem; transition: border-color 0.2s; background: #fff;
    -webkit-appearance: none; appearance: none; min-height: 44px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* ===== BUTTONS ===== */
.btn { padding: 12px 18px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; -webkit-tap-highlight-color: transparent; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }
.btn-primary { background: #2563eb; color: #fff; }
.btn-success { background: #10b981; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #2563eb; color: #2563eb; }
.btn-sm { padding: 8px 12px; font-size: 0.8rem; min-height: 36px; }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; border-radius: 12px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
table thead { background: #f8fafc; }
table th { padding: 10px 12px; text-align: left; font-size: 0.75rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; }
table tbody tr:hover { background: #f8fafc; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: #10b981; }
.text-red { color: #ef4444; }
.text-blue { color: #2563eb; }
.text-gray { color: #64748b; }
.font-bold { font-weight: 700; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-yellow { background: #fef3c7; color: #d97706; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: flex-start; padding: 20px 10px; overflow-y: auto; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 550px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: slideDown 0.3s ease; }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.modal-header h3 { font-size: 1.2rem; color: #1e293b; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #94a3b8; padding: 8px; min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { color: #ef4444; }

/* ===== FILTERS BAR ===== */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters-bar input, .filters-bar select { padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.9rem; min-height: 44px; -webkit-appearance: none; appearance: none; }
.filters-bar input:focus, .filters-bar select:focus { outline: none; border-color: #2563eb; }

/* ===== INFO BOX ===== */
.info-box { background: #f0f7ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.info-box .info-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.85rem; gap: 10px; }
.info-box .info-row.total { border-top: 1px solid #bfdbfe; margin-top: 8px; padding-top: 10px; font-weight: 700; }

/* ===== CUSTOMER CARD ===== */
.customer-card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 12px; border: 1px solid #f1f5f9; transition: box-shadow 0.2s; }
.customer-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.customer-card .customer-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 10px; }
.customer-card .customer-name { font-size: 1rem; font-weight: 700; color: #1e293b; word-break: break-word; }
.customer-card .customer-info { font-size: 0.8rem; color: #64748b; word-break: break-all; }
.customer-card .work-list { margin-top: 10px; border-top: 1px solid #f1f5f9; padding-top: 10px; }
.customer-card .work-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f8fafc; gap: 10px; flex-wrap: wrap; }
.customer-card .work-item:last-child { border-bottom: none; }

/* ===== CHART BAR ===== */
.chart-bar-container { display: flex; height: 24px; border-radius: 12px; overflow: hidden; margin: 12px 0; }
.chart-bar-segment { height: 100%; transition: width 0.3s; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chart-legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; color: #475569; }
.chart-legend-item .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 30px 15px; color: #94a3b8; }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 8px; }

/* ===== ACTION BUTTONS GROUP ===== */
.action-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== PRINT ===== */
@media print {
    .navbar, .btn, .filters-bar, .no-print, .hamburger { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .container { padding: 0; }
    .modal-overlay { position: static !important; background: none !important; display: block !important; padding: 0 !important; }
    .modal { box-shadow: none !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
    .modal-header { display: none !important; }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Navbar */
    .navbar { padding: 10px 15px; flex-wrap: wrap; }
    .navbar .brand { font-size: 1.1rem; }
    .hamburger { display: block; }
    .nav-links {
        display: none; width: 100%; flex-direction: column; gap: 2px;
        padding-top: 10px; border-top: 1px solid #e2e8f0; margin-top: 10px;
    }
    .nav-links.active { display: flex; }
    .nav-links a { padding: 12px 16px; font-size: 0.95rem; border-radius: 8px; }

    /* Page Header */
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header h2 { font-size: 1.3rem; }
    .page-header > div { width: 100%; }
    .page-header .btn { flex: 1; justify-content: center; }

    /* Stats */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-card .value { font-size: 1.1rem; }

    /* Grids */
    .grid-2 { grid-template-columns: 1fr; gap: 12px; }
    .grid-3 { grid-template-columns: 1fr 1fr; gap: 8px; }

    /* Cards */
    .card { padding: 14px; margin-bottom: 12px; }

    /* Filters */
    .filters-bar { flex-direction: column; }
    .filters-bar input, .filters-bar select { width: 100%; min-width: auto; }

    /* Modals */
    .modal-overlay { padding: 10px 8px; align-items: flex-start; }
    .modal { padding: 16px; border-radius: 12px; max-width: 100%; }
    .modal-header { flex-direction: row; }
    .modal-header > div { width: 100%; justify-content: flex-end; }

    /* Tables */
    table { min-width: 450px; }
    table th, table td { padding: 8px 10px; font-size: 0.8rem; }

    /* Customer Cards */
    .customer-card { padding: 14px; }
    .customer-card .customer-header { flex-direction: column; }
    .customer-card .work-item { flex-direction: column; align-items: flex-start; gap: 6px; }

    /* Form rows */
    .form-row { grid-template-columns: 1fr; }

    /* Info box */
    .info-box .info-row { flex-direction: column; gap: 2px; }
    .info-box .info-row span:last-child { font-weight: 700; }

    /* Action buttons */
    .action-buttons { width: 100%; }
    .action-buttons .btn { flex: 1; font-size: 0.75rem; padding: 8px 8px; }

    /* Chart legend */
    .chart-legend { gap: 8px; }
    .chart-legend-item { font-size: 0.75rem; }
}

/* Extra small screens */
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .stat-card .value { font-size: 1rem; }
    .container { padding: 15px 10px; }
    .page-header h2 { font-size: 1.2rem; }
    .nav-links a { font-size: 0.9rem; padding: 10px 14px; }
}