:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-alt: #eef4ff;
    --border: #d7e2f3;
    --primary: #1f6fff;
    --primary-dark: #1556cb;
    --text: #0b1628;
    --muted: #60708a;
    --success: #1f9d62;
    --danger: #d7485d;
    --warning: #c9880a;
    --shadow: 0 20px 55px rgba(18, 52, 104, 0.12);
    --radius: 22px;
}

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

body {
    margin: 0;
    font-family: "Trebuchet MS", "Gill Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(79, 143, 255, 0.18), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

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

img {
    max-width: 100%;
    display: block;
}

code {
    background: #eff4ff;
    border-radius: 8px;
    padding: 0.18rem 0.45rem;
}

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

.sidebar {
    background: linear-gradient(180deg, #0f59da 0%, #5f99ff 100%);
    color: #fff;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.sidebar-brand h2,
.sidebar-brand p {
    margin: 0;
}

.sidebar-brand p {
    color: rgba(255, 255, 255, 0.78);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    padding: 12px 14px;
    border-radius: 16px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(2px);
}

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    padding: 26px 34px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar h1,
.card-header h2,
.standalone-card h1,
.standalone-card h2,
.hero-panel h1 {
    margin: 0;
}

.topbar h1 {
    font-size: 1.8rem;
}

.eyebrow {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: var(--muted);
}

.user-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-chip span,
.muted {
    color: var(--muted);
}

.page-content {
    padding: 0 34px 34px;
}

.alerts-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid transparent;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.alert.is-hidden {
    opacity: 0;
    transform: translateY(-6px);
}

.alert-success {
    background: #ecfbf3;
    border-color: #bfebd0;
    color: #126140;
}

.alert-danger {
    background: #fff0f3;
    border-color: #f6c9d2;
    color: #8c2236;
}

.alert-warning {
    background: #fff8e9;
    border-color: #f0deaf;
    color: #8a6300;
}

.card,
.standalone-card,
.hero-panel,
.stat-card {
    background: var(--surface);
    border: 1px solid rgba(214, 226, 243, 0.7);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card,
.standalone-card,
.hero-panel {
    padding: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -20px -20px auto;
    width: 92px;
    height: 92px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(31, 111, 255, 0.16), transparent);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 12px;
}

.stat-card strong {
    font-size: 2rem;
}

.page-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 22px;
}

.page-grid.page-grid-narrow {
    grid-template-columns: 360px minmax(0, 1fr);
}

.stacked-form,
.stacked-list,
.timeline {
    display: grid;
    gap: 16px;
}

.fields-grid {
    display: grid;
    gap: 16px;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    background: #fbfdff;
    color: var(--text);
    font: inherit;
}

.field textarea {
    resize: vertical;
}

.checkbox-field {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.checkbox-field input {
    width: auto;
}

.filters-bar {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto auto;
    gap: 12px;
    margin-bottom: 18px;
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 11px 16px;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #5f9bff 100%);
    color: #fff;
}

.btn-outline {
    background: #eff5ff;
    color: var(--primary-dark);
    border: 1px solid #d5e4ff;
}

.btn-danger {
    background: #ffecef;
    color: var(--danger);
    border: 1px solid #f6ccd5;
}

.btn-sm {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
}

.btn-block {
    width: 100%;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid #e7eef9;
    vertical-align: top;
}

.data-table th {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 26px 12px;
}

.table-avatar,
.profile-photo-large {
    border-radius: 18px;
    object-fit: cover;
}

.table-avatar {
    width: 52px;
    height: 52px;
}

.profile-photo-large {
    width: 180px;
    height: 180px;
    background: var(--surface-alt);
}

.employee-form-layout,
.employee-profile {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.profile-upload-card {
    background: var(--surface-alt);
    border: 1px solid #dce8ff;
    border-radius: 20px;
    padding: 16px;
    display: grid;
    gap: 14px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.detail-grid div,
.notes-box {
    background: #f8fbff;
    border: 1px solid #e6eefb;
    border-radius: 18px;
    padding: 14px 16px;
}

.detail-grid span,
.notes-box span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.notes-box {
    margin-top: 20px;
}

.action-strip,
.form-actions,
.row-actions,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-strip {
    margin-top: 18px;
}

.status-badge,
.document-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-success {
    background: #e8f8ef;
    color: var(--success);
}

.status-danger {
    background: #fff0f3;
    color: var(--danger);
}

.document-badge {
    background: #edf4ff;
    color: var(--primary-dark);
}

.timeline-item {
    padding-left: 18px;
    border-left: 3px solid #dbe8ff;
}

.timeline-item p,
.timeline-item span {
    margin: 4px 0 0;
}

.standalone-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.standalone-split {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 24px;
}

.hero-panel {
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.35), transparent 35%),
        linear-gradient(160deg, #1c67f1 0%, #88b2ff 100%);
    color: #fff;
}

.hero-badge {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    margin-bottom: 18px;
}

.hero-panel p,
.hero-panel li {
    color: rgba(255, 255, 255, 0.88);
}

.feature-list,
.metric-mini-grid {
    display: grid;
    gap: 12px;
}

.feature-list {
    padding-left: 18px;
}

.metric-mini-grid {
    margin-top: 24px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-mini-card {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    padding: 14px;
}

.section-divider {
    height: 1px;
    background: linear-gradient(90deg, #d7e2f3, transparent);
    margin: 4px 0;
}

.inline-editor {
    border: 1px solid #e2ebf8;
    border-radius: 20px;
    background: #fbfdff;
    padding: 16px;
}

.inline-editor summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.inline-editor summary::-webkit-details-marker {
    display: none;
}

.details-hint {
    color: var(--primary-dark);
    font-size: 0.92rem;
}

.sidebar-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: #eef4ff;
    padding: 0 10px;
    cursor: pointer;
}

.sidebar-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 5px 0;
    background: var(--primary-dark);
}

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

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

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 280px;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        z-index: 20;
    }

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

    .sidebar-toggle {
        display: inline-block;
    }

    .topbar,
    .page-content {
        padding-left: 22px;
        padding-right: 22px;
    }

    .stats-grid,
    .page-grid,
    .page-grid.page-grid-narrow,
    .standalone-split,
    .employee-form-layout,
    .employee-profile,
    .fields-grid-2,
    .metric-mini-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-right {
        justify-content: space-between;
    }
}

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .topbar,
    .print-hide,
    .btn,
    .alerts-stack {
        display: none !important;
    }

    .app-shell,
    .page-grid {
        display: block;
    }

    .page-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 0;
        padding: 0;
    }
}
