:root {
    --ink: #1c1917;
    --muted: #57534e;
    --line: #e7e5e4;
    --paper: #fafaf9;
    --surface: #ffffff;
    --accent: #1f4d3a;
    --accent-ink: #f7f6f3;
    --danger: #9f1239;
    --focus: #1f4d3a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

a { color: var(--accent); }

h1 {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }

.report-block + .report-block { margin-top: 2rem; }
.report-block > .btn { margin-top: 0.75rem; }

.page-head h1 a { color: inherit; text-decoration: none; }
.page-head h1 a:hover { text-decoration: underline; }

tr.is-clickable { cursor: pointer; }
tr.is-clickable:hover,
tr.is-clickable:focus-visible { background: #f4f3f1; }

.lightbox {
    width: min(26rem, calc(100vw - 2rem));
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 12px;
    padding: 1.25rem;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 20px 50px rgba(28, 25, 23, 0.25);
}

.lightbox::backdrop { background: rgba(28, 25, 23, 0.45); }
.lightbox.lightbox-form {
    width: min(32rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
}
.lightbox.lightbox-form.lightbox-calendario { overflow: visible; }
.lightbox h2 { padding-right: 2.5rem; }

.lightbox hr {
    margin: 0.45rem 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.lightbox-fechar {
    position: absolute;
    z-index: 2;
    top: 1rem;
    right: 1rem;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.lightbox-fechar:hover { background: #f4f3f1; color: var(--ink); }
.lightbox-fechar:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    background: #f4f3f1;
    color: var(--ink);
}
.lightbox-fechar svg { display: block; }

@media (max-width: 767px) {
    .lightbox-fechar {
        top: 0.65rem;
        right: 0.65rem;
        width: 3rem;
        height: 3rem;
    }
    .lightbox-fechar svg { width: 1.375rem; height: 1.375rem; }
    .lightbox h2 { padding-right: 3.25rem; }
}
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: var(--paper);
    text-align: center;
}
.dropzone p { margin: 0; }
.dropzone.is-over { border-color: var(--accent); background: #f4f3f1; }
.dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.lightbox-intro { display: flex; flex-direction: column; gap: 0.2rem; }
.lightbox-intro h2,
.lightbox-intro p { margin: 0; }

.menu { position: relative; flex: none; }
.menu-button { min-width: 2.75rem; letter-spacing: 0.12em; }
.menu-panel {
    position: absolute;
    z-index: 6;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 12rem;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.12);
}
.menu-panel[hidden] { display: none; }
.menu-panel form { margin: 0; }
.menu-panel a,
.menu-panel button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.menu-panel a:hover,
.menu-panel button:hover { background: #f4f3f1; }
.menu-panel .is-danger,
.menu-panel .is-danger:hover { color: var(--danger); }

.linkish {
    margin-right: 0.65rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.table-wrap + .btn { margin-top: 0.75rem; }

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 1.1rem;
    height: 2px;
    border-radius: 1px;
    background: var(--ink);
}

.topbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.nav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav a {
    color: var(--ink);
    text-decoration: none;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
}

.nav a.is-current { background: #eceae6; }

.nav-count {
    display: inline-block;
    min-width: 1.15rem;
    margin-left: 0.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #b42318;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.15rem;
    text-align: center;
}

.pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

[data-jornadas] {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.jornada {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.jornada[hidden],
[data-jornada-vazia][hidden],
[data-adicionar-jornada][hidden] { display: none; }

.jornada-rotulo { margin: 0; font-weight: 600; }

[data-adicionar-jornada] { align-self: flex-start; }

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

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

.who {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.page {
    width: min(1180px, calc(100% - 2rem));
    margin: 1.5rem auto 3rem;
}

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

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.25rem;
}

.panel-narrow { max-width: 28rem; }

.stack { display: flex; flex-direction: column; gap: 0.9rem; }

.filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(10rem, 0.9fr) minmax(9rem, 0.8fr) minmax(9rem, 0.8fr) auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}

.filter-bar.filter-bar-dates {
    grid-template-columns: minmax(9rem, 16rem) minmax(9rem, 16rem) auto;
    justify-content: start;
}

.filter-bar.filter-bar-status {
    grid-template-columns: minmax(0, 1.4fr) minmax(10rem, 0.7fr) auto;
    justify-content: start;
}

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

.tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--muted);
}

.field { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }

.field input,
.field select,
.field textarea {
    font: inherit;
    font-weight: 450;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d6d3d1;
    border-radius: 8px;
    background: #fff;
    width: 100%;
}

.field textarea { min-height: 6rem; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.error { color: var(--danger); font-weight: 550; }

.alert {
    margin: 0 0 1rem;
    padding: 0.7rem 0.85rem;
    background: #ecfdf3;
    border: 1px solid #b7e4c7;
    border-radius: 8px;
}

.archived-users { margin-top: 2rem; }

.user-list { table-layout: fixed; }
.user-list th:nth-child(1),
.user-list td:nth-child(1) { width: 34%; }
.user-list th:nth-child(2),
.user-list td:nth-child(2) { width: 44%; }
.user-list th:nth-child(3),
.user-list td:nth-child(3) { width: 22%; }
.user-list td { overflow-wrap: anywhere; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: transparent; border-color: #fecdd3; color: var(--danger); }
.link-danger {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.45rem 0.35rem;
    border: 0;
    background: none;
    color: var(--danger);
    font: inherit;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 0.18em;
    cursor: pointer;
}

.lightbox .link-btn,
.lightbox .link-danger { font-size: 14px; }

.lightbox .link-btn {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.confirmar-caixa { margin: 0.25rem 0 0; }
.confirmar-caixa[hidden] { display: none; }

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

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

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

th { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

tr:last-child td { border-bottom: 0; }

.cell-end { text-align: right; }
.cell-end form { display: inline; }

.inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) auto;
    gap: 0.75rem;
    align-items: end;
    margin: 0 0 1rem;
}

.inline-form.cols-2 { grid-template-columns: minmax(0, 1fr) auto; }

.inline-form .error { grid-column: 1 / -1; }

@media (max-width: 767px) {
    .inline-form,
    .inline-form.cols-2 { grid-template-columns: 1fr; }
}

.filters { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.filters a { color: var(--ink); text-decoration: none; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--line); }
.filters a.is-current { background: #eceae6; }

.split {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    align-items: start;
}

.home-clocks { margin-bottom: 1rem; }

.home-columns {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    align-items: start;
}

.clock-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #14261e;
    color: #f7f6f3;
    border-radius: 12px;
}

.clock-bar p { margin: 0.2rem 0 0; }

.elapsed {
    font-variant-numeric: tabular-nums;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin: 0.35rem 0 0;
}

.alert-day {
    margin: 1.15rem 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 650;
}

.alert-day:first-of-type { margin-top: 0; }

.alert-more { margin-top: 1rem; }

.list { list-style: none; margin: 0; padding: 0; }

.list li + li { border-top: 1px solid var(--line); }

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.list a, .row-link {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    color: inherit;
    text-decoration: none;
}

.check:has(.revision-toggle:checked) + .revision-fields {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.revision-fields { display: none; }

.calendario { position: relative; }

.calendario-pop {
    position: absolute;
    z-index: 5;
    top: calc(100% + 0.35rem);
    left: 0;
    width: min(20rem, 100%);
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.12);
}

.calendario-pop.is-acima {
    top: auto;
    bottom: calc(100% + 0.35rem);
}

.calendario-nav,
.calendario-acoes,
.calendario-hora {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.calendario-nav button,
.calendario-acoes button,
.calendario-grade button {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    color: var(--ink);
}

.calendario-nav button {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
}

.calendario-nav button:hover,
.calendario-grade button:hover,
.calendario-acoes button:hover { background: var(--paper); }

.calendario-semana,
.calendario-grade {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.15rem;
    margin-top: 0.5rem;
    text-align: center;
}

.calendario-semana span {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: lowercase;
}

.calendario-grade button {
    height: 2rem;
    border-radius: 8px;
}

.calendario-grade button.is-today { box-shadow: inset 0 0 0 1px var(--line); }
.calendario-grade button.is-selected { background: var(--accent); color: var(--accent-ink); }

.calendario-hora,
.calendario-acoes { margin-top: 0.75rem; }

.calendario-hora label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    font-size: 0.85rem;
    color: var(--muted);
}

.calendario-hora select { font: inherit; color: var(--ink); }

.calendario-acoes button { color: var(--accent); font-weight: 650; }

.print-title { display: none; }

.sheet-foot {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.sheet-foot div {
    border-top: 2px solid var(--ink);
    padding-top: 0.5rem;
}

.sheet-download { margin-top: 1.75rem; }

@media (max-width: 767px) {
    .topbar { flex-wrap: wrap; }
    .brand { flex: 1; min-width: 0; }
    .nav-toggle { display: inline-flex; }
    .topbar-menu {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .topbar-menu.is-open { display: flex; }
    .nav { flex-direction: column; }
    .nav a { padding: 0.7rem 0.75rem; }
    .who {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        padding-top: 0.5rem;
        border-top: 1px solid var(--line);
    }
    .split,
    .home-columns { grid-template-columns: 1fr; }
    .page-head { align-items: stretch; flex-direction: column; }
    .page-head .menu { align-self: flex-end; }
    .btn-phone { width: 100%; }
    .filter-bar,
    .filter-bar.filter-bar-dates,
    .filter-bar.filter-bar-status,
    .pair { grid-template-columns: 1fr; }
    .clock-bar { position: sticky; top: 0; z-index: 2; align-items: stretch; flex-direction: column; }
    .sheet-foot { grid-template-columns: 1fr 1fr; }
}

@media print {
    .print-title { display: block; }
    .topbar, .no-print, .alert { display: none !important; }
    .page { width: auto; margin: 0; padding: 0; }
    body { background: #fff; }
    .panel { border: 0; padding: 0; }
    a { color: inherit; text-decoration: none; }
}
