:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #1d2430;
    --muted: #667085;
    --line: #ebf0f6;
    --brand: #116a74;
    --brand-dark: #0d4f57;
    --warn: #b93815;
    --warn-bg: #fff0e8;
    --ok-bg: #eaf7f1;
    --control-bg: #ffffff;
    --control-hover: #dfe8ea;
    --nav-hover: #e6f0f1;
    --soft-bg: #eef3f4;
    --date-bg: #f8fbfb;
    --shadow: rgba(29, 36, 48, .06);
}

html[data-theme="dark"] {
    --bg: #101418;
    --panel: #171d23;
    --ink: #eef4f5;
    --muted: #a9b6bc;
    --line: #2b3942;
    --brand: #35a7a0;
    --brand-dark: #8de0d9;
    --warn: #ff8a66;
    --warn-bg: #3a2018;
    --ok-bg: #183329;
    --control-bg: #12181e;
    --control-hover: #26343d;
    --nav-hover: #1e3035;
    --soft-bg: #202a31;
    --date-bg: #151d23;
    --shadow: rgba(0, 0, 0, .3);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

a {
    color: inherit;
}

.topbar {
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-main {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.brand {
    color: var(--brand-dark);
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.menu-toggle {
    align-items: center;
    background: var(--control-bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: none;
    flex-direction: column;
    gap: 4px;
    height: 40px;
    justify-content: center;
    min-height: 40px;
    padding: 0;
    width: 44px;
}

.menu-toggle span {
    background: var(--ink);
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 20px;
}

.menu-toggle:hover {
    background: var(--soft-bg);
}

.lang-switch {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    overflow: hidden;
}

.lang-switch a {
    background: var(--control-bg);
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    padding: 7px 9px;
    text-decoration: none;
}

.lang-switch a.active {
    background: var(--brand);
    color: #fff;
}

nav a,
.button,
button {
    background: var(--brand);
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    min-height: 38px;
    padding: 9px 13px;
    text-decoration: none;
}

nav a {
    background: transparent;
    color: var(--ink);
    font-weight: 600;
}

nav a:hover,
nav a.active {
    background: var(--nav-hover);
    color: var(--brand-dark);
}

nav a.active {
    box-shadow: inset 0 -2px 0 var(--brand);
}

button:hover,
.button:hover {
    background: var(--brand-dark);
}

.button.warn {
    background: var(--warn);
}

.button.secondary {
    background: var(--soft-bg);
    border: 1px solid var(--line);
    color: var(--ink);
}

.button.secondary:hover {
    background: var(--control-hover);
}

.table-link {
    color: var(--brand-dark);
    font-weight: 800;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.shell {
    margin: 0 auto;
    max-width: 1280px;
    padding: 28px;
}

.site-footer {
    align-items: center;
    color: var(--muted);
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr auto 1fr;
    padding: 8px 28px 26px;
}

.footer-version {
    font-size: 12px;
    font-weight: 700;
    justify-self: start;
}

.site-footer .lang-switch {
    justify-self: center;
}

.theme-toggle {
    align-items: center;
    background: var(--control-bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--brand-dark);
    display: inline-flex;
    height: 34px;
    justify-content: center;
    justify-self: end;
    min-height: 34px;
    padding: 0;
    width: 38px;
}

.theme-toggle:hover {
    background: var(--soft-bg);
}

.theme-toggle span {
    font-size: 0;
}

.theme-toggle .theme-sun,
html[data-theme="dark"] .theme-toggle .theme-moon {
    display: none;
}

.theme-toggle .theme-moon,
html[data-theme="dark"] .theme-toggle .theme-sun {
    display: inline-flex;
}

.theme-toggle .theme-sun::before {
    content: "\2600";
    font-size: 17px;
    line-height: 1;
}

.theme-toggle .theme-moon::before {
    content: "\263E";
    font-size: 18px;
    line-height: 1;
}


.notice,
.empty,
.warning {
    background: var(--ok-bg);
    border: 1px solid #bddfce;
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 14px 16px;
}

.warning {
    background: var(--warn-bg);
    border-color: #e88965;
    color: #842b12;
    font-weight: 700;
}

.collision-warn {
    background: #fff7cc;
    border: 1px solid #e5bd3c;
    border-radius: 6px;
    color: #735300;
    font-weight: 800;
    padding: 8px 10px;
}

.collision-warn.compact {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    padding: 6px 8px;
}

.hidden {
    display: none;
}

.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 8vh auto;
    max-width: 440px;
    padding: 28px;
}

h1,
h2 {
    margin: 0 0 14px;
}

p {
    color: var(--muted);
    margin: 0 0 18px;
}

form {
    margin: 0;
}

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

input,
select {
    background: var(--control-bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
    width: 100%;
}

.demo {
    color: var(--muted);
    font-size: 13px;
    margin-top: 18px;
}

.hero {
    align-items: stretch;
    background: linear-gradient(135deg, #0f5961, #287d6f);
    border-radius: 8px;
    color: #fff;
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr 190px;
    margin-bottom: 24px;
    padding: 26px;
}

.hero p {
    color: #e9fbf7;
    max-width: 720px;
}

.stat {
    align-items: center;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 8px;
    display: grid;
    justify-items: center;
    padding: 18px;
}

.stat span {
    color: #d8f5ef;
    font-size: 13px;
    font-weight: 700;
}

.stat strong {
    font-size: 44px;
}

.grid.two {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
}

.quick-card {
    order: 2;
}

.shifts-card {
    order: 1;
}

article,
.editor,
.profile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.editor.nested {
    margin: 18px 0;
}

.cards {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.card {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    min-height: 94px;
    padding: 16px;
    text-decoration: none;
}

.card:hover {
    border-color: var(--brand);
}

.card span {
    font-weight: 800;
}

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

.card .responsible-line {
    color: #1b6a68;
    font-size: 11px;
    font-style: italic;
    line-height: 1.35;
}

.card .responsible-list {
    color: #1b6a68;
    font-size: 11px;
    font-style: italic;
    line-height: 1.35;
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
}

.card .responsible-label {
    color: inherit;
    font: inherit;
}

.group-member-editor {
    margin-bottom: 18px;
}

.group-members-table {
    width: 100%;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

.quick-actions .button {
    justify-content: center;
    max-width: 100%;
    width: fit-content;
}

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

.page-title p {
    margin-bottom: 0;
}

.group-title-line {
    align-items: center;
    display: flex;
    gap: 10px;
}

.group-title-line h1 {
    margin: 0;
}

.icon-button {
    align-items: center;
    background: var(--soft-bg);
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--brand-dark);
    display: inline-flex;
    font-size: 16px;
    height: 34px;
    justify-content: center;
    min-height: 34px;
    padding: 0;
    width: 34px;
}

.icon-button:hover {
    background: var(--brand);
    color: #fff;
}

.counter {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    padding: 10px 14px;
}

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

.counter strong {
    color: var(--brand-dark);
    font-size: 24px;
}

.pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
}

.pagination span {
    color: var(--muted);
    font-weight: 700;
}

.pagination.modern {
    justify-content: center;
}

.page-arrow {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: var(--brand-dark);
    display: inline-flex;
    font-size: 18px;
    font-weight: 900;
    height: 36px;
    justify-content: center;
    text-decoration: none;
    width: 36px;
}

.page-arrow:hover {
    background: transparent;
    color: var(--brand);
}

.page-arrow.disabled {
    color: #aeb8bb;
    cursor: default;
    opacity: 0.55;
}

.page-status {
    color: var(--ink);
    min-width: 96px;
    text-align: center;
}

code {
    background: var(--soft-bg);
    border-radius: 4px;
    padding: 2px 5px;
}

.page-title form {
    align-items: end;
    display: flex;
    gap: 8px;
}

.page-title input {
    width: 110px;
}

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

.table-wrap.narrow {
    max-width: 980px;
}

.responsible-cell {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.filters {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 16px;
}

.filter-panel summary {
    color: var(--brand-dark);
    cursor: pointer;
    font-weight: 800;
}

.filter-panel form {
    margin-top: 14px;
}

.auto-filter-form {
    grid-template-columns: minmax(220px, 360px);
}

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

.profile-role-row p {
    margin: 0;
}

.profile-actions {
    margin-left: auto;
}

.compact-filters {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compact-filters label {
    margin-bottom: 0;
    min-width: 120px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.tabs a {
    background: var(--control-bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    min-width: 48px;
    padding: 8px 10px;
    text-align: center;
    text-decoration: none;
}

.tabs a.active,
.tabs a:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

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

.calendar-wrap {
    max-height: calc(100vh - 230px);
    margin-left: calc(50% - 50vw + 18px);
    margin-right: calc(50% - 50vw + 18px);
    width: calc(100vw - 36px);
}

.calendar-table {
    border-collapse: separate;
    border-spacing: 0;
}


th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    white-space: pre-line;
}

td input,
td select {
    min-width: 150px;
}

.editable-cell .edit-field,
.editable-row .save-row-button {
    display: none;
}

.editable-row.editing .view-value,
.editable-row.editing .edit-row-button {
    display: none;
}

.editable-row.editing .edit-field {
    display: block;
}

.editable-row.editing .save-row-button {
    display: inline-flex;
}

.row-edit-form {
    align-items: center;
    display: flex;
}

thead th {
    background: var(--soft-bg);
    border-bottom: 1px solid #d5e0e3;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    z-index: 2;
}

.calendar-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
}

.calendar-table th:first-child {
    background: var(--soft-bg);
    left: 0;
    position: sticky;
    z-index: 3;
}

.calendar-table thead th:first-child {
    z-index: 5;
}

.date-column-heading {
    min-width: 92px;
    width: 92px;
}

.date-cell {
    min-width: 92px;
    text-align: center;
    width: 92px;
}

.table-date-cell {
    background: var(--date-bg);
    border-right: 1px solid var(--line);
}

.date-cell span,
.date-cell strong {
    display: block;
}

.date-cell .weekday-full {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.date-cell .weekday-short {
    display: none;
}

.date-cell strong {
    color: var(--brand-dark);
    font-size: 22px;
    line-height: 1.05;
}

.date-cell .date-month {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    margin-top: 4px;
    text-align: center;
}

tbody th {
    font-weight: 800;
    white-space: nowrap;
}

tr.has-collision td,
tr.has-collision th {
    background: var(--warn-bg);
}

.cell-groups {
    display: grid;
    gap: 8px;
    min-width: 170px;
}

.cell-group strong {
    color: var(--brand-dark);
    display: block;
    font-size: 13px;
    margin-bottom: 3px;
}

.cell-group ul {
    margin: 0;
    padding-left: 18px;
}

.cell-group li {
    margin: 2px 0;
}

.risk-person {
    background: #ffd8c7;
    border: 1px solid #e88965;
    border-radius: 5px;
    color: #842b12;
    font-weight: 800;
    line-height: 1.35;
    list-style-position: outside;
    padding: 2px 5px;
}

.form-grid {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.search-form {
    align-items: end;
    grid-template-columns: minmax(220px, 1fr) auto auto;
}

.search-form .button {
    align-self: end;
    margin-bottom: 14px;
}

.search-section {
    background: transparent;
    margin-bottom: 18px;
}

.search-bar {
    align-items: center;
    background: var(--control-bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 2px 12px var(--shadow);
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr auto auto;
    margin: 0 auto;
    max-width: 720px;
    padding: 6px 8px 6px 18px;
}

.search-bar input {
    border: 0;
    border-radius: 999px;
    min-height: 38px;
    padding: 8px 4px;
}

.search-bar input:focus {
    outline: none;
}

.search-button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--brand-dark);
    min-height: 34px;
    padding: 6px 14px;
}

.search-button:hover {
    background: var(--soft-bg);
    color: var(--brand-dark);
}

.search-clear {
    align-items: center;
    border-radius: 50%;
    color: var(--muted);
    display: inline-flex;
    font-size: 20px;
    font-weight: 700;
    height: 30px;
    justify-content: center;
    line-height: 1;
    text-decoration: none;
    width: 30px;
}

.search-clear:hover {
    background: var(--soft-bg);
    color: var(--ink);
}

.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.form-grid button {
    align-self: end;
    margin-bottom: 14px;
}

.check {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 38px;
}

.check input {
    min-height: 0;
    width: auto;
}

details summary {
    color: var(--brand-dark);
    cursor: pointer;
    font-weight: 800;
}

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

.detail-list div {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 2px;
    padding: 8px;
}

.detail-list span {
    color: var(--muted);
    font-size: 13px;
}

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

.row-actions {
    min-width: 250px;
}

.row-actions > form {
    margin-top: 8px;
}

.edit-form {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 12px;
}

.edit-form button {
    justify-content: center;
}

.link {
    background: transparent;
    color: var(--brand);
    min-height: 0;
    padding: 0;
}

.link.danger {
    color: var(--warn);
}

.group-field {
    display: none;
}

body.group-mode .group-field {
    display: grid;
}

body.group-mode .person-field {
    display: none;
}

@media (max-width: 760px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 12px 18px;
    }

    .topbar-main {
        width: 100%;
    }

    .menu-toggle {
        display: inline-flex;
    }

    nav {
        display: none;
        flex-direction: column;
        gap: 4px;
        justify-content: flex-start;
        width: 100%;
    }

    body.menu-open nav {
        display: flex;
    }

    nav a {
        border-radius: 6px;
        min-height: 42px;
        padding: 10px 12px;
        width: 100%;
    }

    .lang-switch {
        align-self: flex-start;
    }

    .shell {
        padding: 18px;
    }

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

    .quick-card {
        order: 1;
    }

    .shifts-card {
        order: 2;
    }

    .page-title,
    .collision-title {
        align-items: stretch;
        flex-direction: column;
    }

    .compact-filters {
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        width: 100%;
    }

    .search-bar {
        max-width: none;
    }

    .compact-filters label {
        min-width: 0;
    }

    .calendar-wrap {
        max-height: calc(100vh - 210px);
    }

    .calendar-table th:first-child,
    .calendar-table td:first-child {
        min-width: 72px;
        width: 72px;
    }

    .date-column-heading {
        min-width: 72px;
        width: 72px;
    }

    .date-cell {
        min-width: 72px;
        width: 72px;
    }

    .date-cell .weekday-full {
        display: none;
    }

    .date-cell .weekday-short {
        color: var(--muted);
        display: block;
        font-size: 13px;
        font-weight: 900;
    }

    .date-cell strong {
        font-size: 26px;
    }

    .details-col {
        display: none;
    }

}

@media (max-width: 520px) {
    .compact-filters {
        grid-template-columns: 1fr;
    }

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

    .search-button {
        grid-column: 1 / -1;
        justify-content: center;
    }
}
.responsibles-form {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.checkbox-grid {
    display: grid;
    gap: 10px 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.checkbox-grid .check {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    padding: 10px 12px;
}

.checkbox-grid .check small {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.responsibles-actions {
    display: flex;
    justify-content: flex-end;
}

.responsibles-actions button {
    white-space: nowrap;
}

@media (max-width: 760px) {
    .responsibles-form {
        grid-template-columns: 1fr;
    }

    .responsibles-actions {
        justify-content: stretch;
    }

    .responsibles-actions button {
        width: 100%;
    }
}
