/* ============================================================
   Laravel HR + QuickBooks Desktop 2010
   Enterprise Web UI Styles
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(180deg, #1a365d 0%, #0f2744 100%);
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --qb-green: #2ca01c;
    --bg-body: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,.1);
    --radius: 0.75rem;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: #1e293b;
    min-height: 100vh;
    margin: 0;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* ---------- Sidebar (accordion navigation) ---------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform .25s ease;
    -webkit-overflow-scrolling: touch;
}

.sidebar .brand {
    flex: 0 0 auto;
    padding: 1.25rem 1.25rem 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar .brand small {
    display: block;
    font-weight: 400;
    font-size: .72rem;
    opacity: .65;
    margin-top: .2rem;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: .6rem 0 .5rem;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.35) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.35);
    border-radius: 3px;
}

.sidebar .nav-link {
    color: rgba(255,255,255,.82);
    border-radius: .5rem;
    margin: .1rem .65rem;
    padding: .5rem .85rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .9rem;
    transition: background .15s ease, color .15s ease;
    white-space: nowrap;
}
.sidebar .nav-link i {
    width: 1.25rem;
    font-size: 1.05rem;
    opacity: .9;
    flex-shrink: 0;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.sidebar .nav-link.active {
    background: rgba(37,99,235,.4);
    font-weight: 500;
}

/* Accordion group headers */
.nav-accordion {
    margin: .15rem 0;
}
.nav-accordion-btn {
    width: calc(100% - 1.3rem);
    margin: .1rem .65rem;
    padding: .55rem .85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: rgba(255,255,255,.9);
    font-size: .88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background .15s ease;
}
.nav-accordion-btn span {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.nav-accordion-btn span i {
    width: 1.25rem;
    font-size: 1.05rem;
    opacity: .9;
}
.nav-accordion-btn .chev {
    font-size: .75rem;
    opacity: .7;
    transition: transform .2s ease;
}
.nav-accordion-btn:not(.collapsed) .chev {
    transform: rotate(180deg);
}
.nav-accordion-btn:hover,
.nav-accordion-btn:not(.collapsed) {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.nav-sub {
    padding: .15rem 0 .35rem .35rem;
}
.nav-sub .nav-link {
    font-size: .86rem;
    padding: .42rem .75rem .42rem 1.15rem;
    margin-left: .85rem;
    color: rgba(255,255,255,.75);
}
.nav-sub .nav-link.active {
    background: rgba(37,99,235,.4);
    color: #fff;
}

.nav-footer {
    margin-top: auto;
    padding-top: .5rem;
    border-top: 1px solid rgba(255,255,255,.1);
}
.tenant-label, .user-label {
    color: rgba(255,255,255,.55);
}

/* legacy section labels (unused) */
.sidebar .nav-section { display: none; }
.sidebar hr {
    border-color: rgba(255,255,255,.1);
    margin: .5rem 1rem;
}

/* ---------- Main content ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem 1.75rem 2.5rem;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

.page-header .subtitle {
    color: #64748b;
    font-size: .9rem;
    margin: .15rem 0 0;
}

/* ---------- Cards ---------- */
.stat-card,
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: #fff;
    transition: box-shadow .2s ease;
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
}

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

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
}

.stat-label {
    font-size: .8rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.stat-icon {
    font-size: 1.75rem;
    opacity: .45;
}

/* ---------- Tables ---------- */
.table-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background: #fff;
}

.table-card .table {
    margin-bottom: 0;
}

.table-card thead th {
    background: #f8fafc;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding: .85rem 1rem;
    white-space: nowrap;
}

.table-card tbody td {
    padding: .8rem 1rem;
    vertical-align: middle;
    border-color: #f1f5f9;
    font-size: .9rem;
}

.table-card tbody tr:hover {
    background: #f8fafc;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: .5rem;
    font-weight: 500;
    font-size: .875rem;
    padding: .45rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

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

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

.btn-qb {
    background: var(--qb-green);
    border-color: var(--qb-green);
    color: #fff;
}

.btn-qb:hover {
    background: #249017;
    border-color: #249017;
    color: #fff;
}

.btn-sm {
    padding: .3rem .7rem;
    font-size: .8rem;
}

/* ---------- Badges / Status ---------- */
.badge {
    font-weight: 500;
    font-size: .72rem;
    padding: .35em .65em;
    border-radius: .35rem;
}

.badge-status-open { background: #dbeafe; color: #1e40af; }
.badge-status-draft { background: #f1f5f9; color: #475569; }
.badge-status-exported { background: #fef3c7; color: #92400e; }
.badge-status-imported { background: #d1fae5; color: #065f46; }
.badge-status-approved { background: #dcfce7; color: #166534; }
.badge-status-closed { background: #e2e8f0; color: #334155; }
.badge-status-pending { background: #fef9c3; color: #854d0e; }
.badge-status-active { background: #dcfce7; color: #166534; }
.badge-qb { background: var(--qb-green); color: #fff; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: .5rem;
    border-color: #cbd5e1;
    font-size: .9rem;
    padding: .5rem .85rem;
}

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

.form-label {
    font-weight: 500;
    font-size: .85rem;
    color: #334155;
    margin-bottom: .35rem;
}

/* ---------- Alerts ---------- */
.alert {
    border-radius: .6rem;
    border: none;
    font-size: .9rem;
}

/* ---------- Workflow steps ---------- */
.workflow-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.workflow-steps li {
    background: #f1f5f9;
    border-radius: 2rem;
    padding: .4rem 1rem;
    font-size: .82rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.workflow-steps li.active {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.workflow-steps li.done {
    background: #dcfce7;
    color: #166534;
}

/* ---------- Login / Auth pages ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a365d 0%, #0f2744 50%, #1e3a5f 100%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    overflow: hidden;
}

.auth-card .auth-header {
    background: linear-gradient(135deg, #1a365d, #2563eb);
    color: #fff;
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.auth-card .auth-header h1 {
    font-size: 1.35rem;
    margin: 0 0 .25rem;
    font-weight: 700;
}

.auth-card .auth-header p {
    margin: 0;
    opacity: .8;
    font-size: .85rem;
}

.auth-card .auth-body {
    padding: 1.75rem 1.5rem;
}

/* ---------- Installer ---------- */
.install-page {
    min-height: 100vh;
    background: var(--bg-body);
    padding: 2rem 1rem;
}

.install-card {
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border-radius: 1rem;
    box-shadow: var(--card-shadow-hover);
    overflow: hidden;
}

.install-header {
    background: linear-gradient(135deg, #1a365d, #2563eb);
    color: #fff;
    padding: 1.75rem 2rem;
}

.install-body {
    padding: 2rem;
}

.install-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.install-step:last-child { border-bottom: none; }

.install-step .step-num {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

.install-step.done .step-num {
    background: var(--success);
    color: #fff;
}

.install-step.active .step-num {
    background: var(--primary);
    color: #fff;
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: .5;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-flex !important;
    }
}

.sidebar-toggle {
    display: none;
}

/* ---------- Utility ---------- */
.text-qb { color: var(--qb-green); }
.bg-qb-soft { background: rgba(44,160,28,.1); }
.border-qb { border-color: var(--qb-green) !important; }

.avatar-sm {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 600;
    color: #475569;
}

.action-btns {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
}
.sidebar-overlay.show { display: block; }
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
}
.sidebar .nav-link { cursor: pointer; position: relative; z-index: 1; }
