:root {
    /* Modern Navy Palette */
    --navy-950: #050b14;
    --navy-900: #0a1626;
    --navy-800: #0f223d; /* Primary Brand */
    --navy-700: #1a365d;
    --navy-600: #2a4365;
    --navy-500: #2c5282;
    --navy-400: #4299e1; /* Accent */
    --navy-100: #ebf8ff;
    --navy-050: #f7fafc;

    /* Semantic Colors */
    --color-bg: #f4f6f8;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text-primary: #1a202c;
    --color-text-secondary: #4a5568;
    --color-text-muted: #718096;
    --color-primary: var(--navy-800);
    --color-primary-hover: var(--navy-700);
    --color-accent: var(--navy-400);

    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    font-size: 14px;
    height: 100%;
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--navy-900);
    font-weight: 600;
}

/* Utilities */
.text-primary { color: var(--navy-700) !important; }
.bg-primary { background-color: var(--navy-800) !important; }
.text-muted { color: var(--color-text-muted) !important; }

/* Card Styling */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(10, 22, 38, 0.08);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--navy-900);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.card-body {
    padding: 1.25rem;
}

/* Button Styling */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--navy-800);
    border-color: var(--navy-800);
}

.btn-primary:hover {
    background-color: var(--navy-700);
    border-color: var(--navy-700);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-outline-secondary {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--navy-050);
    color: var(--navy-900);
}

/* Form Controls */
.form-control, .form-select {
    border-radius: var(--border-radius-sm);
    border-color: var(--color-border);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--navy-400);
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.2);
}

/* Badge Styling */
.badge {
    font-weight: 500;
    letter-spacing: 0.025em;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* Table Styling */
.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 600;
    background-color: var(--navy-050);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.table-hover tbody tr:hover {
    background-color: var(--navy-050);
}

/* Loading Spinner */
.spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.2em;
}

/* Layout Container (Used in MainLayout) */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

.sidebar-wrapper {
    width: var(--sidebar-width);
    background: var(--navy-900);
    color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
    z-index: 1040;
}

.main-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--color-bg);
    height: 100vh;
    overflow-y: auto;
}

/* Auth Header */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.auth-header .logo-section i {
    font-size: 3rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

/* Mobile Sidebar Logic */
@media (max-width: 768px) {
    .sidebar-wrapper {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }

    .sidebar-wrapper.show {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1030;
        backdrop-filter: blur(2px);
    }
}

/* ═══════════════════════════════════════════════
   REUSABLE DESIGN PATTERNS
   ═══════════════════════════════════════════════ */

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.page-header-info h2, .page-header-info h4 {
    margin: 0 0 0.25rem;
    font-weight: 700;
    color: var(--navy-900);
}

.page-header-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

@media (max-width: 767.98px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Empty State ── */
.empty-state-global {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3.5rem 2rem;
    border: 2px dashed var(--color-border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fafbfc 0%, #f4f6f8 100%);
}

.empty-state-global .empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
}

.empty-state-global h6 {
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.35rem;
}

.empty-state-global p {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 767.98px) {
    .empty-state-global {
        padding: 2.5rem 1.5rem;
    }
}

/* ── Summary Bar ── */
.summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-top: 1.25rem;
}

.summary-bar .summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

@media (max-width: 767.98px) {
    .summary-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        text-align: center;
    }
}

/* ── Modal Chrome ── */
.modal-content {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 28px 48px -32px rgba(15, 34, 61, 0.75);
    background: var(--color-surface);
}

.modal-header {
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--color-border);
    padding: 1rem 1.25rem;
}

/* ── Pagination ── */
.pagination-navy .page-link {
    border: none;
    color: var(--color-text-secondary);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination-navy .page-link:hover {
    background-color: var(--navy-050);
    color: var(--navy-700);
}

.pagination-navy .page-item.active .page-link {
    background-color: var(--navy-800);
    color: #fff;
}

.pagination-navy .page-item.disabled .page-link {
    opacity: 0.4;
}

/* ── Section Card ── */
.section-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    color: var(--navy-900);
}

.section-card-body {
    padding: 1.25rem;
}

.section-card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
}

/* ── Icon Action Button (34x34) ── */
.icon-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.icon-action-btn:hover {
    background: #f7fafc;
    border-color: var(--color-border);
}

.icon-action-btn.action-edit:hover {
    color: var(--navy-600);
    background: #ebf8ff;
    border-color: #bee3f8;
}

.icon-action-btn.action-delete:hover {
    color: #e53e3e;
    background: #fff5f5;
    border-color: #fed7d7;
}

.icon-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Tag Pills ── */
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.6;
}

.tag-pill.tag-gray { background: #edf2f7; color: #4a5568; }
.tag-pill.tag-blue { background: #ebf8ff; color: #2b6cb0; }
.tag-pill.tag-green { background: #f0fff4; color: #276749; }
.tag-pill.tag-red { background: #fff5f5; color: #c53030; }
.tag-pill.tag-yellow { background: #fffff0; color: #975a16; }
.tag-pill.tag-mono { background: #f7fafc; color: #718096; font-family: 'SF Mono', SFMono-Regular, Consolas, monospace; letter-spacing: 0.02em; }

/* ── Value Highlight ── */
.value-highlight {
    background: linear-gradient(135deg, #ebf8ff 0%, #f0f5ff 100%);
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
}

/* ── Fade In Animation ── */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
