:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #f9fbfd;
    --text: #172033;
    --muted: #667085;
    --line: #e6eaf0;
    --primary: #155eef;
    --primary-dark: #0f48b8;
    --success: #14804a;
    --warning: #b54708;
    --danger: #c11528;
    --sidebar: #101828;
    --sidebar-muted: #98a2b3;
    --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--sidebar);
    color: #fff;
    padding: 20px 16px;
    z-index: 1040;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 18px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #ffffff;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: .02em;
}

.brand-title {
    font-weight: 800;
    line-height: 1.1;
}

.brand-subtitle {
    color: var(--sidebar-muted);
    font-size: .78rem;
    margin-top: 3px;
}

.nav-section {
    color: var(--sidebar-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 22px 10px 8px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 40px;
    color: #d0d5dd;
    border-radius: 8px;
    padding: 9px 10px;
    font-weight: 600;
    font-size: .91rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav .nav-link i {
    font-size: 1rem;
    width: 20px;
}

.app-main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 28px;
    background: rgba(246, 248, 251, 0.86);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.topbar h1 {
    font-size: 1.22rem;
    margin: 0;
    font-weight: 800;
}

.topbar-kicker {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.search-box {
    width: min(360px, 34vw);
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 14px;
}

.search-box input {
    border: 0;
    outline: 0;
    background: transparent;
    width: 100%;
    font-size: .9rem;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    display: inline-grid;
    place-items: center;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 5px 12px 5px 5px;
    font-weight: 700;
}

.avatar {
    width: 31px;
    height: 31px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #e0eaff;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
}

.content {
    padding: 28px;
}

.page-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-end;
    margin-bottom: 22px;
}

.page-hero h2 {
    margin: 4px 0 8px;
    font-size: clamp(1.6rem, 2.4vw, 2.35rem);
    font-weight: 850;
    letter-spacing: 0;
}

.page-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

.eyebrow {
    color: var(--primary);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.hero-actions,
.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
}

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

.grid-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-card {
    display: flex;
    gap: 14px;
    padding: 18px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex: 0 0 auto;
}

.tone-blue .stat-icon { background: #e0eaff; color: var(--primary); }
.tone-green .stat-icon { background: #dcfae6; color: var(--success); }
.tone-orange .stat-icon { background: #fff1d6; color: var(--warning); }
.tone-red .stat-icon { background: #ffe4e8; color: var(--danger); }

.stat-label,
.stat-hint {
    color: var(--muted);
    font-size: .84rem;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 850;
    line-height: 1.15;
}

.panel {
    margin-bottom: 22px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.panel-header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .88rem;
}

.panel-body {
    padding: 20px;
}

.table {
    margin: 0;
    vertical-align: middle;
}

.table thead th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: .76rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
}

.table td,
.table th {
    padding: 14px 16px;
}

.form-label {
    font-weight: 700;
    font-size: .86rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    border-color: #d0d5dd;
    min-height: 42px;
}

.workflow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.workflow-step {
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.workflow-step span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    margin-bottom: 8px;
}

.profile-banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 22px;
}

.profile-photo {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    background: #e0eaff;
    display: grid;
    place-items: center;
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 850;
}

.timeline {
    display: grid;
    gap: 14px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    margin: 6px auto 0;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 6px #e0eaff;
}

.empty-state {
    text-align: center;
    padding: 34px 20px;
    color: var(--muted);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1199px) {
    .grid-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        left: -290px;
        width: 290px;
        transition: left .2s ease;
    }

    .sidebar-open .app-sidebar {
        left: 0;
    }

    .sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(16, 24, 40, .42);
        z-index: 1035;
    }

    .topbar {
        padding: 12px 16px;
    }

    .content {
        padding: 18px 16px;
    }

    .search-box {
        display: none;
    }
}

@media (max-width: 767px) {
    .page-hero,
    .panel-header,
    .profile-banner {
        grid-template-columns: 1fr;
        display: grid;
        align-items: start;
    }

    .grid-stats,
    .workflow {
        grid-template-columns: 1fr;
    }

    .hero-actions,
    .table-actions {
        width: 100%;
    }

    .hero-actions .btn,
    .table-actions .btn {
        flex: 1 1 auto;
    }

    .table-responsive {
        border: 0;
    }
}
