:root {
    --blue: #1e66eb;
    --blue-dark: #1657cf;
    --navy: #1a2340;
    --text: #384662;
    --muted: #8b95a7;
    --bg: #f1f2f4;
    --surface: #ffffff;
    --surface-soft: #f6f7f9;
    --line: #d7dde6;
    --line-dark: #c6ced9;
    --purple-shift: #8f5878;
    --purple-shift-soft: #a86686;
    --leave-blue: #dff1ff;
    --empty: #ebeef3;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Nunito Sans", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    text-decoration: none;
}

.product-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 0.75rem 0 0.5rem;
    min-height: 38px;
    background: var(--blue);
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.product-nav-left,
.product-nav-right,
.product-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.product-mark {
    position: relative;
    width: 36px;
    height: 24px;
    display: inline-block;
    margin-right: 0.35rem;
}

.product-mark span {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background: #fff;
    border-radius: 999px;
}

.product-mark span:nth-child(1) {
    top: 0;
    width: 20px;
    left: 8px;
}

.product-mark span:nth-child(2) {
    top: 9px;
    width: 34px;
    left: 1px;
}

.product-mark span:nth-child(3) {
    top: 18px;
    width: 20px;
    left: 8px;
}

.product-link {
    padding: 0.48rem 0.8rem;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.93rem;
    font-weight: 800;
    line-height: 1;
}

.product-link.active,
.product-link:hover {
    background: rgba(14, 46, 109, 0.28);
    color: #fff;
}

.product-nav-right a {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
}

.app-main {
    padding: 1rem 1.25rem 1.5rem;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.eyebrow {
    margin: 0 0 0.2rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.page-title {
    margin: 0;
    color: var(--navy);
    font-size: 2rem;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.95rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--navy);
}

.btn {
    border-radius: 6px;
    font-weight: 800;
}

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

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

.btn-outline-secondary,
.btn-outline-dark {
    background: var(--surface);
    border-color: var(--line-dark);
    color: var(--navy);
}

.btn-outline-secondary:hover,
.btn-outline-dark:hover {
    background: #eef2f8;
    border-color: var(--line-dark);
    color: var(--navy);
}

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

.panel-card {
    padding: 1rem;
}

.metric-card {
    padding: 0.95rem 1rem;
}

.metric-label,
.helper-copy {
    color: var(--muted);
}

.metric-value {
    color: var(--navy);
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.table-shell {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.table {
    margin-bottom: 0;
}

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

.table td {
    border-color: var(--line);
    vertical-align: middle;
}

.soft-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #ebf2ff;
    color: var(--blue);
    font-size: 0.76rem;
    font-weight: 800;
}

.avatar-pill {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #e8edf5;
    color: var(--navy);
    font-size: 0.78rem;
    font-weight: 800;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.employee-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.stat-ribbon {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #eef8f0;
    color: #198754;
    font-size: 0.78rem;
    font-weight: 800;
}

.stat-ribbon.warning {
    background: #fff2de;
    color: #c17b14;
}

.integration-tile {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.setup-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.canvas-wrap {
    min-height: 280px;
    position: relative;
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
}

.form-control,
.form-select {
    border-radius: 6px;
    border-color: var(--line-dark);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(30, 102, 235, 0.45);
    box-shadow: 0 0 0 0.18rem rgba(30, 102, 235, 0.12);
}

.page-rota .app-main {
    padding: 0;
}

.rota-screen {
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.rota-toolbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 0.7rem;
    background: #ececec;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line-dark);
}

.rota-toolbar-left,
.rota-toolbar-centre,
.rota-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.rota-toolbar-centre {
    justify-content: center;
}

.rota-toolbar-right {
    justify-content: flex-end;
}

.rota-selector,
.rota-date-nav,
.rota-icon-button {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.9rem;
    background: #f5f5f5;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    color: var(--navy);
    font-size: 0.92rem;
    font-weight: 800;
}

.rota-selector,
.rota-icon-button {
    cursor: default;
}

.rota-date-nav {
    min-width: 346px;
    justify-content: space-between;
    gap: 1rem;
}

.rota-date-nav a {
    color: var(--navy);
}

.rota-toggle {
    display: inline-flex;
    padding: 0.15rem;
    background: #f5f5f5;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
}

.rota-toggle a {
    padding: 0.45rem 0.95rem;
    border-radius: 4px;
    color: #505a70;
    font-weight: 800;
}

.rota-toggle a.is-active {
    background: #e0e2e7;
    color: var(--navy);
}

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

.rota-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
}

.rota-table td {
    border-right: 1px solid var(--line-dark);
    border-bottom: 1px solid var(--line-dark);
    vertical-align: top;
}

.rota-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f7f7f8;
}

.rota-summary-header,
.rota-summary-metrics,
.rota-day-header,
.rota-person-cell,
.rota-section-row td {
    background: #f7f7f8;
}

.rota-summary-header {
    width: 156px;
    min-width: 156px;
    padding: 0.7rem 0.6rem;
    color: var(--navy);
    font-weight: 800;
}

.rota-summary-title {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rota-day-header {
    width: 134px;
    min-width: 134px;
    padding: 0.25rem 0.6rem 0.45rem;
}

.rota-day-header.is-today {
    box-shadow: inset 0 -2px 0 var(--blue);
}

.rota-day-title {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    color: var(--navy);
}

.rota-day-number {
    color: var(--blue);
    font-size: 1rem;
    font-weight: 800;
}

.rota-summary-metrics {
    padding: 0.45rem 0.55rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--navy);
}

.rota-summary-metrics div + div {
    margin-top: 0.28rem;
}

.rota-person-cell {
    width: 156px;
    min-width: 156px;
    padding: 0.6rem 0.55rem;
}

.rota-person-block {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.rota-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #d9dce2;
    color: #505a70;
    font-size: 0.66rem;
    font-weight: 800;
}

.rota-avatar.muted {
    background: #e7e9ee;
}

.rota-section-row td {
    padding: 0.55rem 0.6rem;
    color: var(--navy);
    font-weight: 800;
}

.rota-slot {
    width: 134px;
    min-width: 134px;
    padding: 0.28rem;
    background: #eef0f4;
}

.rota-slot.is-today {
    box-shadow: inset 0 2px 0 var(--blue);
}

.rota-empty-slot {
    height: 48px;
    border: 2px dashed #d5dbe5;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.35);
}

.shift-card {
    --shift-colour: var(--purple-shift);
    position: relative;
    margin-bottom: 0.28rem;
    padding: 0.4rem 0.45rem 0.42rem 0.6rem;
    border: 1px solid #c7ccd5;
    border-radius: 4px;
    background: #fff;
    cursor: grab;
    min-height: 48px;
}

.shift-card::before {
    content: "";
    position: absolute;
    left: 0.18rem;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 3px;
    border-radius: 999px;
    background: var(--shift-colour);
}

.shift-card.is-open {
    background: #fff;
}

.shift-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.3rem;
    color: var(--navy);
}

.shift-card-top strong {
    font-size: 0.83rem;
    font-weight: 800;
}

.shift-card-top i {
    color: #555d74;
    font-size: 0.72rem;
}

.shift-card-meta {
    color: #505a70;
    font-size: 0.78rem;
    line-height: 1.1;
}

.rota-leave-block {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.28rem;
    height: 48px;
    border: 1px solid #cfe6fb;
    border-radius: 4px;
    background: var(--leave-blue);
    color: #2c8de2;
}

.js-rota-drop-zone.is-drag-over {
    background: #e6edf9;
}

.month-grid-header,
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-grid-header div {
    padding: 0.65rem 0.45rem 0.3rem;
    border-right: 1px solid var(--line-dark);
    border-bottom: 1px solid var(--line-dark);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    background: #f5f5f6;
}

.month-grid-header div:last-child {
    border-right: 0;
}

.month-cell {
    min-height: 133px;
    padding: 0.35rem 0.5rem;
    border-right: 1px solid var(--line-dark);
    border-bottom: 1px solid var(--line-dark);
    background: #efefef;
}

.month-cell.is-muted {
    color: #a8afbc;
}

.month-cell-day {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    color: var(--navy);
    font-size: 0.84rem;
}

.month-shift-card {
    margin-bottom: 0.35rem;
    padding: 0.42rem 0.5rem;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--purple-shift) 0%, var(--purple-shift-soft) 100%);
    color: #fff;
    font-size: 0.79rem;
    font-weight: 800;
}

.month-shift-site,
.month-shift-location,
.month-shift-time,
.month-shift-role {
    line-height: 1.2;
}

.month-shift-time {
    margin-top: 0.28rem;
}

.leave-screen {
    padding-top: 1rem;
}

.leave-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.leave-toolbar h1 {
    margin: 0;
    color: #4d5668;
    font-size: 2rem;
    font-weight: 800;
}

.leave-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.leave-nav-btn,
.leave-tools-btn {
    border: 0;
    background: #b1b5bd;
    color: #fff;
    font-weight: 800;
}

.leave-nav-btn {
    width: 22px;
    height: 22px;
    border-radius: 3px;
    display: grid;
    place-items: center;
}

.leave-range {
    color: #5d6678;
    font-size: 1.05rem;
    font-weight: 800;
}

.leave-tools-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 1rem;
    border-radius: 4px;
}

.leave-table-wrap {
    overflow-x: auto;
    background: transparent;
}

.leave-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.leave-table th,
.leave-table td {
    padding: 0.8rem 0.7rem;
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.leave-table th {
    color: #8a909b;
    font-size: 0.8rem;
    font-weight: 800;
}

.leave-table td {
    color: #5d6678;
    font-size: 0.96rem;
}

.leave-employee-col {
    min-width: 220px;
    text-align: left !important;
}

.leave-summary-stat {
    color: #4d5668;
    font-size: 1rem;
    font-weight: 700;
}

.leave-summary-stat.strong {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
}

.leave-summary-stat.remaining {
    color: #f58220;
    font-size: 1.6rem;
    line-height: 1;
    font-weight: 800;
}

.page-leave .topbar,
.page-rota .topbar {
    display: none;
}

@media (max-width: 1100px) {
    .employee-grid,
    .setup-status {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .product-nav,
    .leave-toolbar,
    .topbar,
    .rota-toolbar {
        flex-wrap: wrap;
    }

    .rota-toolbar {
        grid-template-columns: 1fr;
    }

    .rota-toolbar-centre,
    .rota-toolbar-right {
        justify-content: flex-start;
    }

    .app-main {
        padding: 0.8rem;
    }
}
