:root {
    --primary: #1e293b;
    --secondary: #3b82f6;
    --bg: #f8fafc;
    --text: #334155;
    --border: #cbd5e1;
    --white: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg); color: var(--text); }

/* Login Screen */
#login-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    display: flex; justify-content: center; align-items: center; z-index: 2000;
}
.login-card {
    background: var(--white); padding: 40px; border-radius: 12px; width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3); text-align: center;
}
.login-card h2 { margin-bottom: 20px; color: var(--primary); font-size: 1.2rem; }
.login-card .form-group { margin-bottom: 15px; text-align: left; display: flex; flex-direction: column; }
.login-card label { margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: #475569; }
.login-card input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; }
.login-card button { width: 100%; padding: 12px; background: var(--secondary); color: white; border: none; border-radius: 6px; font-size: 1rem; font-weight: bold; cursor: pointer; margin-top: 10px; }

/* App Container */
#app-container { display: none; width: 100%; min-height: 100vh; }

/* Sidebar Navigation */
aside { width: 280px; background: var(--primary); color: var(--white); display: flex; flex-direction: column; flex-shrink: 0; }
aside .logo { padding: 18px 20px; font-size: 1.05rem; font-weight: bold; background: #0f172a; border-bottom: 1px solid #334155; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
aside .logo .logo-row { display: flex; align-items: center; gap: 8px; }
aside .logo img { height: 26px; }
aside .logo span { white-space: nowrap; }
aside ul { list-style: none; padding: 15px; flex-grow: 1; }
aside ul li { padding: 12px 15px; border-radius: 6px; cursor: pointer; margin-bottom: 8px; font-size: 0.95rem; transition: background 0.2s; }
aside ul li:hover, aside ul li.active { background: var(--secondary); color: var(--white); }

/* Main Workspace */
main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
header { background: var(--white); padding: 15px 30px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
header h1 { font-size: 1.4rem; color: var(--primary); }
.user-info { font-weight: 600; color: #64748b; display: flex; align-items: center; gap: 15px; }

.content-area { padding: 30px; }
.content-area.hidden { display: none; }

/* Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 25px; }
.card {
    background: linear-gradient(135deg, var(--white), #f1f5f9);
    padding: 20px; border-radius: 12px; border: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.04); position: relative; overflow: hidden;
}
.card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--secondary); }
.card h3 { font-size: 0.8rem; color: #64748b; text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px; }
.card .value { font-size: 2rem; font-weight: bold; color: var(--primary); }

/* Tables */
.table-container { background: var(--white); border-radius: 8px; border: 1px solid var(--border); overflow: hidden; margin-top: 15px; margin-bottom: 25px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: #f1f5f9; padding: 18px 20px; font-size: 0.85rem; font-weight: 700; color: #334155; border-bottom: 1px solid var(--border); white-space: nowrap; letter-spacing: 0.2px; }
td { padding: 18px 20px; border-bottom: 1px solid var(--border); font-size: 0.95rem; line-height: 1.5; }
tr:hover { background: #f8fafc; }

/* Forms & Buttons */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; background: var(--white); padding: 25px; border-radius: 8px; border: 1px solid var(--border); }
.form-group { display: flex; flex-direction: column; }
.form-group label { margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: #475569; }
.form-group input, .form-group select, .form-group textarea { padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; width: 100%; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

button { padding: 8px 14px; border-radius: 6px; border: none; font-weight: 600; cursor: pointer; transition: opacity 0.2s; font-size: 0.85rem; }
button:hover { opacity: 0.9; }
.btn-primary { background: var(--secondary); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; margin-right: 4px; }
.clickable-link { color: var(--secondary); text-decoration: underline; cursor: pointer; font-weight: bold; background: none; border: none; padding: 0; font-size: inherit; }

.status-select { padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); font-size: 0.88rem; background: var(--white); font-weight: 600; }
.date-input { padding: 5px; border-radius: 6px; border: 1px solid var(--border); font-size: 0.85rem; }

/* Modal Overlay */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.modal.flex { display: flex; }
.modal-content { background: var(--white); padding: 30px; border-radius: 8px; width: 600px; max-width: 92vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* Status Row Colors */
tr.status-completed { background-color: #d1fae5 !important; }
tr.status-cancelled { background-color: #fee2e2 !important; }
tr.status-find-carrier { background-color: #e0f2fe !important; }
tr.status-hold { background-color: #fecaca !important; }

/* Checkmark filter container */
.filter-container {
    display: flex; gap: 15px; align-items: center; margin-bottom: 12px; font-size: 0.85rem;
    background: #f1f5f9; padding: 10px 15px; border-radius: 6px; border: 1px solid var(--border);
    flex-wrap: wrap; justify-content: space-between;
}
.filter-container label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 600; }

/* Graphs & Analytics styling */
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 25px; }
.chart-card { background: var(--white); padding: 20px; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 4px 6px rgba(0,0,0,0.04); }
.chart-card h3 { font-size: 0.95rem; color: var(--primary); margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.bar-chart-mock { display: flex; align-items: flex-end; justify-content: space-around; height: 180px; padding-top: 20px; border-bottom: 2px solid var(--border); }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar { width: 35px; background: var(--secondary); border-radius: 4px 4px 0 0; transition: height 0.3s; }
.bar-label { font-size: 0.72rem; color: #64748b; text-align: center; }

.overview-panel { display: flex; flex-direction: column; gap: 15px; justify-content: center; height: 180px; padding: 0 20px; font-size: 0.9rem; }
.overview-row { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.overview-row:last-child { border-bottom: none; }

@media (max-width: 900px) {
    #app-container { flex-direction: column; }
    aside { width: 100%; }
    .form-grid, .charts-grid, .stats-grid { grid-template-columns: 1fr; }
}

/* Toast */
.toast-host { position: fixed; top: 16px; right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 6px; color: white; font-size: 0.85rem; font-weight: 600; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: toastin 0.15s ease-out; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Action button cells: never let neighboring columns squeeze these into wrapping */
td.actions-cell { white-space: nowrap; }
td.actions-cell > * { display: inline-flex; }
.btn-row { display: inline-flex; gap: 6px; flex-wrap: nowrap; align-items: center; }




.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.72rem; font-weight: 700; }
.badge-entity-lrl { background: #dbeafe; color: #1e40af; }
.badge-entity-exp { background: #fee2e2; color: #991b1b; }
.badge-entity-pit { background: #e0e7ff; color: #3730a3; }
.hidden { display: none !important; }
.admin-only-col.role-hidden { display: none !important; }
.text-muted { color: #64748b; }
