:root {
  --blue-900: #173a5e;
  --blue-800: #1f4e78;
  --blue-700: #1f6feb;
  --blue-100: #eaf2ff;
  --slate-950: #172033;
  --slate-700: #475569;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --surface: #ffffff;
  --page: #f4f7fa;
  --green: #15803d;
  --green-bg: #ecfdf5;
  --amber: #a16207;
  --amber-bg: #fffbeb;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --morning: #dcfce7;
  --afternoon: #dbeafe;
  --off: #fef3c7;
  --absence: #fee2e2;
  --shadow: 0 8px 24px rgba(23, 58, 94, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--slate-950);
  background: var(--page);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--slate-950);
}

button, input, select { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.3);
  outline-offset: 2px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.6rem, 3vw, 2.15rem); }
h2 { margin-bottom: 6px; font-size: 1.45rem; }
h3 { margin-bottom: 12px; font-size: 1.05rem; color: var(--blue-900); }
p { color: var(--slate-700); }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 48px);
  background: linear-gradient(135deg, var(--blue-900), var(--blue-800));
  color: white;
}

.app-header p { margin: 0; color: #dbeafe; }
.title-line { display: flex; align-items: center; gap: 10px; }
.version-pill,
.week-state,
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}
.version-pill { color: var(--blue-900); background: #bfdbfe; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.save-status { min-width: 105px; font-size: 0.82rem; color: #dbeafe; text-align: right; }

.button,
.icon-button {
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}
.button { padding: 9px 13px; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: 0.5; }
.button.primary { color: white; background: var(--blue-700); }
.button.primary:hover:not(:disabled) { background: #1559c1; }
.button.secondary { color: var(--blue-900); background: var(--blue-100); border: 1px solid #bfdbfe; }
.button.warning { color: #78350f; background: #fde68a; }
.button.danger { color: white; background: #dc2626; }
.app-header .button.secondary { color: white; background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--blue-900);
  background: var(--blue-100);
  border: 1px solid #bfdbfe;
  font-size: 1.4rem;
}

.week-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--slate-200);
  backdrop-filter: blur(8px);
}
.week-bar label { min-width: 190px; }
.week-state { align-self: center; color: var(--green); background: var(--green-bg); border: 1px solid #86efac; }
.week-state.locked { color: #78350f; background: #fef3c7; border-color: #fcd34d; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 clamp(16px, 4vw, 48px);
  overflow-x: auto;
  background: white;
  border-bottom: 1px solid var(--slate-200);
}
.tab-button {
  flex: 0 0 auto;
  padding: 13px 15px 11px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--slate-700);
  font-weight: 750;
  cursor: pointer;
}
.tab-button.active { color: var(--blue-700); border-bottom-color: var(--blue-700); }

main { width: min(1500px, 100%); margin: 0 auto; padding: 24px clamp(14px, 3vw, 38px) 48px; }
.tab-panel[hidden] { display: none; }
.section-heading,
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.section-heading { margin-bottom: 18px; }
.section-heading p, .card-heading p { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card {
  padding: 18px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--slate-200);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.two-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.align-start { align-items: start; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metric-card {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--slate-200);
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow);
}
.metric-card span { display: block; color: var(--slate-500); font-size: 0.8rem; font-weight: 700; }
.metric-card strong { display: block; margin-top: 7px; font-size: 1.7rem; }
.metric-card small { color: var(--slate-500); }
.metric-card.ok { background: var(--green-bg); border-color: #86efac; color: #166534; }
.metric-card.warning { background: var(--amber-bg); border-color: #fde68a; color: #92400e; }
.metric-card.error { background: var(--red-bg); border-color: #fecaca; color: #991b1b; }
.metric-card.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.count-pill { min-width: 27px; justify-content: center; color: white; background: var(--red); }
.count-pill.zero { background: var(--green); }
.backup-reminder { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; padding:14px 16px; border:1px solid #fbbf24; border-radius:12px; color:#78350f; background:#fffbeb; box-shadow:var(--shadow); }
.backup-reminder strong, .backup-reminder span { display:block; }
.backup-reminder span { margin-top:3px; font-size:.84rem; }
.readiness-card { border-top:4px solid #8b5cf6; }
.readiness-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:9px; }
.readiness-item { display:flex; align-items:center; gap:9px; padding:10px; border:1px solid var(--slate-200); border-radius:9px; background:#f8fafc; }
.readiness-item.ok { color:#166534; background:#f0fdf4; border-color:#bbf7d0; }
.readiness-item.error { color:#991b1b; background:#fef2f2; border-color:#fecaca; }
.readiness-icon { display:grid; place-items:center; flex:0 0 26px; width:26px; height:26px; border-radius:50%; color:white; font-weight:900; }
.readiness-item.ok .readiness-icon { background:#16a34a; }
.readiness-item.error .readiness-icon { background:#dc2626; }
.readiness-item strong, .readiness-item small { display:block; }
.readiness-item small { margin-top:2px; color:inherit; opacity:.82; }
.readiness-result { margin:12px 0 0; }
.overtime-savings-card { border-top:4px solid #16a34a; }
.overtime-savings-card .card-heading { align-items:center; }
.overtime-savings-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.overtime-savings-actions .button { min-height:42px; }
.overtime-savings-status { display:flex; align-items:flex-start; gap:10px; padding:11px 13px; border:1px solid #bbf7d0; border-radius:10px; color:#166534; background:#f0fdf4; }
.overtime-savings-status.neutral { color:var(--slate-600); border-color:var(--slate-200); background:#f8fafc; }
.overtime-savings-status strong, .overtime-savings-status small { display:block; }
.overtime-savings-status small { margin-top:3px; line-height:1.35; }
.overtime-savings-icon { display:grid; place-items:center; flex:0 0 30px; height:30px; border-radius:999px; color:#fff; background:#16a34a; font-weight:900; }
.overtime-savings-status.neutral .overtime-savings-icon { background:var(--slate-400); }
.overtime-savings-badge { color:#166534; background:#dcfce7; }

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--slate-700);
  font-size: 0.84rem;
  font-weight: 750;
}
input, select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--slate-950);
  background: white;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
}
input:disabled, select:disabled { background: var(--slate-100); color: var(--slate-500); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 13px; }
.form-grid.compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.general-rules-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; gap: 12px; }
.general-rules-grid > label:nth-child(1) { grid-column: span 3; }
.general-rules-grid > label:nth-child(2) { grid-column: span 2; }
.general-rules-grid > label:nth-child(3) { grid-column: span 2; }
.general-rules-grid > label:nth-child(4) { grid-column: span 2; }
.general-rules-grid > label:nth-child(5) { grid-column: span 3; }
.general-rules-grid > .coverage-tolerance-field { grid-column: span 3; }
.general-rules-grid > .short-break-options { grid-column: span 5; }
.general-rules-grid > .short-break-options + label { grid-column: span 3; }
.general-rules-grid > .general-overtime-duration { grid-column: span 2; }
.general-rules-grid > .general-overtime-duration + label { grid-column: span 2; }
.short-break-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.short-break-options .short-break-option { min-height: 100%; padding: 10px 12px; }
.short-break-options .short-break-option small { margin-top: 3px; line-height: 1.3; }
.input-suffix { display: flex; align-items: center; }
.input-suffix input { border-radius: 8px 0 0 8px; }
.input-suffix span { align-self: stretch; display: grid; place-items: center; padding: 0 10px; background: var(--slate-100); border: 1px solid var(--slate-300); border-left: 0; border-radius: 0 8px 8px 0; }
.coverage-tolerance-field .input-suffix { width: 100%; min-width: 0; }
.coverage-tolerance-field .input-suffix input { flex: 1 1 90px; min-width: 90px; }
.coverage-tolerance-field .input-suffix span { flex: 0 0 auto; white-space: nowrap; }

.shift-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 10px; margin: 0; padding: 15px; border: 1px solid var(--slate-200); border-radius: 12px; }
legend { padding: 0 7px; color: var(--blue-900); font-weight: 800; }
.duration-label { grid-column: 1 / -1; color: var(--slate-700); font-size: 0.85rem; }
.help-text { margin: -4px 0 13px; color: var(--slate-500); font-size: 0.85rem; }
.info-box, .success-box, .warning-box, .error-box {
  padding: 11px 12px;
  margin-bottom: 13px;
  border-radius: 9px;
  border: 1px solid;
  font-size: 0.88rem;
}
.info-box { color: #1e40af; background: #eff6ff; border-color: #bfdbfe; }
.success-box { color: #166534; background: var(--green-bg); border-color: #86efac; }
.warning-box { color: #92400e; background: var(--amber-bg); border-color: #fde68a; }
.error-box { color: #991b1b; background: var(--red-bg); border-color: #fecaca; }
.staffing-capacity-notice { margin-top: 12px; }
.staffing-capacity-box { margin-bottom: 0; line-height: 1.45; }
.staffing-capacity-box details { margin-top: 7px; }
.staffing-capacity-box summary { cursor: pointer; font-weight: 800; }
.general-overtime-duration { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(110px, 1fr); gap: 8px; }
.employee-extended-lunch-rule { margin-top: 14px; }
.overtime-limit-blocked,
.lunch-window-hint { width: 100%; padding: 9px 10px; border-radius: 8px; font-size: .8rem; line-height: 1.4; }
.overtime-limit-blocked { color: #991b1b; border: 1px solid #fecaca; background: #fff1f2; }
.lunch-window-hint { margin-top: 9px; color: #1e40af; border: 1px solid #bfdbfe; background: #eff6ff; }
.extended-lunch-alternative { padding: 9px; border: 1px solid #a7f3d0; border-radius: 9px; background: #ecfdf5; }
.combined-overtime-alternative { padding: 9px; border: 1px solid #bfdbfe; border-radius: 9px; background: #eff6ff; }
.alert-list { display: grid; gap: 8px; }
.alert-item { display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; background: var(--red-bg); color: #991b1b; }
.alert-item.warning { color: #92400e; background: var(--amber-bg); }
.alert-item::before { content: "!"; display: grid; flex: 0 0 21px; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: white; background: currentColor; font-weight: 900; }

.employee-list { display: grid; gap: 10px; }
.employee-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px 10px;
  align-items: end;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: 11px;
}
.employee-registration { grid-column: span 1; }
.employee-name { grid-column: span 2; }
.employee-allowed-shift { grid-column: span 2; }
.employee-role { grid-column: span 2; }
.employee-type { grid-column: span 3; }
.employee-daily-rate { grid-column: span 2; }
.employee-preferred-shift,
.employee-preferred-off,
.employee-sunday-preference,
.employee-weekend-preference,
.employee-prior-off,
.employee-previous-end { grid-column: span 2; }
.employee-active { grid-column: span 1; }
.employee-row.inactive { opacity: 0.68; }
.toggle-label { align-items: center; justify-content: center; }
.toggle-label input { width: 21px; min-height: 21px; }
.employee-actions { grid-column: span 3; display: flex; flex-wrap: wrap; gap: 7px; }
.employee-actions .button { white-space: nowrap; }
.preference-note { grid-column: 1 / -1; margin: -2px 0 0; color: var(--slate-500); font-size: .76rem; }

.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; font-size: 0.84rem; }
.coverage-summary-wrap { width: 100%; overflow: hidden; }
.coverage-summary-table { min-width: 0; table-layout: fixed; }
.coverage-summary-table th:first-child { width: 52%; }
.coverage-summary-table th:not(:first-child) { width: 24%; }
.coverage-summary-table th,
.coverage-summary-table td { padding: 7px 6px; overflow-wrap: anywhere; }
th, td { padding: 8px; border-right: 1px solid var(--slate-200); border-bottom: 1px solid var(--slate-200); text-align: center; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 2; color: white; background: var(--blue-800); font-weight: 800; }
th:first-child, td:first-child { border-left: 1px solid var(--slate-200); }
tr:first-child th { border-top: 1px solid var(--blue-800); }
th:first-child { border-radius: 9px 0 0 0; }
th:last-child { border-radius: 0 9px 0 0; }
tbody tr:hover td { background-image: linear-gradient(rgba(31,111,235,.035), rgba(31,111,235,.035)); }
td:first-child, th:first-child { text-align: left; }
.sticky-col { position: sticky; left: 0; z-index: 1; background: white; box-shadow: 3px 0 5px rgba(15,23,42,.06); }
th.sticky-col { z-index: 3; background: var(--blue-800); }
.day-date { display: block; margin-top: 2px; color: #dbeafe; font-size: 0.7rem; font-weight: 500; }
.special-day-badge { display:block; margin-top:4px; padding:2px 5px; border-radius:999px; color:#581c87; background:#f3e8ff; font-size:.58rem; font-weight:900; white-space:nowrap; }
.special-table-note { color:#7e22ce; font-weight:800; }
.minimum-input, .extra-input { width: 64px; min-height: 34px; padding: 5px; text-align: center; }
.minimum-input.has-override { border-color: #8b5cf6; box-shadow: 0 0 0 2px rgba(139,92,246,.14); }
.compact-button { padding: 6px 9px; font-size: .75rem; white-space: nowrap; }
.minimum-day-actions { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.coverage-window-button.has-windows { border-color:#059669; background:#ecfdf5; color:#065f46; }
.coverage-window-summary { display:block; margin-top:4px; color:#047857; font-size:.72rem; line-height:1.25; }
.coverage-rules-card { border-top: 4px solid #2563eb; }
.compact-rules-table { max-width: 920px; }
.compact-rules-table table { min-width: 520px; }
.role-minimum-toggle { max-width: 390px; margin-top: 16px; }
.role-defaults-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--slate-200); }
.role-defaults-section h4 { margin: 0 0 6px; color: var(--blue-900); }
.advanced-rules-details { margin-top: 14px; padding: 11px 12px; border: 1px solid var(--slate-200); border-radius: 10px; background: #f8fafc; }
.advanced-rules-details summary { color: var(--blue-900); font-weight: 850; cursor: pointer; }
.advanced-rules-details .help-text { margin: 9px 0; }
.overtime-card { border-top: 4px solid #f59e0b; }
.overtime-card table { min-width: 1120px; table-layout: fixed; font-size: .76rem; }
.overtime-card th:first-child { width: 112px; }
.overtime-card th:last-child { width: 64px; }
.overtime-card th, .overtime-card td { padding: 5px; }
.extra-plan-cell { min-width: 0; vertical-align: top; }
.extra-inline-label { align-items: center; flex-direction: row; justify-content: space-between; gap: 7px; }
.extra-inline-label .input-suffix { width: 78px; }
.extra-inline-label .input-suffix input { width: 48px; }
.extra-inline-label .input-suffix span { padding: 0 7px; }
.extra-placement { min-height: 31px; margin-top: 4px; padding: 4px 5px; font-size: .7rem; }
.extra-custom-times { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; margin-top: 6px; }
.extra-custom-times input { min-width: 0; min-height: 31px; padding: 3px; font-size: .68rem; }
.extra-custom-times span { color: var(--slate-500); font-size: .7rem; }
.extra-range, .extra-unavailable { display: block; margin-top: 4px; color: var(--slate-500); font-size: .62rem; line-height: 1.25; }
.extra-range { color: #92400e; font-weight: 750; }
.extra-range.invalid { color: var(--red); }
.employee-rule-row-badge { display: block; margin-top: 4px; color: #92400e; font-size: .62rem; }
.employee-rule-cell { background: #fffbeb; }
.employee-rule-cell strong { display: block; margin-top: 5px; color: #92400e; font-size: .72rem; }
.employee-rule-badge { display: inline-block; padding: 2px 5px; border-radius: 999px; color: #78350f; background: #fde68a; font-size: .58rem; font-weight: 850; }
.employee-rule-cell.rule-removed { background: #fff1f2; box-shadow: inset 0 0 0 1px #fecaca; }
.rule-exception-badge { color: #991b1b; background: #fecaca; }
.employee-rule-cell .rule-exception-employee { color: #b91c1c; font-weight: 900; line-height: 1.15; }
.rule-exception-original { display: block; margin-top: 3px; color: #7f1d1d; font-size: .6rem; font-weight: 700; line-height: 1.2; }
.employee-rule-cell.rule-removed .rule-extra-day-select { color: #991b1b; border-color: #fca5a5; background: #fff; }
.employee-rule-cell.rule-removed .extra-range { color: #b91c1c; font-weight: 850; }
.employee-rule-cell.rule-overridden { background: #f5f3ff; box-shadow: inset 0 0 0 1px #c4b5fd; }
.rule-override-badge { color: #5b21b6; background: #ddd6fe; }
.rule-extra-day-select { min-height: 31px; margin-top: 5px; padding: 4px; font-size: .64rem; }
.weekly-extra-duration { display: grid; grid-template-columns: auto 34px auto minmax(54px, 1fr); align-items: center; gap: 3px; }
.weekly-extra-duration strong, .weekly-extra-duration span { color: var(--slate-700); font-size: .66rem; }
.weekly-extra-duration input { width: 34px; min-height: 31px; padding: 3px; }
.weekly-extra-duration select { min-width: 0; min-height: 31px; padding: 3px; font-size: .66rem; }

.schedule-cell { min-width: 98px; cursor: pointer; position: relative; }
.schedule-cell:hover { outline: 2px solid var(--blue-700); outline-offset: -2px; }
.schedule-cell.shift-M { background-color: var(--morning); }
.schedule-cell.shift-T { background-color: var(--afternoon); }
.schedule-cell.shift-F, .schedule-cell.shift-FC { background-color: var(--off); }
.schedule-cell.shift-FE, .schedule-cell.shift-AT { background-color: var(--absence); }
.schedule-cell.manual { box-shadow: inset 0 0 0 2px #f59e0b; }
.schedule-cell.has-occurrence { box-shadow: inset 0 0 0 3px #dc2626; }
.schedule-cell.has-coverage { box-shadow: inset 0 0 0 3px #7c3aed; }
.schedule-cell.overtime-removed { box-shadow: inset 0 0 0 3px #dc2626; }
.schedule-cell.cell-divergence { outline: 3px solid #dc2626; outline-offset: -3px; }
.schedule-cell.cell-divergence:hover { outline-color: #991b1b; }
.cell-badge.divergence-badge { color:#fff; background:#dc2626; }
.suggestion-focus-box { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; padding:12px; border:2px solid #dc2626; border-radius:10px; background:#fff1f2; }
.suggestion-focus-box div { display:grid; gap:2px; }
.suggestion-focus-box strong { color:#991b1b; }
.suggestion-focus-box small { color:#7f1d1d; font-weight:750; }
.unresolved-day-header { background: #991b1b; }
.day-status-badge { display:block; margin-top:3px; padding:2px 4px; border-radius:5px; font-size:.55rem; font-weight:900; white-space:nowrap; }
.day-status-badge.unresolved { color:#991b1b; background:#fee2e2; }
.day-status-badge.resolved { color:#166534; background:#dcfce7; }
.schedule-issues-box { margin: 10px 0; }
.shift-code { display: block; font-size: 1rem; font-weight: 900; }
.shift-time { display: block; margin-top: 2px; color: var(--slate-700); font-size: 0.7rem; white-space: nowrap; }
.cell-badge { display: inline-block; margin-top: 4px; padding: 1px 5px; border-radius: 99px; color: #78350f; background: #fde68a; font-size: 0.62rem; font-weight: 900; text-transform: uppercase; }
.cell-badge.occurrence { color: #991b1b; background: #fecaca; }
.cell-badge.coverage { color: #5b21b6; background: #ddd6fe; }
.cell-badge.wildcard-adjustment { color: #075985; background: #bae6fd; }
.cell-badge.rest-transition-badge { color:#5b21b6; background:#ede9fe; }
.wildcard-available-names { color:#075985; font-weight:800; }
.wildcard-available-names small { display:block; margin-top:2px; color:#0369a1; font-size:.58rem; font-weight:700; }
.cell-badge.relief-badge { color: #7c2d12; background: #fed7aa; }
.cell-badge.overtime-removed-badge { color: #991b1b; background: #fecaca; }
.lunch-time { color: #7c2d12; font-weight: 800; }
.status-ok { color: var(--green); font-weight: 850; }
.status-warning { color: var(--amber); font-weight: 850; }
.status-error { color: var(--red); font-weight: 850; }

/* A escala final usa uma grade fixa no computador para caber inteira na tela. */
#scheduleContainer { overflow-x: clip; scrollbar-width: none; }
#scheduleContainer table { width: 100%; max-width: 100%; min-width: 0; table-layout: fixed; font-size: .71rem; }
#scheduleContainer th,
#scheduleContainer td { padding: 6px 4px; overflow-wrap: anywhere; }
#scheduleContainer th:nth-child(1) { width: 92px; }
#scheduleContainer th:nth-child(2) { width: 68px; }
#scheduleContainer th:nth-last-child(5) { width: 38px; }
#scheduleContainer th:nth-last-child(4) { width: 42px; }
#scheduleContainer th:nth-last-child(3),
#scheduleContainer th:nth-last-child(2) { width: 51px; }
#scheduleContainer th:last-child { width: 62px; }
#scheduleContainer .sticky-col { position: static; box-shadow: none; }
#scheduleContainer .schedule-cell { min-width: 0; }
#scheduleContainer .shift-time { white-space: normal; font-size: .63rem; line-height: 1.2; }
#scheduleContainer .cell-badge { max-width: 100%; white-space: normal; line-height: 1.15; }
#scheduleContainer td:nth-last-child(-n+5) { padding-left: 2px; padding-right: 2px; font-size: .69rem; }

/* A prévia mantém todas as colunas de dias com a mesma largura, mesmo com avisos longos. */
#schedulePreview { overflow-x:clip; scrollbar-width:none; }
#schedulePreview table { width:100%; max-width:100%; min-width:0; table-layout:fixed; font-size:.69rem; }
#schedulePreview th,
#schedulePreview td { padding:6px 4px; min-width:0; overflow-wrap:anywhere; word-break:break-word; }
#schedulePreview th:nth-child(1) { width:92px; }
#schedulePreview th:nth-child(2) { width:68px; }
#schedulePreview .sticky-col { position:static; box-shadow:none; }
#schedulePreview .schedule-cell { min-width:0; }
#schedulePreview .shift-time { white-space:normal; font-size:.62rem; line-height:1.2; }
#schedulePreview .cell-badge,
#schedulePreview .day-status-badge { max-width:100%; white-space:normal; line-height:1.15; overflow-wrap:anywhere; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 0 0 14px; color: var(--slate-700); font-size: 0.82rem; font-weight: 700; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-color, .legend-border { display: inline-block; width: 19px; height: 19px; border-radius: 5px; border: 1px solid var(--slate-300); }
.legend-color.morning { background: var(--morning); }
.legend-color.afternoon { background: var(--afternoon); }
.legend-color.off { background: var(--off); }
.legend-color.absence { background: var(--absence); }
.legend-border { background: white; border: 2px solid #f59e0b; }

.coverage-ok { color: var(--green); background: var(--green-bg); }
.coverage-error { color: var(--red); background: var(--red-bg); }
.point-ok { background: var(--green-bg); }
.point-extra { background: var(--amber-bg); }
.point-error { background: var(--red-bg); }
.point-empty { color: var(--slate-500); background: #f8fafc; }
.point-occurrence { color: #991b1b; background: var(--absence); }
.point-justified { color: #5b21b6; background: #f3e8ff; }
.point-times { white-space: nowrap; }
.point-status { display: block; margin-top: 3px; font-size: 0.7rem; font-weight: 850; }
.comparison-legend { color: var(--slate-500); font-size: 0.78rem; }
.import-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 12px; }
.import-stat { padding: 8px; border-radius: 8px; background: var(--slate-100); text-align: center; }
.import-stat strong { display: block; font-size: 1.25rem; }
.occurrence-pill { display:inline-flex; padding:5px 9px; border-radius:999px; color:#7f1d1d; background:#fee2e2; font-size:.74rem; font-weight:800; }
.occurrence-table { margin-top:14px; }
.wide-field { grid-column:span 2; }
.month-field { min-width:160px; }
.monthly-cards { margin-top:14px; }
.occurrence-AT, .occurrence-FE, .occurrence-AJ { color:#7f1d1d; background:#fee2e2; font-weight:800; }
.occurrence-FALTA { color:#991b1b; background:#fecaca; font-weight:800; }
.coverage-label { color:#5b21b6; font-weight:800; }
.period-generator-card { border-top: 4px solid #7c3aed; }
.closed-weeks-card { border-top: 4px solid #2563eb; }
.closed-weeks-actions { align-items: end; }
.week-rules-snapshot-notice { margin: 0 auto 12px; width: min(1440px, calc(100% - 32px)); padding: 12px 16px; border: 1px solid #93c5fd; border-radius: 12px; background: #eff6ff; color: #1e3a8a; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.week-rules-snapshot-notice div { display: grid; gap: 3px; }
.week-rules-snapshot-notice span { font-size: 13px; }
.simple-week-sheet table { width: 100%; table-layout: fixed; }
.simple-week-sheet th:first-child, .simple-week-sheet td:first-child { width: 13%; }
.simple-week-sheet th:nth-child(2), .simple-week-sheet td:nth-child(2) { width: 10%; }
.simple-week-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.simple-week-heading h2, .simple-week-heading p { margin: 0; }
.period-actions { align-items: end; }
.period-actions label { min-width: 175px; }
.period-info { margin: 14px 0 0; }
.period-modal-card { width: min(1250px, 98vw); }
.period-preview-table { max-height: 48vh; }
.period-preview-table table { min-width: 1050px; }
.locked-week-cell { color: #78350f; background: #fef3c7; font-weight: 800; }
.preference-ok { color: var(--green); font-weight: 800; }
.preference-warning { color: var(--amber); font-weight: 800; }
.period-summary-box { margin-top: 12px; }
.hidden-section { display: none !important; }
.period-weeks-view { display: grid; gap: 16px; }
.period-week-card { padding: 13px; border: 1px solid var(--slate-200); border-radius: 11px; background: #f8fafc; break-inside: avoid; }
.period-week-card h4 { margin: 0 0 9px; color: var(--blue-900); }
.period-week-card table { min-width: 820px; background: white; }
.period-day-cell { min-width: 88px; }
.period-day-cell strong { display: block; }
.period-day-cell small { display: block; margin-top: 2px; color: var(--slate-500); }
.period-actions-inline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.individual-controls { min-width: min(520px, 100%); grid-template-columns: 1fr 1fr; }
.individual-actions { margin: 14px 0; }
.individual-preview { padding: 16px; border: 1px solid var(--slate-200); border-radius: 11px; background: white; }
.individual-header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.individual-header p { margin: 3px 0 0; }
.individual-day-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 9px; }
.individual-day { padding: 11px; border: 1px solid var(--slate-200); border-radius: 9px; background: #f8fafc; }
.individual-day.morning { border-left: 5px solid #22c55e; background: var(--morning); }
.individual-day.afternoon { border-left: 5px solid #3b82f6; background: var(--afternoon); }
.individual-day.off { border-left: 5px solid #eab308; background: var(--off); }
.individual-day.absence { border-left: 5px solid #ef4444; background: var(--absence); }
.individual-day strong, .individual-day span, .individual-day small { display: block; }
.individual-day span { margin-top: 5px; font-weight: 850; }
.individual-day small { margin-top: 3px; color: var(--slate-600, var(--slate-700)); }
.suggestion-list { display: grid; gap: 9px; }
.suggestion-item { padding: 11px; border: 1px solid #bfdbfe; border-radius: 9px; background: #eff6ff; }
.suggestion-item.overtime-suggestion { border-color:#fcd34d; background:#fffbeb; }
.suggestion-item.wildcard-suggestion { border-color:#7dd3fc; background:#f0f9ff; }
.suggestion-item.lunch-suggestion { border-color:#fdba74; background:#fff7ed; }
.suggestion-item p { margin: 0 0 8px; }
.suggestion-people { display: flex; flex-wrap: wrap; gap: 7px; }
.suggestion-primary-choices { margin-top: 10px; }
.suggestion-alternatives { margin-top: 11px; padding-top: 9px; border-top: 1px solid #bae6fd; }
.suggestion-alternatives > small { display:block; margin-bottom:7px; font-weight:800; }
.suggestion-relief { margin-top: 11px; padding-top: 9px; border-top: 1px dashed #fb923c; }
.suggestion-relief > small { display:block; margin-bottom:7px; color:#9a3412; font-weight:800; }
.button.relief-button { background:#fff7ed; border-color:#fb923c; color:#9a3412; }
.button.relief-button:hover { background:#ffedd5; }
.suggestion-button { padding: 6px 9px; font-size: .8rem; }
.suggestion-undo-box { display:grid; grid-template-columns:minmax(150px,.75fr) minmax(230px,1.35fr) auto; align-items:end; gap:10px; margin-bottom:10px; padding:11px 12px; border:1px solid #93c5fd; border-radius:9px; color:#1e3a8a; background:#eff6ff; }
.suggestion-undo-box strong,
.suggestion-undo-box small { display:block; }
.suggestion-undo-box small { margin-top:3px; color:#475569; }
.suggestion-undo-box .button { flex:0 0 auto; white-space:nowrap; }
.suggestion-undo-select { min-width:0; color:#1e3a8a; }
.suggestion-undo-select select { min-width:0; text-overflow:ellipsis; }
.history-list { display: grid; gap: 7px; }
.history-item { padding: 9px 10px; border: 1px solid var(--slate-200); border-radius: 8px; background: #f8fafc; }
.history-item strong, .history-item small { display: block; }
.history-item small { margin-top: 2px; color: var(--slate-500); }
.history-modal-card { width: min(1050px, 98vw); }
.history-table td:nth-child(3), .history-table td:nth-child(4) { text-align: left; }
.sunday-rules-card { border-top: 4px solid #f59e0b; }
.operating-hours-card { border-top: 4px solid #2563eb; }
.operating-hours-card h4 { margin:16px 0 8px; color:var(--blue-900); }
.lunch-rules-card { border-top: 4px solid #0ea5e9; }
.special-days-card { border-top:4px solid #8b5cf6; }
.empty-special-days { padding:13px; border:1px dashed var(--slate-300); border-radius:9px; color:var(--slate-500); text-align:center; }
.special-day-list { display:grid; gap:9px; }
.special-day-item { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px; border:1px solid #ddd6fe; border-radius:10px; background:#faf5ff; }
.special-day-item.closed { border-color:#fecaca; background:#fef2f2; }
.special-day-item strong, .special-day-item span, .special-day-item small { display:block; }
.special-day-item span { margin-top:3px; color:#6b21a8; font-weight:800; }
.special-day-item small { margin-top:5px; color:var(--slate-600,var(--slate-700)); line-height:1.35; }
.lunch-options { margin-top: 14px; }
.modal-card.employee-time-modal-card { width: min(1050px, 98vw); }
.employee-time-grid fieldset { grid-template-columns: repeat(3, minmax(135px, 1fr)); }
.employee-boundary-preferences { grid-template-columns: repeat(2, minmax(220px, 1fr)); margin-top: 14px; background: #f8fafc; }
.employee-boundary-preferences .info-box { grid-column: 1 / -1; margin-bottom: 0; }
.employee-overtime-rule { display: block; margin: 14px 0; background: #fffbeb; border-color: #fcd34d; }
.employee-overtime-rule .form-grid { margin-bottom: 10px; }
.employee-overtime-preference-help { margin: 10px 0; }
.employee-overtime-notice { margin: 0; }
.employee-overtime-duration { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.employee-wildcard-rule { display: block; margin: 14px 0; background: #eff6ff; border-color: #93c5fd; }
.employee-wildcard-rule.hidden-section { display: none; }
.employee-wildcard-rule .checkbox-card { background: rgba(255,255,255,.72); }
.employee-wildcard-toggle { margin-top: 4px; }
.employee-wildcard-times { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
.employee-wildcard-ignore { margin-bottom: 2px; }
.checkbox-card { flex-direction: row; align-items: flex-start; gap: 10px; margin: 16px 0 12px; padding: 12px; border: 1px solid var(--slate-200); border-radius: 10px; background: #f8fafc; }
.checkbox-card input { flex: 0 0 auto; width: 21px; min-height: 21px; }
.checkbox-card span, .checkbox-card small { display: block; }
.checkbox-card small { margin-top: 3px; color: var(--slate-500); font-weight: 500; }
.modal-card.special-day-modal-card { width:min(1220px,98vw); }
.modal-card.coverage-windows-modal-card { width:min(820px,96vw); }
.coverage-windows-explanation { margin-bottom:12px; }
.special-day-basic { margin:14px 0 18px; }
.special-type-cards { display:grid; grid-template-columns:repeat(5,minmax(130px,1fr)); gap:8px; margin-bottom:16px; }
.special-type-cards button { min-height:82px; padding:11px; border:2px solid var(--slate-200); border-radius:11px; color:var(--slate-700); background:white; cursor:pointer; text-align:left; }
.special-type-cards button:hover { border-color:#a78bfa; }
.special-type-cards button.active { color:#5b21b6; border-color:#8b5cf6; background:#f5f3ff; box-shadow:inset 0 0 0 1px #8b5cf6; }
.special-type-cards strong, .special-type-cards small { display:block; }
.special-type-cards small { margin-top:5px; color:inherit; font-weight:500; line-height:1.25; }
.special-shift-grid fieldset { display:block; }
.special-open-toggle { flex-direction:row; align-items:center; justify-content:space-between; margin-bottom:12px; padding:10px; border-radius:8px; background:#eff6ff; }
.special-open-toggle input { width:22px; min-height:22px; }
.special-shift-fields { display:grid; grid-template-columns:repeat(4,minmax(120px,1fr)); gap:10px; }
.special-shift-fields[hidden], .special-lunch-fields[hidden] { display:none; }
.special-lunch-fields { grid-column:1/-1; display:grid; grid-template-columns:repeat(4,minmax(120px,1fr)); gap:10px; padding:11px; border:1px solid #bae6fd; border-radius:9px; background:#f0f9ff; }
.special-role-details { grid-column:1/-1; padding:10px; border:1px solid var(--slate-200); border-radius:9px; background:#f8fafc; }
.special-role-details summary { color:var(--blue-900); font-weight:800; cursor:pointer; }
.special-role-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:9px; margin-top:10px; }
.special-coverage-windows-settings { display:block; margin-top:14px; border-color:#a7f3d0; background:#f0fdf4; }
.special-coverage-windows { display:grid; gap:9px; margin:10px 0; }
.special-coverage-window-row { display:grid; grid-template-columns:minmax(130px,1fr) minmax(130px,1fr) minmax(150px,1fr) auto; gap:9px; align-items:end; padding:10px; border:1px solid #bbf7d0; border-radius:9px; background:#fff; }
.special-coverage-window-row .button { margin-bottom:1px; }
.special-coverage-empty { padding:10px; color:var(--slate-500); border:1px dashed #86efac; border-radius:8px; background:#fff; }
.special-settings-disabled { opacity:.45; }
.special-day-summary { margin-top:14px; }
.week-close-modal-card { width:min(900px,98vw); }
.print-schedule-modal-card { width:min(680px,96vw); }
.print-choice-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:16px; }
.print-choice { min-height:120px; padding:16px; border:2px solid var(--slate-200); border-radius:12px; color:var(--slate-700); background:#fff; cursor:pointer; text-align:left; }
.print-choice:hover, .print-choice:focus-visible { color:var(--blue-900); border-color:var(--blue-700); background:var(--blue-100); outline:none; }
.print-choice strong, .print-choice small { display:block; }
.print-choice strong { font-size:1rem; }
.print-choice small { margin-top:7px; line-height:1.4; }
.coverage-report-card { border-top: 4px solid #14b8a6; }
.coverage-report-actions { margin-top: 14px; }
.coverage-controls { margin: 14px 0; }
.coverage-metrics { margin-top: 12px; }
.coverage-report-card h4 { margin: 17px 0 9px; color: var(--blue-900); }
.combined-coverage-block + .combined-coverage-block { margin-top: 22px; padding-top: 18px; border-top: 2px solid var(--slate-200); }
.combined-coverage-block h5 { margin: 0 0 9px; padding: 7px 10px; border-radius: 8px; color: var(--blue-900); background: var(--blue-100); font-size: .92rem; }
.daily-coverage-table-wrap { overflow-x: hidden; }
.hourly-coverage-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: .72rem;
}
.hourly-coverage-table th,
.hourly-coverage-table td {
  padding: 6px 4px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.hourly-coverage-table th:nth-child(1) { width: 7%; }
.hourly-coverage-table th:nth-child(2) { width: 17%; }
.hourly-coverage-table th:nth-child(3) { width: 13%; }
.hourly-coverage-table th:nth-child(4) { width: 12%; }
.hourly-coverage-table th:nth-child(5) { width: 10%; }
.hourly-coverage-table th:nth-child(6) { width: 13%; }
.hourly-coverage-table th:nth-child(7) { width: 8%; }
.hourly-coverage-table th:nth-child(8) { width: 10%; }
.hourly-coverage-table th:nth-child(9) { width: 10%; }
.hourly-coverage-table small { display: block; margin-top: 3px; font-size: .64rem; }
.names-cell { min-width: 0; text-align: left; }
.lunch-names { color: #9a3412; font-weight: 750; }
.overtime-names, .overtime-text { color: #a16207; font-weight: 800; }
.coverage-row-ok td { background-color: #f0fdf4; }
.coverage-row-error td { background-color: #fef2f2; }
.coverage-row-accepted td { box-shadow: inset 0 2px 0 #ef4444, inset 0 -2px 0 #ef4444; }
.accepted-reduced-label { margin-top:5px !important; color:#991b1b; font-weight:900; }
.coverage-neutral { color: var(--slate-500); background: #f8fafc; }
.weekly-lunch-table { min-width: 1120px; }
.weekly-coverage-table { min-width: 1250px; }
.weekly-coverage-cell { min-width: 145px; vertical-align: top; }
.weekly-coverage-cell strong, .weekly-coverage-cell small { display: block; }
.weekly-coverage-cell strong { margin-bottom: 4px; font-size: 1rem; }
.coverage-shortages-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-top:18px; padding-top:14px; border-top:1px solid var(--slate-200); }
.coverage-shortages-heading h4 { margin:0 0 5px; }
.coverage-shortages-heading .help-text { margin:0; }
.coverage-shortage-list { display:grid; gap:8px; }
.coverage-shortage-day { display:grid; grid-template-columns:minmax(115px,.35fr) minmax(0,1.65fr); gap:10px; padding:10px 11px; border:1px solid #fecaca; border-radius:9px; background:#fff7f7; }
.coverage-shortage-day > strong { color:#991b1b; }
.coverage-shortage-day > div { display:flex; flex-wrap:wrap; gap:6px; }
.coverage-shortage-range { padding:5px 8px; border:1px solid #fca5a5; border-radius:7px; color:#991b1b; background:#fff; font-size:.78rem; }
.coverage-shortage-range.accepted { color:#92400e; border-color:#fcd34d; background:#fffbeb; }
.coverage-shortage-empty { margin-top:0; }
.weekly-coverage-cell small { margin-top: 3px; line-height: 1.25; text-align: left; }

.help-tab-button { color: var(--blue-800); }
.help-link-button {
  padding: 8px 11px;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
}
.help-link-button:hover, .help-link-button:focus-visible { background:#dbeafe; border-color:#60a5fa; }
.help-panel { --help-accent:#2563eb; }
.help-hero {
  display:grid;
  grid-template-columns:minmax(0,1.25fr) minmax(300px,.75fr);
  gap:24px;
  align-items:center;
  margin-bottom:18px;
  padding:clamp(20px,4vw,38px);
  border:1px solid #bfdbfe;
  border-radius:18px;
  color:#0f2d5c;
  background:linear-gradient(135deg,#eff6ff 0%,#f8fafc 58%,#ecfeff 100%);
  box-shadow:0 10px 30px rgba(37,99,235,.09);
}
.help-kicker { display:block; margin-bottom:6px; color:#2563eb; font-size:.76rem; font-weight:900; letter-spacing:.11em; text-transform:uppercase; }
.help-hero h2 { margin:0 0 8px; font-size:clamp(1.55rem,3vw,2.25rem); }
.help-hero p { max-width:760px; margin:0; color:#475569; line-height:1.55; }
.help-hero-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.help-chip {
  padding:9px 12px;
  border:1px solid #93c5fd;
  border-radius:999px;
  color:#1e40af;
  background:rgba(255,255,255,.9);
  font-weight:800;
  cursor:pointer;
}
.help-chip:hover, .help-chip:focus-visible { color:white; border-color:#2563eb; background:#2563eb; outline:none; }
.help-section-card { scroll-margin-top:86px; }
.help-section-title { display:flex; align-items:flex-start; gap:12px; margin-bottom:16px; }
.help-section-title h3 { margin:1px 0 4px; }
.help-section-number { display:grid; flex:0 0 34px; width:34px; height:34px; place-items:center; border-radius:10px; color:white; background:#2563eb; font-weight:900; }
.help-section-title .help-text { margin:0; }
.help-step-grid { display:grid; grid-template-columns:repeat(7,minmax(115px,1fr)); gap:8px; margin:0; padding:0; list-style:none; counter-reset:help-step; }
.help-step-grid li { position:relative; min-height:135px; padding:38px 12px 12px; border:1px solid #dbeafe; border-radius:11px; background:#f8fbff; counter-increment:help-step; }
.help-step-grid li::before { content:counter(help-step); position:absolute; top:10px; left:11px; display:grid; width:22px; height:22px; place-items:center; border-radius:7px; color:white; background:#3b82f6; font-size:.72rem; font-weight:900; }
.help-step-grid strong, .help-step-grid span { display:block; }
.help-step-grid strong { margin-bottom:6px; color:#0f2d5c; font-size:.84rem; }
.help-step-grid span { color:#64748b; font-size:.75rem; line-height:1.4; }
.help-note, .help-warning { margin-top:14px; padding:11px 12px; border-radius:9px; font-size:.84rem; line-height:1.5; }
.help-note { color:#1e40af; border:1px solid #bfdbfe; background:#eff6ff; }
.help-warning { color:#92400e; border:1px solid #fcd34d; background:#fffbeb; }
.help-area-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.help-area-card { display:flex; min-height:205px; flex-direction:column; align-items:flex-start; padding:14px; border:1px solid #e2e8f0; border-radius:12px; background:#fff; }
.help-area-icon { display:grid; width:28px; height:28px; place-items:center; border-radius:8px; color:#1d4ed8; background:#dbeafe; font-weight:900; }
.help-area-card h4 { margin:10px 0 6px; color:#0f2d5c; }
.help-area-card p { flex:1; margin:0 0 12px; color:#64748b; font-size:.79rem; line-height:1.45; }
.help-area-card button { width:100%; padding:8px; border:1px solid #bfdbfe; border-radius:8px; color:#1d4ed8; background:#eff6ff; font-weight:800; cursor:pointer; }
.help-area-card button:hover { background:#dbeafe; }
.help-priority-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.help-topic { overflow:hidden; border:1px solid #dbeafe; border-radius:11px; background:#fff; }
.help-topic summary { padding:13px 14px; color:#0f2d5c; background:#f8fbff; font-weight:900; cursor:pointer; }
.help-topic[open] summary { border-bottom:1px solid #dbeafe; color:#1d4ed8; background:#eff6ff; }
.priority-list { margin:0; padding:13px; list-style:none; counter-reset:priority; }
.priority-list li { position:relative; min-height:38px; padding:0 0 12px 36px; counter-increment:priority; }
.priority-list li:last-child { padding-bottom:0; }
.priority-list li::before { content:counter(priority); position:absolute; top:0; left:0; display:grid; width:24px; height:24px; place-items:center; border-radius:50%; color:white; background:#2563eb; font-size:.72rem; font-weight:900; }
.priority-list strong, .priority-list span { display:block; }
.priority-list strong { color:#1e293b; font-size:.84rem; }
.priority-list span { margin-top:2px; color:#64748b; font-size:.76rem; line-height:1.4; }
.help-topic .help-note, .help-topic .help-warning { margin:0 13px 13px; }
.help-rule-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.help-rule-cards > div { padding:13px; border-left:4px solid #60a5fa; border-radius:8px; background:#f8fafc; }
.help-rule-cards strong { color:#0f2d5c; }
.help-rule-cards p { margin:5px 0 0; color:#64748b; font-size:.79rem; line-height:1.45; }
.suggestion-flow { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; }
.suggestion-flow > div { position:relative; min-height:135px; padding:14px 11px 11px; border:1px solid #dbeafe; border-radius:11px; background:#f8fbff; text-align:center; }
.suggestion-flow span { display:grid; width:27px; height:27px; margin:0 auto 8px; place-items:center; border-radius:50%; color:white; background:#2563eb; font-weight:900; }
.suggestion-flow strong, .suggestion-flow small { display:block; }
.suggestion-flow strong { color:#0f2d5c; font-size:.83rem; }
.suggestion-flow small { margin-top:5px; color:#64748b; font-size:.73rem; line-height:1.4; }
.help-checklist { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin:0; padding:0; list-style:none; }
.help-checklist li { display:flex; gap:10px; padding:11px; border:1px solid #dcfce7; border-radius:10px; background:#f0fdf4; }
.help-checklist li > span { display:grid; flex:0 0 25px; width:25px; height:25px; place-items:center; border-radius:50%; color:white; background:#16a34a; font-weight:900; }
.help-checklist strong { color:#14532d; }
.help-checklist p { margin:3px 0 0; color:#4b5563; font-size:.77rem; line-height:1.4; }
.help-example-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.help-example-list details { border:1px solid #e2e8f0; border-radius:10px; background:#f8fafc; }
.help-example-list summary { padding:12px; color:#0f2d5c; font-weight:850; cursor:pointer; }
.help-example-list p { margin:0; padding:0 12px 12px; color:#64748b; font-size:.8rem; line-height:1.5; }
.help-legend-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }
.help-legend-grid > div { display:flex; align-items:center; gap:10px; min-width:0; padding:10px; border:1px solid #e2e8f0; border-radius:10px; background:#fff; }
.legend-sample { display:grid; flex:0 0 42px; width:42px; height:42px; place-items:center; border-radius:9px; color:#0f172a; font-weight:950; }
.legend-sample.shift-M { background:#dcfce7; }
.legend-sample.shift-T { background:#dbeafe; }
.legend-sample.shift-F { background:#fef3c7; }
.legend-extra { color:#92400e; background:#fef3c7; }
.legend-wildcard { color:#075985; background:#bae6fd; }
.legend-warning { color:#92400e; background:#fde68a; }
.legend-error { color:white; background:#dc2626; }
.legend-ok { color:white; background:#16a34a; }
.help-legend-grid p { min-width:0; margin:0; }
.help-legend-grid strong, .help-legend-grid small { display:block; }
.help-legend-grid strong { color:#1e293b; font-size:.8rem; }
.help-legend-grid small { margin-top:2px; color:#64748b; font-size:.72rem; line-height:1.3; }
.help-final-card { color:#334155; background:#f8fafc; }
.help-final-card h3 { margin-top:0; }
.help-final-card ul { margin-bottom:0; padding-left:20px; line-height:1.65; }
.help-highlight { animation:help-highlight 1.8s ease-out; }
@keyframes help-highlight { 0% { box-shadow:0 0 0 4px rgba(37,99,235,.35); } 100% { box-shadow:0 0 0 0 rgba(37,99,235,0); } }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15,23,42,.58);
}
.modal.hidden { display: none; }
.modal-card { width: min(760px, 100%); max-height: 92vh; overflow: auto; padding: 20px; border-radius: 15px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.modal-card.day-editor-modal-card { width: min(920px, 100%); }
.day-editor-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.day-editor-duration-option { grid-column: 1 / -1; min-height: 0; }
.day-editor-grid label small { color: var(--slate-500); font-weight: 500; line-height: 1.35; }
.day-editor-grid input[readonly] { background: #eff6ff; border-color: #93c5fd; color: #1e3a8a; font-weight: 800; }
.day-editor-hours-summary { margin: 13px 0 0; line-height: 1.45; }
.day-editor-hours-summary.warning { color: #92400e; background: var(--amber-bg); border-color: #fde68a; }
.day-editor-hours-summary.error { color: #991b1b; background: var(--red-bg); border-color: #fecaca; }
.modal-actions { justify-content: flex-end; margin-top: 18px; }

.toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; width: min(390px, calc(100vw - 36px)); }
.toast { padding: 11px 13px; border-radius: 9px; color: white; background: var(--slate-950); box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: toast-in 180ms ease-out; }
.toast.error { background: #991b1b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

footer { padding: 18px; color: var(--slate-700); background: white; border-top: 1px solid var(--slate-200); text-align: center; font-size: 0.82rem; }

@media (max-width: 1050px) {
  .app-header, .section-heading { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .save-status { text-align: left; }
  .two-columns, .shift-grid { grid-template-columns: 1fr; }
  fieldset { grid-template-columns: repeat(2, 1fr); }
  .employee-time-grid fieldset { grid-template-columns: repeat(2, 1fr); }
  .special-type-cards { grid-template-columns:repeat(2,1fr); }
  .special-shift-fields, .special-lunch-fields, .special-coverage-window-row { grid-template-columns:repeat(2,1fr); }
  .employee-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .employee-field, .employee-active { grid-column: span 1; }
  .employee-actions, .preference-note { grid-column: 1 / -1; }
  #scheduleContainer { overflow-x: clip; }
  #scheduleContainer table { min-width: 0; font-size: .65rem; }
  #scheduleContainer th,
  #scheduleContainer td { padding: 5px 2px; }
  #scheduleContainer th:nth-child(1) { width: 74px; }
  #scheduleContainer th:nth-child(2) { width: 56px; }
  #scheduleContainer th:nth-last-child(-n+5) { width: 38px; }
  .help-hero { grid-template-columns:1fr; }
  .help-hero-actions { justify-content:flex-start; }
  .help-step-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .help-area-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .suggestion-flow { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .help-legend-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .general-rules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .general-rules-grid > label:nth-child(n),
  .general-rules-grid > .short-break-options,
  .general-rules-grid > .short-break-options + label,
  .general-rules-grid > .general-overtime-duration,
  .general-rules-grid > .general-overtime-duration + label { grid-column: span 1; }
  .general-rules-grid > .short-break-options { grid-column: span 2; }
}

@media (max-width: 650px) {
  .app-header { padding: 18px; }
  .week-bar { justify-content: flex-start; }
  .tabs { padding: 0 10px; }
  main { padding: 18px 10px 36px; }
  .card { padding: 13px; border-radius: 11px; }
  .general-rules-grid,
  .short-break-options { grid-template-columns: 1fr; }
  .general-rules-grid > .short-break-options { grid-column: span 1; }
  .card-heading { align-items: flex-start; flex-direction: column; }
  .employee-row, fieldset { grid-template-columns: 1fr; }
  .employee-field, .employee-active, .employee-actions, .preference-note { grid-column: 1; }
  .day-editor-grid, .employee-boundary-preferences { grid-template-columns: 1fr; }
  .day-editor-duration-option, .employee-boundary-preferences .info-box { grid-column: 1; }
  .employee-time-grid fieldset { grid-template-columns: 1fr; }
  .employee-wildcard-times { grid-template-columns: 1fr; }
  .backup-reminder, .special-day-item { align-items:flex-start; flex-direction:column; }
  .special-type-cards, .special-shift-fields, .special-lunch-fields, .special-coverage-window-row { grid-template-columns:1fr; }
  .individual-controls { min-width: 0; grid-template-columns: 1fr; }
  .individual-header { flex-direction: column; }
  .print-choice-grid { grid-template-columns: 1fr; }
  .wide-field { grid-column:auto; }
  .toggle-label { align-items: flex-start; }
  .import-summary { grid-template-columns: 1fr 1fr; }
  .suggestion-undo-box { grid-template-columns:1fr; align-items:stretch; }
  .suggestion-undo-box .button { width:100%; white-space:normal; }
  .coverage-shortages-heading { align-items:stretch; flex-direction:column; }
  .coverage-shortages-heading .button { width:100%; }
  .coverage-shortage-day { grid-template-columns:1fr; }
  .help-hero { padding:18px; border-radius:13px; }
  .help-hero-actions { display:grid; grid-template-columns:1fr 1fr; }
  .help-chip { white-space:normal; }
  .help-step-grid,
  .help-area-grid,
  .help-priority-grid,
  .help-rule-cards,
  .suggestion-flow,
  .help-checklist,
  .help-example-list,
  .help-legend-grid { grid-template-columns:1fr; }
  .help-step-grid li, .help-area-card, .suggestion-flow > div { min-height:0; }
  #scheduleContainer { overflow-x: auto; scrollbar-width: auto; }
  #scheduleContainer table { min-width: 900px; }
}

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  html, body, body * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: white; }
  .app-header, .week-bar, .week-rules-snapshot-notice, .tabs, footer, .no-print, .toast-container, .modal { display: none !important; }
  main { width: 100%; max-width: none; padding: 0; }
  .tab-panel { display: none !important; }
  body[data-print-target="schedule"] #panel-schedule,
  body[data-print-target="simple-week"] #panel-schedule,
  body[data-print-target="closed-weeks"] #panel-closedweeks,
  body[data-print-target="closed-month"] #panel-closedweeks,
  body[data-print-target="coverage"] #panel-schedule,
  body[data-print-target="period"] #panel-schedule,
  body[data-print-target="individual"] #panel-schedule,
  body[data-print-target="comparison"] #panel-timeclock,
  body[data-print-target="monthly"] #panel-timeclock { display: block !important; }
  body[data-print-target="schedule"] #panel-schedule > *:not(#printScheduleSection),
  body[data-print-target="simple-week"] #panel-schedule > *:not(#simpleWeekPrintSection),
  body[data-print-target="closed-weeks"] #panel-closedweeks > *:not(#printClosedWeeksSection),
  body[data-print-target="closed-month"] #panel-closedweeks > *:not(#printClosedMonthSection),
  body[data-print-target="coverage"] #panel-schedule > *:not(#printHourlyCoverageSection),
  body[data-print-target="period"] #panel-schedule > *:not(#printPeriodSection),
  body[data-print-target="individual"] #panel-schedule > *:not(.individual-card),
  body[data-print-target="comparison"] #panel-timeclock > *:not(#printComparisonSection),
  body[data-print-target="monthly"] #panel-timeclock > *:not(#printMonthlySection) { display: none !important; }
  body[data-print-target="coverage"] #printHourlyCoverageSection > *:not(#coveragePrintContent) { display: none !important; }
  body[data-print-target="coverage"] #coveragePrintContent { display: block !important; }
  body[data-print-target="coverage"] .coverage-print-day { break-after: page; page-break-after: always; }
  body[data-print-target="coverage"] .coverage-print-day:last-child { break-after: auto; page-break-after: auto; }
  body[data-print-target="coverage"] .coverage-print-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 6px; }
  body[data-print-target="coverage"] .coverage-print-heading h2 { margin: 0; }
  body[data-print-target="coverage"] .coverage-print-day .combined-coverage-block h5 { margin: 0 0 5px; }
  body[data-print-target="coverage"] .coverage-print-day table { font-size: 8px; }
  body[data-print-target="coverage"] .coverage-print-day th,
  body[data-print-target="coverage"] .coverage-print-day td { padding: 2.5px 3px; }
  .print-section { display: block !important; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 8.5px; }
  th, td { padding: 3px; }
  th { position: static; }
  .sticky-col { position: static; box-shadow: none; }
  .shift-time, .point-status { font-size: 7px; }
  .schedule-cell { min-width: 0; }
  .schedule-cell.shift-M { background-color: #dcfce7 !important; }
  .schedule-cell.shift-T { background-color: #dbeafe !important; }
  .schedule-cell.shift-F, .schedule-cell.shift-FC { background-color: #fef3c7 !important; }
  .schedule-cell.shift-FE, .schedule-cell.shift-AT { background-color: #fee2e2 !important; }
  .schedule-cell.overtime-removed { box-shadow: inset 0 0 0 2px #dc2626 !important; }
  .cell-badge.overtime-removed-badge { color: #991b1b !important; background: #fecaca !important; }
  body[data-print-target="schedule"][data-schedule-print-mode="week"] #scheduleContainer th:nth-last-child(-n+5),
  body[data-print-target="schedule"][data-schedule-print-mode="week"] #scheduleContainer td:nth-last-child(-n+5) { display: none !important; }
  body[data-print-target="period"] #printPeriodSection,
  body[data-print-target="simple-week"] #simpleWeekPrintSection,
  body[data-print-target="closed-weeks"] #printClosedWeeksSection,
  body[data-print-target="closed-month"] #printClosedMonthSection,
  body[data-print-target="individual"] .individual-card { display: block !important; }
  body[data-print-target="individual"] .individual-card { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .period-week-card { page-break-inside: avoid; border: 0; padding: 0; margin-bottom: 8mm; }
  #printClosedWeeksSection .closed-weeks-print-page { break-after: page; page-break-after: always; }
  #printClosedWeeksSection .closed-weeks-print-page:last-child { break-after: auto; page-break-after: auto; }
  #printClosedWeeksSection .simple-week-sheet { break-inside: avoid; page-break-inside: avoid; }
  #printClosedWeeksSection .two-per-page .simple-week-sheet + .simple-week-sheet { margin-top: 6mm; padding-top: 4mm; border-top: 1px solid #cbd5e1; }
  #printClosedWeeksSection .two-per-page .simple-week-heading { margin-bottom: 4px; }
  #printClosedWeeksSection .two-per-page .simple-week-sheet table { font-size: 8px; }
  #printClosedWeeksSection .two-per-page .simple-week-sheet th,
  #printClosedWeeksSection .two-per-page .simple-week-sheet td { padding: 2px; }
  #printClosedMonthSection .closed-month-print-page { break-after: page; page-break-after: always; }
  #printClosedMonthSection .closed-month-print-page:last-child { break-after: auto; page-break-after: auto; }
  #printClosedMonthSection .simple-week-sheet { break-inside: avoid; page-break-inside: avoid; }
  #printClosedMonthSection .essential-details .simple-week-sheet + .simple-week-sheet { margin-top: 5mm; padding-top: 4mm; border-top: 1px solid #cbd5e1; }
  #printClosedMonthSection .essential-details table { font-size: 7.5px; }
  #printClosedMonthSection .full-details table { font-size: 7px; }
  #printClosedMonthSection th,
  #printClosedMonthSection td { padding: 2px; }
  .simple-week-sheet table { font-size: 9px; }
  .simple-week-sheet th, .simple-week-sheet td { text-align: center; vertical-align: middle; overflow-wrap: anywhere; }
  .period-week-card table { min-width: 0; }
  .individual-preview { border: 0; padding: 0; }
  body[data-print-target="coverage"] #coverageReportBody[hidden] { display: block !important; }
}
.short-break-option,
.employee-auto-overtime {
  align-self: stretch;
}

.closed-month-print-actions {
  align-items: end;
}

.closed-month-print-actions label {
  min-width: 190px;
}

.closed-weeks-archive-list {
  display: grid;
  gap: 10px;
}

.closed-week-archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.closed-week-archive-item h4,
.closed-week-archive-item p {
  margin: 0;
}

.closed-week-archive-item p {
  margin-top: 4px;
  color: #475569;
  font-size: 13px;
}

@media (max-width: 760px) {
  .closed-week-archive-item { align-items: stretch; flex-direction: column; }
  .closed-week-archive-item .button { width: 100%; }
}


.short-break-text {
  color: #7c3aed;
  font-weight: 700;
}

.after-midnight-fields {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(90px, .7fr);
  gap: 10px;
  align-items: end;
}

.after-midnight-fields.inactive-fields { opacity: .58; }

.after-midnight-result {
  grid-column: 1 / -1;
  color: var(--primary, #155eef);
  font-size: .86rem;
}

.inline-after-midnight,
.inline-after-duration {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
}

.inline-after-duration input { width: 58px; }
.inline-after-duration select { width: 70px; }

[data-store-field="afterResult"] {
  display: block;
  margin-top: 5px;
  color: var(--primary, #155eef);
}

.special-store-hours-settings {
  display: block;
  margin: 16px 0;
}

.special-store-hours-settings > .form-grid {
  grid-template-columns: minmax(145px, .75fr) minmax(175px, .85fr) minmax(220px, 1.1fr) minmax(250px, 1.3fr);
  align-items: start;
}

.special-store-hours-settings .after-midnight-toggle {
  min-height: 100%;
  margin: 0;
}

.special-store-hours-settings > .help-text { margin: 12px 0 0; }

.late-closing-badge {
  background: #e8f1ff;
  color: #174ea6;
}

@media (max-width: 720px) {
  .after-midnight-fields { grid-template-columns: 1fr; }
  .after-midnight-result { grid-column: auto; }
  .special-store-hours-settings > .form-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   CAMADA ONLINE — LOGIN, LOJAS, USUÁRIOS E SINCRONIZAÇÃO
   ========================================================= */
.online-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 15%, rgba(31,111,235,.14), transparent 30%),
    linear-gradient(160deg, #f8fbff, #eef4fb);
}

.online-login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid #d6e2f0;
  border-radius: 20px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 24px 60px rgba(23,58,94,.16);
}

.online-login-card h1 { margin-bottom: 8px; }
.online-login-card > p { margin-bottom: 22px; line-height: 1.5; }
.online-kicker {
  margin-bottom: 7px;
  color: var(--blue-700);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .12em;
}
.online-login-form {
  display: grid;
  gap: 14px;
}
.online-login-form label,
.online-password-box label,
.online-user-grid label {
  display: grid;
  gap: 6px;
  color: var(--slate-700);
  font-size: .86rem;
  font-weight: 800;
}
.online-login-form input,
.online-password-box input,
.online-user-grid input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  background: #fff;
  color: var(--slate-950);
}
.online-remember-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  cursor: pointer;
}
.online-remember-row input {
  width: 17px !important;
  height: 17px;
  margin: 0;
}
.online-login-button { width: 100%; min-height: 44px; }

.online-bar {
  position: sticky;
  top: 0;
  z-index: 42;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px clamp(14px, 4vw, 48px);
  border-bottom: 1px solid #cbd9e8;
  background: rgba(255,255,255,.98);
  box-shadow: 0 4px 16px rgba(23,58,94,.06);
}
.online-bar-store,
.online-bar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.online-bar-store > label {
  color: var(--slate-500);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.online-bar-store select {
  min-width: 130px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--slate-300);
  border-radius: 9px;
  background: #fff;
  color: var(--slate-950);
  font-weight: 800;
}
.cloud-save-status {
  min-width: 150px;
  color: var(--slate-500);
  font-size: .78rem;
  font-weight: 700;
}
.cloud-save-status[data-kind="ok"] { color: var(--green); }
.cloud-save-status[data-kind="sync"] { color: var(--blue-700); }
.cloud-save-status[data-kind="warning"] { color: var(--amber); }
.cloud-save-status[data-kind="error"] { color: var(--red); }
.online-user-summary {
  display: grid;
  min-width: 100px;
  text-align: right;
}
.online-user-summary strong { color: var(--blue-900); font-size: .9rem; }
.online-user-summary small { color: var(--slate-500); font-size: .7rem; }

.online-modal {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15,23,42,.52);
}
.online-modal-card {
  width: min(100%, 760px);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15,23,42,.28);
}
.online-modal-small { width: min(100%, 520px); }
.online-modal-wide { width: min(100%, 1080px); }
.online-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.online-modal-heading h2 { margin-bottom: 4px; }
.online-modal-heading p { margin: 0; }
.online-account-list {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}
.online-account-list > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--slate-100);
}
.online-account-list dt {
  color: var(--slate-500);
  font-size: .8rem;
  font-weight: 800;
}
.online-account-list dd { margin: 0; font-weight: 800; }
.online-password-box {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-200);
}
.online-password-box h3 { margin-bottom: 0; }
.online-message {
  min-height: 20px;
  margin-top: 8px;
  font-size: .84rem;
  font-weight: 800;
}
.online-message[data-kind="ok"] { color: var(--green); }
.online-message[data-kind="sync"] { color: var(--blue-700); }
.online-message[data-kind="error"] { color: var(--red); }

.online-create-user-card { margin-bottom: 14px; }
.online-user-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.online-user-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.online-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--slate-700);
  font-size: .82rem;
  font-weight: 800;
}
.online-check input { width: 16px; height: 16px; margin: 0; }
.online-store-checks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: var(--slate-100);
}
.online-users-list { display: grid; gap: 10px; margin-top: 14px; }
.online-user-card {
  padding: 14px;
  border: 1px solid var(--slate-200);
  border-radius: 14px;
  background: #fff;
}

@media (max-width: 900px) {
  .online-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .online-bar-store,
  .online-bar-user { justify-content: space-between; }
  .online-user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .online-bar { padding: 8px 10px; gap: 7px; }
  .online-bar-store { display: grid; grid-template-columns: auto 1fr; }
  .online-bar-store select { width: 100%; min-width: 0; }
  .cloud-save-status { grid-column: 1 / -1; min-width: 0; }
  .online-bar-user {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) auto auto auto;
    gap: 5px;
  }
  .online-user-summary { min-width: 0; text-align: left; }
  .online-user-summary strong,
  .online-user-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .online-bar-user .button { padding: 7px 8px; font-size: .72rem; white-space: nowrap; }
  .online-user-grid { grid-template-columns: 1fr; }
  .online-modal { padding: 8px; }
  .online-modal-card { padding: 14px; border-radius: 14px; }
  .online-login-card { padding: 22px 18px; }
}

/* Correção visual dos controles da Administração online */
.online-check {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start;
  gap: 7px !important;
  white-space: nowrap;
}

.online-check input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  padding: 0 !important;
  margin: 0 !important;
  letter-spacing: normal;
  flex: 0 0 16px;
}

.online-user-options {
  align-items: center;
}

.online-user-options > .online-check {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: #fff;
}

.online-store-checks {
  min-height: 38px;
}

.online-store-checks .online-check {
  padding: 2px 4px;
}

@media (max-width: 700px) {
  .online-user-options {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .online-user-options > .online-check,
  .online-store-checks,
  .online-user-options > .button {
    width: 100%;
  }

  .online-store-checks {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Garantia de estado inicial da camada online */
.online-modal.hidden-section,
.online-bar.hidden-section,
.online-message.hidden-section {
  display: none !important;
}

/* =========================================================
   LOGIN VIAPEG TRANSLÚCIDO + TRANSIÇÃO ENTRE LOJAS
   ========================================================= */
.online-login-overlay {
  isolation: isolate;
  overflow: hidden;
  background: #f4f7fb;
}

.online-login-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("logo-viapeg.png") center center / min(920px, 88vw) no-repeat;
  opacity: .19;
  pointer-events: none;
  z-index: -2;
}

.online-login-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(239,125,32,.055), transparent 34%),
    radial-gradient(circle at 84% 82%, rgba(36,90,156,.07), transparent 40%);
  pointer-events: none;
  z-index: -1;
}

.online-login-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,.56);
  border: 1px solid rgba(255,255,255,.78);
  box-shadow: 0 24px 60px rgba(23,58,94,.17);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.online-login-form input {
  background: rgba(255,255,255,.76);
}

.store-switch-overlay {
  position: fixed;
  inset: 0;
  z-index: 15000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(245,248,252,.96);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.store-switch-card {
  width: min(390px, 92vw);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 30px 26px;
  text-align: center;
  border: 1px solid rgba(205,219,234,.92);
  border-radius: 22px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 24px 60px rgba(23,58,94,.14);
}

.store-switch-card img {
  width: min(210px, 62vw);
  max-height: 145px;
  object-fit: contain;
  margin-bottom: 4px;
}

.store-switch-card strong {
  color: var(--blue-900);
  font-size: 1.08rem;
}

.store-switch-card span {
  color: var(--slate-500);
  font-size: .84rem;
}

.store-switch-spinner {
  width: 28px;
  height: 28px;
  margin-top: 5px;
  border: 3px solid #dbe7f4;
  border-top-color: var(--blue-700);
  border-radius: 50%;
  animation: escala-online-spin .8s linear infinite;
}

@keyframes escala-online-spin {
  to { transform: rotate(360deg); }
}

html.store-switching #loginOverlay {
  display: none !important;
}

html.store-switching #storeSwitchOverlay {
  display: grid !important;
}

.store-switch-overlay.hidden-section {
  display: none !important;
}

/* Corrige alinhamento do checkbox "Lembrar acesso" na tela de login */
.online-login-form .remember-row,
.online-login-form label.remember-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: auto !important;
  min-height: 0 !important;
  margin: 2px 0 4px !important;
  padding: 0 !important;
  text-align: left !important;
}

.online-login-form .remember-row input[type="checkbox"],
.online-login-form label.remember-row input[type="checkbox"] {
  appearance: auto !important;
  -webkit-appearance: checkbox !important;
  width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 16px !important;
  align-self: center !important;
}

.online-login-form .remember-row span,
.online-login-form label.remember-row span {
  display: inline !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

/* Correção definitiva: checkbox Lembrar acesso alinhado à esquerda */
.online-login-form > label.online-remember-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  justify-self: stretch !important;
  place-self: auto stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 20px !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  cursor: pointer;
}

.online-login-form > label.online-remember-row > input#rememberAccess[type="checkbox"] {
  appearance: auto !important;
  -webkit-appearance: checkbox !important;
  display: inline-block !important;
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 16px !important;
  align-self: center !important;
}

.online-login-form > label.online-remember-row > span {
  display: inline-block !important;
  flex: 0 1 auto !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  line-height: 1.25 !important;
}

/* Botão e modal de validação da escala */
.validate-schedule-button {
  background: #e9f8ef;
  border-color: #b8dfc6;
  color: #176238;
}

.validate-schedule-button:hover {
  background: #daf2e3;
  border-color: #91c9a5;
}

.schedule-validation-modal-card {
  width: min(780px, calc(100vw - 30px));
  max-height: min(88vh, 860px);
  overflow: auto;
}

.schedule-validation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.schedule-validation-summary .validation-metric {
  padding: 12px;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  background: #f8fafc;
}

.schedule-validation-summary .validation-metric span {
  display: block;
  color: var(--slate-500);
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.schedule-validation-summary .validation-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
}

.schedule-validation-summary .validation-metric.error strong { color: #b42318; }
.schedule-validation-summary .validation-metric.warning strong { color: #9a6700; }
.schedule-validation-summary .validation-metric.ok strong { color: #18794e; }

@media (max-width: 650px) {
  .schedule-validation-summary {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   ASSISTENTE IA POR LOJA
   ========================================================= */
.ai-store-button {
  min-height: 34px;
  padding: 7px 11px;
  border-color: #b8cff0;
  background: linear-gradient(135deg, #eef5ff, #f8fbff);
  color: var(--blue-900);
  white-space: nowrap;
}

.ai-store-button:hover {
  background: #e4efff;
}

.ai-assistant-backdrop {
  position: fixed;
  inset: 0;
  z-index: 13990;
  background: rgba(15, 23, 42, .28);
}

.ai-assistant-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 14000;
  width: min(430px, 94vw);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border-left: 1px solid #d8e2ee;
  background: rgba(249, 251, 254, .98);
  box-shadow: -18px 0 46px rgba(26, 49, 78, .18);
}

.ai-assistant-panel.hidden-section,
.ai-assistant-backdrop.hidden-section {
  display: none !important;
}

.ai-assistant-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #dce6f0;
  background: rgba(255, 255, 255, .92);
}

.ai-assistant-header h2 {
  margin: 3px 0 2px;
  font-size: 1.12rem;
}

.ai-assistant-header p {
  margin: 0;
  color: var(--slate-500);
  font-size: .8rem;
}

.ai-assistant-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-message {
  max-width: 91%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.42;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.ai-message.user {
  align-self: flex-end;
  color: #fff;
  background: var(--blue-700);
  border-bottom-right-radius: 5px;
}

.ai-message.assistant,
.ai-message.system {
  align-self: flex-start;
  color: var(--slate-900);
  background: #fff;
  border: 1px solid #dce6f0;
  border-bottom-left-radius: 5px;
}

.ai-message.system {
  max-width: 100%;
  background: #eef6ff;
}

.ai-message small {
  display: block;
  margin-top: 6px;
  opacity: .72;
}

.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ai-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8091a5;
  animation: ai-dot 1s infinite ease-in-out;
}
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .28; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ai-proposal-card {
  align-self: stretch;
  padding: 12px;
  border: 1px solid #bfd4ef;
  border-radius: 14px;
  background: #f4f8ff;
}

.ai-proposal-card h4 {
  margin: 0 0 5px;
  color: var(--blue-900);
}

.ai-proposal-card p {
  margin: 0 0 8px;
  color: var(--slate-600);
  font-size: .82rem;
}

.ai-proposal-list {
  display: grid;
  gap: 5px;
  margin: 8px 0 10px;
  padding: 0;
  list-style: none;
}

.ai-proposal-list li {
  padding: 7px 8px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid #e0e8f2;
  font-size: .8rem;
}

.ai-proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ai-quick-prompts {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 14px;
  border-top: 1px solid #e2e9f1;
  background: #f7f9fc;
}

.ai-quick-prompts button {
  flex: 0 0 auto;
  border: 1px solid #cfdbea;
  border-radius: 999px;
  background: #fff;
  padding: 6px 9px;
  color: var(--slate-700);
  font: inherit;
  font-size: .75rem;
  cursor: pointer;
}

.ai-assistant-form {
  display: grid;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid #dce6f0;
  background: #fff;
}

.ai-assistant-form textarea {
  width: 100%;
  min-height: 76px;
  max-height: 160px;
  resize: vertical;
  border: 1px solid #cbd8e7;
  border-radius: 12px;
  padding: 10px 11px;
  font: inherit;
  line-height: 1.35;
  background: #fff;
}

.ai-assistant-form textarea:focus {
  outline: 2px solid #9fc2f4;
  outline-offset: 1px;
}

.ai-assistant-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-assistant-form-footer small {
  color: var(--slate-500);
  font-size: .7rem;
  line-height: 1.25;
}

@media (max-width: 720px) {
  .online-bar-store {
    flex-wrap: wrap;
  }
  .ai-store-button {
    min-height: 32px;
    padding: 6px 9px;
    font-size: .76rem;
  }
  .ai-assistant-panel {
    width: 100vw;
  }
  .ai-assistant-backdrop {
    display: none !important;
  }
}

/* Assistente IA temporariamente desativado */
.ai-store-button:disabled {
  opacity: .58;
  cursor: not-allowed;
  filter: grayscale(.18);
}

