/* ===== CSS VARIABLES ===== */
:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --accent: #c9a96e;
    --accent-dark: #a08050;
    --success: #38a169;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ===== LOGIN ===== */
.login-page { background: var(--primary); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--card-bg); padding: 40px; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; }
.login-box h1 { color: var(--accent); font-size: 28px; margin-bottom: 8px; text-align: center; }
.login-box h2 { color: var(--text-light); font-size: 16px; font-weight: 400; margin-bottom: 24px; text-align: center; }

/* ===== NAVIGATION ===== */
.top-nav { background: var(--primary); color: white; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-size: 20px; font-weight: 700; color: var(--accent); padding: 16px 0; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { color: white; text-decoration: none; padding: 16px 12px; font-size: 14px; border-radius: 4px; transition: background 0.2s; }
.nav-links a:hover, .nav-links a.active { background: var(--primary-light); }
.hamburger { display: none; background: none; border: none; color: white; font-size: 24px; cursor: pointer; }

/* ===== CONTAINER ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 28px; color: var(--primary); }

/* ===== BUTTONS ===== */
.btn-primary { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: white; color: var(--primary); border: 1px solid var(--primary); padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; text-decoration: underline; font-size: 13px; }

/* ===== CARDS ===== */
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 24px; }
.card { background: var(--card-bg); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; border-left: 4px solid var(--accent); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card h3 { font-size: 16px; color: var(--text-light); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.card .stat { font-size: 36px; font-weight: 700; color: var(--primary); }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: var(--primary); color: white; padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table tr:hover { background: #f7fafc; }
.data-table tr:last-child td { border-bottom: none; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-light); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }

/* ===== MODALS ===== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: var(--card-bg); border-radius: 12px; padding: 32px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-content .close { position: absolute; top: 16px; right: 20px; font-size: 28px; cursor: pointer; color: var(--text-light); }

/* ===== DETAIL SECTIONS ===== */
.detail-section { background: var(--card-bg); border-radius: 12px; padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.detail-section h2 { font-size: 18px; color: var(--primary); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.info-item label { font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.info-item .value { font-size: 16px; font-weight: 500; color: var(--text); }

/* ===== STATUS BADGES ===== */
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.status-badge.ordered { background: #bee3f8; color: #2b6cb0; }
.status-badge.received { background: #c6f6d5; color: #276749; }
.status-badge.shipped { background: #fefcbf; color: #975a16; }
.status-badge.cancelled { background: #fed7d7; color: #c53030; }

/* ===== AUDIT TRAIL ===== */
.audit-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 16px; }
.audit-table h4 { font-size: 14px; color: var(--text-light); margin-bottom: 8px; }

/* ===== SHIPPING ===== */
.shipping-legs { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.shipping-leg { border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.shipping-leg h4 { font-size: 14px; color: var(--primary); margin-bottom: 12px; }

/* ===== FILTERS ===== */
.filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: flex-end; }
.filters input, .filters select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 24px; }
.pagination button { padding: 8px 16px; border: 1px solid var(--border); background: white; border-radius: 6px; cursor: pointer; }
.pagination button.active { background: var(--primary); color: white; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 16px 24px; border-radius: 8px; color: white; font-weight: 500; z-index: 300; animation: slideIn 0.3s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .hamburger { display: block; }
    .nav-links { display: none; position: absolute; top: 56px; left: 0; right: 0; background: var(--primary); flex-direction: column; padding: 8px; }
    .nav-links.active { display: flex; }
    .nav-links a { padding: 12px 16px; }
    .dashboard-cards { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .audit-tables { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .filters { flex-direction: column; }
    .filters input, .filters select { width: 100%; }
}

/* ===== PRINT ===== */
@media print {
    .top-nav, .btn-primary, .btn-secondary, .btn-danger, .filters, .pagination { display: none !important; }
    .detail-section { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
    body { background: white; }
}

/* ===== OWNER-ONLY VISIBILITY ===== */
body:not(.is-owner) .owner-only { display: none !important; }

/* ===== ERROR ===== */
.error-message { color: var(--danger); font-size: 14px; margin-top: 8px; }