:root {
    color-scheme: light;
    --red: #d7282f;
    --red-action: #b81c1c;
    --red-dark: #921818;
    --green: #1e5c28;
    --green-dark: #174b21;
    --green-soft: #e7f0e6;
    --cream: #f2ede3;
    --cream-soft: #f7f3eb;
    --surface: #ffffff;
    --surface-warm: #fffdf8;
    --ink: #1a1a18;
    --muted: #686861;
    --line: rgba(30, 92, 40, 0.15);
    --warning: #b56b12;
    --shadow: 0 12px 28px rgba(26, 26, 24, 0.06);
    --radius: 12px;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    background: var(--cream-soft);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Barlow", sans-serif;
    background:
        radial-gradient(circle at 12% 4%, rgba(30, 92, 40, 0.08), transparent 25rem),
        linear-gradient(135deg, var(--cream) 0%, var(--cream-soft) 58%, #f5efe5 100%);
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

button,
.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 10px 18px;
    color: #fff;
    background: var(--red-action);
    box-shadow: 0 8px 18px rgba(184, 28, 28, 0.15);
    cursor: pointer;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

button:hover,
.button:hover {
    background: var(--red-dark);
    box-shadow: 0 10px 22px rgba(184, 28, 28, 0.22);
    transform: translateY(-1px);
}

button:focus-visible,
.button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(215, 40, 47, 0.3);
    outline-offset: 2px;
}

.button-secondary {
    color: var(--green-dark);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: none;
}

.button-secondary:hover {
    color: #fff;
    background: var(--green);
    box-shadow: none;
}

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

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 9px clamp(18px, 3vw, 48px);
    color: #fff;
    background: var(--red);
    box-shadow: 0 8px 24px rgba(112, 16, 20, 0.17);
}

.brand-block,
.topbar-actions {
    display: flex;
    align-items: center;
}

.brand-block {
    gap: 16px;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: 142px;
    max-height: 48px;
    object-fit: contain;
}

.brand-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.42);
}

.brand-product {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.topbar-actions {
    gap: 18px;
    font-size: 0.9rem;
    font-weight: 600;
}

.topbar-actions a { text-underline-offset: 4px; }

.topbar-user {
    font-family: "Playfair Display", serif;
    font-style: italic;
}

.logout-form { margin: 0; }

.logout-form button {
    min-height: 36px;
    padding: 8px 14px;
    color: #fff;
    background: rgba(86, 8, 12, 0.24);
    box-shadow: none;
}

.workspace {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    width: min(1680px, 100%);
    margin: 0 auto;
    padding: 28px clamp(18px, 3vw, 48px) 48px;
}

.sidebar {
    position: sticky;
    top: 100px;
    min-width: 0;
    align-self: start;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    color: #fff;
    background: var(--green);
}

.profile-card > span:last-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.profile-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-card small { color: rgba(255, 255, 255, 0.72); }

.profile-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: var(--green-dark);
    background: var(--surface-warm);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
}

.sidebar nav {
    display: grid;
    gap: 4px;
    padding: 12px;
}

.sidebar nav a {
    position: relative;
    display: block;
    border-radius: 8px;
    padding: 11px 13px;
    color: #31322e;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-decoration: none;
    text-transform: uppercase;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: var(--green-dark);
    background: var(--cream-soft);
}

.sidebar nav a.active::before {
    content: "";
    position: absolute;
    inset: 8px auto 8px 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--red);
}

.sidebar-note {
    display: grid;
    gap: 4px;
    margin: 4px 12px 14px;
    border-top: 1px solid var(--line);
    padding: 14px 4px 2px;
    color: var(--muted);
    font-size: 0.78rem;
}

.sidebar-note strong {
    color: var(--green-dark);
    text-transform: uppercase;
}

.content {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 18px;
}

.page-heading {
    display: flex;
    min-width: 0;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    padding: 7px 2px 3px;
}

.page-heading h1 {
    margin: 3px 0 7px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: clamp(2.25rem, 4vw, 3.8rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 0.95;
}

.page-heading h1 em {
    color: var(--green);
    font-family: "Playfair Display", serif;
    font-size: 0.8em;
    font-weight: 600;
}

.calendar-heading h1 {
    font-family: "Barlow", sans-serif;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.calendar-heading h1 span {
    color: var(--green);
    font-weight: 400;
}

.page-heading p,
.panel p {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.55;
}

.eyebrow {
    color: var(--green);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-featured { border-top: 4px solid var(--green); }

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

.panel-heading h2,
.panel h1,
.panel > h2 {
    margin: 2px 0 0;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.42rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.metrics {
    display: grid;
    gap: 14px;
}

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

.metric {
    position: relative;
    overflow: hidden;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px 15px 21px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--green);
}

.metric-alert::before { background: var(--red); }

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

.metric span {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin: 6px 0 1px;
    color: var(--green-dark);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.metric-alert strong { color: var(--red-action); }

.metric small {
    overflow: hidden;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.dashboard-grid,
.import-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
}

.compact-panel { align-content: start; }

.action-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 22px;
}

.text-link {
    color: var(--green-dark);
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.facts {
    display: grid;
    gap: 0;
    margin: 0 0 16px;
}

.facts div {
    display: grid;
    grid-template-columns: minmax(90px, 0.7fr) minmax(0, 1.3fr);
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

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

.form label,
.period-form label {
    display: grid;
    gap: 7px;
    color: #34352f;
    font-size: 0.84rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(30, 92, 40, 0.22);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: var(--surface-warm);
}

input:focus,
select:focus,
textarea:focus { border-color: var(--green); }

.checkbox {
    grid-auto-flow: column;
    align-items: center;
    justify-content: start;
}

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

.period-form {
    display: flex;
    align-items: end;
    gap: 10px;
    min-width: min(100%, 420px);
}

.period-form label { flex: 1 1 150px; }

.export-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.button-small {
    min-height: 32px;
    padding: 7px 11px;
    font-size: 0.76rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 9px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

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

th {
    color: var(--green-dark);
    background: var(--cream-soft);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    white-space: nowrap;
}

td { font-size: 0.9rem; }
tbody tr:last-child td { border-bottom: 0; }

.numeric {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.status-pill,
.count-pill {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-ok { color: var(--green-dark); background: var(--green-soft); }
.status-error { color: var(--red-dark); background: #f9dddd; }
.status-warning { color: #754507; background: #faebca; }
.status-neutral,
.count-pill { color: #4d4e48; background: #efeee9; }
.count-pill { min-width: 28px; }

.alert {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 15px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.alert.success { color: var(--green-dark); background: var(--green-soft); }
.alert.error { color: var(--red-dark); background: #f9dddd; }

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

.list-item {
    display: grid;
    gap: 3px;
    border-left: 3px solid var(--green);
    padding: 10px 12px;
    background: var(--cream-soft);
}

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

.step-list {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.step-list span {
    flex: 1;
    border-bottom: 2px solid var(--line);
    padding: 0 2px 9px;
    color: var(--muted);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.step-list .active { color: var(--green-dark); border-color: var(--green); }

.upload-box {
    border: 1px dashed rgba(30, 92, 40, 0.38);
    border-radius: 10px;
    padding: 22px;
    background: var(--cream-soft);
}

.upload-box span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
}

.notice-inline,
.scope-note {
    border-left: 3px solid var(--warning);
    padding: 10px 12px;
    background: #fff8e8;
}

.scope-note {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.scope-note strong { flex: 0 0 auto; color: #754507; }
.scope-note span { color: #5f5547; }

.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.calendar-panel {
    padding: 16px;
}

.calendar-weekday {
    padding: 2px 4px 5px;
    color: var(--muted);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
}

.calendar-empty {
    min-height: 78px;
    border-radius: 7px;
    background: rgba(104, 104, 97, 0.035);
}

.day-card {
    display: grid;
    min-height: 78px;
    align-content: start;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 7px;
    background: #ecece8;
}

.day-card.worked {
    border-color: rgba(30, 92, 40, 0.3);
    background: var(--green-soft);
}

.day-card.planned { box-shadow: inset 0 3px 0 var(--warning); }
.day-card.has-anomaly { box-shadow: inset 0 3px 0 var(--red); }

.day-card header { color: var(--muted); }

.day-card header strong {
    color: #555650;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1rem;
    line-height: 1;
}

.day-card.worked header strong { color: var(--green-dark); }

.day-body {
    display: grid;
    gap: 2px;
    color: #43443f;
    font-size: 0.7rem;
    line-height: 1.2;
}

.badge.shift {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    max-width: 100%;
    overflow: hidden;
    padding: 3px 6px;
    color: #fff;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: uppercase;
}

.empty-state { padding: 30px; color: var(--muted); text-align: center; }
.login-body { background: var(--cream-soft); }
.login-content,
.login-layout { min-height: 100vh; }

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
}

.login-visual {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(32px, 5vw, 72px);
    color: #fff;
    background:
        linear-gradient(180deg, rgba(14, 34, 18, 0.35), rgba(11, 28, 14, 0.82)),
        url("sfondologin.jpg") center / cover no-repeat;
}

.login-visual::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -110px;
    width: 310px;
    height: 310px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    box-shadow: 0 0 0 42px rgba(255, 255, 255, 0.04), 0 0 0 84px rgba(255, 255, 255, 0.03);
}

.login-logo {
    position: relative;
    z-index: 1;
    width: clamp(180px, 20vw, 270px);
    height: auto;
}

.login-visual-copy {
    position: relative;
    z-index: 1;
    max-width: 700px;
}

.login-visual-copy > span {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-visual-copy h1 {
    margin: 12px 0 20px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: clamp(3.2rem, 6vw, 6.6rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 0.84;
    text-transform: uppercase;
}

.login-visual-copy p {
    max-width: 530px;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.05rem;
    line-height: 1.5;
}

.login-panel {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: clamp(28px, 6vw, 90px);
    background:
        radial-gradient(circle at 100% 0, rgba(215, 40, 47, 0.08), transparent 19rem),
        var(--surface-warm);
}

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

.login-card-logo {
    width: 138px;
    height: auto;
    margin-bottom: 54px;
}

.login-card h2 {
    margin: 5px 0 8px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.login-card-subtitle {
    margin: 0 0 28px;
    color: var(--muted);
    line-height: 1.5;
}

.auth-form button { width: 100%; margin-top: 5px; }

.login-note {
    display: grid;
    gap: 2px;
    margin-top: 24px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
    color: var(--muted);
    font-size: 0.82rem;
}

.login-note strong {
    color: var(--green-dark);
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.terminal-note { margin: 18px 0 0; color: #86867f; font-size: 0.76rem; }

@media (max-width: 1100px) {
    .workspace { grid-template-columns: 220px minmax(0, 1fr); }
    .metrics-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .topbar-user,
    .topbar-actions > a,
    .brand-divider,
    .brand-product { display: none; }

    .workspace { grid-template-columns: 1fr; padding-top: 18px; }
    .sidebar { position: static; }
    .profile-card,
    .sidebar-note { display: none; }
    .sidebar nav { display: flex; overflow-x: auto; }
    .sidebar nav a { flex: 0 0 auto; }

    .page-heading,
    .period-form { align-items: stretch; flex-direction: column; }

    .period-form { width: 100%; min-width: 0; }
    .period-form label { flex: auto; }

    .grid.two,
    .dashboard-grid,
    .import-grid { grid-template-columns: 1fr; }

    .login-layout { grid-template-columns: 1fr; }
    .login-visual { min-height: 42vh; padding: 30px; }
    .login-visual-copy h1 { font-size: clamp(2.8rem, 12vw, 4.5rem); }
    .login-panel { min-height: 58vh; padding: 42px 28px; }
    .login-card-logo { display: none; }
}

@media (max-width: 620px) {
    .topbar { min-height: 62px; padding: 8px 14px; }
    .brand-logo { width: 122px; }
    .workspace { gap: 14px; padding: 14px 12px 32px; }
    .page-heading h1 { font-size: 2.35rem; }

    .metrics-four,
    .metrics-three,
    .form-grid { grid-template-columns: 1fr; }

    .panel { padding: 16px; }

    .panel-heading,
    .scope-note,
    .action-row { align-items: stretch; flex-direction: column; }

    .calendar { gap: 3px; }
    .calendar-panel { padding: 10px; }
    .calendar-weekday { font-size: 0.62rem; }
    .calendar-empty,
    .day-card { min-height: 58px; padding: 5px; }
    .day-body { font-size: 0.62rem; }
    .day-body .muted { display: none; }
    .export-actions { justify-content: stretch; }
    .export-actions .button { flex: 1 1 auto; }
    .step-list { display: grid; }
    .login-visual { min-height: 38vh; }
    .login-visual-copy p { display: none; }
}
