:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #67738a;
  --border: #dde4ef;
  --primary: #1f6feb;
  --primary-dark: #1557b0;
  --danger: #b42318;
  --success: #087443;
  --warning: #b54708;
  --free-track: #d7dde7;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar {
  background: #0f1728;
  color: #f8fbff;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.sidebar-close { display: none; background: transparent; border: 0; color: #f8fbff; font-size: 1.6rem; padding: 0; }
.brand-title { font-size: 1.1rem; font-weight: 700; }
.brand-version { color: #a7b3c8; margin-top: .25rem; }
.nav { display: grid; gap: .45rem; }
.nav a { display: block; padding: .7rem .85rem; border-radius: .8rem; background: rgba(255,255,255,.04); }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); }
.nav-section-label { margin-top: .5rem; color: #9eb0cc; font-size: .82rem; letter-spacing: .02em; text-transform: uppercase; }

.nav-dropdown { display: grid; gap: .35rem; }
.nav-dropdown summary { display: block; cursor: pointer; list-style: none; padding: .7rem .85rem; border-radius: .8rem; background: rgba(255,255,255,.07); color: #dbe7ff; font-weight: 700; }
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: "▾"; float: right; opacity: .75; transition: transform .15s ease; }
.nav-dropdown[open] summary::after { transform: rotate(180deg); }
.nav-dropdown summary:hover, .nav-dropdown summary.active { background: rgba(255,255,255,.12); }
.nav-dropdown a { margin-left: .55rem; padding-left: 1rem; font-size: .94rem; }
.sidebar-footer { margin-top: auto; display: grid; gap: .75rem; }
.user-chip { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; color: #d7e2f0; }
.sidebar-backdrop { display: none; }
.content { padding: 1.2rem; min-width: 0; }
.mobile-topbar { display: none; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.mobile-topbar-title { display: grid; gap: .1rem; text-align: right; }
.mobile-topbar-title span { color: var(--muted); font-size: .9rem; }
.mobile-menu-button { white-space: nowrap; }
.page-header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.page-header h1 { margin: 0 0 .25rem; }
.muted { color: var(--muted); }
.small-text { font-size: .85rem; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 1rem; padding: 1rem; box-shadow: 0 6px 20px rgba(18,39,76,.05); }
.panel-soft { background: #fbfcff; border: 1px solid var(--border); border-radius: 1rem; padding: 1rem; }

.agenda-section-heading { margin-bottom: .85rem; }
.agenda-section-heading h2 { margin: 0 0 .25rem; font-size: 1.18rem; }
.agenda-section-heading p { margin: 0; }
.narrow { max-width: 980px; }
.form-grid { display: grid; gap: .9rem; }
.compact-grid { gap: .6rem; }
.form-grid label span, .filters label span, .timer-field label { display: block; margin-bottom: .35rem; font-size: .92rem; color: var(--muted); }
label.checkbox { display: flex; align-items: center; gap: .6rem; }
label.checkbox span { margin-bottom: 0; color: var(--text); }
input, select, textarea, button { font: inherit; }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], input[type="file"], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: .8rem;
  padding: .7rem .8rem;
  background: #fff;
}
select[multiple] { min-height: 7rem; }
textarea { resize: vertical; }
button, .btn {
  cursor: pointer;
  border: 0;
  border-radius: .85rem;
  padding: .75rem 1rem;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
.btn:hover, button:hover { background: var(--primary-dark); }
.btn-secondary { background: #eef3fb; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e3ebf8; }
.control-state-on,
.sound-toggle[data-control-state="on"],
.radio-power-toggle[data-control-state="on"] {
  background: #f4fbf6;
  color: var(--success);
  border-color: #b8e5ca;
}
.control-state-on:hover,
.sound-toggle[data-control-state="on"]:hover,
.radio-power-toggle[data-control-state="on"]:hover {
  background: #e8f7ef;
}
.control-state-off,
.sound-toggle[data-control-state="off"],
.radio-power-toggle[data-control-state="off"] {
  background: #fff8f7;
  color: var(--danger);
  border-color: #f2c2be;
}
.control-state-off:hover,
.sound-toggle[data-control-state="off"]:hover,
.radio-power-toggle[data-control-state="off"]:hover {
  background: #fef0ef;
}
.control-state-paused,
.radio-power-toggle[data-control-state="paused"] {
  background: #fff9ef;
  color: var(--warning);
  border-color: #f3d7a2;
}
.control-state-paused:hover,
.radio-power-toggle[data-control-state="paused"]:hover {
  background: #fff6e6;
}
.btn-block { width: 100%; }
.flash-stack { display: grid; gap: .6rem; margin-bottom: 1rem; }
.flash { border-radius: .8rem; padding: .8rem .9rem; }
.flash-success { background: #e8f7ef; color: var(--success); border: 1px solid #b8e5ca; }
.flash-error { background: #fef0ef; color: var(--danger); border: 1px solid #f2c2be; }
.flash-warning { background: #fff6e6; color: var(--warning); border: 1px solid #f3d7a2; }
.notification-center-stack { display: grid; gap: .75rem; margin-bottom: 1rem; }
.notification-card { border-radius: 1rem; border: 1px solid var(--border); background: #fffdf8; padding: .9rem 1rem; display: grid; gap: .75rem; }
.notification-card.notification-pending_approval { border-color: #f3d7a2; }
.notification-card.notification-approved_pending_confirmation { border-color: #c7d8fb; background: #f7faff; }
.notification-card.notification-refused, .notification-card.notification-cancelled_after_approval { border-color: #f2c2be; background: #fff8f7; }
.notification-card.notification-approved_final { border-color: #b8e5ca; background: #f4fbf6; }
.notification-card.notification-is-minimized { opacity: .78; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04); }
.notification-card.notification-is-minimized .notification-card-body { opacity: .9; }
.notification-card.notification-is-minimized .inline-badge { background: #eef3fb; color: var(--muted); }
.notification-popup-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.notification-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .44);
}
.notification-popup-card {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  border-radius: 1.1rem;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .26);
  padding: 1rem 1.05rem;
  display: grid;
  gap: .85rem;
}
.notification-popup-card.notification-pending_approval { border-color: #f3d7a2; background: #fffdf8; }
.notification-popup-card.notification-approved_final { border-color: #b8e5ca; background: #f4fbf6; }
.notification-popup-card.notification-refused { border-color: #f2c2be; background: #fff8f7; }
.notification-popup-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.notification-popup-head h2 { margin: .15rem 0 0; font-size: 1.2rem; }
.notification-popup-kicker { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.notification-popup-meta { display: flex; flex-wrap: wrap; gap: .45rem .75rem; font-size: .9rem; }
.notification-popup-body { display: grid; gap: .55rem; }
.notification-popup-body p { margin: 0; }
.notification-popup-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.notification-popup-actions .btn { min-width: 140px; }
.notification-card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.notification-card p { margin: 0; }
.notification-actions form { margin: 0; }
.split { display: grid; gap: 1rem; grid-template-columns: minmax(280px, 420px) 1fr; margin-bottom: 1rem; }
.split-wide { grid-template-columns: minmax(320px, 480px) 1fr; }
.split-equal { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; }
.filters-compact label { min-width: 220px; }
.table-shell { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 780px; }
.table th, .table td { padding: .75rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.card-grid, .stats-grid, .timer-grid, .history-grid, .section-stack { display: grid; gap: 1rem; }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1rem; }
.stat-card { display: grid; gap: .3rem; }
.stat-card strong { font-size: 2rem; }
.quick-card { display: block; }
.section-stack { margin-bottom: 1rem; }
.section-card { display: grid; grid-template-columns: 64px 1fr auto; gap: 1rem; align-items: center; }
.section-number {
  width: 64px;
  height: 64px;
  border-radius: 1rem;
  background: #eef3fb;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 700;
}
.section-body h2 { margin: 0 0 .2rem; }
.section-body p { margin: 0; }
.form-hint { margin: 0; color: var(--muted); }
.full { grid-column: 1 / -1; }
.inline-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .25rem .55rem;
  margin: .15rem .2rem .15rem 0;
  background: #f8fbff;
  font-size: .88rem;
}
.info-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.color-pill { width: 14px; height: 14px; border-radius: 999px; display: inline-block; margin-right: .4rem; vertical-align: middle; }
.running-stack { display: grid; gap: .8rem; }
.running-card { border: 1px solid var(--border); border-radius: .95rem; padding: .85rem; background: #fafcff; }
.running-card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: .75rem; }
.running-card-body { display: grid; gap: .75rem; }
.running-card.state-indisponivel { border-color: #f3c4bf; background: #fff8f7; }
.chip-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.assignment-title { display: block; margin-bottom: .35rem; font-weight: 600; }
.assignment-meta { margin-bottom: .55rem; }
.assignment-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.assignment-option { display: flex; align-items: center; gap: .5rem; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: .8rem; background: #fff; }
.assignment-option input { width: auto; margin: 0; }
.assignment-option.disabled { opacity: .55; background: #f8fafc; }
.unit-header { margin: 0 0 .75rem 220px; display: grid; grid-template-columns: repeat(13, 1fr); font-size: .78rem; color: var(--muted); }
.unit-agenda-grid { display: grid; gap: 1rem; }
.unit-resource-card { display: grid; gap: .8rem; }
.unit-resource-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.unit-resource-head h3 { margin: 0 0 .15rem; }
.resource-summary-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; }
.unit-row-stack { display: grid; gap: .55rem; }
.unit-row { display: grid; grid-template-columns: 220px 1fr; gap: .75rem; align-items: center; }
.unit-label { font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.agenda-track {
  position: relative;
  min-height: 42px;
  border-radius: 1rem;
  background: linear-gradient(90deg, var(--free-track) 0%, var(--free-track) 100%);
  overflow: hidden;
}
.unit-track::after,
.agenda-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, rgba(23,32,51,.09) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
  pointer-events: none;
}
.agenda-block {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: .8rem;
  opacity: .97;
  padding: .25rem .45rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  font-size: .78rem;
  font-weight: 600;
  color: #fff;
}
.agenda-block span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-state-reserva { background: var(--resource-color); }
.agenda-state-pago { background: color-mix(in srgb, var(--resource-color) 76%, #087443 24%); }
.agenda-state-indisponivel { background: #b42318; }
.timer-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 1rem; align-items: stretch; }
.timer-card { position: relative; border-left: 6px solid transparent; display: flex; flex-direction: column; min-height: 100%; outline: 0 solid transparent; outline-offset: -2px; }
.timer-card.travel { box-shadow: inset 0 0 0 2px rgba(31,111,235,.15); }
.timer-card.warning { box-shadow: inset 0 0 0 3px rgba(181,71,8,.35); animation: pulse-warning 1.1s infinite; }
.timer-card.finished { box-shadow: inset 0 0 0 3px rgba(180,35,24,.45); animation: pulse-danger 1s infinite; }
.timer-card-header { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.timer-title { display: flex; align-items: center; gap: .55rem; }
.timer-title h2 { margin: 0; font-size: 1rem; }
.timer-phase { font-size: .9rem; color: var(--muted); }
.timer-field { margin-top: .8rem; }
.timer-display { margin: 1rem 0; font-size: 2rem; font-weight: 700; text-align: center; }
.timer-linked-booking { min-height: 1.1rem; margin-top: .55rem; }
.history-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.history-card { border-left: 5px solid var(--border); background: #f8fafc; border-radius: .8rem; padding: .8rem; display: grid; gap: .25rem; }
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login-shell { width: min(92vw, 420px); }
.login-panel { padding: 1.2rem; }
.brand-center { text-align: center; margin-bottom: 1rem; }
.brand-center h1 { margin: 0 0 .2rem; }
code { background: #f1f5fb; padding: .15rem .35rem; border-radius: .4rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
@keyframes pulse-warning { 0%,100% { box-shadow: inset 0 0 0 3px rgba(181,71,8,.18); } 50% { box-shadow: inset 0 0 0 4px rgba(181,71,8,.45); } }
@keyframes pulse-danger { 0%,100% { box-shadow: inset 0 0 0 3px rgba(180,35,24,.22); } 50% { box-shadow: inset 0 0 0 4px rgba(180,35,24,.52); } }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 40;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 40, .4);
    z-index: 30;
  }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-close, .mobile-topbar { display: flex; }
}
@media (max-width: 960px) {
  .split, .split-wide, .split-equal { grid-template-columns: 1fr; }
  .unit-header { margin-left: 0; grid-template-columns: repeat(13, minmax(52px, 1fr)); overflow-x: auto; }
  .unit-row { grid-template-columns: 1fr; }
  .section-card { grid-template-columns: 1fr; }
  .section-number { width: 54px; height: 54px; }
  .unit-resource-head, .info-strip { flex-direction: column; align-items: stretch; }
  .resource-summary-badges { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .content { padding: .9rem; }
  .filters, .toolbar { flex-direction: column; align-items: stretch; }
  .filters label { min-width: 100%; }
  .table { min-width: 640px; }
  .agenda-block { font-size: .72rem; }
}
.content-top-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  align-items: start;
  margin-bottom: 1rem;
}
.sound-toggle { white-space: nowrap; position: static; }
.global-alert-stack { display: grid; gap: .6rem; }
.global-alert {
  position: relative;
  overflow: hidden;
  border-radius: .9rem;
  border: 1px solid color-mix(in srgb, var(--alert-accent, #1f6feb) 38%, #d6deeb 62%);
  padding: .8rem .95rem;
  background: #ffffff;
  display: grid;
  gap: .35rem;
}
.global-alert > * { position: relative; z-index: 1; }
.global-alert::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--alert-accent, #1f6feb);
  opacity: var(--alert-bg-opacity, .16);
  pointer-events: none;
}
.global-alert-return { border-color: color-mix(in srgb, var(--alert-accent, #b56b08) 52%, #eadfc5 48%); }
.global-alert-end { border-color: color-mix(in srgb, var(--alert-accent, #b42318) 58%, #edc8c3 42%); }
.global-alert-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .92rem; }
.global-alert-body { display: flex; flex-wrap: wrap; gap: .45rem .9rem; font-size: .9rem; }
.global-alert-empty { min-height: 1px; }

.agenda-state-reserva { background: #c77700; }
.agenda-state-pago { background: #087443; }
.agenda-state-concluida { background: #0d5a35; }
.agenda-state-indisponivel { background: #b42318; }
.agenda-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(23,32,51,.7);
  z-index: 3;
  pointer-events: none;
}
.unit-label { font-weight: 600; }

.timer-board { display: grid; gap: 1rem; }
.timer-resource-group { display: grid; gap: .9rem; }
.timer-resource-header h2, .timer-booking-group-head strong, .history-resource-group h3 { margin: 0; }
.timer-booking-group, .timer-loose-group { display: grid; gap: .7rem; }
.timer-booking-group-head {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  padding: .7rem .85rem;
  border-radius: .85rem;
  background: #f7faff;
  border: 1px solid var(--border);
}
.loose-group-label { margin-left: .2rem; }
.timer-card { position: relative; border-left: 6px solid transparent; display: flex; flex-direction: column; min-height: 100%; outline: 0 solid transparent; outline-offset: -2px; }
.timer-card .timer-card-header { display: flex; justify-content: space-between; gap: .75rem; align-items: start; margin-bottom: .85rem; }
.timer-card .timer-title { display: flex; gap: .6rem; align-items: start; }
.timer-card .timer-title h3 { margin: 0 0 .15rem; font-size: 1rem; }
.timer-card .timer-phase { font-weight: 600; font-size: .9rem; }
.timer-card.phase-ida_pista { box-shadow: inset 0 0 0 2px rgba(31,111,235,.15); }
.timer-card.phase-aviso_regresso { box-shadow: inset 0 0 0 3px rgba(181,71,8,.35); animation: pulse-warning 1.1s infinite; }
.timer-card.phase-fim_total { box-shadow: inset 0 0 0 3px rgba(180,35,24,.35); animation: pulse-finished 1s infinite; }
.timer-display {
  margin: .8rem 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .03em;
}

.label-compact { display: none; }
.timer-field label .label-full,
.timer-field label .label-compact,
.timer-phase .label-full,
.timer-phase .label-compact,
.timer-group-badge .label-full,
.timer-group-badge .label-compact {
  display: inline;
}
.history-resource-groups { display: grid; gap: 1rem; }
.history-resource-group { display: grid; gap: .75rem; }
.history-card {
  border-left: 6px solid var(--primary);
  border-radius: .9rem;
  border: 1px solid var(--border);
  background: #fafcff;
  padding: .8rem .9rem;
  display: grid;
  gap: .3rem;
}

@keyframes pulse-warning {
  0%, 100% { transform: none; }
  50% { transform: scale(1.01); }
}
@keyframes pulse-finished {
  0%, 100% { transform: none; }
  50% { transform: scale(1.015); }
}

@media (max-width: 900px) {
  .content-top-controls { grid-template-columns: 1fr; }
  .sound-toggle { position: static; justify-self: end; }
}


.hidden { display: none !important; }
.review-banner { margin-bottom: 1rem; }
.review-banner p { margin: .35rem 0 0; }
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 40, .45);
}
.modal-card {
  position: relative;
  width: min(92vw, 760px);
  max-height: 88vh;
  overflow: auto;
  z-index: 1;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
#multi-modal-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .6rem;
}
@media (max-width: 720px) {
  .modal-card { width: 100%; max-height: 92vh; }
  .modal-header { flex-direction: column; align-items: stretch; }
}

/* V0.9 overrides */
.agenda-block {
  background: var(--agenda-block-fill, inherit);
  color: var(--agenda-block-text, #ffffff);
  border: 1px solid rgba(17, 24, 39, .15);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.agenda-block small {
  font-size: .68rem;
  line-height: 1.1;
  opacity: .88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sub-resource-tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .22rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  font-size: .82rem;
}
.chip-row-wrap {
  row-gap: .4rem;
}
.beach-badge {
  background: color-mix(in srgb, var(--beach-color) 18%, white);
  border: 1px solid color-mix(in srgb, var(--beach-color) 50%, #d0d7de);
}
.inline-badge-strong {
  font-weight: 700;
}
.timer-field-inline {
  max-width: 11rem;
}
.timer-linked-booking {
  margin-top: .35rem;
}
.timer-action { margin-top: auto; align-self: flex-start; }
.timer-card.phase-em_curso {
  box-shadow: inset 0 0 0 2px rgba(31,111,235,.15);
}
.timer-card.phase-aviso_regresso {
  box-shadow: inset 0 0 0 3px rgba(181,71,8,.35);
  animation: pulse-warning 1.1s infinite;
}
.timer-card.phase-fim_total {
  box-shadow: inset 0 0 0 3px rgba(180,35,24,.35);
  animation: pulse-finished 1s infinite;
}
.unit-label {
  display: flex;
  align-items: center;
  gap: .35rem;
}

/* V0.9 overrides */
.content-top-main { display: grid; gap: .6rem; min-width: 0; }
.content-top-actions { display: grid; gap: .55rem; justify-items: end; position: sticky; top: 1rem; z-index: 25; align-self: start; }
.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fbff;
  padding: .35rem .7rem;
  font-size: .88rem;
}
.inline-badge-warning {
  background: #fff6e6;
  border-color: #f3d7a2;
  color: #9a5a00;
}

.group-row[class*="group-style-"] td {
  box-shadow: inset 0 -1px 0 rgba(208,215,222,.55);
}
.group-row.group-style-1 td,
.sub-resource-tag.group-style-1,
.table .inline-badge.group-style-1 { --group-color: #2563eb; }
.group-row.group-style-2 td,
.sub-resource-tag.group-style-2,
.table .inline-badge.group-style-2 { --group-color: #d97706; }
.group-row.group-style-3 td,
.sub-resource-tag.group-style-3,
.table .inline-badge.group-style-3 { --group-color: #059669; }
.group-row.group-style-4 td,
.sub-resource-tag.group-style-4,
.table .inline-badge.group-style-4 { --group-color: #c026d3; }
.group-row[class*="group-style-"] td {
  border-top: 2px solid color-mix(in srgb, var(--group-color) 60%, #d0d7de);
  border-bottom: 2px solid color-mix(in srgb, var(--group-color) 60%, #d0d7de);
}
.group-row[class*="group-style-"] td:first-child {
  border-left: 3px solid color-mix(in srgb, var(--group-color) 72%, #d0d7de);
}
.group-row[class*="group-style-"] td:last-child {
  border-right: 3px solid color-mix(in srgb, var(--group-color) 72%, #d0d7de);
}
.table .inline-badge[class*="group-style-"],
.sub-resource-tag[class*="group-style-"] {
  border-color: color-mix(in srgb, var(--group-color) 44%, #d0d7de);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--group-color) 18%, transparent);
}
.global-alert {
  border-left: 6px solid var(--alert-accent, var(--border));
}
.global-alert-actions { display: flex; justify-content: flex-end; }
.global-alert.is-acknowledged {
  opacity: .7;
  filter: saturate(.78);
}
.global-alert.is-acknowledged .global-alert-ack::after {
  content: ' ✓';
}
.effects-muted .timer-card.phase-aviso_regresso,
.effects-muted .timer-card.phase-fim_total {
  animation: none !important;
}
.timer-group-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .45rem;
}
.timer-group-button {
  min-height: 2.5rem;
  font-weight: 700;
  border-width: 2px;
}
.timer-group-button.group-style-1 { --group-color: #2563eb; color: #1e3a8a; border-color: color-mix(in srgb, #2563eb 36%, #d0d7de); background: color-mix(in srgb, #2563eb 8%, #ffffff); }
.timer-group-button.group-style-2 { --group-color: #d97706; color: #92400e; border-color: color-mix(in srgb, #d97706 36%, #d0d7de); background: color-mix(in srgb, #d97706 10%, #ffffff); }
.timer-group-button.group-style-3 { --group-color: #059669; color: #065f46; border-color: color-mix(in srgb, #059669 36%, #d0d7de); background: color-mix(in srgb, #059669 10%, #ffffff); }
.timer-group-button.group-style-4 { --group-color: #c026d3; color: #86198f; border-color: color-mix(in srgb, #c026d3 36%, #d0d7de); background: color-mix(in srgb, #c026d3 8%, #ffffff); }
.timer-group-button.is-selected {
  background: var(--group-color, var(--primary));
  color: #ffffff;
  border-color: var(--group-color, var(--primary));
}
.timer-group-badge.group-style-1,
.timer-card.group-active-1 { --group-color: #2563eb; }
.timer-group-badge.group-style-2,
.timer-card.group-active-2 { --group-color: #d97706; }
.timer-group-badge.group-style-3,
.timer-card.group-active-3 { --group-color: #059669; }
.timer-group-badge.group-style-4,
.timer-card.group-active-4 { --group-color: #c026d3; }
.timer-group-badge[class*="group-style-"],
.timer-card[class*="group-active-"] {
  border-color: color-mix(in srgb, var(--group-color) 44%, #d0d7de);
}
.timer-group-badge[class*="group-style-"] {
  background: color-mix(in srgb, var(--group-color) 10%, #ffffff);
  color: color-mix(in srgb, var(--group-color) 88%, #111827);
}
.timer-card[class*="group-active-"] {
  outline: 3px solid color-mix(in srgb, var(--group-color) 72%, #ffffff);
}

.timer-card.phase-fim_total {
  box-shadow: inset 0 0 0 3px rgba(180,35,24,.42);
  animation: pulse-finished-v09 .8s infinite;
}
@keyframes pulse-finished-v09 {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.018); }
}
.alert-popup-shell {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.alert-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 40, .5);
}
.alert-popup-card {
  position: relative;
  overflow: hidden;
  width: min(92vw, 520px);
  z-index: 1;
  display: grid;
  gap: 1rem;
  border: 1px solid color-mix(in srgb, var(--popup-color, #1f6feb) 44%, rgba(255,255,255,.72) 56%);
  color: var(--popup-text, #ffffff);
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(15, 23, 40, .28);
}
.alert-popup-card > * { position: relative; z-index: 1; }
.alert-popup-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--popup-color, #1f6feb);
  opacity: var(--popup-bg-opacity, .88);
  pointer-events: none;
}
.alert-popup-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.alert-popup-header h2 { margin: .15rem 0 0; }
.alert-popup-kicker { font-size: .82rem; opacity: .88; text-transform: uppercase; letter-spacing: .04em; }
.alert-popup-body { display: grid; gap: .55rem; }
.alert-popup-body p { margin: 0; }
.alert-popup-card .btn-secondary {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.28);
  color: inherit;
}
.timeline-header-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .85rem;
}
.timeline-header-row h2 { margin: 0 0 .2rem; }
.timeline-detail-box {
  min-width: min(100%, 360px);
  max-width: 460px;
  padding: .9rem 1rem;
  border-radius: 1rem;
  border: 1px solid #c7d8fb;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
  color: #0f1728;
  font-size: .94rem;
  box-shadow: 0 12px 28px rgba(15, 23, 40, .08);
}
.timeline-detail-box.is-active {
  border-color: #9cb7f5;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .16);
}
.timeline-detail-empty {
  color: #52607a;
  font-weight: 600;
}
.timeline-detail-kicker {
  font-size: .74rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #41516d;
  margin-bottom: .28rem;
  font-weight: 700;
}
.timeline-detail-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: .6rem;
}
.timeline-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem .75rem;
}
.timeline-detail-grid span {
  display: grid;
  gap: .18rem;
  padding: .45rem .55rem;
  border-radius: .8rem;
  background: rgba(255,255,255,.74);
  border: 1px solid rgba(156, 183, 245, .48);
}
.timeline-detail-grid strong {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #52607a;
}
.timeline-detail-grid em {
  font-style: normal;
  font-weight: 700;
  color: #0f1728;
}

.timeline-scroll-shell {
  overflow-x: auto;
  padding-bottom: .2rem;
}
.detailed-header {
  min-width: 1040px;
  grid-template-columns: repeat(12, minmax(72px, 1fr)) 48px;
  align-items: end;
}
.hour-cell {
  display: grid;
  gap: .18rem;
}
.hour-cell small,
.timeline-end-label {
  font-size: .72rem;
  color: var(--muted);
}
.unit-agenda-grid { min-width: 1040px; }
.unit-track::after,
.agenda-track::after {
  background-image:
    linear-gradient(to right, rgba(23,32,51,.14) 1px, transparent 1px),
    linear-gradient(to right, rgba(23,32,51,.06) 1px, transparent 1px);
  background-size:
    calc(100% / 12) 100%,
    calc(100% / 48) 100%;
}
.agenda-block {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.agenda-block:hover,
.agenda-block.is-focused,
.agenda-block:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(15, 23, 40, .28), 0 10px 18px rgba(15, 23, 40, .18);
  outline: none;
  z-index: 4;
}
@media (max-width: 1180px) {
  .split-wide { grid-template-columns: 1fr; }
  .timer-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .unit-row { grid-template-columns: 180px 1fr; }
}
@media (max-width: 900px) {
  .content-top-actions { justify-items: stretch; }
  .timeline-header-row { flex-direction: column; align-items: stretch; }
  .timeline-detail-box { max-width: none; min-width: 0; }
}
@media (max-width: 820px) {
  .unit-agenda-grid,
  .detailed-header { min-width: 900px; }
  .timer-group-buttons { grid-template-columns: repeat(4, minmax(48px, 1fr)); }
}
@media (max-width: 720px) {
  .content-top-actions { width: 100%; }
  .alert-popup-card { width: 100%; }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .timer-grid {
    grid-template-columns: repeat(var(--timer-card-count, 1), minmax(0, 1fr));
    gap: .55rem;
  }
  .timer-card { padding: .72rem; }
  .timer-card .timer-card-header { gap: .45rem; margin-bottom: .55rem; }
  .timer-card .timer-title h3 { font-size: .88rem; }
  .timer-card .timer-phase,
  .timer-linked-booking,
  .timer-card .muted,
  .timer-field label { font-size: .72rem; }
  .timer-display { margin: .5rem 0; font-size: 1.35rem; }
  .timer-field { margin-top: .45rem; }
  .timer-group-buttons { gap: .28rem; }
  .timer-group-button { min-height: 2rem; padding: .35rem .2rem; font-size: .82rem; }
  .timer-action { width: 100%; justify-content: center; }
  .timer-card select,
  .timer-card input { min-height: 2.2rem; padding: .42rem .5rem; font-size: .82rem; }
}

/* V0.9 hotfix 4 */
.global-alert-head {
  align-items: flex-start;
}
.global-alert-head > div:first-child {
  display: grid;
  gap: .2rem;
}
.global-alert-beach {
  font-size: .82rem;
  color: var(--muted);
}
.global-alert-countdown-wrap {
  display: grid;
  justify-items: end;
  gap: .2rem;
  text-align: right;
}
.global-alert-countdown-label {
  margin: 0;
}
.global-alert-countdown {
  font-size: 1.05rem;
  line-height: 1;
}
.global-alert-actions {
  gap: .55rem;
  flex-wrap: wrap;
}
.alert-popup-countdown-wrap {
  display: grid;
  gap: .28rem;
  margin-top: .15rem;
}
.alert-popup-countdown {
  font-size: 1.3rem;
  line-height: 1;
}
.alert-popup-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .global-alert-head {
    flex-direction: column;
    gap: .45rem;
  }
  .global-alert-countdown-wrap {
    justify-items: start;
    text-align: left;
  }
  .global-alert-actions {
    justify-content: stretch;
  }
  .global-alert-actions .btn {
    flex: 1 1 180px;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
  .content {
    padding: .6rem;
  }
  .page-header {
    margin-bottom: .45rem;
  }
  .page-header h1 {
    font-size: 1.55rem;
  }
  .page-header p {
    font-size: .76rem;
  }
  .panel {
    border-radius: .8rem;
  }
  .content-top-controls {
    gap: .45rem;
  }
  .scope-chip {
    font-size: .76rem;
    padding: .24rem .5rem;
  }
  .content-top-actions {
    gap: .34rem;
    top: .55rem;
  }
  .content-top-actions .btn {
    padding: .42rem .58rem;
    font-size: .76rem;
    min-height: 2.3rem;
  }
  .timer-resource-group.panel {
    padding: .6rem;
    gap: .45rem;
  }
  .timer-resource-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .28rem .55rem;
    align-items: end;
  }
  .timer-resource-header h2 {
    font-size: 1rem;
  }
  .timer-resource-header .small-text,
  .timer-resource-header .muted {
    font-size: .7rem;
    text-align: right;
  }
  .timer-grid {
    grid-template-columns: repeat(var(--timer-card-count, 1), minmax(0, 1fr));
    gap: .38rem;
    margin-bottom: 0;
  }
  .timer-card {
    padding: .55rem;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: .28rem .34rem;
    align-items: start;
    border-radius: .85rem;
  }
  .timer-card > .timer-card-header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .18rem .28rem;
    align-items: start;
    margin-bottom: .08rem;
  }
  .timer-card .timer-title {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .26rem;
    min-width: 0;
    align-items: start;
  }
  .timer-card .timer-title > div {
    min-width: 0;
    display: grid;
    gap: .04rem;
  }
  .timer-card .timer-title h3 {
    font-size: .82rem;
    line-height: 1.06;
    margin: 0;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
    max-height: 2.12em;
  }
  .timer-card .timer-title .muted {
    font-size: .64rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .timer-card .chip-row {
    display: grid;
    justify-items: end;
    align-content: start;
    gap: .14rem;
    min-width: 0;
  }
  .timer-card .inline-badge,
  .timer-card .timer-phase {
    font-size: .6rem;
    padding: .12rem .28rem;
    line-height: 1.05;
    white-space: nowrap;
  }
  .timer-card .timer-phase .label-full,
  .timer-card .timer-group-badge .label-full,
  .timer-card .timer-field label .label-full {
    display: none;
  }
  .timer-card .timer-phase .label-compact,
  .timer-card .timer-group-badge .label-compact,
  .timer-card .timer-field label .label-compact {
    display: inline;
  }
  .timer-linked-booking {
    display: none;
  }
  .timer-field {
    margin-top: 0;
    min-width: 0;
  }
  .timer-field label {
    font-size: .62rem;
    margin-bottom: .12rem;
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    line-height: 1.05;
  }
  .timer-field-duration {
    grid-column: 1 / 2;
  }
  .timer-field-discount {
    grid-column: 2 / 3;
  }
  .timer-field-group {
    grid-column: 1 / -1;
  }
  .timer-card select,
  .timer-card input {
    min-height: 1.9rem;
    padding: .18rem .34rem;
    font-size: .74rem;
    border-radius: .52rem;
    width: 100%;
  }
  .timer-group-buttons {
    gap: .16rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .timer-group-button {
    min-height: 1.75rem;
    padding: .14rem .08rem;
    font-size: .72rem;
    border-radius: .48rem;
    min-width: 0;
  }
  .timer-display {
    grid-column: 1 / 2;
    margin: .08rem 0 0;
    font-size: 1.1rem;
    line-height: 1;
    letter-spacing: .01em;
    text-align: left;
    align-self: center;
  }
  .timer-action {
    grid-column: 2 / 3;
    align-self: center;
    justify-self: stretch;
    width: 100%;
    margin-top: 0;
    min-height: 1.9rem;
    padding: .28rem .38rem;
    font-size: .74rem;
    border-radius: .52rem;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) and (max-height: 740px) {
  .flash-stack,
  .notification-center-stack {
    margin-bottom: .48rem;
  }
  .global-alert-stack {
    gap: .42rem;
  }
  .global-alert {
    padding: .56rem .68rem;
  }
  .global-alert-body {
    font-size: .8rem;
  }
}


/* V0.9 hotfix 6 */
.content-top-actions {
  position: sticky;
  top: .75rem;
  align-self: start;
  display: grid;
  gap: .5rem;
  z-index: 12;
}
.content-top-actions .btn {
  justify-content: center;
}
.screen-toggle { white-space: nowrap; }

body.fullscreen-mode .mobile-topbar {
  display: none;
}
body.fullscreen-mode.page-timers .content {
  padding-top: .6rem;
}
body.fullscreen-mode.page-timers .page-header {
  margin-bottom: .55rem;
}
body.fullscreen-mode.page-timers .page-header p,
body.fullscreen-mode.page-timers .flash-stack,
body.fullscreen-mode.page-timers #notification-center {
  display: none;
}
body.fullscreen-mode.page-timers .content-top-controls {
  margin-bottom: .55rem;
}
body.fullscreen-mode.page-timers .scope-chip {
  padding: .22rem .5rem;
  font-size: .78rem;
}
body.fullscreen-mode.page-timers .panel,
body.fullscreen-mode.page-timers .timer-resource-group.panel {
  box-shadow: 0 4px 14px rgba(18,39,76,.04);
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
  .content-top-actions {
    top: .48rem;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) and (max-height: 740px) {
  .mobile-topbar {
    margin-bottom: .45rem;
  }
  .mobile-topbar-title span {
    display: none;
  }
  .content {
    padding-top: .65rem;
  }
  .content-top-controls {
    gap: .45rem;
    margin-bottom: .65rem;
  }
  .scope-chip {
    padding: .22rem .46rem;
    font-size: .76rem;
  }
  .flash-stack,
  #notification-center {
    margin-bottom: .45rem;
  }
  .page-header {
    margin-bottom: .55rem;
  }
  .page-header p {
    margin-top: .18rem;
    font-size: .76rem;
    line-height: 1.15;
  }
  .timer-card .color-pill {
    width: 11px;
    height: 11px;
    margin-top: .12rem;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) and (max-height: 620px) {
  .page-header p,
  .flash-stack,
  #notification-center {
    display: none;
  }
  .content-top-controls {
    margin-bottom: .42rem;
  }
  .mobile-topbar {
    margin-bottom: .26rem;
  }
  .scope-chip {
    font-size: .7rem;
  }
  .timer-resource-group.panel {
    padding: .5rem;
  }
  .timer-card {
    padding: .46rem;
    gap: .2rem .22rem;
  }
  .timer-card .timer-title h3 {
    font-size: .74rem;
  }
  .timer-card .timer-title .muted {
    font-size: .56rem;
  }
  .timer-card .inline-badge,
  .timer-card .timer-phase {
    font-size: .55rem;
    padding: .08rem .22rem;
  }
  .timer-card select,
  .timer-card input {
    min-height: 1.64rem;
    font-size: .66rem;
    padding: .12rem .22rem;
  }
  .timer-group-button {
    min-height: 1.46rem;
    font-size: .62rem;
  }
  .timer-display {
    font-size: .98rem;
  }
  .timer-action {
    min-height: 1.62rem;
    font-size: .66rem;
    padding: .18rem .26rem;
  }
}


.alert-settings-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; margin-top: .35rem; }
.alert-settings-preview { position: relative; overflow: hidden; border-radius: .95rem; padding: 1rem; background: #fff; border: 1px solid var(--border); display: grid; gap: .35rem; }
.alert-settings-preview > * { position: relative; z-index: 1; }
.alert-settings-preview::before { content: ""; position: absolute; inset: 0; opacity: var(--preview-opacity, .2); pointer-events: none; background: var(--preview-color, #1f6feb); }
.form-actions-inline { display: flex; justify-content: flex-start; align-items: center; gap: .75rem; }

.live-update-layout { align-items: start; }
.live-update-info-strip { align-items: center; }
.live-update-candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .9rem;
  margin-bottom: 1rem;
}
.live-update-candidate-grid div { display: grid; gap: .2rem; }
.live-update-steps { display: grid; gap: .75rem; }
.live-update-step {
  border: 1px solid var(--border);
  border-radius: .9rem;
  padding: .85rem .9rem;
  background: #fbfcff;
}
.live-update-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .35rem;
}
.live-update-step.status-done { border-color: #b8e5ca; background: #f4fbf6; }
.live-update-step.status-current { border-color: #c7d8fb; background: #f7faff; }
.live-update-step.status-error { border-color: #f2c2be; background: #fff8f7; }
.live-update-step.status-pending { opacity: .88; }
.live-update-status-pill.status-completed,
.live-update-status-pill.status-success,
.live-update-log-entry.level-success { background: #e8f7ef; color: var(--success); border-color: #b8e5ca; }
.live-update-status-pill.status-failed-with-rollback,
.live-update-status-pill.status-rollback-in-progress,
.live-update-log-entry.level-warning { background: #fff6e6; color: var(--warning); border-color: #f3d7a2; }
.live-update-status-pill.status-rollback-failed,
.live-update-status-pill.status-failed,
.live-update-log-entry.level-error { background: #fef0ef; color: var(--danger); border-color: #f2c2be; }
.live-update-status-pill.status-validated,
.live-update-status-pill.status-uploading,
.live-update-status-pill.status-validating,
.live-update-status-pill.status-queued,
.live-update-status-pill.status-apply-in-progress,
.live-update-status-pill.status-backup-in-progress,
.live-update-status-pill.status-restart-in-progress,
.live-update-status-pill.status-post-validation-in-progress,
.live-update-log-entry.level-info { background: #f4f8ff; color: var(--primary); border-color: #c7d8fb; }
.live-update-timeline { display: grid; gap: .6rem; }
.live-update-log-entry {
  border: 1px solid var(--border);
  border-radius: .85rem;
  padding: .75rem .85rem;
  background: #fff;
}
.live-update-log-entry strong { display: block; margin-bottom: .25rem; }
.live-update-log-entry p { margin: 0; }
.live-update-policy-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .55rem; }

/* V1.3 UI retouches */
.timer-card .timer-title h3 {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  hyphens: auto;
  overflow-wrap: break-word;
  word-break: normal;
  min-height: 2.12em;
  max-height: 2.12em;
}
.timer-card .timer-title > div {
  min-height: 2.9rem;
}
.timer-card .chip-row {
  justify-items: end;
  align-self: start;
}
.timer-card .timer-phase,
.timer-card .inline-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-card .timer-phase .label-full,
.timer-card .timer-group-badge .label-full,
.timer-card .timer-field label .label-full {
  display: none !important;
}
.timer-card .timer-phase .label-compact,
.timer-card .timer-group-badge .label-compact,
.timer-card .timer-field label .label-compact {
  display: inline !important;
}
.timer-card-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.timer-card-actions .btn {
  flex: 1 1 0;
}
.timer-half-time-badge {
  background: #0f766e;
  color: #fff;
  border-color: rgba(255,255,255,.18);
}
.timer-action.timer-action-finish,
.global-alert-finish,
.alert-popup-finish {
  border: 2px solid rgba(255,255,255,.96);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}
.timer-action.timer-action-finish:focus,
.global-alert-finish:focus,
.alert-popup-finish:focus {
  outline: 2px solid rgba(255,255,255,.96);
  outline-offset: 1px;
}
.popups-muted .alert-popup-shell {
  display: none !important;
}
@media (max-width: 900px) {
  .timer-card .timer-title h3 {
    font-size: .82rem;
    line-height: 1.1;
    min-height: 2.2em;
    max-height: 2.2em;
  }
  .timer-card-actions {
    grid-column: 1 / -1;
  }
  .notification-popup-card {
    width: 100%;
  }
}

/* V1.4 alerts, half-time and timer backgrounds */
:root {
  --beachops-interval-bg-opacity: 0.12;
  --beachops-return-bg-opacity: 0.78;
  --beachops-finish-bg-opacity: 0.88;
}

.timer-card {
  isolation: isolate;
  overflow: hidden;
}
.timer-card > * {
  position: relative;
  z-index: 1;
}
.timer-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--timer-state-color, var(--timer-color, #1f6feb));
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 0;
}
.timer-card.phase-em_curso::before,
.timer-card.phase-sem_tempo::before {
  opacity: var(--timer-interval-bg-opacity, var(--beachops-interval-bg-opacity));
}
.timer-card.phase-aviso_regresso::before {
  opacity: var(--timer-return-bg-opacity, var(--beachops-return-bg-opacity));
}
.timer-card.phase-fim_total::before {
  opacity: var(--timer-finish-bg-opacity, var(--beachops-finish-bg-opacity));
}
.timer-card.phase-aviso_regresso,
.timer-card.phase-fim_total {
  color: var(--alert-text, #ffffff);
}
.timer-card.phase-aviso_regresso .muted,
.timer-card.phase-fim_total .muted,
.timer-card.phase-aviso_regresso .timer-phase,
.timer-card.phase-fim_total .timer-phase,
.timer-card.phase-aviso_regresso .timer-field label,
.timer-card.phase-fim_total .timer-field label,
.timer-card.phase-aviso_regresso .timer-title .muted,
.timer-card.phase-fim_total .timer-title .muted {
  color: color-mix(in srgb, #ffffff 84%, rgba(255,255,255,.55));
}
.timer-card.phase-aviso_regresso select,
.timer-card.phase-aviso_regresso input,
.timer-card.phase-fim_total select,
.timer-card.phase-fim_total input {
  background: rgba(255,255,255,.88);
  color: #172033;
}
.timer-half-time-toggle {
  margin-top: .35rem;
}
.timer-half-time-toggle span {
  font-weight: 600;
}
.timer-half-time-toggle.is-disabled {
  opacity: .72;
}
.global-alert-half {
  border-left-color: color-mix(in srgb, var(--alert-accent, #1f6feb) 72%, #d0d7de);
}
.alert-popup-half .alert-popup-card,
.alert-popup-half.alert-popup-card {
  border-color: color-mix(in srgb, var(--popup-color, #1f6feb) 44%, rgba(255,255,255,.72) 56%);
}

/* V1.5 consolidation */
.content-top-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem 1rem;
  margin-bottom: .45rem;
}
.content-top-main {
  display: flex;
  align-items: center;
  min-height: 0;
  gap: .5rem;
}
.content-top-actions {
  position: static;
  top: auto;
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
  width: auto;
}
.content-top-actions .btn {
  min-height: 2.45rem;
  padding: .5rem .78rem;
  white-space: nowrap;
}
.content-top-alerts {
  margin-bottom: 1rem;
}
.content-top-alerts[hidden],
#notification-center:empty,
#global-timer-alerts:empty {
  display: none !important;
}
.scope-chip {
  margin: 0;
}
@media (max-width: 980px) {
  .content-top-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .content-top-actions {
    justify-content: flex-end;
  }
}
@media (max-width: 720px) {
  .content-top-actions {
    justify-content: stretch;
  }
  .content-top-actions .btn {
    flex: 1 1 calc(50% - .45rem);
  }
}


/* V1.6 operational UX */
.timer-layout-toolbar {
  margin-top: .9rem;
  display: flex;
  justify-content: flex-end;
}
.timer-layout-toolbar label {
  min-width: min(100%, 220px);
}
.timer-grid.timer-grid-manual {
  grid-template-columns: repeat(var(--timer-grid-columns, 2), minmax(0, 1fr));
}
.timer-card .timer-card-header,
.timer-card .timer-title,
.timer-card .timer-title > div,
.timer-card .chip-row {
  min-width: 0;
}
.timer-card .timer-title {
  align-items: flex-start;
}
.timer-card .timer-title > div {
  display: grid;
  gap: .14rem;
}
.timer-card .timer-title h3 {
  line-height: 1.18;
  min-height: 2.36em;
  max-height: 2.36em;
}
.timer-card .timer-title .muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-half-time-toggle {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  text-align: center;
  padding-top: .15rem;
}
.timer-half-time-toggle input {
  margin: 0;
  width: auto;
}
.timer-card .chip-row {
  justify-items: end;
  align-content: start;
}
@media (max-width: 900px) {
  .timer-grid.timer-grid-manual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .timer-layout-toolbar {
    justify-content: stretch;
  }
  .timer-layout-toolbar label {
    width: 100%;
  }
}
@media (max-width: 620px) {
  .timer-grid.timer-grid-manual {
    grid-template-columns: 1fr;
  }
}

.integrity-badge-critical { background: #fef0ef; color: var(--danger); border-color: #f2c2be; }
.integrity-badge-noncritical { background: #fff6e6; color: var(--warning); border-color: #f3d7a2; }
.integrity-issue-list { display: grid; gap: .75rem; margin-top: 1rem; }
.integrity-issue-item { display: grid; gap: .4rem; }
.integrity-shell-wide { width: min(96vw, 980px); }
.integrity-standalone-panel { display: grid; gap: 1rem; }
code { word-break: break-word; }

/* V2.5.0 base styles inherited from V2.4.2 hotfix */
.header-radio-widget {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: .95rem;
  background: rgba(255,255,255,.88);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
}
.header-radio-widget audio {
  display: none;
}
.radio-power-toggle,
.radio-station-toggle {
  white-space: nowrap;
}
.radio-volume-control {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: 0 .15rem;
  color: var(--muted);
  min-height: 40px;
}
.radio-volume-control span {
  font-size: .88rem;
  font-weight: 600;
}
.radio-volume-control input[type="range"] {
  width: 110px;
  padding: 0;
  border: 0;
  background: transparent;
}
.header-radio-widget[data-radio-status="playing"] {
  border-color: #b8e5ca;
  background: #f4fbf6;
}
.header-radio-widget[data-radio-status="suppressed"],
.header-radio-widget[data-radio-suppressed="1"] {
  border-color: #f3d7a2;
  background: #fff9ef;
}
.header-radio-widget[data-radio-status="error"] {
  border-color: #f2c2be;
  background: #fff8f7;
}
.header-radio-widget[data-radio-status="loading"] {
  border-color: #c7d8fb;
  background: #f7faff;
}
@media (max-width: 1120px) {
  .header-radio-widget {
    width: 100%;
    justify-content: flex-start;
  }
}
@media (max-width: 640px) {
  .header-radio-widget {
    justify-content: stretch;
  }
  .radio-power-toggle,
  .radio-station-toggle {
    width: 100%;
  }
  .radio-volume-control {
    width: 100%;
    justify-content: space-between;
  }
  .radio-volume-control input[type="range"] {
    width: min(100%, 180px);
  }
}


/* V2.5.0 timer readability, presets and per-row timeline ruler */
.timer-layout-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  align-items: end;
}
.timer-layout-toolbar label {
  min-width: 220px;
}
.timer-resource-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .9rem;
  margin-bottom: .85rem;
}
.timer-card {
  gap: .65rem;
}
.timer-card .timer-title {
  width: 100%;
  display: grid;
  gap: .35rem;
  min-width: 0;
}
.timer-card .timer-name-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .62rem .8rem;
  border-radius: .95rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.timer-card .timer-title h3 {
  margin: 0;
  min-height: auto;
  max-height: none;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: .01em;
  display: block;
}
.timer-card .timer-title-meta {
  text-align: center;
  font-weight: 600;
}
.timer-card .timer-card-header {
  align-items: start;
}
.timer-card .chip-row {
  justify-content: flex-end;
  align-self: start;
}
.timer-display {
  font-weight: 800;
  line-height: 1;
  letter-spacing: .03em;
  margin: .5rem 0 .15rem;
}
.timer-grid-preset-compact .timer-card {
  padding: .75rem;
}
.timer-grid-preset-compact .timer-name-banner {
  min-height: 3.25rem;
}
.timer-grid-preset-compact .timer-card .timer-title h3 {
  font-size: 1rem;
}
.timer-grid-preset-compact .timer-display {
  font-size: clamp(2rem, 3vw, 2.55rem);
}
.timer-grid-preset-balanced .timer-card {
  padding: .95rem;
}
.timer-grid-preset-balanced .timer-name-banner {
  min-height: 3.8rem;
}
.timer-grid-preset-balanced .timer-card .timer-title h3 {
  font-size: 1.15rem;
}
.timer-grid-preset-balanced .timer-display {
  font-size: clamp(2.5rem, 4vw, 3.25rem);
}
.timer-grid-preset-large .timer-card {
  padding: 1.08rem;
}
.timer-grid-preset-large .timer-name-banner {
  min-height: 4.35rem;
}
.timer-grid-preset-large .timer-card .timer-title h3 {
  font-size: 1.35rem;
}
.timer-grid-preset-large .timer-display {
  font-size: clamp(2.9rem, 4.9vw, 3.85rem);
}
.unit-agenda-grid {
  gap: 1.15rem;
}
.unit-row {
  align-items: start;
}
.unit-track-shell {
  display: grid;
  gap: .3rem;
  min-width: 0;
}
.unit-timeline-ruler {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0;
  font-size: .68rem;
  color: var(--muted);
}
.unit-timeline-ruler .hour-cell {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  padding: 0 .18rem;
}
.unit-timeline-ruler .hour-cell small {
  font-size: .58rem;
  opacity: .85;
}
.unit-timeline-ruler .hour-cell:last-child {
  align-items: flex-end;
  text-align: right;
}
@media (max-width: 980px) {
  .timer-layout-toolbar label {
    min-width: 180px;
  }
  .unit-row {
    grid-template-columns: 1fr;
  }
  .unit-label {
    margin-bottom: .15rem;
  }
}
@media (max-width: 760px) {
  .unit-timeline-ruler {
    font-size: .6rem;
  }
  .unit-timeline-ruler .hour-cell small {
    font-size: .52rem;
  }
  .timer-grid-preset-large .timer-display,
  .timer-grid-preset-balanced .timer-display,
  .timer-grid-preset-compact .timer-display {
    font-size: clamp(1.95rem, 8vw, 2.8rem);
  }
}


/* V2.6.2 timer header/state refinement */
.timer-card .timer-phase-inline {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .3rem;
  min-height: 1.2rem;
}
@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
  .timer-card .timer-phase-inline {
    gap: .18rem;
  }
  .timer-card .timer-state-prefix {
    font-size: .56rem;
  }
}


.list-plain {
  margin: 0;
  padding-left: 1.1rem;
}

.list-plain.ordered {
  list-style: decimal;
}

.compact-list > div {
  margin-bottom: 0.35rem;
}

.compact-toolbar {
  gap: 0.4rem;
  flex-wrap: wrap;
}

.notification-focused,
.global-alert-focused {
  outline: 3px solid rgba(14, 165, 233, 0.9);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.18);
}


/* V2.7.2 mobile app shell */
body.app-shell .content-top-controls {
  align-items: start;
  gap: .45rem .75rem;
  margin-bottom: .35rem;
}
body.app-shell .content-top-actions-shell {
  display: grid;
  justify-items: end;
  gap: .4rem;
  width: auto;
}
body.app-shell .content-top-toggle {
  min-height: 2.35rem;
  padding: .45rem .8rem;
  white-space: nowrap;
}
body.app-shell .content-top-actions-collapsible {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
  width: auto;
  padding: .55rem;
  border: 1px solid var(--border);
  border-radius: .85rem;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 24px rgba(16,24,40,.08);
}
body.app-shell .content-top-actions-collapsible[hidden] {
  display: none !important;
}
body.app-shell .content-top-actions-collapsible .btn {
  min-height: 2.35rem;
}
body.app-shell .content-top-main {
  min-height: 2.35rem;
}
@media (max-width: 980px) {
  body.app-shell .content-top-controls {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}
@media (max-width: 720px) {
  body.app-shell .content-top-controls {
    grid-template-columns: 1fr;
  }
  body.app-shell .content-top-actions-shell {
    justify-items: stretch;
  }
  body.app-shell .content-top-actions-collapsible {
    justify-content: stretch;
  }
  body.app-shell .content-top-actions-collapsible .btn {
    flex: 1 1 calc(50% - .45rem);
  }
}


.timer-provisional-banner {
  border: 1px dashed rgba(15, 23, 42, .18);
  background: rgba(255, 248, 220, .85);
  color: #6b4f00;
  border-radius: .8rem;
  padding: .6rem .75rem;
  font-size: .88rem;
  font-weight: 700;
  text-align: center;
}
.timer-grid-preset-compact .timer-card {
  gap: .5rem;
}
.timer-grid-preset-compact .timer-card .timer-field label {
  font-size: .78rem;
}
.timer-grid-preset-compact .timer-card select,
.timer-grid-preset-compact .timer-card input,
.timer-grid-preset-compact .timer-card .timer-group-button,
.timer-grid-preset-compact .timer-card .timer-action {
  min-height: 2.2rem;
  padding: .38rem .48rem;
  font-size: .82rem;
}
.timer-grid-preset-compact .timer-card .timer-action {
  min-width: 100%;
}
.timer-grid-preset-balanced .timer-card {
  gap: .7rem;
}
.timer-grid-preset-balanced .timer-card .timer-field label {
  font-size: .9rem;
}
.timer-grid-preset-balanced .timer-card select,
.timer-grid-preset-balanced .timer-card input,
.timer-grid-preset-balanced .timer-card .timer-group-button,
.timer-grid-preset-balanced .timer-card .timer-action {
  min-height: 2.6rem;
  padding: .5rem .65rem;
  font-size: .92rem;
}
.timer-grid-preset-balanced .timer-card .timer-action {
  min-width: 100%;
}
.timer-grid-preset-large .timer-card {
  gap: .85rem;
}
.timer-grid-preset-large .timer-card .timer-field label {
  font-size: 1rem;
}
.timer-grid-preset-large .timer-card select,
.timer-grid-preset-large .timer-card input,
.timer-grid-preset-large .timer-card .timer-group-button,
.timer-grid-preset-large .timer-card .timer-action {
  min-height: 3rem;
  padding: .62rem .78rem;
  font-size: 1rem;
}
.timer-grid-preset-large .timer-card .timer-action {
  min-width: 100%;
}
.timer-grid-preset-large .timer-card .timer-name-banner {
  padding: .82rem .95rem;
}


.timer-board-fotos {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}
.timer-board-fotos .timer-resource-group {
  height: 100%;
}
.timer-board-fotos .timer-resource-header {
  margin-bottom: .75rem;
}
.timer-board-fotos .timer-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.timer-card-readonly .timer-readonly-meta {
  line-height: 1.35;
}
@media (max-width: 900px) {
  .timer-board-fotos {
    grid-template-columns: 1fr;
  }
  .timer-board-fotos .timer-grid {
    grid-template-columns: 1fr;
  }
}


/* V3.0.1 hotfix: modo Fotos em móvel deve manter o máximo de recursos visível sem interação */
.page-header-photos {
  margin-bottom: .55rem;
}
.photo-mode-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .35rem;
}
.timer-board-fotos {
  gap: .65rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.timer-board-fotos .timer-resource-group.panel {
  padding: .55rem;
  gap: .45rem;
}
.timer-board-fotos .timer-resource-header {
  margin-bottom: .3rem;
}
.timer-board-fotos .timer-resource-header h2 {
  font-size: .95rem;
  line-height: 1.1;
}
.timer-board-fotos .timer-resource-header .muted,
.timer-board-fotos .timer-resource-header .small-text,
.timer-board-fotos .timer-card-readonly .timer-card-actions {
  display: none;
}
.timer-board-fotos .timer-grid {
  gap: .38rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.timer-board-fotos .timer-card {
  padding: .48rem;
  gap: .18rem .24rem;
}
.timer-board-fotos .timer-card .timer-card-header {
  margin-bottom: .12rem;
}
.timer-board-fotos .timer-card .timer-title {
  gap: .22rem;
}
.timer-board-fotos .timer-card .timer-name-banner {
  min-height: 0;
  padding: .4rem .5rem;
}
.timer-board-fotos .timer-card .timer-title h3 {
  font-size: .8rem;
  line-height: 1.05;
}
.timer-board-fotos .timer-card .timer-phase,
.timer-board-fotos .timer-card .inline-badge {
  font-size: .58rem;
  padding: .08rem .2rem;
}
.timer-board-fotos .timer-card .chip-row {
  gap: .18rem;
}
.timer-board-fotos .timer-card .timer-display {
  font-size: clamp(1.1rem, 4.6vw, 2rem);
  line-height: .95;
  margin: .1rem 0 0;
}
.timer-board-fotos .timer-card .timer-readonly-meta,
.timer-board-fotos .timer-card .timer-linked-booking,
.timer-board-fotos .timer-card .timer-provisional-banner {
  font-size: .58rem;
  line-height: 1.15;
}
@media (max-width: 900px) {
  .page-header-photos {
    margin-bottom: .35rem;
  }
  .page-header-photos h1 {
    margin-bottom: .12rem;
  }
  .photo-mode-header-meta {
    gap: .28rem;
    margin-top: .2rem;
  }
  .photo-mode-header-meta .inline-badge {
    font-size: .62rem;
    padding: .12rem .3rem;
  }
  .timer-board-fotos {
    grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
    gap: .4rem;
  }
  .timer-board-fotos .timer-resource-group.panel {
    padding: .4rem;
    gap: .3rem;
  }
  .timer-board-fotos .timer-resource-header {
    grid-template-columns: 1fr;
    gap: .12rem;
    margin-bottom: .18rem;
  }
  .timer-board-fotos .timer-resource-header h2 {
    font-size: .78rem;
  }
  .timer-board-fotos .timer-grid {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: .28rem;
  }
  .timer-board-fotos .timer-card {
    padding: .34rem;
    border-radius: .62rem;
    gap: .12rem .16rem;
  }
  .timer-board-fotos .timer-card .timer-card-header {
    gap: .1rem .16rem;
    margin-bottom: 0;
  }
  .timer-board-fotos .timer-card .timer-title {
    grid-template-columns: 1fr;
    gap: .1rem;
  }
  .timer-board-fotos .timer-card .timer-name-banner {
    padding: .26rem .34rem;
    border-radius: .45rem;
  }
  .timer-board-fotos .timer-card .timer-title h3 {
    font-size: .68rem;
  }
  .timer-board-fotos .timer-card .timer-phase,
  .timer-board-fotos .timer-card .inline-badge {
    font-size: .5rem;
    padding: .05rem .14rem;
  }
  .timer-board-fotos .timer-card .timer-display {
    font-size: clamp(1rem, 6vw, 1.55rem);
  }
  .timer-board-fotos .timer-card .timer-readonly-meta,
  .timer-board-fotos .timer-card .timer-linked-booking,
  .timer-board-fotos .timer-card .timer-provisional-banner {
    font-size: .5rem;
  }
}
@media (max-width: 420px) {
  .timer-board-fotos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .timer-board-fotos .timer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* V3.0.4 hotfix: modo Fotos mobile realmente compacto e legível */
.page-header-photos .page-title-photos {
  margin-bottom: .08rem;
}
@media (max-width: 900px) {
  .page-header-photos {
    margin-bottom: .3rem;
  }
  .page-header-photos .page-title-photos {
    font-size: clamp(1.2rem, 6.4vw, 1.55rem);
    line-height: .95;
    letter-spacing: -.02em;
  }
  .photo-mode-header-meta {
    margin-top: .12rem;
  }
  .photo-mode-header-meta .inline-badge {
    font-size: .56rem;
    padding: .08rem .24rem;
  }
  .timer-board-fotos .timer-resource-group.panel {
    padding: .3rem;
    border-radius: .8rem;
  }
  .timer-board-fotos .timer-resource-header {
    margin-bottom: .12rem;
  }
  .timer-board-fotos .timer-resource-header h2 {
    font-size: .7rem;
    line-height: 1;
  }
  .timer-board-fotos .timer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .2rem;
  }
  .timer-board-fotos .timer-card {
    padding: .24rem;
    border-radius: .52rem;
    gap: .06rem;
  }
  .timer-board-fotos .timer-card .timer-card-header {
    margin-bottom: 0;
  }
  .timer-board-fotos .timer-card .timer-title {
    gap: .08rem;
  }
  .timer-board-fotos .timer-card .timer-name-banner {
    padding: .16rem .18rem;
    border-radius: .34rem;
  }
  .timer-board-fotos .timer-card .timer-title h3 {
    font-size: .72rem;
    line-height: .9;
    word-break: normal;
    overflow-wrap: break-word;
  }
  .timer-board-fotos .timer-card .timer-phase,
  .timer-board-fotos .timer-card .inline-badge {
    font-size: .52rem;
    padding: .03rem .08rem;
  }
  .timer-board-fotos .timer-card .timer-readonly-meta {
    font-size: .66rem;
    line-height: 1;
    margin-top: .02rem;
  }
  .timer-board-fotos .timer-card .timer-compact-note {
    min-height: 0;
    padding: .08rem .14rem;
    border-radius: .34rem;
    font-size: .54rem;
    line-height: .95;
    margin-top: .02rem;
  }
  .timer-board-fotos .timer-card .timer-display {
    font-size: clamp(1.45rem, 8.2vw, 2rem);
    line-height: .88;
    margin: .06rem 0 0;
    letter-spacing: -.03em;
  }
}
@media (max-width: 420px) {
  .page-header-photos .page-title-photos {
    font-size: 1.08rem;
  }
  .timer-board-fotos .timer-card .timer-title h3 {
    font-size: .68rem;
  }
  .timer-board-fotos .timer-card .timer-display {
    font-size: clamp(1.34rem, 9vw, 1.85rem);
  }
}



/* V3.1.1 ajuste fino adicional: resumo centrado e contorno simples por grupo no modo Fotos */
.timer-board-fotos .timer-card .timer-readonly-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  justify-self: stretch;
}
.timer-board-fotos .timer-card-readonly[class*="group-active-"] {
  outline: 3px solid color-mix(in srgb, var(--group-color) 78%, #ffffff);
  outline-offset: 0;
  border: 2px solid color-mix(in srgb, var(--group-color) 56%, #d0d7de);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--group-color) 20%, transparent);
}

/* V3.1.1 mobile timers: menu de controlos secundários reutilizado também fora do app shell */
.content-top-actions-shell {
  display: grid;
  justify-items: end;
  gap: .4rem;
  width: auto;
}
.content-top-toggle {
  display: none;
}
.content-top-actions-shell-collapsible .content-top-toggle {
  min-height: 2.35rem;
  padding: .45rem .8rem;
  white-space: nowrap;
}
.content-top-actions-shell-collapsible .content-top-actions-collapsible {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
  width: auto;
  padding: .55rem;
  border: 1px solid var(--border);
  border-radius: .85rem;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 24px rgba(16,24,40,.08);
}
.content-top-actions-shell-collapsible .content-top-actions-collapsible[hidden] {
  display: none !important;
}
.content-top-actions-shell-collapsible .content-top-actions-collapsible .btn {
  min-height: 2.35rem;
}
@media (max-width: 900px) {
  body.page-timers .content-top-controls,
  body.app-shell .content-top-controls {
    grid-template-columns: 1fr;
    gap: .45rem;
    margin-bottom: .55rem;
  }
  body.page-timers .content-top-actions,
  body.app-shell .content-top-actions {
    position: static;
    top: auto;
    z-index: auto;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] {
    justify-items: stretch;
    width: 100%;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-toggle {
    display: inline-flex;
    width: 100%;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible {
    width: 100%;
    justify-content: stretch;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible .btn {
    flex: 1 1 calc(50% - .45rem);
  }
}
@media (max-width: 560px) {
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible .btn,
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible .header-radio-widget {
    flex: 1 1 100%;
  }
}

/* V3.1.1 Fotos mobile vertical: o recurso/grupo tem de usar a largura útil total */
@media (max-width: 900px) and (orientation: portrait) {
  .timer-board-fotos {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 560px) {
  .timer-board-fotos {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 340px) {
  .timer-board-fotos .timer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* V3.4 - Segurança de acessos */
.section-inline-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.section-inline-head h2 { margin-top: 0; }
.section-inline-head form { margin: 0; }
.roadmap-card-grid { margin-top: .85rem; }
.audit-ok {
  background: #e8f7ef;
  border-color: #b8e5ca;
  color: var(--success);
}
.audit-fail {
  background: #fff6e6;
  border-color: #f3d7a2;
  color: var(--warning);
}
@media (max-width: 720px) {
  .section-inline-head { flex-direction: column; }
  .section-inline-head form, .section-inline-head .btn { width: 100%; }
}

/* V3.5.0 — logs técnicos */
.page-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.log-summary-grid .stat-card { min-height: 5.5rem; }
.log-summary-error { border-color: rgba(180, 35, 24, .35); }
.log-summary-warning { border-color: rgba(194, 120, 3, .35); }
.log-summary-settings { border-color: rgba(37, 99, 235, .25); }
.log-summary-test { border-color: rgba(91, 33, 182, .25); }
.log-filter-panel { margin-bottom: 1rem; }
.form-actions-inline { align-self: end; display: flex; flex-wrap: wrap; gap: .5rem; }
.log-test-panel { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.log-list-panel { display: grid; gap: 1rem; }
.log-entry-list { display: grid; gap: .7rem; }
.log-entry {
  border: 1px solid var(--border);
  border-left-width: .45rem;
  border-radius: 1rem;
  padding: .85rem;
  background: #fff;
  display: grid;
  gap: .45rem;
}
.log-entry-header { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; font-size: .82rem; color: var(--muted); }
.log-entry-time { font-variant-numeric: tabular-nums; }
.log-entry-badge,
.log-entry-level { border: 1px solid var(--border); border-radius: 999px; padding: .15rem .5rem; background: #f8fafc; color: var(--text); }
.log-entry code { display: block; white-space: pre-wrap; overflow-wrap: anywhere; background: #f8fafc; border: 1px solid var(--border); border-radius: .8rem; padding: .65rem; font-size: .84rem; color: #334155; }
.log-entry-error { border-left-color: var(--danger); background: #fffafa; }
.log-entry-warning { border-left-color: var(--warning); background: #fffdf7; }
.log-entry-settings { border-left-color: var(--primary); }
.log-entry-test { border-left-color: #6d28d9; background: #fbfaff; }
.log-entry-normal { border-left-color: #64748b; }
@media (max-width: 760px) {
  .page-actions, .log-test-panel, .form-actions-inline { align-items: stretch; flex-direction: column; }
  .page-actions .btn, .log-test-panel .btn, .form-actions-inline .btn { width: 100%; }
}

/* V3.5.0 — diagnóstico operacional */
.diagnostics-grid .stat-card { min-height: 5.5rem; }
.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .18rem .55rem;
  font-size: .82rem;
  background: #f8fafc;
  color: var(--text);
  font-weight: 700;
}
.status-running { background: #e8f7ef; border-color: #b8e5ca; color: var(--success); }
.status-error,
.status-stopped_with_error { background: #fffafa; border-color: rgba(180, 35, 24, .35); color: var(--danger); }
.status-stopped,
.status-not_started { background: #fff6e6; border-color: #f3d7a2; color: var(--warning); }
.details-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: .55rem 1rem;
}
.details-grid dt { font-weight: 700; color: var(--muted); }
.details-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .details-grid { grid-template-columns: 1fr; }
}

/* V4.0.1 — Agenda geral: apoio livre de hora e timeline por capacidade anónima */
.field-help {
  display: block;
  margin-top: .28rem;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.agenda-event-grid .agenda-event-unit-row .unit-label {
  white-space: nowrap;
}
.agenda-event-block span {
  max-width: 100%;
}

/* V4.3 - diagnóstico de manutenção de dados */
.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-title-row form {
  margin: 0;
}

/* V4.4 - dashboard estatístico operacional */
.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.stats-report-panel {
  margin-top: 1.5rem;
}
.compact-report-filter {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  margin-bottom: 1rem;
}
.stats-report-grid {
  margin: 1rem 0 1.25rem;
}
.stat-card small {
  display: block;
  color: var(--muted, #64748b);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}
.compact-table th,
.compact-table td {
  white-space: nowrap;
}
.table-scroll {
  overflow-x: auto;
}
@media (max-width: 720px) {
  .section-title-row {
    display: block;
  }
  .section-title-row .btn {
    margin-top: 0.75rem;
  }
}

/* V4.6 - Histórico dos Temporizadores funcional */
.agenda-summary-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
}
.summary-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: #fff;
}
.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}
.summary-card strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.2;
  margin: 0.2rem 0;
}
.details-block summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 1rem;
}
.agenda-filters {
  align-items: end;
}
.agenda-table th a {
  color: inherit;
  text-decoration: none;
}
.agenda-table th a:hover,
.agenda-table th a:focus {
  text-decoration: underline;
}
.actions-cell {
  min-width: 18rem;
}
.action-stack {
  display: grid;
  gap: 0.45rem;
}
.inline-form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
}
.inline-form select,
.inline-form input[type="time"] {
  min-width: 6.8rem;
}
.btn-small {
  padding: 0.38rem 0.55rem;
  font-size: 0.82rem;
}
.btn-danger {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}
.btn-danger:hover,
.btn-danger:focus {
  filter: brightness(0.95);
}
.assignment-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.chip-checkbox {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: #fff;
}
@media (max-width: 760px) {
  .actions-cell { min-width: 14rem; }
  .inline-form { display: grid; grid-template-columns: 1fr auto; }
  .inline-form input[type="time"],
  .inline-form select { width: 100%; }
}

/* V4.7.3 - Agenda normal: grupos e ações de manutenção de reservas */
.agenda-group-block {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.45), 0 0 0 2px color-mix(in srgb, currentColor 20%, transparent);
  border-left: 5px solid var(--resource-color, #1f6feb);
}
.agenda-group-row {
  border-left: 6px solid var(--agenda-group-color, #7c3aed);
  background: color-mix(in srgb, var(--agenda-group-color, #7c3aed) 8%, #ffffff 92%);
}
.agenda-event-actions .inline-form input[type="text"] {
  min-width: 5.8rem;
  max-width: 7.5rem;
}
.agenda-status-value-form {
  align-items: center;
}
@media (max-width: 760px) {
  .agenda-event-actions .inline-form {
    grid-template-columns: 1fr 1fr auto;
  }
  .agenda-event-actions .inline-form[data-danger-confirm] {
    grid-template-columns: 1fr;
  }
}

/* V4.8 - Agenda agrupada sem fusão de dados */
.agenda-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 6px 20px rgba(18,39,76,.04);
}
.agenda-section-nav-label {
  color: var(--muted);
  font-weight: 700;
  margin-right: 0.25rem;
}
.agenda-section-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: #eef3fb;
  color: var(--text);
  font-weight: 700;
}
.agenda-section-link:hover,
.agenda-section-link.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.active-elements-group-card {
  grid-template-columns: 64px 1fr;
  align-items: start;
}
.active-elements-subgrid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}
.active-elements-subcard {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem;
  align-items: center;
}
.active-elements-subcard p {
  margin: 0.2rem 0 0;
}
@media (max-width: 720px) {
  .agenda-section-nav,
  .active-elements-subcard {
    align-items: stretch;
  }
  .agenda-section-nav,
  .agenda-section-link,
  .active-elements-subcard {
    width: 100%;
  }
  .agenda-section-nav-label {
    width: 100%;
  }
  .active-elements-subcard {
    grid-template-columns: 1fr;
  }
}

/* V4.8.2 - Agenda operacional única com recursos partilhados integrados */
.agenda-scope-panel {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.agenda-shared-fields {
  border: 1px solid var(--border-color, #d9e2ec);
  border-radius: 12px;
  padding: 0.9rem;
  background: rgba(31, 111, 235, 0.04);
}
.agenda-shared-integrated-note {
  margin-top: 1.5rem;
}


/* V4.8.4 - Agenda normal sem rótulos de sub-recursos e legenda operacional */
.agenda-operational-legend {
  display: grid;
  gap: 0.6rem;
  margin: 0.85rem 0 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: #fff;
}
.agenda-legend-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  align-items: center;
}
.agenda-legend-group strong {
  margin-right: 0.15rem;
}
.agenda-legend-group span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.agenda-legend-fill,
.agenda-legend-outline {
  width: 1rem;
  height: 1rem;
  border-radius: 0.28rem;
  display: inline-block;
  background: #fff;
}
.agenda-legend-fill-paid { background: #16a34a; }
.agenda-legend-fill-reserved { background: #f2c94c; border: 1px solid rgba(17, 24, 39, .18); }
.agenda-legend-fill-unavailable { background: #dc2626; }
.agenda-legend-outline { border: 3px solid transparent; }
.agenda-outline-1 { border-color: transparent; box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .15); }
.agenda-outline-2 { border-color: #2563eb; }
.agenda-outline-3 { border-color: #f97316; }
.agenda-outline-4 { border-color: #dc2626; }
.agenda-outline-5 { border-color: #7c3aed; }

.agenda-event-unit-row-no-label {
  grid-template-columns: minmax(620px, 1fr);
}
.agenda-event-unit-row-no-label .unit-track-shell {
  min-width: 620px;
}
.agenda-event-block {
  border-width: 1px;
  border-style: solid;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-weight: 800;
}
.agenda-event-block.agenda-quantity-1 {
  border-color: transparent !important;
}
.agenda-event-block.agenda-quantity-2,
.agenda-event-block.agenda-quantity-3,
.agenda-event-block.agenda-quantity-4,
.agenda-event-block.agenda-quantity-5 {
  border-width: 3px;
}
.agenda-event-block.agenda-group-block {
  box-shadow: none;
  border-left-width: 3px;
}
.agenda-event-block span {
  width: 100%;
  text-align: center;
}
@media (max-width: 760px) {
  .agenda-event-unit-row-no-label {
    grid-template-columns: minmax(560px, 1fr);
  }
  .agenda-event-unit-row-no-label .unit-track-shell {
    min-width: 560px;
  }
}

/* V4.9 — confirmações críticas e prevenção de ações acidentais */
body.danger-modal-open {
  overflow: hidden;
}
.danger-confirm-shell {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}
.danger-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
}
.danger-confirm-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #fff;
  color: var(--text, #111827);
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.34);
}
.danger-confirm-head,
.danger-confirm-body,
.danger-confirm-actions {
  padding: 1rem 1.15rem;
}
.danger-confirm-head {
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.danger-confirm-kicker {
  margin-bottom: 0.25rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--danger, #b91c1c);
}
.danger-confirm-head h2 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.25;
}
.danger-confirm-body {
  display: grid;
  gap: 0.85rem;
}
.danger-confirm-body p {
  margin: 0;
}
.danger-confirm-summary {
  display: grid;
  gap: 0.35rem;
  padding: 0.8rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  font-size: 0.92rem;
}
.danger-confirm-summary strong {
  color: var(--text, #111827);
}
.danger-confirm-summary span {
  color: var(--muted, #4b5563);
}
.danger-confirm-consequence {
  padding: 0.75rem 0.85rem;
  border-left: 4px solid var(--danger, #dc2626);
  background: #fef2f2;
  color: #7f1d1d;
  border-radius: 0.65rem;
  font-weight: 700;
}
.danger-confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border, #e5e7eb);
}
.form-is-submitting {
  opacity: 0.82;
}
.form-is-submitting button[disabled],
.form-is-submitting input[type="submit"][disabled] {
  cursor: progress;
}
.destructive-action-zone {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(220, 38, 38, 0.42);
}
.action-stack .destructive-action-zone,
.agenda-event-actions .destructive-action-zone {
  width: 100%;
}
@media (max-width: 760px) {
  .danger-confirm-shell {
    align-items: flex-end;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .danger-confirm-card {
    border-radius: 1rem 1rem 0.5rem 0.5rem;
  }
  .danger-confirm-actions {
    flex-direction: column-reverse;
  }
  .danger-confirm-actions .btn {
    width: 100%;
    min-height: 44px;
  }
  .destructive-action-zone .btn,
  .destructive-action-zone button {
    min-height: 44px;
  }
}
.notice-card {
  padding: 0.8rem 0.95rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
  color: var(--text, #111827);
}
.notice-card.warning-card {
  border-color: rgba(245, 158, 11, 0.45);
  background: #fffbeb;
  color: #78350f;
}

/* V5.0 — Agenda mobile operacional e separação visual de reserva/pedido */
.export-menu {
  position: relative;
  display: inline-block;
}
.export-menu summary {
  list-style: none;
  cursor: pointer;
}
.export-menu summary::-webkit-details-marker {
  display: none;
}
.export-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 30;
  min-width: 180px;
  display: grid;
  gap: 0.45rem;
  padding: 0.65rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border, #e5e7eb);
  background: #fff;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.18);
}
.agenda-primary-filters,
.agenda-create-panel,
.agenda-day-cards-panel,
.agenda-detail-panel {
  scroll-margin-top: 5rem;
}
.agenda-scope-panel {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.chip-row-wrap {
  flex-wrap: wrap;
}
.agenda-kind-segments {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.35rem;
  border-radius: 0.9rem;
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
}
.agenda-kind-tab {
  flex: 1 1 0;
  border: 0;
  border-radius: 0.7rem;
  padding: 0.75rem 0.9rem;
  background: transparent;
  color: var(--muted, #475569);
  font-weight: 800;
  cursor: pointer;
}
.agenda-kind-tab.is-active,
.agenda-kind-tab:focus-visible {
  background: #fff;
  color: var(--text, #111827);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
  outline: 2px solid rgba(37, 99, 235, 0.18);
}
.agenda-mode-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
}
.agenda-mode-card[data-mode="normal"] {
  border-color: rgba(37, 99, 235, 0.28);
  background: #eff6ff;
}
.agenda-mode-card[data-mode="shared"] {
  border-color: rgba(245, 158, 11, 0.35);
  background: #fffbeb;
}
.agenda-mode-card span {
  color: var(--muted, #475569);
  font-size: 0.92rem;
}
.field-help {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted, #64748b);
  font-size: 0.82rem;
  line-height: 1.3;
}
.agenda-create-form select:disabled,
.agenda-create-form input:disabled,
.agenda-create-form textarea:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}
.agenda-now-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.agenda-now-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border, #e5e7eb);
  background: #fff;
}
.agenda-now-card.is-occupied {
  border-color: rgba(37, 99, 235, 0.22);
  background: #f8fbff;
}
.agenda-mobile-card-list {
  display: none;
  gap: 0.85rem;
}
.agenda-booking-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.95rem;
  border-radius: 1rem;
  border: 1px solid var(--border, #e5e7eb);
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}
.agenda-booking-card.is-group {
  border-left: 5px solid var(--agenda-group-color, #2563eb);
}
.agenda-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: flex-start;
}
.agenda-card-time {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text, #111827);
}
.agenda-card-resource {
  margin-top: 0.15rem;
  color: var(--muted, #475569);
  font-size: 0.92rem;
}
.agenda-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.agenda-card-meta div {
  display: grid;
  gap: 0.12rem;
  padding: 0.5rem;
  border-radius: 0.65rem;
  background: #f8fafc;
}
.agenda-card-meta span {
  color: var(--muted, #64748b);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.agenda-card-meta strong {
  font-size: 0.95rem;
  color: var(--text, #111827);
}
.agenda-card-notes {
  padding: 0.65rem;
  border-radius: 0.65rem;
  background: #f8fafc;
  color: var(--muted, #475569);
}
.agenda-card-actions {
  display: grid;
  gap: 0.6rem;
}
.agenda-card-actions .agenda-status-value-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.agenda-card-actions .agenda-status-value-form button,
.agenda-card-actions .destructive-action-zone button,
.agenda-card-actions a.btn {
  min-height: 44px;
}
.agenda-technical-details summary {
  cursor: pointer;
  font-weight: 900;
  padding: 0.35rem 0;
}
.agenda-mobile-hour-list {
  display: none;
  gap: 0.75rem;
}
.agenda-hour-group {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border, #e5e7eb);
  background: #fff;
}
.agenda-hour-group h3 {
  margin: 0;
  font-size: 1rem;
}
.agenda-hour-items {
  display: grid;
  gap: 0.5rem;
}
.agenda-hour-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem;
  border-radius: 0.75rem;
  border-left: 5px solid var(--agenda-hour-color, #2563eb);
  background: #f8fafc;
}
.agenda-hour-time {
  font-weight: 900;
  color: var(--text, #111827);
  white-space: nowrap;
}
.agenda-hour-main {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.agenda-hour-main span {
  color: var(--muted, #475569);
  font-size: 0.86rem;
}
@media (max-width: 760px) {
  .app-mobile-topbar {
    padding-top: max(0.7rem, env(safe-area-inset-top));
    min-height: calc(48px + env(safe-area-inset-top));
  }
  .app-mobile-topbar strong {
    font-size: 1rem;
  }
  .agenda-page-header {
    align-items: flex-start;
    gap: 0.75rem;
  }
  .agenda-page-header h1 {
    font-size: 1.35rem;
  }
  .agenda-page-header p {
    font-size: 0.92rem;
  }
  .export-menu {
    width: 100%;
  }
  .export-menu summary,
  .export-menu-panel .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .export-menu-panel {
    position: static;
    margin-top: 0.55rem;
    box-shadow: none;
  }
  .agenda-filters-form,
  .agenda-filter-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .agenda-filter-actions .btn,
  .agenda-create-form .btn,
  .agenda-create-form button,
  .agenda-create-form select,
  .agenda-create-form input,
  .agenda-create-form textarea {
    min-height: 44px;
  }
  .agenda-kind-segments {
    grid-column: 1 / -1;
    flex-direction: column;
  }
  .agenda-card-meta {
    grid-template-columns: 1fr;
  }
  .agenda-mobile-card-list {
    display: grid;
  }
  .agenda-desktop-table {
    display: none;
  }
  .agenda-mobile-hour-list {
    display: grid;
  }
  .agenda-desktop-timeline {
    display: none;
  }
  .agenda-hour-card {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .agenda-operational-legend {
    gap: 0.6rem;
  }
  .agenda-legend-group {
    flex-wrap: wrap;
  }
}
@media (min-width: 761px) {
  .agenda-desktop-table,
  .agenda-desktop-timeline {
    display: block;
  }
}

/* V5.1 — Temporizadores, Histórico dos Temporizadores e Transferências */
.timer-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .34rem .62rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--timer-state-color, #1f6feb) 16%, #ffffff 84%);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--timer-state-color, #1f6feb) 40%, transparent);
  font-weight: 800;
  min-height: 2rem;
}
.timer-status-symbol {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--timer-state-color, #1f6feb);
  color: var(--alert-text, #fff);
  font-size: .78rem;
}
.timer-card.phase-aviso_regresso .timer-status-badge,
.timer-card.phase-fim_total .timer-status-badge {
  background: color-mix(in srgb, var(--timer-state-color, #b42318) 22%, #ffffff 78%);
}
.timer-help-text,
.timer-half-time-toggle small {
  display: block;
  margin-top: .22rem;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.25;
}
.timer-half-time-toggle {
  align-items: flex-start;
  gap: .55rem;
}
.timer-half-time-toggle span {
  font-weight: 700;
}
.timer-active-config {
  padding: .58rem .72rem;
  border: 1px dashed color-mix(in srgb, var(--timer-state-color, #1f6feb) 50%, var(--border));
  border-radius: .9rem;
  background: color-mix(in srgb, var(--timer-state-color, #1f6feb) 8%, #ffffff 92%);
  color: var(--text);
  font-size: .86rem;
  line-height: 1.35;
  font-weight: 650;
}
.history-mobile-card-list,
.transfer-mobile-card-list {
  display: none;
}
.history-advanced-filters {
  display: contents;
}
.history-advanced-filters summary {
  display: none;
}
.history-advanced-filters-grid {
  display: contents;
}
.notification-reason-field,
.notification-popup-reason-field {
  display: grid;
  gap: .25rem;
  min-width: min(100%, 320px);
  font-size: .82rem;
  color: var(--muted);
}
.notification-reason-field textarea,
.notification-popup-reason-field textarea {
  width: 100%;
  min-height: 4.8rem;
  resize: vertical;
}
.transfer-summary-panel {
  grid-column: 1 / -1;
  padding: .72rem .85rem;
  border-radius: .9rem;
  background: #f7faff;
  border: 1px solid #c7d8fb;
  color: var(--text);
  font-weight: 650;
}
.transfer-mobile-card {
  display: grid;
  gap: .65rem;
  padding: .9rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
.transfer-mobile-card header {
  display: grid;
  gap: .35rem;
}
.transfer-mobile-card div {
  display: grid;
  gap: .12rem;
}
.transfer-mobile-card div span,
.history-mobile-card-grid span,
.history-mobile-subresources > span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.history-mobile-card {
  display: grid;
  gap: .8rem;
  padding: .95rem;
  border: 1px solid var(--border);
  border-left: 6px solid var(--group-color, var(--primary));
  border-radius: 1.1rem;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
}
.history-mobile-card-head {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: flex-start;
}
.history-mobile-card-head div {
  display: grid;
  gap: .15rem;
}
.history-mobile-card-head strong {
  font-size: 1.08rem;
}
.history-mobile-card-head span:not(.inline-badge) {
  color: var(--muted);
  font-weight: 700;
}
.history-mobile-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem .75rem;
}
.history-mobile-card-grid > div,
.history-mobile-subresources {
  display: grid;
  gap: .18rem;
  min-width: 0;
}
.history-mobile-card-grid strong {
  overflow-wrap: anywhere;
}
.history-mobile-observations {
  margin: 0;
  padding: .62rem .72rem;
  border-radius: .8rem;
  background: #f8fafc;
  color: var(--text);
}
.history-mobile-actions {
  display: grid;
  gap: .55rem;
}
.history-mobile-actions .inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
}
.history-mobile-actions > .btn,
.history-mobile-actions button,
.history-mobile-actions select {
  min-height: 44px;
}
@media (max-width: 760px) {
  .history-advanced-filters {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
  }
  .history-advanced-filters summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: .72rem .85rem;
    border: 1px solid var(--border);
    border-radius: .9rem;
    background: #fff;
    font-weight: 800;
    cursor: pointer;
  }
  .history-advanced-filters-grid {
    display: grid;
    gap: .75rem;
    margin-top: .75rem;
  }
  .history-table-shell,
  .transfer-table-shell {
    display: none;
  }
  .history-mobile-card-list,
  .transfer-mobile-card-list {
    display: grid;
    gap: .8rem;
  }
  .history-mobile-card-grid {
    grid-template-columns: 1fr;
  }
  .history-mobile-actions .inline-form {
    grid-template-columns: 1fr;
  }
  .timer-status-badge {
    min-height: 2.2rem;
    font-size: .78rem;
    padding: .34rem .5rem;
  }
  .timer-active-config {
    grid-column: 1 / -1;
    font-size: .78rem;
  }
  .timer-help-text,
  .timer-half-time-toggle small {
    font-size: .7rem;
  }
  .transfer-mobile-card .btn,
  .history-mobile-card .btn {
    width: 100%;
  }
}


/* V5.2 — Home operacional, acessibilidade, Administração e prontidão visual */
.home-hero { display: flex; justify-content: space-between; gap: 1.2rem; align-items: stretch; margin-bottom: 1rem; }
.home-hero-main { display: grid; gap: .45rem; align-content: center; }
.home-hero h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.6rem); }
.home-kicker { margin: 0; color: var(--primary-dark); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
.home-context-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.home-primary-actions { display: grid; gap: .65rem; align-content: center; min-width: min(100%, 260px); }
.btn-large { min-height: 3.1rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.home-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.home-metric-card { display: grid; gap: .22rem; }
.home-metric-card strong { font-size: 2rem; line-height: 1; }
.home-metric-label { color: var(--muted); font-size: .86rem; font-weight: 700; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.home-section-card { display: grid; gap: .8rem; align-content: start; }
.compact-heading { margin-bottom: 0; align-items: center; }
.compact-heading h2 { margin: 0 0 .15rem; }
.home-list { display: grid; gap: .55rem; }
.home-list-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .68rem .78rem; border: 1px solid var(--border); border-radius: .9rem; background: #fbfcff; }
.home-list-row div { display: grid; gap: .12rem; min-width: 0; }
.home-list-row div span { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.home-shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; }
.home-shortcuts .quick-card { border: 1px solid var(--border); border-radius: .9rem; padding: .8rem; background: #fbfcff; font-weight: 750; }
.home-shortcuts .quick-card:hover, .home-shortcuts .quick-card:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,235,.14); outline: none; }
.state-pill { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); border-radius: 999px; padding: .28rem .58rem; background: #f8fbff; color: var(--text); font-weight: 800; font-size: .82rem; white-space: nowrap; }
.state-symbol { width: .7rem; height: .7rem; border-radius: 999px; display: inline-block; background: currentColor; box-shadow: inset 0 0 0 2px rgba(255,255,255,.65); }
.state-reserva .state-symbol, .state-pending .state-symbol { background: repeating-linear-gradient(45deg, #b54708 0 3px, #f7d08a 3px 6px); }
.state-pago .state-symbol, .timer-phase-em_curso .state-symbol { background: #087443; }
.state-indisponivel .state-symbol, .timer-phase-fim_total .state-symbol { background: repeating-linear-gradient(135deg, #b42318 0 3px, #f2b8b5 3px 6px); }
.timer-phase-aviso_regresso .state-symbol { background: repeating-linear-gradient(45deg, #b54708 0 3px, #ffe2a8 3px 6px); }
.timer-phase-sem_tempo .state-symbol { background: #1f6feb; }
.timer-phase-janela_tolerancia .state-symbol { background: #6d28d9; }
.impact-list { margin: .45rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; line-height: 1.35; }
.compact-impact-list { font-size: .82rem; }
.active-elements-admin-panel .section-card { align-items: start; }
.active-elements-warning { margin-top: .25rem; }
.restore-files-panel { margin-top: .9rem; }
.restore-file-grid { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.restore-file-chip { display: inline-flex; border: 1px solid var(--border); background: #fbfcff; border-radius: 999px; padding: .28rem .55rem; font-size: .84rem; overflow-wrap: anywhere; }
.agenda-block::before, .inline-badge[class*="state-"]::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 999px; margin-right: .22rem; background: currentColor; flex: 0 0 auto; }
.agenda-block.agenda-state-reserva::before { background: repeating-linear-gradient(45deg, currentColor 0 2px, rgba(255,255,255,.85) 2px 4px); }
.agenda-block.agenda-state-pago::before { background: currentColor; }
.agenda-block.agenda-state-indisponivel::before { background: repeating-linear-gradient(135deg, currentColor 0 2px, rgba(255,255,255,.9) 2px 4px); }
[role="button"][tabindex]:focus-visible, .agenda-block:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(31,111,235,.45); outline-offset: 2px; }
@media (min-width: 900px) { .panel { box-shadow: 0 4px 14px rgba(18,39,76,.04); } .panel .panel .panel { box-shadow: none; } }
@media (max-width: 900px) { .home-hero { display: grid; } .home-primary-actions { grid-template-columns: 1fr; } .home-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-grid { grid-template-columns: 1fr; } .home-list-row { align-items: flex-start; } .active-elements-admin-panel .section-card { grid-template-columns: 48px 1fr; } .active-elements-admin-panel .section-card .toggle-row { grid-column: 1 / -1; justify-content: space-between; } }
@media (max-width: 760px) { .btn-small, .inline-form .btn-small, .agenda-card-actions .btn, .history-mobile-card-actions .btn, .transfer-card-actions .btn { min-height: 44px; padding: .62rem .72rem; } .home-metric-grid { grid-template-columns: 1fr; } .home-list-row { display: grid; } .state-pill { width: fit-content; } }

/* V5.2 correções pós-validação — filtros, transferências e temporizadores inativos */
@media (min-width: 761px) {
  .agenda-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, max-content));
    align-items: end;
    justify-content: start;
    gap: .75rem 1rem;
  }
  .agenda-filters > label,
  .agenda-filters .history-advanced-filters-grid > label {
    min-width: 170px;
    width: 100%;
  }
  .agenda-filters .history-advanced-filters,
  .agenda-filters .history-advanced-filters-grid {
    display: contents;
  }
  .agenda-filters .history-advanced-filters summary {
    display: none;
  }
  .agenda-filters .toolbar {
    align-self: end;
    min-height: 44px;
  }
}

.transfer-table-shell .table {
  min-width: 0;
}
.transfer-table-shell th,
.transfer-table-shell td {
  white-space: normal;
}
.timer-card:not(.is-active) .timer-display,
.timer-card .timer-display:empty {
  display: none;
}

/* V5.2.1 — correções de validação visual: filtros do histórico e temporizadores inativos */
@media (min-width: 761px) {
  form.agenda-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, max-content));
    align-items: end;
    justify-content: start;
    gap: .75rem 1rem;
  }
  form.agenda-filters > label {
    min-width: 160px;
    width: 100%;
  }
  form.agenda-filters .history-advanced-filters {
    display: block;
    grid-column: span 4;
    min-width: min(100%, 680px);
    width: 100%;
  }
  form.agenda-filters .history-advanced-filters summary {
    display: none;
  }
  form.agenda-filters .history-advanced-filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    align-items: end;
    gap: .75rem 1rem;
    width: 100%;
  }
  form.agenda-filters .history-advanced-filters-grid > label {
    min-width: 0;
    width: 100%;
  }
  form.agenda-filters .toolbar {
    align-self: end;
    min-height: 44px;
  }
}
@media (max-width: 1180px) and (min-width: 761px) {
  form.agenda-filters .history-advanced-filters {
    grid-column: 1 / -1;
  }
  form.agenda-filters .history-advanced-filters-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}
.timer-card:not(.is-active) .timer-status-symbol {
  display: none;
}

/* V5.5 — UX operacional por perfil, administração clara e toque/mobile */
.inline-badge-warning { background: #fff6e6; border-color: #f3d7a2; color: var(--warning); font-weight: 800; }
.home-operational-hint { margin: 0; padding: .65rem .8rem; border-left: 4px solid var(--primary); background: #f7faff; border-radius: .8rem; font-weight: 700; }
.home-profile-fotos .home-operational-hint,
.home-profile-barco .home-operational-hint { border-left-color: var(--warning); background: #fffaf0; }
.home-profile-installer .home-operational-hint { border-left-color: var(--danger); background: #fff8f7; }
.home-shortcuts .quick-card { display: grid; gap: .18rem; min-height: 4rem; align-content: center; }
.home-shortcuts .quick-card strong { font-size: .98rem; }
.home-shortcuts .quick-card span { color: var(--muted); font-size: .86rem; font-weight: 600; line-height: 1.25; }
.home-primary-actions .btn { width: 100%; }
.nav-dropdown summary:focus-visible,
a:focus-visible { outline: 3px solid rgba(31,111,235,.45); outline-offset: 2px; }
.notice-card strong { display: block; margin-bottom: .2rem; }
.active-elements-subcard strong { display: inline-block; margin-bottom: .2rem; }
.active-elements-subcard .toggle-row { min-height: 44px; }
.form-actions .btn,
.toolbar .btn,
.notification-actions .btn { min-height: 44px; }
@media (max-width: 760px) {
  button, .btn, input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], input[type="file"], select, textarea { min-height: 44px; }
  .home-hero { padding: .9rem; }
  .home-context-row .inline-badge { width: fit-content; }
  .home-shortcuts { grid-template-columns: 1fr; }
  .section-card { gap: .75rem; }
  .section-card .btn { width: 100%; }
  .page-header { display: grid; }
}

/* V5.8 corrective UI alignment — Agenda ordering and collapsible secondary blocks */
.agenda-collapsible-panel {
  padding: 0;
  overflow: hidden;
}
.agenda-collapsible-section > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
  color: var(--text, #111827);
}
.agenda-collapsible-section > summary::-webkit-details-marker {
  display: none;
}
.agenda-collapsible-section > summary::after {
  content: "Abrir";
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--muted, #64748b);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: #f8fafc;
}
.agenda-collapsible-section[open] > summary::after {
  content: "Fechar";
}
.agenda-collapsible-section > summary span {
  font-size: 1.05rem;
}
.agenda-collapsible-section > summary small {
  color: var(--muted, #64748b);
  font-weight: 700;
  text-align: right;
}
.agenda-collapsible-section > *:not(summary) {
  margin-left: 1.1rem;
  margin-right: 1.1rem;
}
.agenda-collapsible-section > *:last-child {
  margin-bottom: 1.1rem;
}
.agenda-collapsible-intro {
  margin-top: 0;
}
.agenda-priority-panel {
  border-width: 2px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.10);
}
.agenda-priority-panel .timeline-header-row h2 {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}
.agenda-shared-timeline-wrapper #timeline-section {
  scroll-margin-top: 5rem;
}
@media (max-width: 760px) {
  .agenda-collapsible-section > summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }
  .agenda-collapsible-section > summary::after {
    align-self: flex-start;
  }
}


/* V5.8 corrective UI alignment — agenda detail metadata and compact create heading */
.agenda-create-panel .agenda-collapsible-section > summary span {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}
.timeline-detail-action {
  margin-top: .75rem;
}
.agenda-booking-focus {
  outline: 3px solid rgba(37, 99, 235, .45);
  outline-offset: 3px;
  animation: agendaBookingFocusPulse 1.1s ease-in-out 2;
}
@keyframes agendaBookingFocusPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, .14); }
}

/* V6.0 — sistema visual por temas. Alteração estritamente de apresentação. */
:root,
:root[data-theme="costa"] {
  color-scheme: light;
  --bg: #f8f3ea;
  --panel: rgba(255, 253, 248, .92);
  --panel-solid: #fffdf8;
  --panel-soft: rgba(255, 249, 239, .84);
  --text: #123040;
  --muted: #6c7b82;
  --border: rgba(36, 73, 86, .14);
  --primary: #0b6f86;
  --primary-dark: #084f60;
  --danger: #b42318;
  --success: #087443;
  --warning: #b76a00;
  --accent: #ff765f;
  --accent-strong: #f05f49;
  --free-track: rgba(11, 111, 134, .13);
  --shell-bg: linear-gradient(135deg, #fbf4e8 0%, #f7fbfb 44%, #eaf7fb 100%);
  --sidebar-bg: linear-gradient(180deg, #053949 0%, #075369 48%, #0a3e55 100%);
  --sidebar-text: #f7fbff;
  --sidebar-muted: rgba(247, 251, 255, .68);
  --surface-shadow: 0 18px 45px rgba(18, 48, 64, .10);
  --surface-shadow-soft: 0 8px 24px rgba(18, 48, 64, .07);
  --focus-ring: rgba(11, 111, 134, .28);
  --glass-border: rgba(255, 255, 255, .48);
}

:root[data-theme="sunset"] {
  color-scheme: light;
  --bg: #102f3a;
  --panel: rgba(255, 255, 255, .18);
  --panel-solid: rgba(255, 255, 255, .82);
  --panel-soft: rgba(255, 255, 255, .13);
  --text: #fff9f1;
  --muted: rgba(255, 249, 241, .74);
  --border: rgba(255, 255, 255, .24);
  --primary: #2dd4bf;
  --primary-dark: #0f766e;
  --danger: #ff5f5f;
  --success: #22c55e;
  --warning: #fbbf24;
  --accent: #ff7a59;
  --accent-strong: #ff5d6c;
  --free-track: rgba(255, 255, 255, .18);
  --shell-bg: radial-gradient(circle at 75% 24%, rgba(255, 184, 76, .88) 0%, rgba(255, 122, 89, .66) 28%, transparent 52%), linear-gradient(135deg, #034c5e 0%, #2e6671 36%, #d86a55 70%, #f1aa53 100%);
  --sidebar-bg: linear-gradient(180deg, rgba(3, 39, 54, .96) 0%, rgba(5, 68, 80, .94) 58%, rgba(91, 42, 56, .94) 100%);
  --sidebar-text: #fffaf4;
  --sidebar-muted: rgba(255, 250, 244, .70);
  --surface-shadow: 0 20px 55px rgba(32, 23, 30, .26);
  --surface-shadow-soft: 0 10px 28px rgba(32, 23, 30, .16);
  --focus-ring: rgba(255, 229, 169, .42);
  --glass-border: rgba(255, 255, 255, .36);
}

:root[data-theme="noite"] {
  color-scheme: dark;
  --bg: #06131c;
  --panel: rgba(10, 28, 42, .86);
  --panel-solid: #0a1c2a;
  --panel-soft: rgba(18, 44, 63, .78);
  --text: #eaf7ff;
  --muted: #95a9b8;
  --border: rgba(135, 177, 196, .20);
  --primary: #36d8e8;
  --primary-dark: #1596a5;
  --danger: #ff5f66;
  --success: #2dd4bf;
  --warning: #ffbd2e;
  --accent: #33e1d8;
  --accent-strong: #6ee7f9;
  --free-track: rgba(54, 216, 232, .16);
  --shell-bg: radial-gradient(circle at 76% 2%, rgba(54, 216, 232, .14) 0%, transparent 34%), radial-gradient(circle at 8% 88%, rgba(45, 212, 191, .12) 0%, transparent 36%), linear-gradient(135deg, #06131c 0%, #071b2b 48%, #06131c 100%);
  --sidebar-bg: linear-gradient(180deg, #03101a 0%, #071c2b 55%, #03101a 100%);
  --sidebar-text: #eaf7ff;
  --sidebar-muted: rgba(234, 247, 255, .62);
  --surface-shadow: 0 18px 48px rgba(0, 0, 0, .36);
  --surface-shadow-soft: 0 9px 28px rgba(0, 0, 0, .22);
  --focus-ring: rgba(54, 216, 232, .34);
  --glass-border: rgba(100, 210, 224, .20);
}

html[data-theme],
body[data-theme] {
  background: var(--bg);
}

body {
  background: var(--shell-bg);
  color: var(--text);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 62%, rgba(255,255,255,.12) 62% 63%, transparent 63% 100%),
    radial-gradient(circle at 92% 8%, rgba(255,255,255,.34), transparent 24%),
    radial-gradient(circle at 14% 96%, rgba(11,111,134,.10), transparent 28%);
}

html[data-theme="noite"] body::before {
  background:
    linear-gradient(115deg, transparent 0 62%, rgba(54,216,232,.08) 62% 63%, transparent 63% 100%),
    radial-gradient(circle at 92% 8%, rgba(54,216,232,.14), transparent 26%),
    radial-gradient(circle at 10% 90%, rgba(45,212,191,.10), transparent 28%);
}

html[data-theme="sunset"] body::before {
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 232, 155, .32), transparent 20%),
    linear-gradient(115deg, transparent 0 57%, rgba(255,255,255,.18) 57% 58%, transparent 58% 100%);
}

.layout {
  background: transparent;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255,255,255,.10);
  box-shadow: 18px 0 55px rgba(0, 28, 40, .18);
}

.sidebar::after {
  content: "";
  position: sticky;
  bottom: -1.1rem;
  display: block;
  height: 6.5rem;
  margin: auto -1.1rem -1.1rem;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(248, 208, 150, .54), transparent 62%),
    repeating-radial-gradient(ellipse at 18% 100%, rgba(255,255,255,.20) 0 1px, transparent 1px 18px);
  opacity: .72;
}

.brand {
  position: relative;
  display: grid;
  gap: .28rem;
  padding: .65rem .2rem 1rem;
}

.brand::before {
  content: "";
  width: 3.15rem;
  height: 2rem;
  border-radius: 55% 45% 48% 52%;
  background:
    radial-gradient(circle at 74% 28%, transparent 0 32%, var(--accent) 33% 38%, transparent 39%),
    linear-gradient(160deg, var(--accent), transparent 60%);
  opacity: .92;
}

.brand-title {
  font-size: 1.35rem;
  letter-spacing: -.03em;
  color: #fff;
}

.brand-version {
  color: var(--sidebar-muted);
  font-size: .9rem;
}

.nav {
  gap: .5rem;
}

.nav a,
.nav-dropdown summary {
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.055);
  color: var(--sidebar-text);
  backdrop-filter: blur(10px);
}

.nav a:hover,
.nav a.active,
.nav-dropdown summary:hover,
.nav-dropdown summary.active {
  background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
  border-color: rgba(255,255,255,.18);
  box-shadow: inset 3px 0 0 var(--accent), 0 12px 24px rgba(0,0,0,.12);
}

.nav-dropdown a {
  background: rgba(255,255,255,.035);
  color: rgba(255,255,255,.90);
}

.sidebar-footer {
  position: relative;
  z-index: 1;
}

.user-chip {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 1rem;
  padding: .72rem .78rem;
  background: rgba(255,255,255,.07);
  color: var(--sidebar-text);
}

.user-role { color: var(--sidebar-muted); }

.content {
  padding: clamp(1rem, 1.7vw, 1.85rem);
}

.content-top-controls {
  position: relative;
  z-index: 10;
}

.content-top-actions {
  align-items: center;
}

.theme-selector {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.45rem;
  padding: .34rem .45rem .34rem .72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  color: var(--text);
  box-shadow: var(--surface-shadow-soft);
}

.theme-selector span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.theme-select {
  width: auto;
  min-width: 10.5rem;
  min-height: 2rem;
  border-radius: 999px;
  padding: .35rem 2rem .35rem .78rem;
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 80%, var(--primary) 20%);
  font-weight: 800;
}

.page-header {
  position: relative;
  isolation: isolate;
  align-items: center;
  padding: .2rem 0 .45rem;
}

.page-header::after {
  content: "";
  position: absolute;
  right: 0;
  top: -.35rem;
  width: min(48vw, 560px);
  height: 5rem;
  z-index: -1;
  opacity: .42;
  background: repeating-radial-gradient(ellipse at 100% 70%, transparent 0 16px, color-mix(in srgb, var(--primary) 22%, transparent) 17px 18px, transparent 19px 34px);
}

.page-header h1 {
  font-size: clamp(2rem, 3.2vw, 3.2rem);
  letter-spacing: -.055em;
  line-height: .98;
  color: var(--text);
}

.page-header p,
.muted,
.form-hint,
.field-help {
  color: var(--muted);
}

.panel,
.login-panel,
.notification-card,
.notification-popup-card,
.summary-card,
.stat-card,
.home-section-card,
.alert-settings-preview,
.live-update-step,
.live-update-log-entry {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: var(--surface-shadow);
  backdrop-filter: blur(18px);
}

.panel-soft,
.home-list-row,
.home-shortcuts .quick-card,
.restore-file-chip,
.header-radio-widget,
body.app-shell .content-top-actions-collapsible {
  background: var(--panel-soft);
  border-color: var(--border);
  color: var(--text);
}

input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], input[type="file"], select, textarea {
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  color: var(--text);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.20);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

button,
.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 22%, transparent);
}

.btn:hover,
button:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-secondary,
.content-top-actions .btn-secondary,
.export-menu summary.btn-secondary {
  background: color-mix(in srgb, var(--panel-solid) 80%, transparent);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--surface-shadow-soft);
}

.btn-secondary:hover,
.content-top-actions .btn-secondary:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--panel-solid));
}

.flash,
.inline-badge,
.state-pill {
  border: 1px solid var(--border);
  box-shadow: var(--surface-shadow-soft);
}

.table th,
.table td {
  border-bottom-color: var(--border);
}

.table tr:hover td {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.agenda-section-nav,
.agenda-section-tabs,
.toolbar,
.filters,
.agenda-filters {
  border-radius: 1.05rem;
}

.agenda-section-nav a,
.agenda-section-tabs a,
.tab-link {
  border-radius: 999px;
}

.agenda-block,
.agenda-event-block {
  border-radius: .95rem;
  box-shadow: 0 12px 30px rgba(12, 37, 48, .18);
  border: 1px solid rgba(255,255,255,.30);
}

.unit-track,
.unit-track-shell,
.agenda-event-unit-row,
.unit-row {
  border-color: var(--border);
}

.timer-resource-group.panel {
  border-radius: 1.25rem;
}

.timer-resource-header {
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border);
}

.timer-card {
  border-radius: 1.15rem;
  background: color-mix(in srgb, var(--panel-solid) 86%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--surface-shadow-soft);
}

.timer-card .timer-name-banner {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}

.timer-display {
  color: var(--primary);
  text-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 22%, transparent);
}

.timer-card.phase-aviso_regresso .timer-display,
.timer-card.phase-aviso_regresso .timer-phase {
  color: #ffd66b;
}

.timer-card.phase-fim_total .timer-display,
.timer-card.phase-fim_total .timer-phase {
  color: #ff7b7f;
}

.header-radio-widget[data-radio-status="playing"],
.control-state-on,
.sound-toggle[data-control-state="on"],
.radio-power-toggle[data-control-state="on"] {
  background: color-mix(in srgb, var(--success) 12%, var(--panel-solid));
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
}

.control-state-off,
.sound-toggle[data-control-state="off"],
.radio-power-toggle[data-control-state="off"] {
  background: color-mix(in srgb, var(--danger) 12%, var(--panel-solid));
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.control-state-paused,
.radio-power-toggle[data-control-state="paused"],
.header-radio-widget[data-radio-status="suppressed"],
.header-radio-widget[data-radio-suppressed="1"] {
  background: color-mix(in srgb, var(--warning) 14%, var(--panel-solid));
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
}

[role="button"][tabindex]:focus-visible,
.agenda-block:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-dropdown summary:focus-visible,
a:focus-visible {
  outline-color: var(--focus-ring);
}

.login-body {
  background: var(--shell-bg);
}

.login-panel {
  border-radius: 1.35rem;
}

.brand-center h1 {
  color: var(--text);
  letter-spacing: -.04em;
}

html[data-theme="sunset"] .panel,
html[data-theme="sunset"] .login-panel,
html[data-theme="sunset"] .notification-card,
html[data-theme="sunset"] .summary-card,
html[data-theme="sunset"] .stat-card,
html[data-theme="sunset"] .home-section-card,
html[data-theme="sunset"] .timer-card,
html[data-theme="sunset"] .theme-selector,
html[data-theme="sunset"] .header-radio-widget {
  border-color: var(--glass-border);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  color: var(--text);
  box-shadow: var(--surface-shadow);
}

html[data-theme="sunset"] .btn:not(.btn-secondary),
html[data-theme="sunset"] button:not(.btn-secondary):not(.content-top-toggle) {
  background: linear-gradient(135deg, #ff7a59, #ff5d6c);
}

html[data-theme="sunset"] .sidebar {
  box-shadow: 20px 0 60px rgba(0, 30, 42, .26);
}

html[data-theme="sunset"] input[type="text"],
html[data-theme="sunset"] input[type="password"],
html[data-theme="sunset"] input[type="email"],
html[data-theme="sunset"] input[type="date"],
html[data-theme="sunset"] input[type="time"],
html[data-theme="sunset"] input[type="number"],
html[data-theme="sunset"] input[type="file"],
html[data-theme="sunset"] select,
html[data-theme="sunset"] textarea {
  background: rgba(255,255,255,.70);
  color: #172033;
}

html[data-theme="sunset"] .btn-secondary,
html[data-theme="sunset"] .theme-select {
  color: #172033;
  background: rgba(255,255,255,.76);
}

html[data-theme="noite"] .panel,
html[data-theme="noite"] .login-panel,
html[data-theme="noite"] .notification-card,
html[data-theme="noite"] .summary-card,
html[data-theme="noite"] .stat-card,
html[data-theme="noite"] .home-section-card,
html[data-theme="noite"] .alert-settings-preview,
html[data-theme="noite"] .live-update-step,
html[data-theme="noite"] .live-update-log-entry,
html[data-theme="noite"] .timer-card {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="noite"] .panel-soft,
html[data-theme="noite"] .home-list-row,
html[data-theme="noite"] .home-shortcuts .quick-card,
html[data-theme="noite"] .header-radio-widget,
html[data-theme="noite"] body.app-shell .content-top-actions-collapsible,
html[data-theme="noite"] .table tr:hover td {
  background: var(--panel-soft);
  color: var(--text);
}

html[data-theme="noite"] input[type="text"],
html[data-theme="noite"] input[type="password"],
html[data-theme="noite"] input[type="email"],
html[data-theme="noite"] input[type="date"],
html[data-theme="noite"] input[type="time"],
html[data-theme="noite"] input[type="number"],
html[data-theme="noite"] input[type="file"],
html[data-theme="noite"] select,
html[data-theme="noite"] textarea {
  background: #081b29;
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="noite"] .btn-secondary,
html[data-theme="noite"] .theme-selector,
html[data-theme="noite"] .theme-select,
html[data-theme="noite"] .export-menu-panel {
  background: #0b2233;
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="noite"] .table,
html[data-theme="noite"] .table th,
html[data-theme="noite"] .table td,
html[data-theme="noite"] .details-grid,
html[data-theme="noite"] .agenda-table {
  color: var(--text);
}

html[data-theme="noite"] .flash-success,
html[data-theme="noite"] .notification-card.notification-approved_final,
html[data-theme="noite"] .live-update-step.status-done {
  background: rgba(45, 212, 191, .12);
}

html[data-theme="noite"] .flash-warning,
html[data-theme="noite"] .notification-card.notification-pending_approval,
html[data-theme="noite"] .live-update-step.status-failed-with-rollback,
html[data-theme="noite"] .live-update-step.status-rollback-in-progress {
  background: rgba(255, 189, 46, .12);
}

html[data-theme="noite"] .flash-error,
html[data-theme="noite"] .notification-card.notification-refused,
html[data-theme="noite"] .notification-card.notification-cancelled_after_approval {
  background: rgba(255, 95, 102, .12);
}

@media (max-width: 720px) {
  .theme-selector {
    width: 100%;
    justify-content: space-between;
    border-radius: .9rem;
  }
  .theme-select {
    min-width: 0;
    width: 100%;
  }
}

/* V6.0.1 — correção de contraste dos temas.
   Intervenção estritamente visual: não altera rotas, serviços, dados nem lógica operacional. */
:root,
:root[data-theme="costa"] {
  --chip-bg: rgba(255, 253, 248, .94);
  --chip-text: #123040;
  --chip-muted-text: #52666f;
  --hint-bg: rgba(255, 248, 244, .96);
  --hint-text: #123040;
  --hint-border: var(--primary);
  --warning-chip-bg: #fff6e6;
  --warning-chip-text: #8a4f00;
  --button-secondary-bg: rgba(255, 253, 248, .92);
  --button-secondary-text: #123040;
}

:root[data-theme="sunset"] {
  --chip-bg: rgba(255, 255, 255, .90);
  --chip-text: #172033;
  --chip-muted-text: #425466;
  --hint-bg: rgba(255, 255, 255, .90);
  --hint-text: #172033;
  --hint-border: #ff5d6c;
  --warning-chip-bg: rgba(255, 246, 230, .94);
  --warning-chip-text: #7a3f00;
  --button-secondary-bg: rgba(255, 255, 255, .86);
  --button-secondary-text: #172033;
}

:root[data-theme="noite"] {
  --chip-bg: rgba(11, 34, 51, .94);
  --chip-text: #eaf7ff;
  --chip-muted-text: #b6cad8;
  --hint-bg: rgba(255, 248, 244, .96);
  --hint-text: #102333;
  --hint-border: #ff5f66;
  --warning-chip-bg: rgba(255, 189, 46, .18);
  --warning-chip-text: #ffd66b;
  --button-secondary-bg: rgba(11, 34, 51, .96);
  --button-secondary-text: #eaf7ff;
}

.scope-chip,
.inline-badge,
.state-pill,
.restore-file-chip,
.home-context-row .inline-badge {
  background: var(--chip-bg);
  color: var(--chip-text);
  border-color: color-mix(in srgb, var(--border) 72%, var(--primary) 28%);
}

.scope-chip strong,
.inline-badge strong,
.state-pill strong,
.restore-file-chip strong {
  color: inherit;
}

.home-operational-hint,
.home-profile-fotos .home-operational-hint,
.home-profile-barco .home-operational-hint,
.home-profile-installer .home-operational-hint {
  background: var(--hint-bg);
  color: var(--hint-text);
  border-left-color: var(--hint-border);
}

.inline-badge-warning,
.flash-warning .inline-badge,
.notification-card.notification-pending_approval .inline-badge {
  background: var(--warning-chip-bg);
  color: var(--warning-chip-text);
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
}

.btn-secondary,
.content-top-actions .btn-secondary,
.export-menu summary.btn-secondary,
body.app-shell .content-top-actions-collapsible .btn,
.content-top-actions-shell-collapsible .content-top-actions-collapsible .btn {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
}

html[data-theme="sunset"] .btn-secondary,
html[data-theme="sunset"] .theme-select,
html[data-theme="sunset"] .content-top-actions .btn-secondary,
html[data-theme="sunset"] .header-radio-widget,
html[data-theme="sunset"] .scope-chip,
html[data-theme="sunset"] .inline-badge,
html[data-theme="sunset"] .state-pill {
  color: var(--chip-text);
}

html[data-theme="noite"] .home-operational-hint,
html[data-theme="noite"] .home-profile-installer .home-operational-hint {
  box-shadow: 0 0 0 1px rgba(255, 95, 102, .18), var(--surface-shadow-soft);
}

html[data-theme="noite"] .btn-secondary:hover,
html[data-theme="noite"] .content-top-actions .btn-secondary:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--button-secondary-bg));
}

html[data-theme="sunset"] .panel .muted,
html[data-theme="sunset"] .home-section-card .muted,
html[data-theme="sunset"] .home-list-row div span,
html[data-theme="sunset"] .home-shortcuts .quick-card span {
  color: rgba(255, 249, 241, .82);
}

html[data-theme="sunset"] .home-operational-hint .muted,
html[data-theme="sunset"] .scope-chip .muted,
html[data-theme="sunset"] .inline-badge .muted,
html[data-theme="sunset"] .state-pill .muted,
html[data-theme="sunset"] .restore-file-chip .muted {
  color: var(--chip-muted-text);
}

html[data-theme="noite"] .home-operational-hint .muted,
html[data-theme="noite"] .scope-chip .muted,
html[data-theme="noite"] .inline-badge .muted,
html[data-theme="noite"] .state-pill .muted,
html[data-theme="noite"] .restore-file-chip .muted {
  color: var(--chip-muted-text);
}



/* V6.1 — correção global de contraste + tema Base.
   Intervenção estritamente visual: não altera rotas, serviços, dados nem lógica operacional. */
:root[data-theme="base"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --panel-soft: #fbfcff;
  --text: #172033;
  --muted: #67738a;
  --border: #dde4ef;
  --primary: #1f6feb;
  --primary-dark: #1557b0;
  --danger: #b42318;
  --success: #087443;
  --warning: #b54708;
  --accent: #1f6feb;
  --accent-strong: #1557b0;
  --free-track: #d7dde7;
  --shell-bg: #f5f7fb;
  --sidebar-bg: #0f1728;
  --sidebar-text: #f8fbff;
  --sidebar-muted: #a7b3c8;
  --surface-shadow: 0 6px 20px rgba(18,39,76,.05);
  --surface-shadow-soft: 0 4px 12px rgba(18,39,76,.04);
  --focus-ring: rgba(31,111,235,.35);
  --glass-border: #dde4ef;
  --chip-bg: #f8fbff;
  --chip-text: #172033;
  --chip-muted-text: #67738a;
  --hint-bg: #f7faff;
  --hint-text: #172033;
  --hint-border: #1f6feb;
  --warning-chip-bg: #fff6e6;
  --warning-chip-text: #9a5a00;
  --button-secondary-bg: #eef3fb;
  --button-secondary-text: #172033;
}

:root[data-theme="costa"] {
  --text: #103040;
  --muted: #5c6d76;
}

:root[data-theme="sunset"] {
  color-scheme: light;
  --bg: #18343d;
  --panel: rgba(255, 250, 245, .78);
  --panel-solid: rgba(255, 250, 245, .94);
  --panel-soft: rgba(255, 250, 245, .68);
  --text: #1b2d39;
  --muted: #546675;
  --border: rgba(33, 62, 75, .18);
  --primary: #0d7d8f;
  --primary-dark: #0a5f73;
  --danger: #cc3848;
  --success: #0d8d57;
  --warning: #a86500;
  --accent: #ff7a59;
  --accent-strong: #ff5d6c;
  --free-track: rgba(13, 125, 143, .12);
  --sidebar-text: #fffaf4;
  --sidebar-muted: rgba(255,250,244,.72);
  --focus-ring: rgba(255, 140, 90, .32);
  --glass-border: rgba(255, 255, 255, .42);
  --chip-bg: rgba(255, 252, 248, .95);
  --chip-text: #1b2d39;
  --chip-muted-text: #596c79;
  --hint-bg: rgba(255, 252, 249, .96);
  --hint-text: #1b2d39;
  --hint-border: #ff7a59;
  --warning-chip-bg: rgba(255, 243, 220, .97);
  --warning-chip-text: #8b5200;
  --button-secondary-bg: rgba(255, 252, 248, .94);
  --button-secondary-text: #1b2d39;
}

:root[data-theme="noite"] {
  color-scheme: dark;
  --bg: #06131c;
  --panel: rgba(8, 28, 42, .97);
  --panel-solid: #081c2a;
  --panel-soft: #0d2434;
  --text: #ecf7ff;
  --muted: #b2c5d3;
  --border: rgba(150, 190, 208, .26);
  --primary: #36d8e8;
  --primary-dark: #1596a5;
  --danger: #ff6a70;
  --success: #38d9a9;
  --warning: #ffc24a;
  --accent: #33e1d8;
  --accent-strong: #6ee7f9;
  --free-track: rgba(54, 216, 232, .16);
  --glass-border: rgba(100, 210, 224, .24);
  --chip-bg: #0f2a3b;
  --chip-text: #ecf7ff;
  --chip-muted-text: #b2c5d3;
  --hint-bg: #10293a;
  --hint-text: #ecf7ff;
  --hint-border: #36d8e8;
  --warning-chip-bg: rgba(255, 194, 74, .18);
  --warning-chip-text: #ffd98a;
  --button-secondary-bg: #0d2434;
  --button-secondary-text: #ecf7ff;
}

html[data-theme="base"] body::before,
html[data-theme="base"] .sidebar::after {
  display: none;
}

html[data-theme="base"] .sidebar {
  border-right: 0;
  box-shadow: none;
}

html[data-theme="base"] .brand::before {
  display: none;
}

html[data-theme="base"] .brand-title {
  font-size: 1.1rem;
  letter-spacing: normal;
}

html[data-theme="base"] .nav a,
html[data-theme="base"] .nav-dropdown summary,
html[data-theme="base"] .nav-dropdown a {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
  backdrop-filter: none;
  box-shadow: none;
}

html[data-theme="base"] .nav a:hover,
html[data-theme="base"] .nav a.active,
html[data-theme="base"] .nav-dropdown summary:hover,
html[data-theme="base"] .nav-dropdown summary.active {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.10);
  box-shadow: none;
}

html[data-theme="base"] .panel,
html[data-theme="base"] .login-panel,
html[data-theme="base"] .notification-card,
html[data-theme="base"] .notification-popup-card,
html[data-theme="base"] .summary-card,
html[data-theme="base"] .stat-card,
html[data-theme="base"] .home-section-card,
html[data-theme="base"] .alert-settings-preview,
html[data-theme="base"] .live-update-step,
html[data-theme="base"] .live-update-log-entry {
  backdrop-filter: none;
  border-radius: 1rem;
  box-shadow: var(--surface-shadow);
}

html[data-theme="base"] button,
html[data-theme="base"] .btn {
  background: var(--primary);
  box-shadow: none;
}

html[data-theme="base"] .btn:hover,
html[data-theme="base"] button:hover {
  background: var(--primary-dark);
}

html[data-theme="base"] .btn-secondary,
html[data-theme="base"] .content-top-actions .btn-secondary,
html[data-theme="base"] .export-menu summary.btn-secondary,
html[data-theme="base"] .theme-selector,
html[data-theme="base"] .theme-select,
html[data-theme="base"] .header-radio-widget,
html[data-theme="base"] .scope-chip,
html[data-theme="base"] .inline-badge,
html[data-theme="base"] .state-pill,
html[data-theme="base"] .restore-file-chip {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border-color: var(--border);
}

html[data-theme="base"] .page-header::after {
  display: none;
}

html[data-theme="sunset"] .page-header p,
html[data-theme="sunset"] .muted,
html[data-theme="sunset"] .form-hint,
html[data-theme="sunset"] .field-help,
html[data-theme="sunset"] .small-text,
html[data-theme="sunset"] .home-shortcuts .quick-card span,
html[data-theme="sunset"] .home-list-row span,
html[data-theme="sunset"] .impact-list,
html[data-theme="sunset"] .compact-impact-list,
html[data-theme="sunset"] .restore-file-chip .muted,
html[data-theme="sunset"] .scope-chip .muted,
html[data-theme="sunset"] .inline-badge .muted,
html[data-theme="sunset"] .state-pill .muted {
  color: var(--muted) !important;
}

html[data-theme="noite"] .page-header p,
html[data-theme="noite"] .muted,
html[data-theme="noite"] .form-hint,
html[data-theme="noite"] .field-help,
html[data-theme="noite"] .small-text,
html[data-theme="noite"] .home-shortcuts .quick-card span,
html[data-theme="noite"] .home-list-row span,
html[data-theme="noite"] .impact-list,
html[data-theme="noite"] .compact-impact-list,
html[data-theme="noite"] .restore-file-chip .muted,
html[data-theme="noite"] .scope-chip .muted,
html[data-theme="noite"] .inline-badge .muted,
html[data-theme="noite"] .state-pill .muted {
  color: var(--muted) !important;
}

html[data-theme="sunset"] .content :where(
  .panel, .panel-soft, .summary-card, .stat-card, .home-section-card, .timer-card,
  .notification-card, .notification-popup-card, .alert-settings-preview,
  .live-update-step, .live-update-log-entry, .theme-selector, .header-radio-widget,
  .scope-chip, .inline-badge, .state-pill, .restore-file-chip,
  .toolbar, .filters, .agenda-filters, .agenda-section-nav, .agenda-section-tabs,
  .home-list-row, .home-shortcuts .quick-card, .content-top-actions-collapsible,
  .export-menu-panel, .details-grid, .notice-card, .active-elements-subcard,
  .admin-card, .card, .subcard, .mobile-topbar, .table-wrapper, .resource-table,
  .history-day-card, .history-entry, .schedule-card, .availability-card
),
html[data-theme="noite"] .content :where(
  .panel, .panel-soft, .summary-card, .stat-card, .home-section-card, .timer-card,
  .notification-card, .notification-popup-card, .alert-settings-preview,
  .live-update-step, .live-update-log-entry, .theme-selector, .header-radio-widget,
  .scope-chip, .inline-badge, .state-pill, .restore-file-chip,
  .toolbar, .filters, .agenda-filters, .agenda-section-nav, .agenda-section-tabs,
  .home-list-row, .home-shortcuts .quick-card, .content-top-actions-collapsible,
  .export-menu-panel, .details-grid, .notice-card, .active-elements-subcard,
  .admin-card, .card, .subcard, .mobile-topbar, .table-wrapper, .resource-table,
  .history-day-card, .history-entry, .schedule-card, .availability-card
) {
  color: var(--text) !important;
  border-color: var(--border);
}

html[data-theme="sunset"] .content :where(
  .panel, .summary-card, .stat-card, .home-section-card, .notification-card,
  .notification-popup-card, .alert-settings-preview, .live-update-step,
  .live-update-log-entry, .toolbar, .filters, .agenda-filters,
  .agenda-section-nav, .agenda-section-tabs, .table-wrapper, .details-grid,
  .notice-card, .active-elements-subcard, .card, .subcard
) {
  background: var(--panel);
}

html[data-theme="sunset"] .content :where(
  .panel-soft, .home-list-row, .home-shortcuts .quick-card, .restore-file-chip,
  .header-radio-widget, .content-top-actions-collapsible, .theme-selector,
  .scope-chip, .inline-badge, .state-pill
) {
  background: var(--panel-soft);
}

html[data-theme="noite"] .content :where(
  .panel, .summary-card, .stat-card, .home-section-card, .notification-card,
  .notification-popup-card, .alert-settings-preview, .live-update-step,
  .live-update-log-entry, .toolbar, .filters, .agenda-filters,
  .agenda-section-nav, .agenda-section-tabs, .table-wrapper, .details-grid,
  .notice-card, .active-elements-subcard, .card, .subcard
) {
  background: var(--panel);
}

html[data-theme="noite"] .content :where(
  .panel-soft, .home-list-row, .home-shortcuts .quick-card, .restore-file-chip,
  .header-radio-widget, .content-top-actions-collapsible, .theme-selector,
  .scope-chip, .inline-badge, .state-pill
) {
  background: var(--panel-soft);
}

html[data-theme="sunset"] input[type="text"],
html[data-theme="sunset"] input[type="password"],
html[data-theme="sunset"] input[type="email"],
html[data-theme="sunset"] input[type="date"],
html[data-theme="sunset"] input[type="time"],
html[data-theme="sunset"] input[type="number"],
html[data-theme="sunset"] input[type="file"],
html[data-theme="sunset"] select,
html[data-theme="sunset"] textarea,
html[data-theme="noite"] input[type="text"],
html[data-theme="noite"] input[type="password"],
html[data-theme="noite"] input[type="email"],
html[data-theme="noite"] input[type="date"],
html[data-theme="noite"] input[type="time"],
html[data-theme="noite"] input[type="number"],
html[data-theme="noite"] input[type="file"],
html[data-theme="noite"] select,
html[data-theme="noite"] textarea {
  background: color-mix(in srgb, var(--panel-solid) 96%, transparent) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

html[data-theme="sunset"] option,
html[data-theme="noite"] option {
  background: var(--panel-solid);
  color: var(--text);
}

html[data-theme="sunset"] .btn-secondary,
html[data-theme="sunset"] .content-top-actions .btn-secondary,
html[data-theme="sunset"] .export-menu summary.btn-secondary,
html[data-theme="sunset"] .theme-select,
html[data-theme="noite"] .btn-secondary,
html[data-theme="noite"] .content-top-actions .btn-secondary,
html[data-theme="noite"] .export-menu summary.btn-secondary,
html[data-theme="noite"] .theme-select {
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--border) !important;
}

html[data-theme="sunset"] .table,
html[data-theme="sunset"] .table th,
html[data-theme="sunset"] .table td,
html[data-theme="sunset"] .agenda-table,
html[data-theme="sunset"] .agenda-table * ,
html[data-theme="sunset"] .details-grid,
html[data-theme="sunset"] .details-grid *,
html[data-theme="noite"] .table,
html[data-theme="noite"] .table th,
html[data-theme="noite"] .table td,
html[data-theme="noite"] .agenda-table,
html[data-theme="noite"] .agenda-table *,
html[data-theme="noite"] .details-grid,
html[data-theme="noite"] .details-grid * {
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="sunset"] .table th,
html[data-theme="noite"] .table th {
  background: color-mix(in srgb, var(--panel-solid) 94%, transparent);
}

html[data-theme="sunset"] .table tr:hover td,
html[data-theme="noite"] .table tr:hover td {
  background: color-mix(in srgb, var(--primary) 8%, var(--panel-soft));
}

html[data-theme="sunset"] .home-operational-hint,
html[data-theme="sunset"] .home-profile-fotos .home-operational-hint,
html[data-theme="sunset"] .home-profile-barco .home-operational-hint,
html[data-theme="sunset"] .home-profile-installer .home-operational-hint,
html[data-theme="noite"] .home-operational-hint,
html[data-theme="noite"] .home-profile-fotos .home-operational-hint,
html[data-theme="noite"] .home-profile-barco .home-operational-hint,
html[data-theme="noite"] .home-profile-installer .home-operational-hint {
  background: var(--hint-bg) !important;
  color: var(--hint-text) !important;
  border-left-color: var(--hint-border) !important;
}

html[data-theme="sunset"] .scope-chip,
html[data-theme="sunset"] .inline-badge,
html[data-theme="sunset"] .state-pill,
html[data-theme="sunset"] .restore-file-chip,
html[data-theme="noite"] .scope-chip,
html[data-theme="noite"] .inline-badge,
html[data-theme="noite"] .state-pill,
html[data-theme="noite"] .restore-file-chip {
  background: var(--chip-bg) !important;
  color: var(--chip-text) !important;
  border-color: color-mix(in srgb, var(--border) 72%, var(--primary) 28%) !important;
}

html[data-theme="sunset"] .inline-badge-warning,
html[data-theme="sunset"] .flash-warning .inline-badge,
html[data-theme="sunset"] .notification-card.notification-pending_approval .inline-badge,
html[data-theme="noite"] .inline-badge-warning,
html[data-theme="noite"] .flash-warning .inline-badge,
html[data-theme="noite"] .notification-card.notification-pending_approval .inline-badge {
  background: var(--warning-chip-bg) !important;
  color: var(--warning-chip-text) !important;
}

html[data-theme="sunset"] .flash,
html[data-theme="sunset"] .flash-success,
html[data-theme="sunset"] .flash-warning,
html[data-theme="sunset"] .flash-error,
html[data-theme="noite"] .flash,
html[data-theme="noite"] .flash-success,
html[data-theme="noite"] .flash-warning,
html[data-theme="noite"] .flash-error {
  color: var(--text);
}

html[data-theme="sunset"] .flash-success,
html[data-theme="sunset"] .notification-card.notification-approved_final,
html[data-theme="sunset"] .live-update-step.status-done,
html[data-theme="noite"] .flash-success,
html[data-theme="noite"] .notification-card.notification-approved_final,
html[data-theme="noite"] .live-update-step.status-done {
  background: color-mix(in srgb, var(--success) 14%, var(--panel));
}

html[data-theme="sunset"] .flash-warning,
html[data-theme="sunset"] .notification-card.notification-pending_approval,
html[data-theme="sunset"] .live-update-step.status-failed-with-rollback,
html[data-theme="sunset"] .live-update-step.status-rollback-in-progress,
html[data-theme="noite"] .flash-warning,
html[data-theme="noite"] .notification-card.notification-pending_approval,
html[data-theme="noite"] .live-update-step.status-failed-with-rollback,
html[data-theme="noite"] .live-update-step.status-rollback-in-progress {
  background: color-mix(in srgb, var(--warning) 14%, var(--panel));
}

html[data-theme="sunset"] .flash-error,
html[data-theme="sunset"] .notification-card.notification-refused,
html[data-theme="sunset"] .notification-card.notification-cancelled_after_approval,
html[data-theme="noite"] .flash-error,
html[data-theme="noite"] .notification-card.notification-refused,
html[data-theme="noite"] .notification-card.notification-cancelled_after_approval {
  background: color-mix(in srgb, var(--danger) 14%, var(--panel));
}

html[data-theme="sunset"] .agenda-block,
html[data-theme="sunset"] .agenda-event-block,
html[data-theme="noite"] .agenda-block,
html[data-theme="noite"] .agenda-event-block {
  border-color: color-mix(in srgb, var(--border) 76%, var(--primary) 24%);
}

html[data-theme="sunset"] .notification-popup-card,
html[data-theme="noite"] .notification-popup-card {
  box-shadow: 0 22px 55px rgba(15, 23, 42, .30);
}

/* V6.1.1 — bloqueio final de contraste para temas escuros/visuais.
   Objetivo: impedir texto com baixo contraste em superfícies, cartões, tabelas,
   formulários, modais, avisos e blocos operacionais. Apenas CSS. */
:root[data-theme="sunset"] {
  --bo-shell-text: #fffaf4;
  --bo-shell-muted: rgba(255, 250, 244, .84);
  --bo-surface-bg: rgba(255, 252, 248, .96);
  --bo-surface-bg-soft: rgba(255, 250, 245, .88);
  --bo-surface-text: #172033;
  --bo-surface-muted: #526575;
  --bo-surface-border: rgba(33, 62, 75, .24);
  --bo-input-bg: #fffdf8;
  --bo-input-text: #172033;
  --bo-code-bg: #eef4f8;
  --bo-code-text: #172033;
  --bo-success-bg: #e8f7ef;
  --bo-success-text: #075f39;
  --bo-warning-bg: #fff3dc;
  --bo-warning-text: #7a4500;
  --bo-danger-bg: #fff0ef;
  --bo-danger-text: #9b211b;
  --bo-info-bg: #eef8fb;
  --bo-info-text: #064f63;
}

:root[data-theme="noite"] {
  --bo-shell-text: #ecf7ff;
  --bo-shell-muted: #b2c5d3;
  --bo-surface-bg: #081c2a;
  --bo-surface-bg-soft: #0d2434;
  --bo-surface-text: #ecf7ff;
  --bo-surface-muted: #b2c5d3;
  --bo-surface-border: rgba(150, 190, 208, .32);
  --bo-input-bg: #071926;
  --bo-input-text: #ecf7ff;
  --bo-code-bg: #0f2a3b;
  --bo-code-text: #ecf7ff;
  --bo-success-bg: rgba(56, 217, 169, .16);
  --bo-success-text: #9ff3d5;
  --bo-warning-bg: rgba(255, 194, 74, .18);
  --bo-warning-text: #ffd98a;
  --bo-danger-bg: rgba(255, 106, 112, .18);
  --bo-danger-text: #ffb9bd;
  --bo-info-bg: rgba(54, 216, 232, .14);
  --bo-info-text: #a8f3fb;
}

html[data-theme="sunset"] body {
  color: var(--bo-shell-text) !important;
}

html[data-theme="sunset"] .page-header h1,
html[data-theme="sunset"] .page-header p,
html[data-theme="sunset"] .page-header .muted,
html[data-theme="sunset"] .page-header .small-text,
html[data-theme="sunset"] .mobile-topbar-title strong,
html[data-theme="sunset"] .mobile-topbar-title span {
  color: var(--bo-shell-text) !important;
  text-shadow: 0 2px 10px rgba(0, 28, 40, .30);
}

html[data-theme="sunset"] .content > .muted,
html[data-theme="sunset"] .content > .small-text,
html[data-theme="sunset"] .content-top-main > .muted,
html[data-theme="sunset"] .content-top-main > .small-text {
  color: var(--bo-shell-muted) !important;
}

html[data-theme="sunset"] :where(
  .panel, .panel-soft, .login-panel, .summary-card, .stat-card, .home-section-card,
  .home-hero, .home-list-row, .home-shortcuts .quick-card, .quick-card,
  .notification-card, .notification-popup-card, .global-alert, .modal-card,
  .danger-confirm-card, .danger-confirm-summary, .notice-card, .warning-card,
  .agenda-section-nav, .agenda-operational-legend, .agenda-kind-segments,
  .agenda-mode-card, .agenda-now-card, .agenda-booking-card,
  .agenda-card-meta div, .agenda-card-notes, .agenda-hour-group, .agenda-hour-card,
  .agenda-collapsible-panel, .agenda-priority-panel, .timeline-detail-box,
  .timer-resource-group, .timer-card, .timer-booking-group-head,
  .timer-active-config, .timer-provisional-banner, .timer-status-badge,
  .history-card, .history-mobile-card, .history-mobile-observations,
  .transfer-summary-panel, .transfer-mobile-card, .live-update-step,
  .live-update-log-entry, .log-entry, .details-grid, .alert-settings-preview,
  .export-menu-panel, .theme-selector, .header-radio-widget,
  .content-top-actions-collapsible, .active-elements-subcard, .active-elements-group-card,
  .section-card, .restore-file-chip, .scope-chip, .inline-badge, .state-pill,
  .status-pill, .sub-resource-tag, .assignment-option, .chip-checkbox
) {
  background: var(--bo-surface-bg) !important;
  color: var(--bo-surface-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="sunset"] :where(
  .panel-soft, .home-list-row, .home-shortcuts .quick-card, .quick-card,
  .agenda-card-meta div, .agenda-card-notes, .agenda-hour-card,
  .timer-active-config, .timer-provisional-banner, .history-mobile-observations,
  .danger-confirm-summary, .log-entry code, code, .restore-file-chip,
  .scope-chip, .inline-badge, .state-pill, .status-pill, .sub-resource-tag,
  .assignment-option, .chip-checkbox
) {
  background: var(--bo-surface-bg-soft) !important;
}

html[data-theme="noite"] :where(
  .panel, .panel-soft, .login-panel, .summary-card, .stat-card, .home-section-card,
  .home-hero, .home-list-row, .home-shortcuts .quick-card, .quick-card,
  .notification-card, .notification-popup-card, .global-alert, .modal-card,
  .danger-confirm-card, .danger-confirm-summary, .notice-card, .warning-card,
  .agenda-section-nav, .agenda-operational-legend, .agenda-kind-segments,
  .agenda-mode-card, .agenda-now-card, .agenda-booking-card,
  .agenda-card-meta div, .agenda-card-notes, .agenda-hour-group, .agenda-hour-card,
  .agenda-collapsible-panel, .agenda-priority-panel, .timeline-detail-box,
  .timer-resource-group, .timer-card, .timer-booking-group-head,
  .timer-active-config, .timer-provisional-banner, .timer-status-badge,
  .history-card, .history-mobile-card, .history-mobile-observations,
  .transfer-summary-panel, .transfer-mobile-card, .live-update-step,
  .live-update-log-entry, .log-entry, .details-grid, .alert-settings-preview,
  .export-menu-panel, .theme-selector, .header-radio-widget,
  .content-top-actions-collapsible, .active-elements-subcard, .active-elements-group-card,
  .section-card, .restore-file-chip, .scope-chip, .inline-badge, .state-pill,
  .status-pill, .sub-resource-tag, .assignment-option, .chip-checkbox
) {
  background: var(--bo-surface-bg) !important;
  color: var(--bo-surface-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="noite"] :where(
  .panel-soft, .home-list-row, .home-shortcuts .quick-card, .quick-card,
  .agenda-card-meta div, .agenda-card-notes, .agenda-hour-card,
  .timer-active-config, .timer-provisional-banner, .history-mobile-observations,
  .danger-confirm-summary, .log-entry code, code, .restore-file-chip,
  .scope-chip, .inline-badge, .state-pill, .status-pill, .sub-resource-tag,
  .assignment-option, .chip-checkbox
) {
  background: var(--bo-surface-bg-soft) !important;
}

html[data-theme="sunset"] :where(
  .panel, .panel-soft, .login-panel, .summary-card, .stat-card, .home-section-card,
  .home-hero, .home-list-row, .home-shortcuts .quick-card, .notification-card,
  .notification-popup-card, .global-alert, .modal-card, .danger-confirm-card,
  .notice-card, .agenda-section-nav, .agenda-operational-legend,
  .agenda-kind-segments, .agenda-mode-card, .agenda-now-card,
  .agenda-booking-card, .agenda-hour-group, .agenda-hour-card,
  .timeline-detail-box, .timer-resource-group, .timer-card,
  .history-card, .history-mobile-card, .transfer-mobile-card,
  .live-update-step, .live-update-log-entry, .log-entry, .details-grid,
  .alert-settings-preview, .export-menu-panel, .theme-selector,
  .header-radio-widget, .content-top-actions-collapsible,
  .active-elements-subcard, .section-card
) :where(.muted, .small-text, .form-hint, .field-help, small, dt, label span, .timer-field label, .home-metric-label, .agenda-card-resource, .agenda-hour-main span, .history-mobile-card-grid span, .history-mobile-subresources > span, .transfer-mobile-card div span, .log-entry-header, .details-grid dt) {
  color: var(--bo-surface-muted) !important;
}

html[data-theme="noite"] :where(
  .panel, .panel-soft, .login-panel, .summary-card, .stat-card, .home-section-card,
  .home-hero, .home-list-row, .home-shortcuts .quick-card, .notification-card,
  .notification-popup-card, .global-alert, .modal-card, .danger-confirm-card,
  .notice-card, .agenda-section-nav, .agenda-operational-legend,
  .agenda-kind-segments, .agenda-mode-card, .agenda-now-card,
  .agenda-booking-card, .agenda-hour-group, .agenda-hour-card,
  .timeline-detail-box, .timer-resource-group, .timer-card,
  .history-card, .history-mobile-card, .transfer-mobile-card,
  .live-update-step, .live-update-log-entry, .log-entry, .details-grid,
  .alert-settings-preview, .export-menu-panel, .theme-selector,
  .header-radio-widget, .content-top-actions-collapsible,
  .active-elements-subcard, .section-card
) :where(.muted, .small-text, .form-hint, .field-help, small, dt, label span, .timer-field label, .home-metric-label, .agenda-card-resource, .agenda-hour-main span, .history-mobile-card-grid span, .history-mobile-subresources > span, .transfer-mobile-card div span, .log-entry-header, .details-grid dt) {
  color: var(--bo-surface-muted) !important;
}

html[data-theme="sunset"] :where(h1, h2, h3, h4, h5, h6, strong, b, dt, dd, .agenda-card-time, .agenda-hour-time, .timeline-detail-title, .timeline-detail-grid em),
html[data-theme="noite"] :where(h1, h2, h3, h4, h5, h6, strong, b, dt, dd, .agenda-card-time, .agenda-hour-time, .timeline-detail-title, .timeline-detail-grid em) {
  color: inherit;
}

html[data-theme="sunset"] :where(input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], input[type="file"], select, textarea),
html[data-theme="noite"] :where(input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], input[type="file"], select, textarea) {
  background: var(--bo-input-bg) !important;
  color: var(--bo-input-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="sunset"] :where(input::placeholder, textarea::placeholder),
html[data-theme="noite"] :where(input::placeholder, textarea::placeholder) {
  color: color-mix(in srgb, var(--bo-input-text) 58%, transparent) !important;
}

html[data-theme="sunset"] option,
html[data-theme="noite"] option {
  background: var(--bo-input-bg) !important;
  color: var(--bo-input-text) !important;
}

html[data-theme="sunset"] :where(code, pre, .log-entry code),
html[data-theme="noite"] :where(code, pre, .log-entry code) {
  background: var(--bo-code-bg) !important;
  color: var(--bo-code-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="sunset"] :where(.table, .table th, .table td, .agenda-table, .agenda-table th, .agenda-table td),
html[data-theme="noite"] :where(.table, .table th, .table td, .agenda-table, .agenda-table th, .agenda-table td) {
  color: var(--bo-surface-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="sunset"] :where(.table th, .agenda-table th),
html[data-theme="noite"] :where(.table th, .agenda-table th) {
  background: var(--bo-surface-bg-soft) !important;
  color: var(--bo-surface-text) !important;
}

html[data-theme="sunset"] :where(.table tr:hover td, .agenda-table tr:hover td),
html[data-theme="noite"] :where(.table tr:hover td, .agenda-table tr:hover td) {
  background: color-mix(in srgb, var(--primary) 10%, var(--bo-surface-bg-soft)) !important;
}

html[data-theme="sunset"] .agenda-collapsible-section > summary,
html[data-theme="noite"] .agenda-collapsible-section > summary {
  color: var(--bo-surface-text) !important;
}

html[data-theme="sunset"] .agenda-collapsible-section > summary small,
html[data-theme="noite"] .agenda-collapsible-section > summary small {
  color: var(--bo-surface-muted) !important;
}

html[data-theme="sunset"] .agenda-collapsible-section > summary::after,
html[data-theme="noite"] .agenda-collapsible-section > summary::after {
  background: var(--bo-surface-bg-soft) !important;
  color: var(--bo-surface-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="sunset"] :where(.flash-success, .notification-approved_final, .live-update-step.status-done, .live-update-status-pill.status-completed, .live-update-status-pill.status-success, .live-update-log-entry.level-success, .status-running, .audit-ok),
html[data-theme="noite"] :where(.flash-success, .notification-approved_final, .live-update-step.status-done, .live-update-status-pill.status-completed, .live-update-status-pill.status-success, .live-update-log-entry.level-success, .status-running, .audit-ok) {
  background: var(--bo-success-bg) !important;
  color: var(--bo-success-text) !important;
  border-color: color-mix(in srgb, var(--success) 55%, var(--bo-surface-border)) !important;
}

html[data-theme="sunset"] :where(.flash-warning, .notification-pending_approval, .live-update-step.status-failed-with-rollback, .live-update-step.status-rollback-in-progress, .live-update-status-pill.status-failed-with-rollback, .live-update-status-pill.status-rollback-in-progress, .live-update-log-entry.level-warning, .status-stopped, .status-not_started, .audit-fail, .inline-badge-warning),
html[data-theme="noite"] :where(.flash-warning, .notification-pending_approval, .live-update-step.status-failed-with-rollback, .live-update-step.status-rollback-in-progress, .live-update-status-pill.status-failed-with-rollback, .live-update-status-pill.status-rollback-in-progress, .live-update-log-entry.level-warning, .status-stopped, .status-not_started, .audit-fail, .inline-badge-warning) {
  background: var(--bo-warning-bg) !important;
  color: var(--bo-warning-text) !important;
  border-color: color-mix(in srgb, var(--warning) 55%, var(--bo-surface-border)) !important;
}

html[data-theme="sunset"] :where(.flash-error, .notification-refused, .notification-cancelled_after_approval, .live-update-step.status-rollback-failed, .live-update-step.status-failed, .live-update-status-pill.status-rollback-failed, .live-update-status-pill.status-failed, .live-update-log-entry.level-error, .status-error, .status-stopped_with_error, .log-entry-error, .danger-confirm-consequence),
html[data-theme="noite"] :where(.flash-error, .notification-refused, .notification-cancelled_after_approval, .live-update-step.status-rollback-failed, .live-update-step.status-failed, .live-update-status-pill.status-rollback-failed, .live-update-status-pill.status-failed, .live-update-log-entry.level-error, .status-error, .status-stopped_with_error, .log-entry-error, .danger-confirm-consequence) {
  background: var(--bo-danger-bg) !important;
  color: var(--bo-danger-text) !important;
  border-color: color-mix(in srgb, var(--danger) 55%, var(--bo-surface-border)) !important;
}

html[data-theme="sunset"] :where(.live-update-status-pill.status-validated, .live-update-status-pill.status-uploading, .live-update-status-pill.status-validating, .live-update-status-pill.status-queued, .live-update-status-pill.status-apply-in-progress, .live-update-status-pill.status-backup-in-progress, .live-update-status-pill.status-restart-in-progress, .live-update-status-pill.status-post-validation-in-progress, .live-update-log-entry.level-info, .transfer-summary-panel),
html[data-theme="noite"] :where(.live-update-status-pill.status-validated, .live-update-status-pill.status-uploading, .live-update-status-pill.status-validating, .live-update-status-pill.status-queued, .live-update-status-pill.status-apply-in-progress, .live-update-status-pill.status-backup-in-progress, .live-update-status-pill.status-restart-in-progress, .live-update-status-pill.status-post-validation-in-progress, .live-update-log-entry.level-info, .transfer-summary-panel) {
  background: var(--bo-info-bg) !important;
  color: var(--bo-info-text) !important;
  border-color: color-mix(in srgb, var(--primary) 50%, var(--bo-surface-border)) !important;
}

html[data-theme="sunset"] :where(.btn-secondary, .content-top-actions .btn-secondary, .export-menu summary.btn-secondary, .theme-select, .content-top-toggle),
html[data-theme="noite"] :where(.btn-secondary, .content-top-actions .btn-secondary, .export-menu summary.btn-secondary, .theme-select, .content-top-toggle) {
  background: var(--bo-surface-bg-soft) !important;
  color: var(--bo-surface-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="sunset"] :where(.btn-secondary:hover, .content-top-actions .btn-secondary:hover, .export-menu summary.btn-secondary:hover, .content-top-toggle:hover),
html[data-theme="noite"] :where(.btn-secondary:hover, .content-top-actions .btn-secondary:hover, .export-menu summary.btn-secondary:hover, .content-top-toggle:hover) {
  background: color-mix(in srgb, var(--primary) 12%, var(--bo-surface-bg-soft)) !important;
}

html[data-theme="sunset"] .home-operational-hint,
html[data-theme="sunset"] .home-profile-fotos .home-operational-hint,
html[data-theme="sunset"] .home-profile-barco .home-operational-hint,
html[data-theme="sunset"] .home-profile-installer .home-operational-hint,
html[data-theme="noite"] .home-operational-hint,
html[data-theme="noite"] .home-profile-fotos .home-operational-hint,
html[data-theme="noite"] .home-profile-barco .home-operational-hint,
html[data-theme="noite"] .home-profile-installer .home-operational-hint {
  background: var(--bo-info-bg) !important;
  color: var(--bo-info-text) !important;
  border-left-color: var(--primary) !important;
}

html[data-theme="sunset"] .home-profile-fotos .home-operational-hint,
html[data-theme="sunset"] .home-profile-barco .home-operational-hint,
html[data-theme="noite"] .home-profile-fotos .home-operational-hint,
html[data-theme="noite"] .home-profile-barco .home-operational-hint {
  background: var(--bo-warning-bg) !important;
  color: var(--bo-warning-text) !important;
  border-left-color: var(--warning) !important;
}

html[data-theme="sunset"] .home-profile-installer .home-operational-hint,
html[data-theme="noite"] .home-profile-installer .home-operational-hint {
  background: var(--bo-danger-bg) !important;
  color: var(--bo-danger-text) !important;
  border-left-color: var(--danger) !important;
}

html[data-theme="sunset"] .timer-card.phase-aviso_regresso,
html[data-theme="sunset"] .timer-card.phase-fim_total,
html[data-theme="noite"] .timer-card.phase-aviso_regresso,
html[data-theme="noite"] .timer-card.phase-fim_total {
  color: #ffffff !important;
}

html[data-theme="sunset"] .timer-card.phase-aviso_regresso :where(.muted, .small-text, .timer-phase, .timer-field label, .timer-title .muted, .timer-help-text, .timer-half-time-toggle small),
html[data-theme="sunset"] .timer-card.phase-fim_total :where(.muted, .small-text, .timer-phase, .timer-field label, .timer-title .muted, .timer-help-text, .timer-half-time-toggle small),
html[data-theme="noite"] .timer-card.phase-aviso_regresso :where(.muted, .small-text, .timer-phase, .timer-field label, .timer-title .muted, .timer-help-text, .timer-half-time-toggle small),
html[data-theme="noite"] .timer-card.phase-fim_total :where(.muted, .small-text, .timer-phase, .timer-field label, .timer-title .muted, .timer-help-text, .timer-half-time-toggle small) {
  color: rgba(255, 255, 255, .88) !important;
}

html[data-theme="sunset"] .timer-card.phase-aviso_regresso :where(input, select),
html[data-theme="sunset"] .timer-card.phase-fim_total :where(input, select),
html[data-theme="noite"] .timer-card.phase-aviso_regresso :where(input, select),
html[data-theme="noite"] .timer-card.phase-fim_total :where(input, select) {
  background: rgba(255, 255, 255, .94) !important;
  color: #172033 !important;
  border-color: rgba(255, 255, 255, .65) !important;
}

html[data-theme="sunset"] .agenda-section-link:not(.active),
html[data-theme="noite"] .agenda-section-link:not(.active) {
  background: var(--bo-surface-bg-soft) !important;
  color: var(--bo-surface-text) !important;
  border-color: var(--bo-surface-border) !important;
}

html[data-theme="sunset"] .agenda-section-link.active,
html[data-theme="sunset"] .agenda-section-link:hover,
html[data-theme="noite"] .agenda-section-link.active,
html[data-theme="noite"] .agenda-section-link:hover {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
}

html[data-theme="sunset"] .notification-popup-backdrop,
html[data-theme="sunset"] .modal-backdrop,
html[data-theme="sunset"] .danger-confirm-backdrop,
html[data-theme="noite"] .notification-popup-backdrop,
html[data-theme="noite"] .modal-backdrop,
html[data-theme="noite"] .danger-confirm-backdrop {
  background: rgba(3, 16, 26, .70) !important;
}

html[data-theme="sunset"] .brand-title,
html[data-theme="sunset"] .brand-version,
html[data-theme="sunset"] .nav a,
html[data-theme="sunset"] .nav-dropdown summary,
html[data-theme="sunset"] .nav-dropdown a,
html[data-theme="sunset"] .user-chip,
html[data-theme="sunset"] .user-role,
html[data-theme="noite"] .brand-title,
html[data-theme="noite"] .brand-version,
html[data-theme="noite"] .nav a,
html[data-theme="noite"] .nav-dropdown summary,
html[data-theme="noite"] .nav-dropdown a,
html[data-theme="noite"] .user-chip,
html[data-theme="noite"] .user-role {
  color: var(--sidebar-text) !important;
}

html[data-theme="sunset"] .brand-version,
html[data-theme="sunset"] .user-role,
html[data-theme="noite"] .brand-version,
html[data-theme="noite"] .user-role {
  color: var(--sidebar-muted) !important;
}


/* V6.2 - correções críticas mobile/tablet do roadmap unificado.
   Escopo: apresentação e interação; sem alterações ao modelo de dados ou regras de temporizadores. */
@media (pointer: coarse) {
  :where(button, .btn, input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], input[type="file"], select, textarea, summary[role="button"], .nav a, .nav-dropdown summary, .timer-action, .timer-group-button, .content-top-toggle) {
    min-height: 44px;
  }
  :where(.timer-group-button, .mobile-menu-button, .sidebar-close, .notification-popup-close, .alert-popup-close) {
    min-width: 44px;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-toggle {
    min-height: 44px;
  }
}

@media (max-width: 900px) {
  .content-top-controls {
    grid-template-columns: 1fr;
    gap: .45rem;
    margin-bottom: .55rem;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] {
    justify-items: stretch;
    width: 100%;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-toggle {
    display: inline-flex;
    width: 100%;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible {
    width: 100%;
    justify-content: stretch;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
  body.page-timers .timer-grid,
  body.page-timers .timer-grid.timer-grid-manual {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.page-timers .timer-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem .65rem;
    align-items: center;
    padding: .72rem;
  }
  body.page-timers .timer-card > .timer-card-header {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .35rem;
    margin-bottom: .1rem;
  }
  body.page-timers .timer-card .timer-title h3 {
    font-size: .9rem;
    line-height: 1.18;
  }
  body.page-timers .timer-card .timer-phase,
  body.page-timers .timer-card .inline-badge {
    font-size: .78rem;
    line-height: 1.15;
  }
  body.page-timers .timer-card .muted,
  body.page-timers .timer-field label {
    font-size: .72rem;
  }
  body.page-timers .timer-display {
    grid-column: 1 / 2;
    margin: .05rem 0;
    font-size: clamp(1.8rem, 7.2vh, 2.35rem);
    line-height: 1;
    text-align: left;
    letter-spacing: .01em;
  }
  body.page-timers .timer-card-actions {
    grid-column: 2 / 3;
    align-self: center;
    justify-self: end;
    min-width: min(38vw, 180px);
  }
  body.page-timers .timer-action {
    width: 100%;
    min-height: 44px;
    padding: .55rem .72rem;
    font-size: .86rem;
  }
  body.page-timers .timer-group-buttons {
    gap: .35rem;
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }
  body.page-timers .timer-group-button {
    min-height: 44px;
    min-width: 44px;
    padding: .35rem .25rem;
    font-size: .82rem;
  }
  body.page-timers .timer-card select,
  body.page-timers .timer-card input {
    min-height: 44px;
    padding: .45rem .55rem;
    font-size: .86rem;
  }
  body.page-timers .timer-help-text,
  body.page-timers .timer-half-time-toggle small,
  body.page-timers .timer-linked-booking,
  body.page-timers .timer-active-config {
    display: none;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) and (max-height: 620px) {
  body.page-timers .timer-card {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: .58rem;
  }
  body.page-timers .timer-card .timer-title h3 {
    font-size: .86rem;
  }
  body.page-timers .timer-card .timer-phase,
  body.page-timers .timer-card .inline-badge {
    font-size: .78rem;
  }
  body.page-timers .timer-display {
    font-size: clamp(1.8rem, 8vh, 2.2rem);
  }
  body.page-timers .timer-field-duration,
  body.page-timers .timer-field-discount,
  body.page-timers .timer-field-group,
  body.page-timers .timer-half-time-toggle {
    grid-column: 1 / -1;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) and (max-height: 420px) {
  body.page-timers .content {
    padding: .45rem;
  }
  body.page-timers .mobile-topbar {
    margin-bottom: .28rem;
  }
  body.page-timers .content-top-controls {
    margin-bottom: .35rem;
  }
  body.page-timers .timer-resource-group.panel {
    padding: .48rem;
  }
  body.page-timers .timer-resource-header .small-text,
  body.page-timers .timer-resource-header .muted {
    display: none;
  }
  body.page-timers .timer-card .timer-title .muted,
  body.page-timers .timer-card .chip-row:empty {
    display: none;
  }
}

/* V6.3 - Agenda/tablet portrait e tabelas responsivas do roadmap unificado.
   Escopo: apresentação e redundância textual; sem alterações a persistência, backup, live update ou regras de negócio. */
.agenda-block-state {
  display: block;
  max-width: 100%;
  margin-top: .12rem;
  font-size: .66rem;
  line-height: 1.05;
  font-weight: 850;
  opacity: .96;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.responsive-table-card,
.responsive-table {
  width: 100%;
}

@media (max-width: 1024px) and (orientation: portrait) {
  body {
    overflow-x: hidden;
  }

  .agenda-page-header,
  .agenda-primary-filters,
  .agenda-section-heading,
  .timeline-header-row,
  .unit-resource-head,
  .running-card-head,
  .notification-card-head,
  .info-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .agenda-filters-form,
  .filters,
  .form-actions-inline,
  .agenda-filter-actions,
  .page-actions,
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: .65rem;
  }

  .filters label,
  .agenda-filters-form label,
  .agenda-filter-actions .btn,
  .page-actions .btn,
  .toolbar .btn,
  .toolbar button,
  .toolbar select {
    width: 100%;
  }

  .agenda-mobile-card-list,
  .agenda-mobile-hour-list,
  .history-mobile-card-list,
  .transfer-mobile-card-list {
    display: grid;
    gap: .85rem;
  }

  .agenda-desktop-table,
  .agenda-desktop-timeline,
  .history-table-shell,
  .transfer-table-shell {
    display: none !important;
  }

  .timeline-scroll-shell {
    overflow-x: visible;
    max-width: 100%;
  }

  .unit-agenda-grid,
  .agenda-event-grid,
  .detailed-header {
    min-width: 0 !important;
    width: 100%;
  }

  .unit-resource-card {
    min-width: 0;
  }

  .resource-summary-badges {
    justify-content: flex-start;
  }

  .unit-row,
  .agenda-event-unit-row-no-label {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: .45rem;
    align-items: stretch;
    min-width: 0;
  }

  .unit-label {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .unit-track-shell,
  .agenda-event-unit-row-no-label .unit-track-shell {
    min-width: 0 !important;
    width: 100%;
  }

  .unit-timeline-ruler {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    row-gap: .18rem;
    font-size: .6rem;
  }

  .unit-timeline-ruler .hour-cell:nth-child(even) small {
    display: none;
  }

  .agenda-track {
    min-height: 54px;
    border-radius: .95rem;
  }

  .agenda-block,
  .agenda-event-block {
    top: 6px;
    bottom: 6px;
    min-width: 44px;
    padding: .28rem .36rem;
    font-size: .72rem;
    line-height: 1.05;
  }

  .agenda-block span,
  .agenda-event-block span {
    white-space: normal;
    line-height: 1.05;
  }

  .agenda-hour-card,
  .agenda-booking-card-head,
  .history-mobile-card-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .agenda-card-actions .agenda-status-value-form,
  .history-mobile-actions .inline-form {
    grid-template-columns: 1fr;
  }

  .agenda-card-actions .btn,
  .agenda-card-actions button,
  .agenda-card-actions select,
  .agenda-card-actions input,
  .history-mobile-actions .btn,
  .history-mobile-actions button,
  .history-mobile-actions select,
  .history-mobile-actions input {
    width: 100%;
    min-height: 44px;
  }

  .responsive-table,
  .responsive-table-card,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) {
    overflow: visible;
  }

  .responsive-table table,
  .responsive-table-card table,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table {
    display: block;
    width: 100%;
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
  }

  .responsive-table thead,
  .responsive-table-card thead,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table thead {
    display: none;
  }

  .responsive-table tbody,
  .responsive-table-card tbody,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table tbody {
    display: grid;
    gap: .75rem;
  }

  .responsive-table tr,
  .responsive-table-card tr,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table tr {
    display: grid;
    gap: .48rem;
    width: 100%;
    padding: .78rem;
    border: 1px solid var(--border);
    border-radius: .95rem;
    background: var(--panel, #ffffff);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
  }

  .responsive-table td,
  .responsive-table-card td,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table td {
    display: grid;
    grid-template-columns: minmax(7.8rem, 38%) minmax(0, 1fr);
    gap: .55rem;
    align-items: start;
    padding: .35rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
    overflow-wrap: anywhere;
  }

  .responsive-table td:last-child,
  .responsive-table-card td:last-child,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table td:last-child {
    border-bottom: 0;
  }

  .responsive-table td::before,
  .responsive-table-card td::before,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .76rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .025em;
  }

  .responsive-table td[data-label=""]::before,
  .responsive-table-card td[data-label=""]::before,
  .table-shell:not(.agenda-desktop-table):not(.history-table-shell):not(.transfer-table-shell) > table td[data-label=""]::before {
    content: "Campo";
  }
}

@media (min-width: 761px) and (max-width: 1024px) and (orientation: portrait) {
  .agenda-mobile-card-list,
  .agenda-mobile-hour-list,
  .history-mobile-card-list {
    display: grid;
  }

  .agenda-desktop-table,
  .agenda-desktop-timeline,
  .history-table-shell {
    display: none !important;
  }

  .agenda-hour-card {
    grid-template-columns: minmax(6rem, auto) minmax(0, 1fr) auto;
  }

  .agenda-card-meta,
  .history-mobile-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* V6.4 - Formulários, validação inline, teclado virtual e ações críticas.
   Escopo: UX operacional em toque; sem alterações a persistência, backup, live update ou regras de negócio. */
.form-mobile-safe input,
.form-mobile-safe select,
.form-mobile-safe textarea,
[data-inline-validation] input,
[data-inline-validation] select,
[data-inline-validation] textarea {
  scroll-margin-top: 5rem;
  scroll-margin-bottom: 11rem;
}

.form-section-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: .75rem;
  margin: .2rem 0 .05rem;
  padding: .8rem .9rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: .95rem;
  background: #f8fafc;
}

.form-section-heading h3 {
  margin: 0 0 .15rem;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--text, #111827);
}

.form-section-heading p {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: .88rem;
  line-height: 1.35;
}

.form-section-heading-action {
  background: #f7faff;
  border-color: rgba(37, 99, 235, .18);
}

.form-section-step {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  border-radius: .7rem;
  background: var(--primary, #1f6feb);
  color: #fff;
  font-weight: 900;
}

.field-has-error > span,
.field-has-error .field-help {
  color: var(--danger, #dc2626) !important;
}

[data-inline-validation] [aria-invalid="true"],
.form-mobile-safe [aria-invalid="true"] {
  border-color: var(--danger, #dc2626) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .14);
  background: #fffafa;
}

.field-error {
  display: block;
  margin-top: .35rem;
  color: var(--danger, #b91c1c);
  font-size: .84rem;
  line-height: 1.35;
  font-weight: 750;
}

.action-group-safe {
  align-items: center;
}

.destructive-action-zone {
  margin-top: .65rem;
  padding-top: .65rem;
  border-top: 1px dashed rgba(220, 38, 38, .5);
}

.toolbar .destructive-action-zone,
.form-actions-inline .destructive-action-zone {
  flex-basis: 100%;
}

.danger-confirm-shell {
  z-index: 12000;
}

.danger-confirm-card:focus {
  outline: none;
}

body[data-overlay-priority="danger-modal"] .notification-center-panel,
body[data-overlay-priority="danger-modal"] .global-timer-alert-stack {
  pointer-events: none;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .form-section-heading {
    grid-template-columns: 1fr;
    gap: .55rem;
  }

  .form-section-step {
    width: 2.25rem;
    height: 2.25rem;
  }

  .form-mobile-safe,
  [data-inline-validation] {
    padding-bottom: 2.5rem;
  }

  .action-bar-sticky {
    position: sticky;
    bottom: max(.5rem, env(safe-area-inset-bottom));
    z-index: 60;
    display: grid !important;
    grid-template-columns: 1fr;
    width: 100%;
    gap: .65rem;
    padding: .75rem;
    margin: .2rem 0 0;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 1rem;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .18);
    backdrop-filter: blur(10px);
  }

  .action-bar-sticky .btn,
  .action-bar-sticky button,
  .action-bar-sticky a {
    width: 100%;
    min-height: 44px;
  }

  .agenda-create-form .agenda-kind-segments {
    position: sticky;
    top: .35rem;
    z-index: 35;
    background: rgba(238, 243, 251, .96);
    border-radius: 1rem;
    padding: .2rem;
    backdrop-filter: blur(8px);
  }

  .field-error {
    font-size: .88rem;
  }
}

@supports not (backdrop-filter: blur(10px)) {
  @media (max-width: 900px), (hover: none) and (pointer: coarse) {
    .action-bar-sticky,
    .agenda-create-form .agenda-kind-segments {
      background: #fff;
    }
  }
}

/* =========================================================
   V6.5 - Consolidação visual, temas, CSS e auditoria final
   Matriz canónica de breakpoints:
   - <= 480px: telemóvel estreito / operação vertical
   - 481-760px: telemóvel largo / horizontal curto
   - 761-1024px: tablet ecrã médio, portrait/landscape
   - >= 1025px: desktop/tablet largo
   Regras V6.5: largura define densidade; orientação apenas ajusta altura/fluxo; pointer/hover só ajusta alvos táteis.
   ========================================================= */

:root {
  --bo-dynamic-text-on-light: #111827;
  --bo-dynamic-text-on-dark: #ffffff;
  --bo-critical-text: var(--text, #111827);
  --bo-critical-muted: var(--muted, #4b5563);
  --bo-surface-contrast: var(--panel, #ffffff);
  --bo-z-controls: 40;
  --bo-z-flash: 50;
  --bo-z-shared-request: 80;
  --bo-z-timer-alert: 90;
  --bo-z-danger-modal: 12000;
}

html[data-theme="costa"] {
  --bo-critical-text: #0f172a;
  --bo-critical-muted: #334155;
  --bo-surface-contrast: #ffffff;
}

html[data-theme="sunset"] {
  --bo-critical-text: #1c1917;
  --bo-critical-muted: #4a2c1d;
  --bo-surface-contrast: #fff7ed;
}

html[data-theme="noite"] {
  --bo-critical-text: #f8fafc;
  --bo-critical-muted: #cbd5e1;
  --bo-surface-contrast: #111827;
}

.notification-popup-shell {
  z-index: var(--bo-z-shared-request) !important;
}

.alert-popup-shell {
  z-index: var(--bo-z-timer-alert) !important;
}

.danger-confirm-shell {
  z-index: var(--bo-z-danger-modal) !important;
}

.flash,
.flash-stack {
  z-index: var(--bo-z-flash);
}

.content-top-actions-shell-collapsible .content-top-actions-collapsible {
  z-index: var(--bo-z-controls);
}

body[data-overlay-priority="danger-modal"] :where(.notification-popup-shell, .alert-popup-shell, .content-top-actions-shell-collapsible .content-top-actions-collapsible),
body.overlay-priority-danger-modal :where(.notification-popup-shell, .alert-popup-shell, .content-top-actions-shell-collapsible .content-top-actions-collapsible) {
  pointer-events: none !important;
}

body[data-overlay-priority="timer-alert"] .notification-popup-shell,
body.overlay-priority-timer-alert .notification-popup-shell {
  pointer-events: none !important;
}

body[data-overlay-priority="shared-request"] .content-top-actions-shell-collapsible .content-top-actions-collapsible,
body.overlay-priority-shared-request .content-top-actions-shell-collapsible .content-top-actions-collapsible {
  pointer-events: none !important;
}

:where(.agenda-block, .agenda-hour-card, .global-alert, .alert-popup-card, .notification-popup-card, .notification-card) {
  color: var(--agenda-block-text, var(--agenda-hour-text, var(--alert-text, var(--popup-text, var(--bo-critical-text))))) !important;
}

:where(.agenda-block, .agenda-hour-card, .global-alert, .alert-popup-card, .notification-popup-card, .notification-card) :where(.muted, .small-text, small, .meta) {
  color: currentColor !important;
  opacity: .84;
}

.agenda-block :where(a, button),
.global-alert :where(a, button),
.alert-popup-card :where(a, button),
.notification-popup-card :where(a, button),
.notification-card :where(a, button) {
  color: inherit;
}

.field-error,
.field-has-error > span,
.field-has-error .field-help,
[data-inline-validation] .field-error {
  color: var(--danger, #b91c1c) !important;
  text-shadow: none;
}

html[data-theme="noite"] .field-error,
html[data-theme="noite"] .field-has-error > span,
html[data-theme="noite"] .field-has-error .field-help,
html[data-theme="noite"] [data-inline-validation] .field-error {
  color: #fecaca !important;
}

[data-inline-validation] [aria-invalid="true"],
.form-mobile-safe [aria-invalid="true"] {
  color: var(--bo-critical-text) !important;
}

html[data-theme="noite"] [data-inline-validation] [aria-invalid="true"],
html[data-theme="noite"] .form-mobile-safe [aria-invalid="true"] {
  background: #1f2937;
  color: #f8fafc !important;
}

.action-bar-sticky,
.agenda-create-form .agenda-kind-segments,
.content-top-actions-shell-collapsible .content-top-actions-collapsible {
  color: var(--bo-critical-text);
}

html[data-theme="noite"] .action-bar-sticky,
html[data-theme="noite"] .agenda-create-form .agenda-kind-segments,
html[data-theme="noite"] .content-top-actions-shell-collapsible .content-top-actions-collapsible {
  background: rgba(17, 24, 39, .96);
  color: #f8fafc;
  border-color: rgba(148, 163, 184, .42);
}

@media (max-width: 480px) {
  .agenda-mobile-hour-list,
  .timer-grid,
  .home-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 481px) and (max-width: 760px) {
  .agenda-mobile-hour-list,
  .timer-grid {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .agenda-mobile-hour-list,
  .timer-grid,
  .unit-agenda-grid {
    min-width: 0;
  }
}

@media (max-height: 420px) and (orientation: landscape) {
  .alert-popup-card,
  .notification-popup-card,
  .danger-confirm-card {
    max-height: calc(100vh - 1rem);
    overflow: auto;
  }
}

@media (pointer: coarse) {
  :where(.btn, button, input, select, textarea, .content-top-toggle) {
    min-height: 44px;
  }
}


/* V6.5.3 — coerência visual canónica para estados e grupos nos temas.
   Escopo estritamente visual: repõe prioridade de estados semânticos após os overrides de tema. */
:root {
  --bo-control-on-bg: #f4fbf6;
  --bo-control-on-bg-hover: #e8f7ef;
  --bo-control-on-text: #087443;
  --bo-control-on-border: #b8e5ca;
  --bo-control-off-bg: #fff8f7;
  --bo-control-off-bg-hover: #fef0ef;
  --bo-control-off-text: #b42318;
  --bo-control-off-border: #f2c2be;
  --bo-control-paused-bg: #fff9ef;
  --bo-control-paused-bg-hover: #fff6e6;
  --bo-control-paused-text: #9a5a00;
  --bo-control-paused-border: #f3d7a2;
  --bo-group-neutral-bg: var(--button-secondary-bg, #eef3fb);
  --bo-group-neutral-bg-hover: color-mix(in srgb, var(--primary, #1f6feb) 10%, var(--button-secondary-bg, #eef3fb));
  --bo-group-neutral-text: var(--button-secondary-text, var(--text, #172033));
  --bo-group-neutral-border: var(--border, #dde4ef);
}

html[data-theme] :where(.sound-toggle[data-control-state="on"], .radio-power-toggle[data-control-state="on"], .control-state-on),
html[data-theme="base"] :where(.sound-toggle[data-control-state="on"], .radio-power-toggle[data-control-state="on"], .control-state-on),
html[data-theme="sunset"] :where(.content-top-actions .sound-toggle[data-control-state="on"], .content-top-actions .radio-power-toggle[data-control-state="on"]),
html[data-theme="noite"] :where(.content-top-actions .sound-toggle[data-control-state="on"], .content-top-actions .radio-power-toggle[data-control-state="on"]) {
  background: var(--bo-control-on-bg) !important;
  color: var(--bo-control-on-text) !important;
  border-color: var(--bo-control-on-border) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bo-control-on-border) 55%, transparent) !important;
}

html[data-theme] :where(.sound-toggle[data-control-state="on"]:hover, .radio-power-toggle[data-control-state="on"]:hover, .control-state-on:hover) {
  background: var(--bo-control-on-bg-hover) !important;
  color: var(--bo-control-on-text) !important;
}

html[data-theme] :where(.sound-toggle[data-control-state="off"], .radio-power-toggle[data-control-state="off"], .control-state-off),
html[data-theme="base"] :where(.sound-toggle[data-control-state="off"], .radio-power-toggle[data-control-state="off"], .control-state-off),
html[data-theme="sunset"] :where(.content-top-actions .sound-toggle[data-control-state="off"], .content-top-actions .radio-power-toggle[data-control-state="off"]),
html[data-theme="noite"] :where(.content-top-actions .sound-toggle[data-control-state="off"], .content-top-actions .radio-power-toggle[data-control-state="off"]) {
  background: var(--bo-control-off-bg) !important;
  color: var(--bo-control-off-text) !important;
  border-color: var(--bo-control-off-border) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bo-control-off-border) 55%, transparent) !important;
}

html[data-theme] :where(.sound-toggle[data-control-state="off"]:hover, .radio-power-toggle[data-control-state="off"]:hover, .control-state-off:hover) {
  background: var(--bo-control-off-bg-hover) !important;
  color: var(--bo-control-off-text) !important;
}

html[data-theme] :where(.radio-power-toggle[data-control-state="paused"], .control-state-paused),
html[data-theme="base"] :where(.radio-power-toggle[data-control-state="paused"], .control-state-paused),
html[data-theme="sunset"] :where(.content-top-actions .radio-power-toggle[data-control-state="paused"]),
html[data-theme="noite"] :where(.content-top-actions .radio-power-toggle[data-control-state="paused"]) {
  background: var(--bo-control-paused-bg) !important;
  color: var(--bo-control-paused-text) !important;
  border-color: var(--bo-control-paused-border) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bo-control-paused-border) 55%, transparent) !important;
}

html[data-theme] :where(.radio-power-toggle[data-control-state="paused"]:hover, .control-state-paused:hover) {
  background: var(--bo-control-paused-bg-hover) !important;
  color: var(--bo-control-paused-text) !important;
}

html[data-theme] :where(.timer-group-button.group-style-1) { --group-color: #2563eb; }
html[data-theme] :where(.timer-group-button.group-style-2) { --group-color: #d97706; }
html[data-theme] :where(.timer-group-button.group-style-3) { --group-color: #059669; }
html[data-theme] :where(.timer-group-button.group-style-4) { --group-color: #c026d3; }

html[data-theme] :where(.timer-group-button[class*="group-style-"]:not(.is-selected)),
html[data-theme="base"] :where(.timer-group-button[class*="group-style-"]:not(.is-selected)),
html[data-theme="sunset"] :where(.timer-group-button[class*="group-style-"]:not(.is-selected)),
html[data-theme="noite"] :where(.timer-group-button[class*="group-style-"]:not(.is-selected)) {
  background: var(--bo-group-neutral-bg) !important;
  color: var(--bo-group-neutral-text) !important;
  border-color: var(--bo-group-neutral-border) !important;
  box-shadow: var(--surface-shadow-soft, none) !important;
}

html[data-theme] :where(.timer-group-button[class*="group-style-"]:not(.is-selected):hover) {
  background: var(--bo-group-neutral-bg-hover) !important;
  color: var(--bo-group-neutral-text) !important;
}

html[data-theme] :where(.timer-group-button[class*="group-style-"].is-selected),
html[data-theme="base"] :where(.timer-group-button[class*="group-style-"].is-selected),
html[data-theme="sunset"] :where(.timer-group-button[class*="group-style-"].is-selected),
html[data-theme="noite"] :where(.timer-group-button[class*="group-style-"].is-selected) {
  background: var(--group-color, var(--primary)) !important;
  color: #ffffff !important;
  border-color: var(--group-color, var(--primary)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--group-color, var(--primary)) 26%, transparent) !important;
}

html[data-theme] :where(.timer-group-button[class*="group-style-"].is-selected:hover) {
  background: color-mix(in srgb, var(--group-color, var(--primary)) 88%, #111827) !important;
  color: #ffffff !important;
}

/* V6.5.5 — normalização final dos botões de grupo dos temporizadores.
   Escopo estritamente visual: estado neutro segue o tema; estado selecionado usa cor ativa e contorno evidente. */
:root {
  --bo-group-active-ring: color-mix(in srgb, var(--group-color, var(--primary)) 32%, transparent);
}

.timer-card .timer-field-group .timer-group-buttons .timer-group-button.group-style-1 { --group-color: #2563eb; }
.timer-card .timer-field-group .timer-group-buttons .timer-group-button.group-style-2 { --group-color: #d97706; }
.timer-card .timer-field-group .timer-group-buttons .timer-group-button.group-style-3 { --group-color: #059669; }
.timer-card .timer-field-group .timer-group-buttons .timer-group-button.group-style-4 { --group-color: #c026d3; }

html[data-theme] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"]:not(.is-selected),
html[data-theme="base"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"]:not(.is-selected),
html[data-theme="costa"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"]:not(.is-selected),
html[data-theme="sunset"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"]:not(.is-selected),
html[data-theme="noite"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"]:not(.is-selected) {
  background: var(--button-secondary-bg, var(--bo-group-neutral-bg, #eef3fb)) !important;
  color: var(--button-secondary-text, var(--bo-group-neutral-text, var(--text, #172033))) !important;
  border-color: var(--border, var(--bo-group-neutral-border, #dde4ef)) !important;
  box-shadow: var(--surface-shadow-soft, none) !important;
}

html[data-theme] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"]:not(.is-selected):hover,
html[data-theme] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"]:not(.is-selected):focus-visible {
  background: color-mix(in srgb, var(--primary, #1f6feb) 10%, var(--button-secondary-bg, var(--bo-group-neutral-bg, #eef3fb))) !important;
  color: var(--button-secondary-text, var(--bo-group-neutral-text, var(--text, #172033))) !important;
  border-color: color-mix(in srgb, var(--primary, #1f6feb) 32%, var(--border, #dde4ef)) !important;
}

html[data-theme] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"].is-selected,
html[data-theme="base"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"].is-selected,
html[data-theme="costa"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"].is-selected,
html[data-theme="sunset"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"].is-selected,
html[data-theme="noite"] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"].is-selected {
  background: var(--group-color, var(--primary)) !important;
  color: #ffffff !important;
  border-color: var(--group-color, var(--primary)) !important;
  box-shadow: 0 0 0 3px var(--bo-group-active-ring), var(--surface-shadow-soft, none) !important;
}

html[data-theme] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"].is-selected:hover,
html[data-theme] .timer-card .timer-field-group .timer-group-buttons .timer-group-button[class*="group-style-"].is-selected:focus-visible {
  background: color-mix(in srgb, var(--group-color, var(--primary)) 88%, #111827) !important;
  color: #ffffff !important;
  border-color: var(--group-color, var(--primary)) !important;
}


/* V6.5.6 — normalização transversal dos botões globais de estado.
   Escopo estritamente visual: mantém os estados canónicos verde/vermelho/âmbar em todos os temas. */
:root {
  --bo-global-control-on-bg: #f4fbf6;
  --bo-global-control-on-bg-hover: #e8f7ef;
  --bo-global-control-on-text: #087443;
  --bo-global-control-on-border: #b8e5ca;
  --bo-global-control-off-bg: #fff8f7;
  --bo-global-control-off-bg-hover: #fef0ef;
  --bo-global-control-off-text: #b42318;
  --bo-global-control-off-border: #f2c2be;
  --bo-global-control-paused-bg: #fff9ef;
  --bo-global-control-paused-bg-hover: #fff6e6;
  --bo-global-control-paused-text: #9a5a00;
  --bo-global-control-paused-border: #f3d7a2;
  --bo-global-control-neutral-bg: #fffdf8;
  --bo-global-control-neutral-bg-hover: #f8fbff;
  --bo-global-control-neutral-text: #172033;
  --bo-global-control-neutral-border: #dde4ef;
}

html[data-theme] body .content-top-actions .sound-toggle[data-control-state="on"],
html[data-theme] body .content-top-actions .radio-power-toggle[data-control-state="on"],
html[data-theme] body .content-top-actions .control-state-on,
html[data-theme="base"] body .content-top-actions .sound-toggle[data-control-state="on"],
html[data-theme="costa"] body .content-top-actions .sound-toggle[data-control-state="on"],
html[data-theme="sunset"] body .content-top-actions .sound-toggle[data-control-state="on"],
html[data-theme="noite"] body .content-top-actions .sound-toggle[data-control-state="on"] {
  background: var(--bo-global-control-on-bg) !important;
  background-image: none !important;
  color: var(--bo-global-control-on-text) !important;
  border: 1px solid var(--bo-global-control-on-border) !important;
  box-shadow: inset 0 0 0 1px rgba(184, 229, 202, .45), 0 6px 14px rgba(8, 116, 67, .06) !important;
  text-shadow: none !important;
}

html[data-theme] body .content-top-actions .sound-toggle[data-control-state="on"]:hover,
html[data-theme] body .content-top-actions .radio-power-toggle[data-control-state="on"]:hover,
html[data-theme] body .content-top-actions .control-state-on:hover {
  background: var(--bo-global-control-on-bg-hover) !important;
  background-image: none !important;
  color: var(--bo-global-control-on-text) !important;
  border-color: var(--bo-global-control-on-border) !important;
}

html[data-theme] body .content-top-actions .sound-toggle[data-control-state="off"],
html[data-theme] body .content-top-actions .radio-power-toggle[data-control-state="off"],
html[data-theme] body .content-top-actions .control-state-off,
html[data-theme="base"] body .content-top-actions .sound-toggle[data-control-state="off"],
html[data-theme="costa"] body .content-top-actions .sound-toggle[data-control-state="off"],
html[data-theme="sunset"] body .content-top-actions .sound-toggle[data-control-state="off"],
html[data-theme="noite"] body .content-top-actions .sound-toggle[data-control-state="off"] {
  background: var(--bo-global-control-off-bg) !important;
  background-image: none !important;
  color: var(--bo-global-control-off-text) !important;
  border: 1px solid var(--bo-global-control-off-border) !important;
  box-shadow: inset 0 0 0 1px rgba(242, 194, 190, .48), 0 6px 14px rgba(180, 35, 24, .06) !important;
  text-shadow: none !important;
}

html[data-theme] body .content-top-actions .sound-toggle[data-control-state="off"]:hover,
html[data-theme] body .content-top-actions .radio-power-toggle[data-control-state="off"]:hover,
html[data-theme] body .content-top-actions .control-state-off:hover {
  background: var(--bo-global-control-off-bg-hover) !important;
  background-image: none !important;
  color: var(--bo-global-control-off-text) !important;
  border-color: var(--bo-global-control-off-border) !important;
}

html[data-theme] body .content-top-actions .radio-power-toggle[data-control-state="paused"],
html[data-theme] body .content-top-actions .control-state-paused {
  background: var(--bo-global-control-paused-bg) !important;
  background-image: none !important;
  color: var(--bo-global-control-paused-text) !important;
  border: 1px solid var(--bo-global-control-paused-border) !important;
  box-shadow: inset 0 0 0 1px rgba(243, 215, 162, .52), 0 6px 14px rgba(154, 90, 0, .06) !important;
  text-shadow: none !important;
}

html[data-theme] body .content-top-actions .radio-power-toggle[data-control-state="paused"]:hover,
html[data-theme] body .content-top-actions .control-state-paused:hover {
  background: var(--bo-global-control-paused-bg-hover) !important;
  background-image: none !important;
  color: var(--bo-global-control-paused-text) !important;
  border-color: var(--bo-global-control-paused-border) !important;
}

html[data-theme] body .content-top-actions .radio-station-toggle,
html[data-theme] body .content-top-actions .screen-toggle[aria-pressed="false"] {
  background: var(--bo-global-control-neutral-bg) !important;
  background-image: none !important;
  color: var(--bo-global-control-neutral-text) !important;
  border: 1px solid var(--bo-global-control-neutral-border) !important;
  box-shadow: 0 6px 14px rgba(18, 32, 51, .04) !important;
  text-shadow: none !important;
}

html[data-theme] body .content-top-actions .radio-station-toggle:hover,
html[data-theme] body .content-top-actions .screen-toggle[aria-pressed="false"]:hover {
  background: var(--bo-global-control-neutral-bg-hover) !important;
  background-image: none !important;
  color: var(--bo-global-control-neutral-text) !important;
  border-color: var(--bo-global-control-neutral-border) !important;
}

html[data-theme] body .content-top-actions .screen-toggle[aria-pressed="true"] {
  background: var(--bo-global-control-on-bg) !important;
  background-image: none !important;
  color: var(--bo-global-control-on-text) !important;
  border: 1px solid var(--bo-global-control-on-border) !important;
  box-shadow: inset 0 0 0 1px rgba(184, 229, 202, .45), 0 6px 14px rgba(8, 116, 67, .06) !important;
  text-shadow: none !important;
}

html[data-theme] body .content-top-actions .screen-toggle[aria-pressed="true"]:hover {
  background: var(--bo-global-control-on-bg-hover) !important;
  background-image: none !important;
  color: var(--bo-global-control-on-text) !important;
  border-color: var(--bo-global-control-on-border) !important;
}

/* V6.5.7 — correção patch da grelha de Temporizadores em touch landscape.
   Escopo estritamente visual/responsivo: respeita a preferência "Produtos por linha" também em tablet/mobile horizontal,
   sem alterar contratos JS, persistência, permissões, agenda, temporizadores ou Live Update. */
@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
  body.page-timers .timer-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)) !important;
  }

  body.page-timers .timer-grid.timer-grid-manual {
    grid-template-columns: repeat(var(--timer-grid-columns, 2), minmax(0, 1fr)) !important;
  }

  body.page-timers .timer-grid .timer-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }

  body.page-timers .timer-grid .timer-card-actions {
    min-width: 0;
    width: 100%;
    justify-self: stretch;
  }

  body.page-timers .timer-grid .timer-action {
    width: 100%;
    min-width: 0;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) and (max-width: 760px) {
  body.page-timers .timer-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)) !important;
  }

  body.page-timers .timer-grid.timer-grid-manual {
    grid-template-columns: repeat(var(--timer-grid-columns, 2), minmax(0, 1fr)) !important;
  }

  body.page-timers .timer-layout-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: end;
  }

  body.page-timers .timer-layout-toolbar label {
    flex: 1 1 min(14rem, 100%);
    min-width: min(100%, 12rem);
  }
}

/* V6.5.8 — correção patch da Agenda normal: contorno de 2 reservas em azul. */
.agenda-outline-2 { border-color: #2563eb; }

/* V6.6 — Temporizadores Operacionais */
.operational-timer-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.operational-resource-card .timer-card-actions,
.operational-active-card .running-card-body {
  margin-top: 1rem;
}

.operational-active-card .timer-display strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.4rem;
}


/* V6.6.3 — correções patch de perceção visual, grupos e temporizadores operacionais.
   Escopo estritamente visual/UX: não altera persistência, permissões ou contratos dos temporizadores. */
.timer-status-badge.timer-status-active,
.timer-status-badge.timer-status-inactive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  min-width: 4.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 900;
  letter-spacing: .01em;
  text-transform: uppercase;
  text-shadow: none;
}

html[data-theme] .timer-card .timer-status-badge.timer-status-active {
  background: #e8f7ef !important;
  color: #087443 !important;
  border-color: #9fd9bb !important;
  box-shadow: inset 0 0 0 1px rgba(8, 116, 67, .08);
}

html[data-theme] .timer-card .timer-status-badge.timer-status-inactive {
  background: #fff8f7 !important;
  color: #b42318 !important;
  border-color: #f2c2be !important;
  box-shadow: inset 0 0 0 1px rgba(180, 35, 24, .08);
}

.timer-card.phase-aviso_regresso .timer-status-badge.timer-status-active,
.timer-card.phase-fim_total .timer-status-badge.timer-status-active {
  background: rgba(255,255,255,.92) !important;
  color: #087443 !important;
  border-color: rgba(255,255,255,.96) !important;
}

.timer-group-badge.group-style-1,
.timer-group-badge.group-style-2,
.timer-group-badge.group-style-3,
.timer-group-badge.group-style-4,
html[data-theme] .timer-card .timer-group-badge.group-style-1,
html[data-theme] .timer-card .timer-group-badge.group-style-2,
html[data-theme] .timer-card .timer-group-badge.group-style-3,
html[data-theme] .timer-card .timer-group-badge.group-style-4 {
  background: var(--group-color, var(--primary)) !important;
  color: #ffffff !important;
  border-color: var(--group-color, var(--primary)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--group-color, var(--primary)) 22%, transparent) !important;
}

.operational-resource-card,
.operational-active-card {
  min-height: auto;
}

.operational-resource-card .timer-active-config,
.operational-active-card .timer-active-config {
  margin-top: .65rem;
}

.operational-active-card .timer-display {
  display: block;
  margin-top: .75rem;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 900;
  line-height: 1;
  color: var(--text, #172033);
}

.operational-active-card .timer-display strong {
  font: inherit;
}

.global-alert-locally-minimized,
.global-alert[hidden] {
  display: none !important;
}

.global-alert-local-minimize {
  min-width: 7rem;
}

@media (max-width: 760px) {
  .timer-status-badge.timer-status-active,
  .timer-status-badge.timer-status-inactive {
    min-width: 4.2rem;
    font-size: .72rem;
  }
}


/* V6.6.3 — simplificação da vista de Temporizadores Operacionais para perfil Fotos/operacional. */
.operational-history-list {
  display: grid;
  gap: .85rem;
}
.operational-history-entry {
  padding: .9rem 1rem;
}
.operational-history-entry > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .45rem;
}
.operational-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  color: var(--text-soft, #5b6472);
  font-size: .92rem;
}
.operational-resource-card .timer-active-config {
  margin-bottom: .55rem;
}
.operational-resource-card .timer-display {
  margin-bottom: .8rem;
}
@media (max-width: 720px) {
  .operational-history-entry > header {
    flex-direction: column;
    align-items: flex-start;
  }
  .operational-history-meta {
    flex-direction: column;
    gap: .35rem;
  }
}

/* V6.6.4 — correção patch de abertura rápida dos Temporizadores Operacionais.
   O histórico operacional é carregado de forma assíncrona para não bloquear
   a primeira renderização dos recursos e temporizadores ativos. */

/* V6.6.5 — correção patch: remove o histórico do dia da vista Operação > Temporizadores Operacionais.
   O histórico permanece disponível na área própria: Operação > Histórico dos Temporizadores. */


/* V6.7.3 — correção de redirecionamento da Agenda Partilhada; V6.7.2 — apresentação das estatísticas separada por domínio e sem métricas indevidas nos Temporizadores */
.stats-config-grid {
  align-items: stretch;
}

.stats-report-panel {
  display: grid;
  gap: 1.15rem;
  padding: clamp(1rem, 1.8vw, 1.4rem);
}

.stats-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.stats-report-header h2 {
  margin: .1rem 0 .25rem;
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: -.035em;
}

.stats-report-header p {
  margin: 0;
}

.stats-kicker {
  margin: 0;
  color: var(--primary);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stats-filter-bar {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: end;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--panel-soft) 80%, transparent);
}

.stats-report-grid {
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.stats-report-grid--three {
  grid-template-columns: repeat(3, minmax(210px, 1fr));
}

.stats-metric-card {
  min-height: 7rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--border) 78%, var(--primary) 22%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-solid) 92%, transparent), color-mix(in srgb, var(--panel-soft) 88%, transparent));
  box-shadow: var(--surface-shadow-soft);
  align-content: start;
}

.stats-metric-card span {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

.stats-metric-card strong {
  color: var(--text);
  font-size: clamp(1.75rem, 2.6vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

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

.stats-section-grid {
  display: grid;
  gap: 1rem;
}

.stats-table-section {
  display: grid;
  gap: .75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--panel-solid) 76%, transparent);
}

.stats-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.stats-section-title h3 {
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: -.015em;
}

.stats-section-title p {
  margin: 0;
  max-width: 720px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: .9rem;
  background: color-mix(in srgb, var(--panel-solid) 84%, transparent);
}

.data-table th,
.data-table td {
  padding: .72rem .78rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: color-mix(in srgb, var(--text) 88%, var(--primary) 12%);
  background: color-mix(in srgb, var(--primary) 9%, var(--panel-solid));
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .015em;
  text-transform: uppercase;
}

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

.data-table tbody tr:hover td {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.compact-table th,
.compact-table td {
  white-space: nowrap;
}

.strong-cell {
  font-weight: 750;
  color: var(--text);
}

.empty-cell,
.empty-state {
  padding: 1rem;
  text-align: left;
}

.timer-subresource-groups {
  display: grid;
  gap: .85rem;
}

.timer-subresource-group {
  display: grid;
  gap: .6rem;
  padding: .85rem;
  border: 1px solid color-mix(in srgb, var(--border) 82%, var(--primary) 18%);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--panel-soft) 72%, transparent);
}

.timer-subresource-group h4 {
  margin: 0;
  color: var(--primary);
  font-size: 1rem;
  letter-spacing: -.01em;
}

html[data-theme="noite"] .stats-filter-bar,
html[data-theme="noite"] .stats-table-section,
html[data-theme="noite"] .timer-subresource-group,
html[data-theme="noite"] .data-table,
html[data-theme="noite"] .stats-metric-card {
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  border-color: var(--border);
}

html[data-theme="noite"] .data-table th {
  background: color-mix(in srgb, var(--primary) 12%, var(--panel-solid));
  color: var(--text);
}

@media (max-width: 980px) {
  .stats-filter-bar,
  .stats-report-grid--three {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .stats-report-header {
    display: grid;
  }
  .stats-report-header .btn {
    width: 100%;
  }
  .stats-filter-bar,
  .stats-report-grid--three {
    grid-template-columns: 1fr;
  }
  .stats-table-section {
    padding: .8rem;
  }
}

/* V6.8 — Organização Temporizadores */
.timer-org-rules {
  display: grid;
  gap: 0.5rem;
}

.timer-org-rules span {
  display: block;
}

.timer-org-group-header {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.timer-org-order-actions,
.timer-org-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.timer-org-actions {
  justify-content: flex-start;
}

.timer-org-actions-cell {
  min-width: 320px;
}

.timer-org-transfer-form {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.timer-org-transfer-form select {
  min-width: 9rem;
}

.timer-org-table td {
  vertical-align: middle;
}

@media (max-width: 760px) {
  .timer-org-group-header {
    display: block;
  }

  .timer-org-group-header .timer-org-order-actions {
    margin-top: 0.75rem;
  }

  .timer-org-actions-cell {
    min-width: 0;
  }

  .timer-org-transfer-form select {
    min-width: 100%;
  }
}


/* V6.8.1 - barra superior: evitar sobreposição dos controlos sobre a praia ativa em ecrãs médios */
.mobile-scope-line {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.2;
}
.mobile-scope-line strong { color: inherit; }
@media (max-width: 1180px) {
  .content-top-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: .5rem;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] {
    justify-items: stretch;
    width: 100%;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-toggle {
    display: inline-flex;
    width: 100%;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible {
    width: 100%;
    justify-content: stretch;
  }
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible .btn,
  .content-top-actions-shell[data-controls-collapse="responsive"] .content-top-actions-collapsible .header-radio-widget {
    flex: 1 1 calc(50% - .45rem);
  }
}
@media (max-width: 900px) {
  .content-top-main .scope-chip { display: none; }
}
.agenda-state-parcial { background: #f97316; }
.agenda-event-inline-edit-form {
  align-items: end;
}
.agenda-event-inline-edit-form .inline-field {
  display: grid;
  gap: .18rem;
  min-width: 5.6rem;
}
.agenda-event-inline-edit-form .inline-field span {
  font-size: .72rem;
  color: var(--muted);
}
.agenda-event-inline-edit-form select,
.agenda-event-inline-edit-form input[type="text"] {
  min-width: 5.8rem;
}
@media (max-width: 760px) {
  .agenda-event-inline-edit-form {
    display: grid;
    grid-template-columns: 1fr;
  }
  .agenda-event-inline-edit-form .inline-field,
  .agenda-event-inline-edit-form select,
  .agenda-event-inline-edit-form input[type="text"],
  .agenda-event-inline-edit-form .btn {
    width: 100%;
  }
}

/* V7.0 - Temporizadores: tempo visível e ajuste operacional + Agenda Faltou */
.timer-visible-config {
  display: block;
  margin: 0.35rem 0 0.6rem;
  font-weight: 700;
}

.timer-duration-adjust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.75rem;
}

.timer-duration-adjust-label {
  font-weight: 800;
  min-width: 7rem;
  text-align: center;
}

.timer-adjust-button {
  min-width: 3.25rem;
  font-weight: 900;
}

.agenda-state-faltou {
  background: #9d174d;
  color: #ffffff;
}

.agenda-legend-fill-missed {
  background: #9d174d;
}

.state-faltou .state-symbol,
.inline-badge.state-faltou {
  background: #9d174d;
  color: #ffffff;
  border-color: #831843;
}

.agenda-block.agenda-state-faltou::before,
.agenda-booking-card.agenda-state-faltou {
  border-color: #9d174d;
}

@media (max-width: 760px) {
  .timer-duration-adjust {
    justify-content: stretch;
  }
  .timer-duration-adjust-label {
    flex: 1 1 auto;
  }
}
