:root {
    --ink: #17202a;
    --muted: #64748b;
    --line: #d9e2ec;
    --panel: #ffffff;
    --page: #f4f7fa;
    --nav: #182436;
    --nav-soft: #22334b;
    --teal: #0f766e;
    --orange: #d97706;
    --red: #b91c1c;
    --blue: #2563eb;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--page);
    color: var(--ink);
    font-size: 15px;
    letter-spacing: 0;
}

a {
    text-decoration: none;
}

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

.sidebar {
    width: 270px;
    background: var(--nav);
    color: #fff;
    padding: 18px 14px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    overflow-y: auto;
}

.brand-mark,
.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    padding: 8px 8px 22px;
}

.brand-mark small,
.login-brand small {
    display: block;
    color: #aab7c7;
    font-size: 12px;
}

.brand-icon,
.login-brand span {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0f766e;
    color: #fff;
}

.sidebar-nav .nav-link {
    color: #d8e2ef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--nav-soft);
}

.nav-section {
    color: #95a6bb;
    font-size: 11px;
    text-transform: uppercase;
    margin: 18px 12px 8px;
}

.main-panel {
    margin-left: 270px;
    width: calc(100% - 270px);
    min-height: 100vh;
}

.topbar {
    min-height: 68px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 26px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.content-wrap {
    padding: 26px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.page-heading h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.page-heading p {
    margin: 4px 0 0;
    color: var(--muted);
}

.panel,
.metric-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(23, 32, 42, 0.04);
}

.panel {
    padding: 18px;
    margin-bottom: 18px;
}

.metric-card {
    padding: 18px;
    min-height: 118px;
}

.metric-card .label {
    color: var(--muted);
    font-size: 13px;
}

.metric-card .value {
    font-size: 30px;
    line-height: 1.2;
    font-weight: 800;
    margin-top: 10px;
}

.metric-card .icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e6f5f2;
    color: var(--teal);
}

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

.btn-primary:hover,
.btn-primary:focus {
    background: #0b5f59;
    border-color: #0b5f59;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: #fff;
}

.search-box {
    max-width: 470px;
    width: 100%;
    position: relative;
}

.search-box > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-box .form-control {
    padding-left: 40px;
}

.global-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 20px 35px rgba(15, 23, 42, 0.12);
    max-height: 360px;
    overflow-y: auto;
    z-index: 1050;
}

.global-search-results a {
    display: block;
    padding: 10px 12px;
    color: var(--ink);
    border-bottom: 1px solid #edf2f7;
}

.global-search-results a:hover {
    background: #f6fafc;
}

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

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.avatar {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: var(--teal);
    border-radius: 50%;
    font-weight: 700;
}

.notification-menu {
    min-width: 330px;
}

.notification-item strong,
.notification-item span {
    display: block;
}

.notification-item span {
    color: var(--muted);
    white-space: normal;
}

.form-label {
    font-weight: 600;
}

.table thead th {
    color: #334155;
    font-size: 13px;
    text-transform: uppercase;
}

.timeline {
    border-left: 3px solid #dbeafe;
    padding-left: 16px;
}

.timeline-item {
    position: relative;
    padding-bottom: 18px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 4px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--blue);
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #bfdbfe;
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.attachment-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    color: var(--ink);
    background: #fff;
    display: block;
}

.attachment-item img,
.attachment-item span {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    background: #eef4f8;
    color: var(--red);
    font-size: 34px;
}

.attachment-item small {
    display: block;
    padding: 8px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(217, 119, 6, 0.08)),
        #eef3f7;
    padding: 20px;
}

.login-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 24px 60px rgba(23, 32, 42, 0.12);
}

.login-brand {
    margin-bottom: 24px;
}

.login-brand strong {
    font-size: 22px;
}

.login-help {
    color: var(--muted);
    font-size: 13px;
    margin: 18px 0 0;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

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

    .main-panel {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        padding: 10px 14px;
    }

    .content-wrap {
        padding: 16px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .search-box {
        max-width: none;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .topbar-actions {
        margin-left: auto;
    }
}
