:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-light: #f4f6f9;
    --bg-card: #ffffff;
    --border-light: #e5e9f0;
    --text-main: #1f2937;
    --text-muted: #6b7280;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14.5px;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid var(--border-light);
    min-height: 100vh;
    position: sticky;
    top: 0;
    transition: width .2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.3rem 1.25rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border-light);
}

.sidebar-nav { padding: 1rem .75rem; display: flex; flex-direction: column; gap: .15rem; }

.nav-section-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: 1rem .75rem .35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .85rem;
    border-radius: .55rem;
    color: var(--text-main);
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
}

.nav-link i { font-size: 1rem; color: var(--text-muted); }

.nav-link:hover { background: var(--bg-light); }

.nav-link.active {
    background: var(--primary);
    color: #fff;
}

.nav-link.active i { color: #fff; }

/* Main */
.main-content { flex: 1; min-width: 0; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    padding: .85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.btn-toggle {
    border: none;
    background: transparent;
    font-size: 1.3rem;
    color: var(--text-main);
}

.user-menu {
    border: 1px solid var(--border-light);
    border-radius: .6rem;
    font-size: .88rem;
    background: #fff;
}

.page-content { padding: 1.75rem; }

/* Cards */
.card {
    border: 1px solid var(--border-light);
    border-radius: .9rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.stat-card {
    border-radius: 1rem;
    padding: 1.25rem 1.4rem;
    background: #fff;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.stat-card .stat-icon {
    width: 46px; height: 46px;
    border-radius: .75rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    background: rgba(37, 99, 235, .1);
    color: var(--primary);
}

.stat-card .stat-value { font-size: 1.55rem; font-weight: 700; }
.stat-card .stat-label { color: var(--text-muted); font-size: .82rem; }

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); }

.btn, .form-control, .form-select { border-radius: .55rem; }

/* Tables */
.table { font-size: .89rem; }
.table thead th {
    background: var(--bg-light);
    border-bottom: none;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .03em;
}

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f4f6f9 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(16, 24, 40, .08);
    padding: 2.5rem 2.25rem;
}

.badge-role {
    background: rgba(37, 99, 235, .1);
    color: var(--primary);
    font-weight: 500;
    border-radius: .4rem;
    padding: .3rem .6rem;
}

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -260px; z-index: 1000; box-shadow: 0 0 20px rgba(0,0,0,.1);}
    .sidebar.show { left: 0; }
}

/* Asset Form */
.section-divider { margin-bottom: .5rem; }
.section-divider .badge { font-size: .8rem; border-radius: .5rem; }

/* Pagination */
.pagination { margin-bottom: 0; }
.page-link { border-radius: .45rem !important; margin: 0 .1rem; color: var(--primary); }
.page-item.active .page-link { background-color: var(--primary); border-color: var(--primary); }

/* Table hover */
.table > tbody > tr:hover { background-color: #f8faff; }

/* Code in tables */
code { color: #1d4ed8; background: #eef2ff; border-radius: .35rem; padding: .15rem .4rem; font-size: .82rem; }

/* Doc card & btn-xs */
.btn-xs { padding:.25rem .5rem; font-size:.75rem; border-radius:.4rem; }
.doc-card { border:1px solid var(--border-light); border-radius:.75rem; padding:.9rem 1rem; background:#fff; transition:box-shadow .15s; }
.doc-card:hover { box-shadow:0 2px 12px rgba(37,99,235,.1); }

/* Modal */
.modal-content { border-radius:.9rem; border:none; box-shadow:0 8px 40px rgba(16,24,40,.15); }
.modal-header { border-bottom:1px solid var(--border-light); border-radius:.9rem .9rem 0 0; }

/* Spinner */
.spinner-border { width:1.75rem; height:1.75rem; }

/* Timeline */
.timeline { position:relative; padding-left:1.5rem; }
.timeline::before { content:''; position:absolute; left:.45rem; top:0; bottom:0; width:2px; background:var(--border-light); }
.timeline-item { position:relative; margin-bottom:1.25rem; }
.timeline-dot { position:absolute; left:-1.5rem; top:.25rem; width:10px; height:10px; border-radius:50%; background:var(--primary); border:2px solid #fff; box-shadow:0 0 0 2px var(--border-light); }

/* Purple color utility */
.text-purple { color: #7c3aed !important; }
.bg-purple-subtle { background-color: #f3f0ff !important; }

/* Transaction status colors */
.badge.text-teal { color: #0d9488 !important; }
.bg-teal-subtle { background-color: #f0fdfa !important; }

/* Info label (shared across views) */
.info-label { font-size:.75rem; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); font-weight:600; margin-bottom:.15rem; }
.info-value { font-size:.92rem; color:var(--text-main); font-weight:500; }
.info-value.mono, .mono { font-family: monospace; }

/* Alert border style */
.alert-light.border { background: #f8faff; }

/* ── Phase 5: Responsive & Polish ─────────────────────────────── */

/* Responsive tables */
@media (max-width: 768px) {
    .page-content { padding: 1rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
    .topbar { padding: .7rem 1rem; }
    .filter-bar { padding: .75rem; }
    .filter-bar .row { --bs-gutter-y: .4rem; }
    .table-responsive { font-size: .82rem; }
    .card-footer { flex-direction: column; gap: .5rem; align-items: flex-start !important; }
}

/* Dropdown menu styling */
.dropdown-menu { border-radius: .75rem; border: 1px solid var(--border-light); box-shadow: 0 4px 20px rgba(16,24,40,.1); padding: .4rem; }
.dropdown-item { border-radius: .45rem; font-size: .87rem; padding: .45rem .75rem; }
.dropdown-item:hover { background: var(--bg-light); }
.dropdown-item-text { font-size: .75rem; padding: .35rem .75rem; }

/* Sidebar mobile backdrop */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 999; }
.sidebar-backdrop.show { display: block; }

/* Form control focus */
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* Alert improvements */
.alert { border-radius: .75rem; border: none; }
.alert-success { background: #f0fdf4; color: #15803d; }
.alert-danger  { background: #fef2f2; color: #b91c1c; }
.alert-warning { background: #fffbeb; color: #b45309; }

/* Card table adjustments */
.card > .table-responsive > .table { margin-bottom: 0; }

/* Print styles for PDF pages */
@media print {
    .sidebar, .topbar, .btn, .alert { display: none !important; }
    .main-content { margin: 0 !important; }
    .page-content { padding: 0 !important; }
}
