:root {
    --ink: #0f2528;
    --muted: #637083;
    --line: #d6e6df;
    --surface: #ffffff;
    --canvas: #f2f8f5;
    --nav: #004f57;
    --nav-2: #07383d;
    --teal: #006b73;
    --green: #54b948;
    --amber: #b56a00;
    --red: #b3353a;
    --blue: #2f65b0;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background: var(--canvas);
    font-family: Arial, Helvetica, sans-serif;
}

html[data-offline] body::before {
    content: "Offline mode: reconnect to sync live HR data";
    position: sticky;
    top: 0;
    z-index: 20;
    display: block;
    padding: 8px 14px;
    background: #fff2d9;
    color: var(--amber);
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid #ead7ad;
}

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

button, input {
    font: inherit;
}

input, select, textarea {
    max-width: 100%;
}

button {
    cursor: pointer;
}

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

.sidebar {
    min-height: 100vh;
    padding: 22px 16px;
    background: linear-gradient(180deg, var(--nav), var(--nav-2));
    color: #f7fbfc;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    background: #f7fbfc;
    color: var(--nav);
    font-weight: 800;
    border-radius: 8px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}

.brand strong, .brand span {
    display: block;
}

.brand span, .sidebar-footer {
    color: #b8c8d0;
    font-size: 13px;
}

.sidebar nav {
    display: grid;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    color: #dce7eb;
    border-radius: 8px;
    padding: 12px 10px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #52c77c;
}

.main {
    min-width: 0;
    padding: 26px;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--teal);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 30px;
}

h2 {
    font-size: 19px;
    margin-bottom: 4px;
}

.profile-pill {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 8px;
    padding: 0 10px;
}

.profile-pill form {
    margin: 0;
}

.profile-pill span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

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

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.metric, .panel, .report-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(26, 40, 52, .06);
}

.metric {
    padding: 18px;
    border-left: 4px solid var(--teal);
}

button.metric {
    text-align: left;
}

.metric.filter {
    cursor: pointer;
}

.metric.filter.active-filter {
    outline: 3px solid rgba(0, 124, 137, .18);
    border-color: var(--teal);
}

.metric.warning {
    border-left-color: var(--amber);
}

.metric.danger {
    border-left-color: var(--red);
}

.metric span, .metric small, small {
    color: var(--muted);
}

.metric strong {
    display: block;
    font-size: 32px;
    margin: 8px 0 4px;
}

.drill-metric {
    display: block;
    transition: border-color .15s ease, transform .15s ease;
}

.drill-metric:hover {
    border-color: var(--teal);
    transform: translateY(-1px);
}

.dashboard-grid, .employee-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
    gap: 16px;
}

.panel {
    padding: 18px;
}

.panel-wide {
    min-height: 420px;
}

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

.panel-header p {
    color: var(--muted);
    margin-bottom: 0;
}

.button {
    min-height: 38px;
    border-radius: 8px;
    padding: 8px 14px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
}

.button.primary {
    background: var(--teal);
    color: white;
}

.button.secondary {
    background: #edf5f5;
    color: var(--teal);
    border-color: #c8dddd;
}

.task-list {
    display: grid;
    gap: 8px;
}

.task-row {
    width: 100%;
    min-height: 64px;
    border: 1px solid var(--line);
    background: #fbfcfd;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-row div {
    flex: 1;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--teal);
}

.status-dot.warning {
    background: var(--amber);
}

.status-dot.danger {
    background: var(--red);
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.pill.red {
    color: var(--red);
    background: #fdecee;
}

.pill.amber {
    color: var(--amber);
    background: #fff2d9;
}

.pill.blue {
    color: var(--blue);
    background: #eaf1fc;
}

.plain-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 12px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search {
    min-height: 44px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: min(460px, 100%);
}

.search span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.search input {
    width: 100%;
    border: 0;
    outline: 0;
}

.table-panel {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

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

th, td {
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

td.wrap-cell {
    max-width: 520px;
    white-space: normal;
    line-height: 1.35;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td small {
    display: block;
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover, tbody tr.selected {
    background: #eef7f7;
}

tbody tr.drill-row {
    cursor: pointer;
}

tfoot td {
    color: var(--muted);
    font-size: 12px;
    background: #fbfcfd;
}

.profile-panel {
    align-self: start;
}

.profile-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
}

.avatar {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--nav);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0 0 18px;
}

.detail-grid.single-column {
    grid-template-columns: 1fr;
}

dt {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 4px;
}

dd {
    margin: 0;
    font-weight: 700;
}

.history-grid {
    display: grid;
    gap: 10px;
}

.document-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.document-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    padding: 12px;
}

.offline-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--canvas);
}

.offline-panel {
    width: min(560px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    text-align: center;
    box-shadow: 0 12px 32px rgba(0, 79, 87, .14);
}

.offline-panel img {
    width: min(180px, 60vw);
    height: auto;
}

.document-row strong, .document-row small {
    display: block;
}

.empty-note {
    color: var(--muted);
    margin: 0;
}

.history-entry-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfd;
}

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    padding: 3px;
    margin-bottom: 12px;
}

.segmented button {
    border: 0;
    border-radius: 6px;
    background: transparent;
    padding: 8px 10px;
    color: var(--muted);
}

.segmented button.active {
    background: var(--teal);
    color: white;
}

.compact-form {
    display: grid;
    gap: 12px;
}

.lookup-create-form {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    padding: 12px;
    margin-bottom: 16px;
    display: grid;
    gap: 12px;
}

.form-grid select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    color: var(--ink);
    background: white;
}

.inline-message {
    color: var(--green);
    font-weight: 700;
}

.employee-edit-form {
    margin-bottom: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-grid .full-field {
    grid-column: 1 / -1;
}

.form-grid input {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    color: var(--ink);
    background: white;
}

.checkbox-field {
    display: flex !important;
    align-items: center;
    grid-template-columns: none !important;
    gap: 10px !important;
    min-height: 40px;
}

.checkbox-field input {
    min-height: auto;
}

.form-message {
    padding: 10px 12px;
    border-radius: 8px;
    background: #e5f5ed;
    color: var(--green);
    font-weight: 700;
}

.history-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfd;
}

.history-panel h3 {
    font-size: 14px;
    margin-bottom: 8px;
}

.history-panel ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.section-gap {
    margin-top: 22px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.report-card {
    min-height: 130px;
    padding: 18px;
    text-align: left;
    border-left: 4px solid var(--teal);
}

.report-card.active-report {
    border-color: var(--green);
    outline: 3px solid rgba(35, 131, 91, .16);
}

.report-card strong, .report-card span, .report-card small {
    display: block;
}

.report-card span {
    margin-top: 10px;
    color: var(--muted);
}

.report-card small {
    margin-top: 16px;
}

.compact-metric {
    min-width: 160px;
    padding: 12px;
}

.compact-metric strong {
    font-size: 24px;
}

.empty-state {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background: radial-gradient(circle at top, #ffffff 0, #eef8f0 48%, #dfeeea 100%);
}

.login-panel {
    width: min(760px, 100%);
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 44px rgba(0, 79, 87, .16);
    padding: 28px;
    text-align: center;
}

.login-logo {
    width: min(260px, 70vw);
    height: auto;
}

.login-overview {
    color: var(--muted);
    max-width: 620px;
    margin: 12px auto 20px;
    line-height: 1.5;
}

.login-form {
    display: grid;
    gap: 12px;
    max-width: 420px;
    margin: 0 auto 14px;
    text-align: left;
}

.login-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    color: var(--muted);
}

.login-form input {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
}

.error-message {
    background: #fdecee;
    color: var(--red);
}

@media (max-width: 1050px) {
    .shell {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .sidebar {
        padding: 16px 12px;
    }

    .metric-grid, .dashboard-grid, .employee-layout, .report-grid, .admin-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid, .employee-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .shell {
        display: block;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 10;
        min-height: auto;
        padding: 8px 10px;
        gap: 8px;
    }

    .brand {
        gap: 8px;
    }

    .brand-logo {
        width: 40px;
        height: 40px;
    }

    .brand strong {
        font-size: 15px;
    }

    .brand span, .sidebar-footer {
        font-size: 12px;
    }

    .sidebar nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .nav-item {
        flex: 0 0 auto;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
        padding: 9px 10px;
        background: rgba(255, 255, 255, .08);
    }

    .sidebar-footer {
        display: none;
    }

    .main {
        padding: 14px;
    }

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

    .metric-grid, .detail-grid {
        grid-template-columns: 1fr;
    }

    .admin-summary-grid, .report-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        font-size: 22px;
    }

    .profile-pill {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        padding: 8px;
    }

    .toolbar-actions {
        flex-wrap: wrap;
    }

    .search {
        min-width: 0;
        width: 100%;
    }

    .panel, .metric, .report-card {
        padding: 14px;
    }

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

    .document-row, .task-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .login-shell {
        padding: 14px;
        place-items: start stretch;
    }

    .login-panel {
        padding: 18px;
    }

    .login-logo {
        width: min(190px, 66vw);
    }
}

@media (max-width: 430px) {
    .metric strong {
        font-size: 26px;
    }

    .button {
        width: 100%;
        justify-content: center;
    }

    .segmented {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }
}
