:root {
    --bg: #eef2f5;
    --bg-deep: #0f1b20;
    --graphite: #1f292f;
    --graphite-2: #2f3a40;
    --surface: #ffffff;
    --surface-soft: #f6f8fa;
    --text: #172026;
    --muted: #687780;
    --line: #d8e0e5;
    --line-strong: #b9c7cf;
    --zinc: #1d8f8a;
    --teal: #009b9f;
    --copper: #e56a2c;
    --gold: #d7a84a;
    --danger: #b42318;
    --ok: #16815e;
    --warning: #b45309;
    --shadow: 0 18px 46px rgba(20, 31, 38, 0.11);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Roboto", Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(125deg, rgba(0, 155, 159, 0.08) 0 22%, transparent 22% 100%),
        linear-gradient(145deg, transparent 0 62%, rgba(229, 106, 44, 0.08) 62% 100%),
        var(--bg);
}

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

button,
input,
select {
    font: inherit;
}

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

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 24px 18px;
    color: #f8fbfc;
    background:
        linear-gradient(155deg, rgba(0, 155, 159, 0.34), transparent 34%),
        linear-gradient(24deg, rgba(215, 168, 74, 0.22), transparent 42%),
        var(--bg-deep);
    overflow: hidden;
}

.sidebar::after {
    content: "";
    position: absolute;
    right: -74px;
    bottom: 34px;
    width: 220px;
    height: 380px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: rotate(34deg);
    pointer-events: none;
}

.brand {
    position: relative;
    z-index: 1;
    display: block;
    min-width: 0;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 250px;
    height: auto;
}

.brand-mark {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--teal), var(--copper));
    font-weight: 700;
}

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

.brand strong {
    line-height: 1.15;
}

.brand small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.sidebar-caption {
    position: relative;
    z-index: 1;
    margin: 34px 0 22px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-caption span,
.topbar-title span,
.metric span,
.status-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.sidebar-caption span {
    color: rgba(255, 255, 255, 0.58);
}

.sidebar-caption b {
    display: block;
    margin-top: 6px;
    font-size: 18px;
}

.main-nav {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 8px;
}

.main-nav a {
    position: relative;
    padding: 13px 14px 13px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.84);
    font-weight: 700;
}

.main-nav a::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold);
    transform: translateY(-50%);
}

.main-nav a:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 5px;
    margin-top: auto;
    padding-top: 24px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
    line-height: 1.45;
}

.sidebar-footer::before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-footer small {
    color: rgba(255, 255, 255, 0.46);
}

.workspace {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 14px 30px;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.topbar-title strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
}

.userbox {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.user-pill {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--teal), var(--zinc));
    font-weight: 700;
}

.username {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--graphite-2);
    font-weight: 700;
}

.shell {
    width: min(1560px, calc(100% - 42px));
    margin: 0 auto;
    padding: 28px 0 46px;
}

.page-head {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid rgba(15, 27, 32, 0.08);
    border-radius: 8px;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.78)),
        linear-gradient(120deg, rgba(0, 155, 159, 0.14), rgba(215, 168, 74, 0.12));
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--teal);
    font-size: 18px;
    font-weight: 700;
}

.page-subtitle {
    margin: 10px 0 0;
    color: var(--muted);
    font-weight: 700;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 36px;
    line-height: 1.12;
}

h2 {
    font-size: 20px;
}

.panel,
.metric,
.login-panel,
.status-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    position: relative;
    padding: 22px;
    margin-bottom: 18px;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--teal), var(--zinc), var(--gold), var(--copper));
}

.wide-panel {
    width: 100%;
}

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

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

.metric {
    position: relative;
    padding: 20px 20px 20px 24px;
    overflow: hidden;
}

.metric::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(180deg, var(--teal), var(--copper));
}

.metric strong {
    display: block;
    margin-top: 10px;
    color: var(--graphite);
    font-size: 34px;
}

.status-card {
    min-width: 252px;
    padding: 15px 16px;
}

.status-card strong {
    display: block;
    margin-top: 5px;
}

.status-card.ok {
    border-color: rgba(22, 129, 94, 0.35);
}

.status-card.warning {
    border-color: rgba(180, 83, 9, 0.35);
}

.journal-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.journal-visual-card,
.journal-step-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.journal-visual-card {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: center;
    min-height: 190px;
    padding: 22px;
    overflow: hidden;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82)),
        linear-gradient(135deg, rgba(0, 155, 159, 0.16), rgba(229, 106, 44, 0.12));
}

.journal-visual-card h2 {
    max-width: 620px;
    font-size: 24px;
    line-height: 1.18;
}

.journal-visual-card p:last-child {
    max-width: 620px;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.journal-visual {
    width: 100%;
    height: auto;
}

.journal-step-card {
    position: relative;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 18px;
    overflow: hidden;
}

.journal-step-card::after {
    content: "";
    position: absolute;
    right: -38px;
    bottom: -54px;
    width: 120px;
    height: 120px;
    border: 18px solid rgba(0, 155, 159, 0.08);
    border-radius: 50%;
}

.journal-step-card span {
    color: var(--copper);
    font-size: 13px;
    font-weight: 800;
}

.journal-step-card strong {
    font-size: 18px;
}

.journal-step-card small {
    color: var(--muted);
    line-height: 1.45;
}

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

.employee-coefficients-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}

.coefficient-reference-panel {
    position: sticky;
    top: 94px;
}

.coefficient-reference-list {
    display: grid;
    gap: 12px;
}

.coefficient-reference-item {
    position: relative;
    display: grid;
    gap: 7px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(0, 155, 159, 0.06), rgba(229, 106, 44, 0.04)),
        #fff;
    overflow: hidden;
}

.coefficient-reference-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--teal), var(--copper));
}

.coefficient-reference-item strong {
    color: var(--graphite);
    font-size: 18px;
}

.coefficient-reference-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.coefficient-reference-item span {
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
}

.period-filter,
.period-inline,
.row-tools,
.actions {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.period-filter {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
}

.period-filter label,
.period-inline label,
.stack-form label,
.form-grid label {
    display: grid;
    gap: 6px;
}

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

.control-input,
.sheet-control,
.table-input,
.login-panel input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--text);
    background: #fff;
}

.control-input:focus,
.sheet-control:focus,
.table-input:focus,
.login-panel input:focus {
    outline: 3px solid rgba(0, 155, 159, 0.16);
    border-color: var(--teal);
}

.button,
.link-button {
    border: 0;
    cursor: pointer;
    font-weight: 700;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 8px;
}

.button.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--copper), #cf4f1e);
    box-shadow: 0 10px 24px rgba(229, 106, 44, 0.24);
}

.button.secondary {
    color: #fff;
    background: var(--graphite);
}

.button.small {
    min-height: 36px;
    padding: 8px 12px;
}

.link-button {
    padding: 0;
    color: var(--copper);
    background: transparent;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.message {
    padding: 12px 14px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
}

.message.success {
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 27, 32, 0.58);
    backdrop-filter: blur(10px);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    position: relative;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 18px;
    width: min(560px, 100%);
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 8px;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92)),
        linear-gradient(135deg, rgba(0, 155, 159, 0.16), rgba(229, 106, 44, 0.12));
    box-shadow: 0 28px 76px rgba(15, 27, 32, 0.32);
    overflow: hidden;
}

.modal-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--teal), var(--zinc), var(--gold), var(--copper));
}

.modal-mark {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--copper), #cf4f1e);
    box-shadow: 0 12px 26px rgba(229, 106, 44, 0.26);
    font-size: 28px;
    font-weight: 800;
}

.modal-content {
    min-width: 0;
}

.modal-content .eyebrow {
    margin-bottom: 8px;
}

.modal-content h2 {
    margin-bottom: 10px;
    color: var(--graphite);
}

.modal-content p:last-child {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.modal-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 4px;
}

.sheet-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.bulk-fill-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    gap: 14px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(0, 155, 159, 0.06), rgba(229, 106, 44, 0.05)),
        #fff;
}

.bulk-fill-panel strong,
.bulk-fill-panel span {
    display: block;
}

.bulk-fill-panel strong {
    color: var(--graphite);
}

.bulk-fill-panel span {
    margin-top: 5px;
    color: var(--muted);
    line-height: 1.45;
}

.import-button {
    position: relative;
    overflow: hidden;
}

.import-button input {
    position: absolute;
    inset: 0;
    cursor: pointer;
    opacity: 0;
}

.import-status {
    min-height: 20px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.sheet-table,
.responsive-table {
    overflow-x: auto;
}

.sheet-grid {
    display: grid;
    grid-template-columns: minmax(190px, 1.35fr) minmax(150px, 0.95fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) minmax(145px, 0.85fr) minmax(130px, 0.75fr) minmax(130px, 0.75fr) minmax(76px, 0.45fr) minmax(76px, 0.45fr) minmax(82px, 0.5fr) minmax(100px, 0.65fr) 40px;
    min-width: 1320px;
    gap: 6px;
    align-items: stretch;
}

.sheet-head {
    position: relative;
    z-index: 1;
    padding: 10px 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
}

.sheet-row {
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.sheet-row:hover {
    background: rgba(0, 155, 159, 0.035);
}

.sheet-row label > span,
.readonly-cell span {
    display: none;
}

.readonly-cell {
    display: grid;
    align-items: center;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbfc;
}

.sheet-row .sheet-control {
    min-height: 38px;
    padding: 7px 9px;
}

.total-cell strong {
    color: var(--copper);
}

.hidden-calc {
    display: none !important;
}

.row-action {
    display: grid;
    place-items: center;
}

.delete-row {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--danger);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

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

tbody tr:hover {
    background: rgba(0, 155, 159, 0.045);
}

td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.table-input {
    min-width: 84px;
}

.plan-input,
.salary-input {
    min-width: 140px;
}

.shifts-input,
.bonus-input {
    min-width: 96px;
}

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

.recent-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.recent-row span {
    color: var(--muted);
}

.recent-row b {
    grid-row: span 2;
    align-self: center;
    color: var(--copper);
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tabs a {
    padding: 11px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-weight: 700;
}

.tabs a.active {
    color: #fff;
    background: linear-gradient(135deg, var(--graphite), #111a1f);
    border-color: var(--graphite);
}

.dashboard-tabs {
    margin-top: -6px;
}

.dashboard-filter-panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 18px;
    align-items: end;
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 250, 0.9)),
        linear-gradient(120deg, rgba(0, 155, 159, 0.08), rgba(229, 106, 44, 0.07));
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dashboard-filter-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--teal), var(--zinc), var(--gold), var(--copper));
}

.filter-help {
    display: grid;
    gap: 8px;
    align-content: start;
}

.filter-help strong {
    color: var(--graphite);
    font-size: 19px;
}

.filter-help span {
    color: var(--muted);
    line-height: 1.5;
}

.dashboard-filter {
    position: relative;
    z-index: 1;
    justify-content: flex-start;
    width: 100%;
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
}

.dashboard-filter label {
    min-width: 118px;
}

.dashboard-filter label:last-of-type {
    min-width: 190px;
}

.chart-sort-form {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    min-width: 210px;
}

.chart-sort-form label {
    display: grid;
    gap: 5px;
    width: 100%;
}

.chart-sort-form .control-input {
    min-height: 36px;
    padding: 7px 10px;
    color: var(--graphite);
    background: #fff;
}

.chart-grid {
    align-items: stretch;
}

.chart-panel {
    min-height: 320px;
}

.line-chart {
    display: grid;
    gap: 10px;
}

.line-chart svg {
    width: 100%;
    min-height: 190px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(0, 155, 159, 0.05), transparent),
        #fff;
}

.chart-grid-line {
    fill: none;
    stroke: rgba(104, 119, 128, 0.18);
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: var(--teal);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5;
}

.chart-line.copper {
    stroke: var(--copper);
}

.chart-point {
    fill: #fff;
    stroke: var(--teal);
    stroke-width: 4;
}

.chart-point.copper {
    stroke: var(--copper);
}

.chart-data-label {
    fill: var(--graphite);
    font-size: 13px;
    font-weight: 800;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 4px;
    stroke-linejoin: round;
    text-anchor: middle;
}

.chart-legend {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.chart-legend span {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--teal);
}

.legend-dot.copper {
    background: var(--copper);
}

.legend-dot.graphite {
    background: var(--graphite);
}

.chart-labels {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    gap: 12px;
    align-items: end;
    min-height: 225px;
}

.bar-column {
    display: grid;
    gap: 8px;
    justify-items: center;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.bar-column strong {
    color: var(--graphite);
    font-size: 16px;
}

.bar-value {
    color: var(--graphite);
    font-size: 15px;
}

.bar-track {
    position: relative;
    display: flex;
    align-items: end;
    width: 100%;
    max-width: 46px;
    height: 156px;
    padding: 4px;
    border-radius: 8px;
    background: #edf3f5;
    overflow: hidden;
}

.bar-fill {
    display: block;
    width: 100%;
    min-height: 4px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--teal), var(--copper));
}

.monthly-summary,
.employee-load-list {
    display: grid;
    gap: 12px;
}

.monthly-summary-row,
.employee-load-row {
    display: grid;
    grid-template-columns: 50px minmax(110px, 1fr) minmax(92px, auto) minmax(72px, auto);
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.monthly-summary-row span,
.employee-load-row span,
.monthly-summary-row small,
.kpi-card span,
.kpi-card p {
    color: var(--muted);
}

.monthly-summary-row span,
.employee-load-row strong {
    font-weight: 800;
}

.monthly-summary-row b,
.employee-load-row b,
.kpi-card b {
    color: var(--copper);
}

.load-bar {
    height: 10px;
    border-radius: 999px;
    background: #edf3f5;
    overflow: hidden;
}

.load-bar i {
    display: block;
    min-width: 4px;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--copper));
}

.employee-load-row {
    grid-template-columns: minmax(120px, 0.9fr) minmax(120px, 1.2fr) minmax(90px, auto);
}

.employee-load-list-wide {
    display: block;
    column-count: 2;
    column-gap: 12px;
}

.employee-load-list-wide .employee-load-row {
    break-inside: avoid;
    margin-bottom: 12px;
}

.employee-load-row div:first-child {
    min-width: 0;
}

.employee-load-row strong,
.employee-load-row span {
    display: block;
}

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

.kpi-card {
    display: grid;
    gap: 7px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(0, 155, 159, 0.06), rgba(229, 106, 44, 0.05)),
        #fff;
}

.kpi-card strong {
    color: var(--teal);
    font-size: 18px;
}

.kpi-card b {
    font-size: 24px;
}

.kpi-card p {
    margin: 0;
    line-height: 1.45;
}

.plan-progress-panel {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(246, 248, 250, 0.9)),
        linear-gradient(120deg, rgba(0, 155, 159, 0.1), rgba(229, 106, 44, 0.08));
}

.plan-percent {
    color: var(--copper);
    font-size: 28px;
}

.plan-progress,
.mini-progress {
    height: 14px;
    border-radius: 999px;
    background: #e7eef1;
    overflow: hidden;
}

.plan-progress {
    height: 18px;
}

.plan-progress-fill,
.mini-progress i {
    display: block;
    min-width: 4px;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--gold), var(--copper));
}

.plan-progress-caption {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: var(--muted);
    font-weight: 800;
}

.podium-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.podium-card {
    position: relative;
    display: grid;
    gap: 9px;
    justify-items: center;
    min-height: 210px;
    padding: 24px 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 250, 0.92)),
        linear-gradient(135deg, rgba(0, 155, 159, 0.08), rgba(229, 106, 44, 0.07));
    text-align: center;
    overflow: hidden;
}

.podium-card.rank-1 {
    min-height: 246px;
    border-color: rgba(215, 168, 74, 0.58);
}

.podium-card.rank-2 {
    min-height: 224px;
}

.podium-rank,
.ranking-place {
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--graphite), var(--teal));
    font-weight: 900;
}

.podium-rank {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    box-shadow: 0 10px 24px rgba(15, 27, 32, 0.16);
}

.employee-avatar {
    display: grid;
    width: 68px;
    height: 68px;
    place-items: center;
    border: 3px solid rgba(255, 255, 255, 0.88);
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--teal), var(--copper));
    box-shadow: 0 12px 28px rgba(15, 27, 32, 0.16);
    font-weight: 900;
}

.employee-avatar.small {
    width: 42px;
    height: 42px;
    border-width: 2px;
    font-size: 13px;
}

.podium-card span,
.podium-card small,
.ranking-row small,
.plan-row small {
    color: var(--muted);
}

.achievement-grid {
    align-items: start;
}

.achievement-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ranking-list:not(.is-expanded) .is-extra {
    display: none;
}

.show-more-button {
    margin-top: 14px;
}

.payroll-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payroll-metrics,
.payroll-panel {
    width: calc(100% + 42px);
    margin-left: -21px;
    margin-right: -21px;
}

.payroll-panel {
    margin-bottom: 22px;
    padding: 16px;
}

.export-button {
    white-space: nowrap;
}

.payroll-table table {
    min-width: 0;
    table-layout: fixed;
    font-size: 11px;
    line-height: 1.25;
}

.payroll-table th,
.payroll-table td {
    padding: 8px 5px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.payroll-table th {
    font-size: 10px;
    line-height: 1.2;
}

.payroll-table td:not(:first-child):not(:nth-child(2)) {
    text-align: right;
    white-space: nowrap;
}

.payroll-table th:first-child,
.payroll-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
}

.payroll-table thead th:first-child {
    z-index: 3;
}

.payroll-table th:first-child,
.payroll-table td:first-child {
    width: 12%;
}

.payroll-table th:nth-child(2),
.payroll-table td:nth-child(2) {
    width: 10%;
}

.payroll-table th:nth-last-child(1),
.payroll-table td:nth-last-child(1),
.payroll-table th:nth-last-child(4),
.payroll-table td:nth-last-child(4),
.payroll-table th:nth-last-child(5),
.payroll-table td:nth-last-child(5) {
    width: 7%;
}

.payroll-total {
    color: var(--copper);
    font-weight: 900;
}

.ranking-list,
.plan-list {
    display: grid;
    gap: 12px;
}

.ranking-row,
.plan-row {
    display: grid;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.ranking-row {
    grid-template-columns: 34px 42px minmax(0, 1fr) auto;
}

.ranking-row-progress {
    grid-template-columns: 34px 42px minmax(0, 1fr) 72px;
}

.plan-row {
    grid-template-columns: minmax(0, 1fr) minmax(140px, 0.8fr) 72px;
}

.ranking-place {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

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

.ranking-row b,
.plan-row b {
    color: var(--copper);
    text-align: right;
}

.stack-form {
    display: grid;
    gap: 16px;
}

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

fieldset.form-grid {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

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

.login-layout {
    display: grid;
    min-height: calc(100vh - 140px);
    place-items: center;
}

.login-panel {
    width: min(460px, 100%);
    padding: 30px;
}

.login-panel h1 {
    font-size: 30px;
}

.login-note {
    margin: 12px 0 20px;
    color: var(--muted);
    line-height: 1.5;
}

.login-helper-link {
    justify-self: center;
    color: var(--copper);
    font-weight: 800;
}

.muted {
    color: var(--muted);
}

.form-errors,
.row-errors {
    margin: 8px 0;
    color: var(--danger);
}

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

    .sidebar {
        position: relative;
        min-height: auto;
        padding: 16px;
    }

    .sidebar-caption {
        display: none;
    }

    .main-nav {
        display: flex;
        gap: 8px;
        margin-top: 14px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .main-nav a {
        flex: 0 0 auto;
    }

    .sidebar-footer {
        margin-top: 14px;
        padding-top: 12px;
    }

    .topbar {
        top: 0;
        padding: 12px 18px;
    }

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

    .coefficient-reference-panel {
        position: static;
    }

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

@media (max-width: 980px) {
    .page-head,
    .dashboard-filter-panel,
    .sheet-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-filter-panel {
        grid-template-columns: 1fr;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-sort-form {
        justify-content: stretch;
        width: 100%;
    }

    .metric-grid,
    .dashboard-grid,
    .settings-grid,
    .journal-overview,
    .payroll-metrics {
        grid-template-columns: 1fr;
    }

    .payroll-metrics,
    .payroll-panel {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

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

    .payroll-table table {
        min-width: 1180px;
    }

    .journal-visual-card {
        grid-template-columns: 1fr;
    }

    .journal-visual {
        max-width: 340px;
        justify-self: center;
    }

    .coefficient-reference-list {
        grid-template-columns: 1fr;
    }

    .kpi-card-grid {
        grid-template-columns: 1fr;
    }

    .podium-grid,
    .achievement-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 29px;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 20px, 1500px);
        padding-top: 14px;
    }

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

    .userbox {
        justify-content: flex-start;
        width: 100%;
    }

    .username {
        max-width: 130px;
    }

    .page-head {
        padding: 18px;
    }

    .sheet-grid {
        display: grid;
        grid-template-columns: 1fr;
        min-width: 0;
        gap: 10px;
    }

    .sheet-head {
        display: none;
    }

    .sheet-row {
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
    }

    .sheet-row label > span,
    .readonly-cell span {
        display: block;
        margin-bottom: 5px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }

    .readonly-cell {
        display: block;
    }

    .row-action {
        justify-content: start;
    }

    .period-inline,
    .row-tools,
    .actions,
    .bulk-fill-panel,
    .period-filter {
        align-items: stretch;
        flex-direction: column;
    }

    .bulk-fill-panel {
        grid-template-columns: 1fr;
    }

    .button {
        width: 100%;
    }

    .modal-overlay {
        align-items: end;
        padding: 12px;
    }

    .modal-card {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 22px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .recent-row {
        grid-template-columns: 1fr;
    }

    .recent-row b {
        grid-row: auto;
    }

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

    .tabs {
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .tabs a {
        flex: 0 0 auto;
    }

    .bar-chart,
    .chart-labels {
        gap: 6px;
    }

    .chart-labels {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 3px;
    }

    .chart-labels span {
        flex: 0 0 42px;
    }

    .bar-track {
        max-width: 34px;
        height: 126px;
    }

    .monthly-summary-row,
    .employee-load-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ranking-row,
    .ranking-row-progress,
    .plan-row {
        grid-template-columns: 1fr;
    }

    .ranking-place,
    .employee-avatar.small {
        justify-self: start;
    }

    .plan-progress-caption {
        flex-direction: column;
    }

    .employee-load-list-wide {
        column-count: 1;
    }
}
