/* ==========================================================================
   Sistema de Folha de Ponto - folha de estilo unica
   Paleta derivada da logo da empresa: azul-marinho #22314F e verde #7A9A2E.

   A aplicacao nao usa style="" nem <style> inline: a Content-Security-Policy
   so libera 'self', entao todo CSS precisa morar aqui.
   ========================================================================== */

:root {
    --navy-900: #16213a;
    --navy-800: #1c2a46;
    --navy-700: #22314f;
    --navy-600: #2d4066;
    --navy-100: #e8ecf4;

    --green-700: #5f7a22;
    --green-600: #7a9a2e;
    --green-500: #8fb23c;
    --green-100: #eef4dd;

    --gray-900: #1f2430;
    --gray-700: #444c5c;
    --gray-600: #626b7d;
    --gray-500: #858d9c;
    --gray-400: #aeb5c1;
    --gray-300: #d4d9e1;
    --gray-200: #e5e9ef;
    --gray-100: #f1f4f8;
    --gray-50: #f8fafc;
    --white: #ffffff;

    --red-700: #9a2b2b;
    --red-600: #c0392b;
    --red-100: #fdecea;
    --amber-700: #8a6100;
    --amber-100: #fdf3d8;
    --blue-700: #1d4e89;
    --blue-100: #e6effa;

    --radius: 8px;
    --radius-sm: 5px;
    --shadow-sm: 0 1px 2px rgba(22, 33, 58, .08);
    --shadow: 0 2px 8px rgba(22, 33, 58, .10);
    --shadow-lg: 0 12px 32px rgba(22, 33, 58, .18);

    --sidebar-width: 244px;
    --header-height: 58px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-100);
}

h1, h2, h3, h4 {
    margin: 0 0 .5rem;
    line-height: 1.25;
    color: var(--navy-800);
    font-weight: 600;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

p { margin: 0 0 .85rem; }

a {
    color: var(--navy-600);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ==========================================================================
   Acessibilidade
   ========================================================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 999;
    padding: .6rem 1rem;
    background: var(--navy-700);
    color: var(--white);
    border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
    left: 0;
}

:focus-visible {
    outline: 3px solid var(--green-500);
    outline-offset: 2px;
}

/* ==========================================================================
   Tela de login
   ========================================================================== */

.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(150deg, var(--navy-800) 0%, var(--navy-600) 60%, var(--green-700) 170%);
}

.auth__card {
    width: 100%;
    max-width: 408px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.auth__brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth__brand img {
    max-width: 210px;
    height: auto;
}

.auth__brand-mark {
    display: inline-block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy-700);
}

.auth__title {
    text-align: center;
    font-size: 1.05rem;
    color: var(--gray-600);
    font-weight: 500;
    margin-bottom: 1.4rem;
}

.auth__footer {
    margin-top: 1.4rem;
    text-align: center;
    font-size: .8rem;
    color: var(--gray-500);
}

/* ==========================================================================
   Estrutura principal
   ========================================================================== */

.layout {
    min-height: 100vh;
}

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
    background: var(--navy-700);
    color: var(--white);
    z-index: 40;
    box-shadow: var(--shadow);
}

.topbar__toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .28);
    color: var(--white);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 34px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: .01em;
}

.topbar__brand:hover { text-decoration: none; }

.topbar__brand img {
    height: 26px;
    width: auto;
    background: var(--white);
    border-radius: 4px;
    padding: 2px 5px;
}

.topbar__spacer { flex: 1; }

.topbar__user {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .85rem;
}

.topbar__user-name {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    text-align: right;
}

.topbar__user-role {
    font-size: .72rem;
    color: var(--green-500);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--navy-800);
    overflow-y: auto;
    padding: 1rem 0 2rem;
    z-index: 30;
}

.sidebar__group + .sidebar__group { margin-top: 1.1rem; }

.sidebar__group-title {
    padding: 0 1.15rem .35rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255, 255, 255, .42);
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.15rem;
    color: rgba(255, 255, 255, .82);
    font-size: .89rem;
    border-left: 3px solid transparent;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, .07);
    color: var(--white);
    text-decoration: none;
}

.sidebar__link.is-active {
    background: rgba(122, 154, 46, .18);
    border-left-color: var(--green-500);
    color: var(--white);
    font-weight: 600;
}

.sidebar__icon {
    width: 18px;
    text-align: center;
    opacity: .9;
    flex: none;
}

.backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(22, 33, 58, .5);
    z-index: 25;
}

.backdrop.is-visible { display: block; }

.content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--header-height) + 1.4rem) 1.5rem 3rem;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .9rem;
    margin-bottom: 1.25rem;
}

.page-head__text { min-width: 0; }

.page-head h1 { margin-bottom: .15rem; }

.page-head__subtitle {
    margin: 0;
    color: var(--gray-600);
    font-size: .88rem;
}

.page-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* ==========================================================================
   Cartoes
   ========================================================================== */

.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .85rem 1.15rem;
    border-bottom: 1px solid var(--gray-200);
}

.card__head h2,
.card__head h3 { margin: 0; }

.card__body { padding: 1.15rem; }

.card__foot {
    padding: .85rem 1.15rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

/* ==========================================================================
   Indicadores do painel
   ========================================================================== */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .9rem;
    margin-bottom: 1.4rem;
}

.stat {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--navy-600);
    border-radius: var(--radius);
    padding: .95rem 1.1rem;
    box-shadow: var(--shadow-sm);
}

.stat--green { border-left-color: var(--green-600); }
.stat--gray  { border-left-color: var(--gray-400); }
.stat--blue  { border-left-color: var(--blue-700); }

.stat__label {
    display: block;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gray-600);
    font-weight: 600;
}

.stat__value {
    display: block;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--navy-800);
    line-height: 1.15;
    margin-top: .2rem;
}

.stat__hint {
    display: block;
    font-size: .78rem;
    color: var(--gray-500);
}

/* ==========================================================================
   Formularios
   ========================================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: .95rem 1rem;
}

.field { grid-column: span 12; }

.field--2  { grid-column: span 2; }
.field--3  { grid-column: span 3; }
.field--4  { grid-column: span 4; }
.field--5  { grid-column: span 5; }
.field--6  { grid-column: span 6; }
.field--8  { grid-column: span 8; }
.field--9  { grid-column: span 9; }

.field > label,
.field__label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: .28rem;
}

.field__required { color: var(--red-600); }

.field__hint {
    display: block;
    font-size: .76rem;
    color: var(--gray-500);
    margin-top: .25rem;
}

.field__error {
    display: block;
    font-size: .78rem;
    color: var(--red-700);
    margin-top: .25rem;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: .5rem .65rem;
    font-family: inherit;
    font-size: .92rem;
    color: var(--gray-900);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--navy-600);
    box-shadow: 0 0 0 3px rgba(45, 64, 102, .14);
    outline: none;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--red-600);
    background: var(--red-100);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: not-allowed;
}

textarea { min-height: 88px; resize: vertical; }

.check {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: .88rem;
    color: var(--gray-700);
}

.check input { width: auto; margin-top: .18rem; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--gray-200);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .7rem;
}

.filters .field {
    grid-column: auto;
    min-width: 148px;
    flex: 1 1 148px;
}

.filters .field--wide { flex: 2 1 240px; }

.filters__actions {
    display: flex;
    gap: .5rem;
    flex: none;
}

/* ==========================================================================
   Botoes
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem .95rem;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.3;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.btn:hover { text-decoration: none; }

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: .6;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--navy-700);
    border-color: var(--navy-700);
    color: var(--white);
}

.btn--primary:hover { background: var(--navy-600); border-color: var(--navy-600); }

.btn--accent {
    background: var(--green-600);
    border-color: var(--green-600);
    color: var(--white);
}

.btn--accent:hover { background: var(--green-700); border-color: var(--green-700); }

.btn--outline {
    background: var(--white);
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn--outline:hover { border-color: var(--navy-600); color: var(--navy-700); }

.btn--danger {
    background: var(--white);
    border-color: var(--red-600);
    color: var(--red-700);
}

.btn--danger:hover { background: var(--red-600); color: var(--white); }

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--gray-600);
    padding: .35rem .5rem;
}

.btn--ghost:hover { color: var(--navy-700); background: var(--gray-100); }

.btn--sm { padding: .3rem .6rem; font-size: .79rem; }
.btn--block { width: 100%; }

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

/* ==========================================================================
   Mensagens
   ========================================================================== */

.alerts { margin-bottom: 1.1rem; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    font-size: .89rem;
    margin-bottom: .6rem;
}

.alert--success { background: var(--green-100); border-color: var(--green-600); color: #3d5214; }
.alert--error   { background: var(--red-100);   border-color: var(--red-600);   color: var(--red-700); }
.alert--warning { background: var(--amber-100); border-color: #d9a406;          color: var(--amber-700); }
.alert--info    { background: var(--blue-100);  border-color: var(--blue-700);  color: var(--blue-700); }

.alert__close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    padding: 0 .15rem;
}

.alert__close:hover { opacity: 1; }

/* ==========================================================================
   Tabelas
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

table.data th,
table.data td {
    padding: .6rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

table.data thead th {
    background: var(--gray-50);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-600);
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 2px solid var(--gray-200);
}

table.data tbody tr:hover { background: var(--gray-50); }

table.data tbody tr:last-child td { border-bottom: none; }

.td-actions {
    text-align: right;
    white-space: nowrap;
}

.td-actions form { display: inline; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: .84em; }

/* ==========================================================================
   Etiquetas
   ========================================================================== */

.badge {
    display: inline-block;
    padding: .16rem .5rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    border-radius: 99px;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge--active   { background: var(--green-100); color: var(--green-700); }
.badge--inactive { background: var(--gray-200);  color: var(--gray-600); }
.badge--admin    { background: var(--navy-100);  color: var(--navy-700); }
.badge--user     { background: var(--gray-100);  color: var(--gray-600); }
.badge--holiday  { background: var(--red-100);   color: var(--red-700); }
.badge--sunday   { background: var(--amber-100); color: var(--amber-700); }
.badge--neutral  { background: var(--blue-100);  color: var(--blue-700); }

/* ==========================================================================
   Estado vazio
   ========================================================================== */

.empty {
    text-align: center;
    padding: 2.6rem 1.25rem;
    color: var(--gray-600);
}

.empty__icon {
    font-size: 2.1rem;
    opacity: .4;
    display: block;
    margin-bottom: .5rem;
}

.empty h3 { color: var(--gray-700); }

.empty p { max-width: 420px; margin: 0 auto .9rem; font-size: .9rem; }

/* ==========================================================================
   Paginacao
   ========================================================================== */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .8rem 1.15rem;
    border-top: 1px solid var(--gray-200);
    font-size: .84rem;
    color: var(--gray-600);
}

.pagination__pages {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
}

.pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 .45rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-700);
    font-weight: 600;
}

.pagination__page:hover { border-color: var(--navy-600); text-decoration: none; }

.pagination__page.is-current {
    background: var(--navy-700);
    border-color: var(--navy-700);
    color: var(--white);
}

/* ==========================================================================
   Listas de definicao (visualizacao de cadastro)
   ========================================================================== */

.definition {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .95rem 1.25rem;
    margin: 0;
}

.definition dt {
    font-size: .73rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    font-weight: 700;
    margin-bottom: .1rem;
}

.definition dd {
    margin: 0;
    font-size: .94rem;
    color: var(--gray-900);
    word-break: break-word;
}

/* ==========================================================================
   Calendario
   ========================================================================== */

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar__weekday {
    text-align: center;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    padding: .3rem 0;
}

.calendar__day {
    min-height: 68px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: .35rem .4rem;
    background: var(--white);
    font-size: .76rem;
}

.calendar__day--empty {
    background: transparent;
    border-color: transparent;
}

.calendar__day--sunday   { background: var(--amber-100); border-color: #eedfae; }
.calendar__day--saturday { background: var(--gray-50); }
.calendar__day--holiday  { background: var(--red-100); border-color: #f3c9c4; }
.calendar__day--today    { border: 2px solid var(--navy-600); }

.calendar__number {
    display: block;
    font-size: .95rem;
    font-weight: 700;
    color: var(--navy-800);
}

.calendar__note {
    display: block;
    margin-top: .15rem;
    color: var(--red-700);
    font-weight: 600;
    line-height: 1.25;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    font-size: .8rem;
    color: var(--gray-600);
    margin-top: 1rem;
}

.legend__item { display: flex; align-items: center; gap: .35rem; }

.legend__swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--gray-300);
    flex: none;
}

.legend__swatch--sunday   { background: var(--amber-100); }
.legend__swatch--holiday  { background: var(--red-100); }
.legend__swatch--business { background: var(--white); }
.legend__swatch--outside  { background: #eeeeee; }

/* ==========================================================================
   Previa da folha de ponto (espelho do PDF)
   ========================================================================== */

.sheet-scroll {
    overflow-x: auto;
    background: var(--gray-200);
    padding: 1.1rem;
    border-radius: var(--radius);
}

.sheet {
    width: 720px;
    margin: 0 auto;
    background: var(--white);
    padding: 18px 22px 22px;
    box-shadow: var(--shadow);
    font-size: 11px;
    color: #000;
}

.sheet__header {
    display: flex;
    align-items: stretch;
    border: 1px solid #000;
}

.sheet__logo {
    width: 182px;
    flex: none;
    border-right: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
}

.sheet__logo img {
    max-width: 100%;
    max-height: 32px;
    height: auto;
}

.sheet__tagline {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    padding: 4px 8px;
}

.sheet__title {
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    margin: 14px 0 10px;
}

.sheet__info {
    display: flex;
    border: 1px solid #000;
    border-bottom: none;
}

.sheet__info-left {
    flex: 1 1 70%;
    border-right: 1px solid #000;
    padding: 4px 6px;
    min-width: 0;
}

.sheet__info-right {
    flex: 1 1 30%;
    padding: 4px 6px;
    min-width: 0;
}

.sheet__row {
    display: flex;
    gap: 6px;
    line-height: 1.45;
}

.sheet__row dt,
.sheet__label {
    font-weight: 700;
    flex: none;
    width: 78px;
}

.sheet__label--short { width: auto; margin-left: 10px; }

.sheet__value {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.sheet__jornada-title {
    text-align: center;
    font-weight: 700;
    line-height: 1.45;
}

.sheet__jornada-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    line-height: 1.45;
}

.sheet__period {
    display: flex;
    gap: 26px;
    border: 1px solid #000;
    padding: 3px 6px;
    font-weight: 700;
}

.sheet__period span { font-weight: 400; margin-left: 6px; }

.sheet__table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 10px;
}

.sheet__table th,
.sheet__table td {
    border: 1px solid #000;
    padding: 3px 4px;
    text-align: center;
    height: 17px;
}

.sheet__table th { font-weight: 700; font-size: 11px; }

.sheet__table td:first-child { width: 6%; }

.sheet__table tr.is-shaded td { background: #eeeeee; }

.sheet__blocks { margin-top: 14px; }

.sheet__block {
    border: 1px solid #000;
    padding: 12px 8px 4px;
    margin-bottom: 9px;
}

.sheet__block-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.sheet__block-field {
    text-align: center;
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    min-height: 15px;
}

.sheet__block-caption {
    display: flex;
    gap: 10px;
    font-size: 9px;
}

.sheet__block-caption span { text-align: center; }

.sheet__class {
    width: 52%;
    border: 1px solid #000;
    border-bottom: none;
    margin-top: 14px;
}

.sheet__class-row {
    display: flex;
    border-bottom: 1px solid #000;
}

.sheet__class-label {
    width: 42%;
    border-right: 1px solid #000;
    padding: 3px 6px;
    font-weight: 700;
    text-align: center;
}

.sheet__class-value { flex: 1; padding: 3px 6px; }

.sheet__signatures {
    border: 1px solid #000;
    margin-top: 22px;
    padding: 6px 8px 10px;
    min-height: 84px;
    display: flex;
    flex-direction: column;
}

.sheet__signatures-title {
    text-align: center;
    font-weight: 700;
    font-size: 12px;
}

.sheet__signature-row {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-top: auto;
}

.sheet__signature {
    width: 40%;
    text-align: center;
    border-top: 1px solid #000;
    padding-top: 2px;
    font-size: 10px;
}

/* ==========================================================================
   Modal de confirmacao
   ========================================================================== */

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    background: rgba(22, 33, 58, .55);
    z-index: 60;
}

.modal[hidden] { display: none; }

.modal__dialog {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 1.4rem;
}

.modal__title { margin-bottom: .5rem; }

.modal__text { color: var(--gray-700); font-size: .92rem; }

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.2rem;
}

/* ==========================================================================
   Indicador de carregamento
   ========================================================================== */

.loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .9rem;
    background: rgba(248, 250, 252, .9);
    z-index: 70;
    color: var(--navy-700);
    font-weight: 600;
}

.loading[hidden] { display: none; }

.loading__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-300);
    border-top-color: var(--navy-700);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .loading__spinner { animation-duration: 3s; }
    * { transition-duration: .01ms !important; }
}

/* ==========================================================================
   Utilitarios
   ========================================================================== */

.muted { color: var(--gray-500); }
.small { font-size: .82rem; }
.strong { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .6rem; }
.mt-2 { margin-top: 1.1rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .6rem; }
.mb-2 { margin-bottom: 1.1rem; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.inline-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.inline-list li {
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: .87rem;
}

.inline-list li:last-child { border-bottom: none; }

/* ==========================================================================
   Responsivo
   ========================================================================== */

@media (max-width: 1024px) {
    .content { padding-left: 1.1rem; padding-right: 1.1rem; }
}

@media (max-width: 900px) {
    .topbar__toggle { display: inline-flex; align-items: center; justify-content: center; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.is-open { transform: translateX(0); }

    .content { margin-left: 0; }

    .field--2, .field--3, .field--4, .field--5 { grid-column: span 6; }
    .field--8, .field--9 { grid-column: span 12; }
}

@media (max-width: 640px) {
    body { font-size: 14px; }

    .content { padding: calc(var(--header-height) + 1rem) .85rem 2.5rem; }

    .topbar__user-name { display: none; }

    .field--6, .field--3, .field--4, .field--5, .field--2 { grid-column: span 12; }

    .stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }

    .stat__value { font-size: 1.5rem; }

    .page-head { flex-direction: column; align-items: stretch; }

    .page-head__actions .btn { flex: 1 1 auto; }

    .filters .field { min-width: 100%; flex: 1 1 100%; }

    .filters__actions { width: 100%; }

    .filters__actions .btn { flex: 1; }

    .calendar { grid-template-columns: repeat(7, minmax(40px, 1fr)); font-size: .7rem; }

    .calendar__day { min-height: 52px; padding: .25rem; }

    .card__foot { justify-content: stretch; }

    .card__foot .btn { flex: 1 1 auto; }

    .form-actions .btn { flex: 1 1 auto; }
}

/* ==========================================================================
   Impressao da previa
   ========================================================================== */

@media print {
    .topbar,
    .sidebar,
    .backdrop,
    .page-head__actions,
    .alerts,
    .card__head,
    .card__foot,
    .no-print { display: none !important; }

    body { background: var(--white); }

    .content { margin: 0; padding: 0; }

    .card {
        border: none;
        box-shadow: none;
        margin: 0;
    }

    .card__body { padding: 0; }

    .sheet-scroll { background: none; padding: 0; overflow: visible; }

    .sheet {
        width: 100%;
        box-shadow: none;
        padding: 0;
    }

    @page { size: A4 portrait; margin: 12mm; }
}

/* Larguras das colunas dos blocos de aula (modelo do professor),
   proporcionais as do PDF de referencia. */
.sheet__block-field--date { flex: 0 0 15%; }
.sheet__block-field--time { flex: 0 0 11%; }
.sheet__block-field--line { flex: 0 0 21%; }
.sheet__block-field--wide { flex: 0 0 30%; }

/* Pre-visualizacao da logo na tela de empresa. */
.sheet__logo-preview {
    max-width: 320px;
    max-height: 80px;
    height: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    background: var(--white);
}

/* ==========================================================================
   Seletor de dias da semana (turmas de professor)
   ========================================================================== */

.weekday-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.weekday-picker__item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .7rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-size: .82rem;
    cursor: pointer;
    user-select: none;
}

.weekday-picker__item:hover { border-color: var(--navy-600); }

.weekday-picker__item input { width: auto; margin: 0; }

.weekday-picker__item:has(input:checked) {
    background: var(--green-100);
    border-color: var(--green-600);
    color: var(--green-700);
    font-weight: 600;
}

@media (max-width: 640px) {
    .weekday-picker__item { flex: 1 1 45%; }
}

/* Separador entre as folhas na previa de um professor com varias turmas. */
.sheet-divider {
    max-width: 720px;
    margin: 1.1rem auto .5rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--navy-700);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sheet-divider:first-child { margin-top: 0; }

.sheet + .sheet-divider { margin-top: 1.6rem; }

/* ==========================================================================
   Instalador (public/instalar.php)
   Roda fora do layout da aplicacao: sem menu lateral e sem barra superior.
   ========================================================================== */

.content.install {
    margin-left: 0;
    padding: 2rem 1.25rem 3rem;
    max-width: 880px;
    margin-inline: auto;
}

@media (max-width: 640px) {
    .content.install { padding: 1.5rem .9rem 2.5rem; }
}
