:root {
  --bg: #050607;
  --panel: rgba(18, 21, 25, 0.94);
  --panel-strong: rgba(11, 14, 17, 0.98);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #eef1f4;
  --muted: #b7c0ca;
  --accent: #c5b38a;
  --accent-soft: rgba(197, 179, 138, 0.18);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(197, 179, 138, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(96, 111, 126, 0.14), transparent 28%),
    linear-gradient(180deg, #040506 0%, #090b0d 56%, #050607 100%);
}

body.light-surface {
  background:
    radial-gradient(circle at top left, rgba(197, 179, 138, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(96, 111, 126, 0.08), transparent 28%),
    linear-gradient(180deg, #f1f2f4 0%, #e6e8eb 56%, #dde0e4 100%);
}

button, input, textarea, select { font: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.hidden { display: none !important; }

body.auth-pending .app-shell,
body.auth-pending .report-top-nav,
body.auth-pending .reception-top-nav {
  display: none !important;
}

body.app-loading .app-shell,
body.app-loading .report-top-nav,
body.app-loading .reception-top-nav {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
  color: #111;
  box-shadow: var(--shadow);
}

.login-card .eyebrow,
.login-card .subtitle {
  color: #333;
}

.login-card h1 {
  color: #111;
  font-size: 2rem;
  line-height: 1.05;
}

.login-message {
  min-height: 20px;
  color: #8a0018;
  font-weight: 800;
}

.reception-top-nav {
  display: none;
}

.report-top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 52px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 13, 16, 0.96);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.report-top-nav-title {
  margin-right: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-top-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.035);
}

.report-top-nav-link:hover,
.report-top-nav-link.active {
  color: #f3ead7;
  border-color: rgba(197, 179, 138, 0.34);
  background: rgba(197, 179, 138, 0.16);
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 78px 0 48px;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.hero-card,
.panel-card,
.side-nav-card {
  background: linear-gradient(180deg, rgba(20, 24, 29, 0.96), rgba(12, 15, 18, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 30px 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-card > div:first-child {
  display: flex;
  flex-direction: column;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
}

.app-notice-card {
  order: 5;
  display: grid;
  gap: 12px;
  margin-top: 16px;
  max-width: 760px;
  padding: 14px;
  border: 1px solid rgba(197, 179, 138, 0.28);
  border-radius: 8px;
  background: rgba(197, 179, 138, 0.1);
}

.app-notice-view {
  display: grid;
  gap: 6px;
}

.app-notice-view strong,
.shift-messages-view strong,
.app-notice-editor span,
.shift-message-editor span {
  color: #f3ead7;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app-notice-view p,
.shift-message-text {
  color: #fff;
  line-height: 1.45;
  white-space: pre-wrap;
}

.shift-messages-view,
.shift-messages-list,
.app-notice-editor,
.shift-message-editor {
  display: grid;
  gap: 10px;
}

.shift-message-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.shift-message-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  color: #e5d9bb;
  font-size: 0.78rem;
  font-weight: 800;
}

.shift-message-meta {
  display: grid;
  gap: 2px;
}

.shift-message-expires {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.shift-message-delete {
  min-width: 72px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.76rem;
}

.shift-message-controls {
  display: grid;
  grid-template-columns: minmax(150px, 190px) auto;
  gap: 10px;
  align-items: end;
}

.app-notice-editor label,
.shift-message-editor label {
  display: grid;
  gap: 6px;
}

.app-notice-editor textarea,
.shift-message-editor textarea,
.shift-message-editor select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: #111;
}

.app-notice-editor textarea,
.shift-message-editor textarea {
  resize: vertical;
  min-height: 82px;
}

h1 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(2.5rem, 4vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: 0.03em;
}

.subtitle {
  margin-top: 12px;
  max-width: 64ch;
  color: var(--muted);
}

.hero-meta {
  align-self: flex-start;
  min-width: 220px;
}

.hero-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.current-user-box {
  display: grid;
  gap: 2px;
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.current-user-box span {
  font-weight: 900;
}

.current-user-box small {
  color: var(--muted);
  font-weight: 800;
}

.current-user-box .btn {
  width: fit-content;
  margin-top: 5px;
}

.app-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
}

.app-dialog::backdrop {
  background: rgba(8, 12, 20, 0.58);
  backdrop-filter: blur(2px);
}

.app-dialog-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.app-dialog-card label span {
  color: #f3ead7;
}

.app-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.app-dialog-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.dialog-helper {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.dialog-close-btn {
  width: 38px;
  height: 38px;
  font-size: 1.45rem;
  line-height: 1;
}

.theme-toggle-btn {
  width: 46px;
  height: 46px;
  align-self: end;
  font-size: 1rem;
  font-weight: 700;
}

.hero-turno {
  min-width: 180px;
}

.hero-turno span {
  display: block;
  margin-bottom: 8px;
  color: #e7e0d0;
  font-size: 0.93rem;
  font-weight: 600;
}

.hero-turno select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(34, 40, 46, 0.98), rgba(20, 24, 28, 0.98));
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  appearance: none;
  color-scheme: dark;
}

.hero-turno select:focus {
  border-color: rgba(197, 179, 138, 0.46);
  box-shadow: 0 0 0 3px rgba(197, 179, 138, 0.12);
}

.hero-turno select option {
  background: #111418;
  color: #eef1f4;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.side-nav-card {
  position: sticky;
  top: 20px;
  padding: 18px 16px;
  display: none;
}

.side-nav-title {
  margin-bottom: 14px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav-link {
  display: block;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.side-nav-link:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.side-nav-link.active {
  color: #f3ead7;
  border-color: rgba(197, 179, 138, 0.35);
  background: linear-gradient(180deg, rgba(197, 179, 138, 0.18), rgba(255, 255, 255, 0.03));
}

body.reception-mode .side-nav-card,
body.reception-mode .report-top-nav,
body.reception-mode .hero-card,
body.reception-mode [data-nav-section]:not(#sec-agendamentos),
body.reception-mode .hero-turno,
body.reception-mode #newReportBtn {
  display: none !important;
}

body.reception-mode .app-layout,
body.reception-mode .layout-grid {
  display: block;
}

body.reception-mode .app-shell {
  width: calc(100vw - 20px);
  max-width: none;
  padding-top: 64px;
}

body.reception-mode #sec-agendamentos {
  margin-top: 0;
  padding: 16px;
}

body.reception-mode .section-heading {
  margin: -16px -16px 14px;
}

body.reception-mode .reception-top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 13, 16, 0.96);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

body:not(.management-mode) #sec-operacional,
body:not(.management-mode) [data-nav-link="sec-operacional"] {
  display: none !important;
}

body.management-mode #sec-dados,
body.management-mode #sec-pcnet,
body.management-mode #sec-procedimentos,
body.management-mode #sec-complementos,
body.management-mode #sec-servidores,
body.management-mode #sec-links,
body.management-mode #sec-escala,
body.management-mode #sec-dashboard,
body.management-mode .hero-turno,
body.management-mode #newReportBtn,
body.management-mode #appNoticeEditor,
body.management-mode .appointment-form,
body.management-mode .custody-control,
body.management-mode .custody-bulk-actions,
body.management-mode #syncAppointmentsBtn,
body.management-mode #custodySelectAll {
  display: none !important;
}

body.management-mode .layout-grid {
  grid-template-columns: 1fr;
}

body.management-mode #sec-operacional,
body.management-mode #sec-acervo,
body.management-mode #sec-agendamentos {
  grid-column: 1 / -1;
}

body.management-mode #sec-operacional {
  order: 1;
}

body.management-mode #sec-agendamentos {
  order: 2;
}

body.management-mode #sec-acervo {
  order: 3;
}

body.management-mode [data-nav-link="sec-dados"],
body.management-mode [data-nav-link="sec-pcnet"],
body.management-mode [data-nav-link="sec-procedimentos"],
body.management-mode [data-nav-link="sec-complementos"],
body.management-mode [data-nav-link="sec-servidores"],
body.management-mode [data-nav-link="sec-previa"],
body.management-mode [data-nav-link="sec-links"],
body.management-mode [data-nav-link="sec-escala"],
body.management-mode [data-nav-link="sec-dashboard"] {
  display: none !important;
}

body.management-mode #sec-previa {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.management-status-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.management-status-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.management-status-card.normal {
  border-color: rgba(100, 204, 139, 0.36);
  background: rgba(100, 204, 139, 0.08);
}

.management-status-card.critical {
  border-color: rgba(255, 95, 86, 0.55);
  background: rgba(255, 95, 86, 0.1);
}

.management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.management-critical-list,
.management-summary-list {
  display: grid;
  gap: 10px;
}

.management-critical-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 95, 86, 0.34);
  border-radius: 8px;
  background: rgba(255, 95, 86, 0.08);
}

.management-critical-item strong,
.management-critical-item span {
  display: block;
}

.management-critical-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.83rem;
}

.reception-top-nav-title {
  margin-right: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reception-top-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.035);
}

.reception-top-nav a:hover,
.reception-top-nav a.active {
  color: #f3ead7;
  border-color: rgba(197, 179, 138, 0.34);
  background: rgba(197, 179, 138, 0.16);
}

[data-reception-nav-section] {
  scroll-margin-top: 72px;
}

[data-nav-section] {
  scroll-margin-top: 74px;
}

.panel-card {
  padding: 24px;
  color: #111418;
  background: #fff;
  border: 1px solid #111;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.panel-card .empty-state,
.panel-card .history-meta,
.panel-card .appointment-meta,
.panel-card .dashboard-meta,
.panel-card .appointment-sync-status {
  color: #333;
}

.panel-card .appointment-sync-status {
  border-color: #222;
  background: #fff;
}

.full-width {
  grid-column: 1 / -1;
}

.section-heading {
  margin: -24px -24px 18px;
  padding: 13px 16px;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  border-bottom: 1px solid #111;
  background: #050607;
}

.section-heading-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.section-heading-actions .btn {
  white-space: nowrap;
}

.section-action-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.section-heading h2 {
  color: #fff;
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.section-heading p {
  color: #d7dde3;
}

.editing-report-status {
  margin-top: 10px;
  color: #f3ead7;
  font-size: 0.95rem;
  font-weight: 700;
}

.editing-report-status.is-empty {
  color: #d7dde3;
  font-weight: 600;
}

.usage-help {
  margin: -4px 0 14px;
  border: 1px solid #111;
  border-radius: 10px;
  background: #f8f8f8;
  overflow: hidden;
}

.usage-help summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #111;
  font-weight: 800;
  user-select: none;
}

.usage-help div {
  display: grid;
  gap: 7px;
  padding: 0 12px 12px;
  color: #2f3439;
  font-size: 0.92rem;
  line-height: 1.45;
}

.usage-help strong {
  color: #111;
}

.form-grid,
.essential-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.essential-wide {
  grid-column: span 2;
}

.essential-warning {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid #b00020;
  border-left: 5px solid #b00020;
  border-radius: 8px;
  background: #fff1f1;
  color: #8a0018;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
}

.staff-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.server-table-wrap {
  overflow-x: auto;
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
}

.server-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.server-table th,
.server-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #d5d5d5;
  text-align: left;
  vertical-align: middle;
}

.server-table th {
  color: #fff;
  font-size: 0.74rem;
  text-transform: uppercase;
  background: #050607;
}

.server-table tbody tr:hover {
  background: #f2f2f2;
}

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

.server-table td:first-child {
  width: 190px;
  color: #111;
  font-weight: 700;
}

.server-table td:last-child {
  width: 170px;
}

.server-table input {
  height: 34px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 0.86rem;
}

.server-table input[list="staffDirectoryList"] {
  text-transform: uppercase;
}

#delegadoNome {
  text-transform: uppercase;
}

label,
.textarea-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label span,
.textarea-block span {
  color: #111;
  font-size: 0.93rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #222;
  border-radius: 12px;
  background: #fff;
  color: #111;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.12);
  background: #fff;
}

select {
  color-scheme: light;
}

select option {
  background: #fff;
  color: #111;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.hero-turno select {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(34, 40, 46, 0.98), rgba(20, 24, 28, 0.98));
  color: var(--text);
  color-scheme: dark;
}

.hero-turno select option {
  background: #111418;
  color: #eef1f4;
}

.complement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.complement-grid textarea {
  min-height: 96px;
}

.complement-wide {
  grid-column: 1 / -1;
}

.complement-wide textarea {
  min-height: 112px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.history-toolbar {
  display: grid;
  grid-template-columns: 180px 160px minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.history-search span {
  display: block;
}

.history-meta {
  color: var(--muted);
  font-size: 0.94rem;
  margin-bottom: 16px;
}

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

.history-list {
  display: block;
}

.appointment-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 200px) minmax(150px, 180px) minmax(130px, 160px) auto 1fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.appointment-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.appointment-filter-actions .btn {
  min-height: 50px;
  padding: 10px 14px;
  white-space: nowrap;
}

.appointment-meta {
  color: var(--muted);
  font-size: 0.94rem;
}

.appointment-sync-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
}

.appointment-sync-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}

.appointment-sync-status.synced::before {
  background: #64cc8b;
}

.appointment-sync-status.local::before,
.appointment-sync-status.pending::before {
  background: #e2b557;
}

.appointment-sync-status.error::before {
  background: #da5c5c;
}

.appointment-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.2fr) minmax(300px, 1.2fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid #111;
  border-radius: 10px;
  background: #f8f8f8;
}

.appointment-form-block,
.appointment-people-panel,
.appointment-notes-field {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #fff;
}

.appointment-form-block {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.appointment-import-block {
  grid-template-columns: 1fr;
}

.appointment-schedule-block {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.appointment-form label span,
.appointment-people-head span {
  font-size: 0.78rem;
}

.appointment-form input,
.appointment-form select {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.appointment-field-wide {
  grid-column: span 2;
}

.appointment-people-panel {
  grid-column: span 2;
}

.appointment-people-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.appointment-people-head span {
  color: #111;
  font-weight: 700;
}

.appointment-people-head .btn,
.appointment-person-remove {
  padding: 7px 9px;
  font-size: 0.78rem;
}

.appointment-people-list {
  display: grid;
  gap: 10px;
}

.appointment-person-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(150px, 0.8fr) minmax(78px, 0.35fr) 84px auto;
  gap: 8px;
  align-items: end;
}

.appointment-notes-field {
  grid-column: 1 / -1;
}

.appointment-person-release {
  align-items: center;
}

.appointment-person-release input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #64cc8b;
}

.custody-control {
  margin-top: 14px;
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

body:not(.reception-mode):not(.management-mode) .custody-control {
  display: none;
}

.custody-control-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: end;
  padding: 10px;
  border-bottom: 1px solid #111;
}

.custody-control-head h3 {
  font-size: 1rem;
  margin-bottom: 3px;
}

.custody-control-head p {
  color: #333;
  font-size: 0.9rem;
}

.custody-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  color: #333;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.custody-print-btn {
  margin-top: 9px;
}

.custody-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.custody-bulk-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.custody-bulk-actions label {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: #111;
  font-weight: 800;
}

.custody-bulk-actions label span {
  font-size: 0.82rem;
}

.custody-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.custody-legend-dot.caop {
  background: #4aa3ff;
  box-shadow: 0 0 0 2px rgba(74, 163, 255, 0.18);
}

.custody-legend-dot.pc {
  background: #f2c94c;
  box-shadow: 0 0 0 2px rgba(242, 201, 76, 0.18);
}

.custody-control-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  min-width: 0;
  align-items: end;
}

.custody-control-filters label,
.custody-search-actions {
  min-width: 0;
}

.custody-search-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
}

.custody-search-actions .btn {
  width: 100%;
  min-height: 38px;
  padding-inline: 12px;
}

.custody-table-wrap {
  overflow: auto;
  max-height: max(300px, calc(100vh - 420px));
}

.custody-table {
  min-width: 1180px;
  font-size: 0.82rem;
}

body.reception-mode .custody-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 0.76rem;
}

.custody-table th,
.custody-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #d5d5d5;
  vertical-align: middle;
}

body.reception-mode .custody-table th,
body.reception-mode .custody-table td {
  padding: 5px 6px;
  overflow-wrap: anywhere;
}

body.reception-mode .custody-table th:nth-child(1),
body.reception-mode .custody-table td:nth-child(1) {
  width: 3%;
}

body.reception-mode .custody-table th:nth-child(2),
body.reception-mode .custody-table td:nth-child(2) {
  width: 10%;
}

body.reception-mode .custody-table th:nth-child(3),
body.reception-mode .custody-table td:nth-child(3) {
  width: 7%;
}

body.reception-mode .custody-table th:nth-child(4),
body.reception-mode .custody-table td:nth-child(4) {
  width: 12%;
}

body.reception-mode .custody-table th:nth-child(5),
body.reception-mode .custody-table td:nth-child(5) {
  width: 5%;
}

body.reception-mode .custody-table th:nth-child(6),
body.reception-mode .custody-table td:nth-child(6) {
  width: 12%;
}

body.reception-mode .custody-table th:nth-child(7),
body.reception-mode .custody-table td:nth-child(7) {
  width: 8%;
}

body.reception-mode .custody-table th:nth-child(8),
body.reception-mode .custody-table td:nth-child(8) {
  width: 7%;
}

body.reception-mode .custody-table th:nth-child(9),
body.reception-mode .custody-table td:nth-child(9) {
  width: 7%;
}

body.reception-mode .custody-table th:nth-child(10),
body.reception-mode .custody-table td:nth-child(10) {
  width: 9%;
}

body.reception-mode .custody-table th:nth-child(11),
body.reception-mode .custody-table td:nth-child(11) {
  width: 10%;
}

body.reception-mode .custody-table th:nth-child(12),
body.reception-mode .custody-table td:nth-child(12) {
  width: 8%;
}

.custody-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #050607;
  color: #fff;
}

.custody-table tbody tr {
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.custody-table tbody tr:hover {
  background: #f2f2f2;
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.015);
}

.custody-table tbody tr.pending {
  background: #fff7d6;
  box-shadow: inset 4px 0 0 #c79210;
}

.custody-table .btn-compact {
  padding: 5px 8px;
  font-size: 0.76rem;
  min-height: 30px;
}

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

.custody-name {
  color: #111;
  font-weight: 700;
}

.custody-reds-cell {
  white-space: nowrap;
}

.custody-notes-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custody-location-select,
.custody-status-select,
.custody-cell-select {
  min-height: 30px;
  padding: 4px 26px 4px 8px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 800;
}

.custody-cell-select {
  min-width: 104px;
  border: 1px solid #111;
  background: #fff;
  color: #111;
}

.custody-cell-select:disabled {
  opacity: 0.55;
  background: #eeeeee;
}

.custody-location-cell {
  box-shadow: inset 4px 0 0 transparent;
}

.custody-location-cell.caop {
  background: rgba(74, 163, 255, 0.16);
  box-shadow: inset 4px 0 0 #4aa3ff;
}

.custody-location-cell.pc {
  background: rgba(242, 201, 76, 0.2);
  box-shadow: inset 4px 0 0 #f2c94c;
}

.custody-location-select.caop {
  border-color: rgba(74, 163, 255, 0.72);
  background: rgba(20, 77, 128, 0.88);
  color: #eaf5ff;
}

.custody-location-select.pc {
  border-color: rgba(242, 201, 76, 0.78);
  background: rgba(104, 80, 12, 0.9);
  color: #fff4c2;
}

.custody-row.recebido {
  background: rgba(100, 204, 139, 0.13);
}

.custody-row.encerrado {
  opacity: 0.65;
}

.custody-status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(197, 179, 138, 0.14);
  color: #efe4cc;
  white-space: nowrap;
}

.custody-status.recebido {
  background: rgba(100, 204, 139, 0.22);
  color: #dff8e8;
}

.custody-status.encerrado {
  background: rgba(120, 120, 120, 0.18);
  color: #e1e1e1;
}

.custody-status-select {
  min-width: 132px;
  border-color: #111;
  background: #fff7e6;
  color: #111;
}

.custody-status-select.recebido,
.custody-status-select.liberado {
  border-color: #1d6f3a;
  background: #dff4e6;
  color: #111;
}

.custody-status-select.encaminhado {
  border-color: #215f9c;
  background: #dbeeff;
  color: #111;
}

.custody-status-select.encerrado {
  border-color: #666;
  background: #eeeeee;
  color: #111;
}

.appointment-timeline {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.appointment-list-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid #111;
}

.appointment-list-heading h3 {
  font-size: 1.08rem;
  color: #111;
}

.appointment-list-heading p {
  color: #333;
  font-size: 0.9rem;
}

.appointment-list-heading + .appointment-toolbar {
  margin-top: 12px;
}

.appointment-group {
  display: grid;
  gap: 0;
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.appointment-group-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid #111;
  background: #050607;
}

.appointment-group-head h3 {
  color: #fff;
  font-size: 1.08rem;
  margin-bottom: 5px;
}

.appointment-group-head p {
  color: #d7dde3;
  font-size: 0.94rem;
}

.appointment-table-wrap {
  overflow-x: auto;
}

.appointment-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

body.reception-mode .appointment-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 0.78rem;
}

.appointment-table th,
.appointment-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #d5d5d5;
  text-align: left;
  vertical-align: middle;
}

body.reception-mode .appointment-table th,
body.reception-mode .appointment-table td {
  padding: 5px 6px;
  overflow-wrap: anywhere;
}

body.reception-mode .appointment-table th:nth-child(1),
body.reception-mode .appointment-table td:nth-child(1) {
  width: 7%;
}

body.reception-mode .appointment-table th:nth-child(2),
body.reception-mode .appointment-table td:nth-child(2) {
  width: 16%;
}

body.reception-mode .appointment-table th:nth-child(3),
body.reception-mode .appointment-table td:nth-child(3) {
  width: 6%;
}

body.reception-mode .appointment-table th:nth-child(4),
body.reception-mode .appointment-table td:nth-child(4) {
  width: 14%;
}

body.reception-mode .appointment-table th:nth-child(5),
body.reception-mode .appointment-table td:nth-child(5) {
  width: 27%;
}

body.reception-mode .appointment-table th:nth-child(6),
body.reception-mode .appointment-table td:nth-child(6) {
  width: 12%;
}

body.reception-mode .appointment-table th:nth-child(7),
body.reception-mode .appointment-table td:nth-child(7) {
  width: 10%;
}

body.reception-mode .appointment-table th:nth-child(8),
body.reception-mode .appointment-table td:nth-child(8) {
  width: 8%;
}

.appointment-table th {
  color: #fff;
  font-size: 0.72rem;
  text-transform: uppercase;
  background: #050607;
}

.appointment-table tbody tr:hover {
  background: #f2f2f2;
}

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

.appointment-row.alert {
  background: rgba(226, 181, 87, 0.08);
}

.appointment-row.critical {
  background: rgba(218, 92, 92, 0.1);
}

.appointment-row.received {
  background: rgba(100, 204, 139, 0.16);
}

.appointment-row.locked {
  opacity: 0.78;
}

.appointment-reds-cell {
  white-space: nowrap;
}

.appointment-table-status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #8b650f;
  background: #fff1c7;
  color: #111;
  white-space: nowrap;
  font-weight: 700;
}

.appointment-table-status.recebido {
  border-color: #1d6f3a;
  background: #dff4e6;
  color: #111;
}

.appointment-table-status.cancelado {
  border-color: #9b1f1f;
  background: #ffe1e1;
  color: #111;
}

.appointment-table-status.encerrado {
  border-color: #666;
  background: #eeeeee;
  color: #111;
}

.appointment-row-note {
  margin-top: 5px;
  color: #333;
  font-size: 0.78rem;
}

.appointment-group-slots {
  display: grid;
  gap: 12px;
}

.appointment-slot {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.012));
}

.appointment-slot-time {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(197, 179, 138, 0.12);
  color: #f3ead7;
  font-weight: 700;
}

.appointment-slot-items {
  display: grid;
  gap: 10px;
}

.appointment-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.appointment-item.alert {
  border-color: rgba(226, 181, 87, 0.48);
  background: rgba(226, 181, 87, 0.09);
}

.appointment-item.critical {
  border-color: rgba(218, 92, 92, 0.58);
  background: rgba(218, 92, 92, 0.1);
}

.appointment-item.received {
  border-color: rgba(100, 204, 139, 0.7);
  background: rgba(100, 204, 139, 0.18);
  box-shadow: inset 0 0 0 1px rgba(100, 204, 139, 0.18);
}

.appointment-item.received .appointment-badge {
  background: rgba(100, 204, 139, 0.2);
  color: #dff8e8;
}

.appointment-item.locked {
  border-style: dashed;
  opacity: 0.82;
}

.appointment-item.locked .appointment-badge {
  background: rgba(156, 163, 175, 0.16);
  color: #d8dde3;
}

.appointment-item-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.appointment-item-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 700;
  color: var(--text);
}

.reds-core-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #fff;
  color: #111;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
}

.reds-core-copy-btn:hover {
  border-color: #111;
  background: #e8e8e8;
}

.custody-reds-copy {
  width: 24px;
  height: 24px;
  margin-left: 6px;
  font-size: 0.82rem;
}

.appointment-item-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.appointment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.appointment-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(197, 179, 138, 0.14);
  color: #efe4cc;
  font-size: 0.8rem;
}

.appointment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.appointment-actions .btn {
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 0.78rem;
}

.appointment-actions .btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.dashboard-toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.dashboard-filter {
  min-width: 220px;
}

.dashboard-filter span {
  display: block;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(34, 40, 46, 0.98), rgba(20, 24, 28, 0.98));
  color: var(--text);
  padding: 13px 42px 13px 14px;
  outline: none;
  text-align: left;
  position: relative;
}

.custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(238, 241, 244, 0.82);
  border-bottom: 2px solid rgba(238, 241, 244, 0.82);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.18s ease;
  pointer-events: none;
}

.custom-select.open .custom-select-trigger::after {
  transform: translateY(-30%) rotate(-135deg);
}

.custom-select-trigger:focus,
.custom-select.open .custom-select-trigger {
  border-color: rgba(197, 179, 138, 0.46);
  box-shadow: 0 0 0 3px rgba(197, 179, 138, 0.12);
}

.custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  display: none;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(25, 30, 35, 0.99), rgba(15, 18, 22, 0.99));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: 4px;
}

.custom-select-option {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.custom-select-option.active {
  background: rgba(197, 179, 138, 0.18);
  color: #f3ead7;
}

.custom-select input[type="hidden"] {
  display: none;
}

.dashboard-meta {
  color: var(--muted);
  font-size: 0.94rem;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-card {
  border: 1px solid #111;
  border-radius: 16px;
  padding: 16px;
  background: #fff;
}

.dashboard-card-label {
  color: #333;
  font-size: 0.88rem;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-card-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #111;
}

.dashboard-card-note {
  margin-top: 6px;
  color: #333;
  font-size: 0.92rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.dashboard-panel {
  border: 1px solid #111;
  border-radius: 16px;
  padding: 16px;
  background: #fff;
}

.useful-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.useful-link-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid #111;
  border-radius: 16px;
  background: #fff;
  color: #111;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.useful-link-card:hover {
  transform: translateY(-2px);
  border-color: #111;
  background: #f2f2f2;
}

.useful-link-title {
  color: #111;
  font-size: 1rem;
  font-weight: 700;
}

.useful-link-desc {
  color: #333;
  line-height: 1.45;
}

.useful-link-url {
  color: #1c4f86;
  font-size: 0.86rem;
  word-break: break-word;
}

.dashboard-panel-head {
  margin-bottom: 12px;
}

.dashboard-panel-head h3 {
  color: #111;
  font-size: 1rem;
}

.dashboard-bars,
.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-bar-row,
.dashboard-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.dashboard-bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e2e2;
  margin-top: 6px;
}

.dashboard-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(197, 179, 138, 0.9), rgba(118, 155, 198, 0.9));
}

.dashboard-bar-label,
.dashboard-list-label {
  color: #111;
  font-size: 0.94rem;
}

.dashboard-bar-value,
.dashboard-list-value {
  color: #111;
  font-weight: 700;
  font-size: 0.92rem;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
}

.history-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.history-table th,
.history-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #d5d5d5;
  text-align: left;
  vertical-align: middle;
}

.history-table th {
  color: #fff;
  font-size: 0.78rem;
  text-transform: uppercase;
  background: #050607;
}

.history-table tbody tr:hover {
  background: #f2f2f2;
}

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

.history-table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.btn-compact {
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 0.82rem;
}

.history-table-actions .btn-compact {
  width: 86px;
  min-height: 34px;
  padding-inline: 8px;
  text-align: center;
}

.btn,
.icon-btn {
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(38, 45, 52, 0.96), rgba(22, 27, 31, 0.96));
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.btn {
  padding: 12px 16px;
  font-weight: 600;
}

.btn-primary {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(38, 45, 52, 0.96), rgba(22, 27, 31, 0.96));
  color: var(--text);
  font-weight: 800;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(229, 221, 201, 0.38);
}

.icon-btn {
  width: 38px;
  height: 38px;
  font-size: 1.15rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #111;
  border-radius: 16px;
}

.procedure-editor-list {
  display: grid;
  gap: 18px;
}

.manual-procedure-dialog {
  width: min(680px, calc(100vw - 32px));
}

.manual-procedure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.manual-procedure-wide {
  grid-column: 1 / -1;
}

.manual-procedure-check {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: end;
  min-height: 42px;
}

.manual-procedure-check input {
  width: 18px;
  height: 18px;
}

.procedure-topic {
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.procedure-topic-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #111;
  background: #050607;
}

.procedure-topic-head h3 {
  color: #fff;
  font-size: 1rem;
}

.procedure-count {
  color: #d7dde3;
  font-size: 0.92rem;
}

.procedure-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.procedure-edit-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.procedure-edit-table th,
.procedure-edit-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #d5d5d5;
  text-align: left;
  vertical-align: middle;
}

.procedure-edit-table td {
  position: relative;
}

.procedure-edit-table th {
  color: #fff;
  font-size: 0.72rem;
  text-transform: uppercase;
  background: #050607;
}

.procedure-edit-table tbody tr:hover {
  background: #f2f2f2;
}

.procedure-edit-table tbody tr:last-child td {
  border-bottom: 0;
}

.procedure-edit-table input[type="text"],
.procedure-edit-table input:not([type]) {
  width: 100%;
  min-width: 110px;
  height: 34px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 0.84rem;
}

.procedure-edit-table td:first-child input {
  min-width: 118px;
}

.procedure-staff-suggestions {
  position: fixed;
  z-index: 150;
  max-height: 210px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #111;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

.procedure-staff-suggestion {
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #111;
  font: inherit;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.procedure-staff-suggestion:hover,
.procedure-staff-suggestion:focus {
  background: #e8eef8;
  outline: none;
}

.procedure-status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.procedure-status.complete {
  background: rgba(100, 204, 139, 0.18);
  color: #176732;
}

.procedure-status.incomplete {
  background: rgba(228, 98, 98, 0.18);
  color: #9b1f1f;
}

.procedure-inline-action {
  display: flex;
  gap: 6px;
  align-items: center;
}

.procedure-inline-action input {
  flex: 1;
}

.pje-link-btn {
  min-width: 92px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.procedure-checkbox-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 58px;
  font-weight: 700;
  color: #111;
}

.procedure-checkbox-cell input {
  width: 17px;
  height: 17px;
  accent-color: #64cc8b;
}

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

thead {
  background: linear-gradient(180deg, rgba(197, 179, 138, 0.18), rgba(255, 255, 255, 0.03));
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

th {
  color: #f0e7d4;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td input {
  padding: 10px 11px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 22px 14px;
}

.category-sections {
  display: grid;
  gap: 12px;
}

.category-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
}

.category-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.category-card h3 {
  font-size: 1rem;
}

.category-count {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #f0e7d4;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.84rem;
}

.category-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.document-preview {
  margin-top: 18px;
  min-height: 720px;
  padding: 40px 46px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(241, 234, 219, 0.98), rgba(251, 248, 240, 0.98)),
    repeating-linear-gradient(0deg, rgba(111, 97, 66, 0.03), rgba(111, 97, 66, 0.03) 1px, transparent 1px, transparent 26px);
  color: #151515;
  box-shadow: inset 0 0 0 1px rgba(77, 67, 45, 0.08), 0 24px 60px rgba(0, 0, 0, 0.28);
}

.report-viewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #111418;
  color: var(--text);
}

.report-viewer[hidden] {
  display: none !important;
}

.report-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 13, 16, 0.96);
}

.report-viewer-toolbar strong,
.report-viewer-toolbar span {
  display: block;
}

.report-viewer-toolbar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.report-viewer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.report-viewer-body {
  overflow: auto;
  padding: 18px;
}

.report-viewer-body .document-preview {
  width: min(100%, 840px);
  min-height: 1188px;
  margin: 0 auto 28px;
  padding: 34px 38px;
  border-radius: 10px;
}

.report-viewer-body .doc-table {
  font-size: 0.78rem;
}

.report-viewer-body .doc-table th,
.report-viewer-body .doc-table td {
  padding: 6px 6px;
}

body.report-viewer-open {
  overflow: hidden;
}

.doc-header {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 22px;
  border-bottom: 2px solid #222;
}

.doc-logo {
  width: 96px;
  height: auto;
  display: block;
}

.doc-header-text {
  text-align: center;
}

.doc-header-line {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
}

.doc-title {
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: underline;
  margin-bottom: 18px;
}

.doc-dest {
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.16rem;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: underline;
  margin-bottom: 28px;
}

.doc-intro,
.doc-paragraph,
.doc-signature,
.doc-city {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.98rem;
  line-height: 1.45;
}

.doc-intro,
.doc-paragraph {
  text-align: justify;
  text-indent: 2.6rem;
  margin-bottom: 16px;
}

.doc-section {
  margin-top: 22px;
}

.doc-section-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: underline;
  margin-bottom: 10px;
}

.doc-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 0.88rem;
  table-layout: fixed;
}

.doc-table th,
.doc-table td {
  border: 1px solid #232323;
  padding: 7px 7px;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 0;
}

.doc-table th {
  background: #111;
  color: #fff;
  text-align: center;
}

.doc-table td {
  background: rgba(255, 255, 255, 0.45);
}

.doc-servers {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  table-layout: fixed;
}

.doc-servers td {
  border: 1px solid #222;
  padding: 7px 8px;
  font-size: 0.92rem;
  word-break: break-word;
}

.doc-servers td:first-child {
  width: 26%;
  font-weight: 700;
}

.doc-city {
  margin-top: 34px;
  text-align: left;
  text-indent: 2.6rem;
}

.doc-signature {
  margin-top: 40px;
  text-align: center;
  text-indent: 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(17, 20, 24, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(2px);
}

.busy-overlay.show {
  display: flex;
}

.busy-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(440px, 100%);
  padding: 18px 20px;
  border: 2px solid #050607;
  border-radius: 8px;
  background: #fff;
  color: #111;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.busy-spinner {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 4px solid #d6d6d6;
  border-top-color: #111;
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}

.busy-title {
  color: #111;
  font-size: 1rem;
  font-weight: 900;
}

.busy-subtitle {
  margin-top: 4px;
  color: #454545;
  font-size: 0.9rem;
  font-weight: 700;
}

body.app-busy {
  cursor: progress;
}

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

@media (max-width: 1120px) {
  .app-layout,
  .layout-grid,
  .form-grid,
  .essential-grid,
  .complement-grid,
  .staff-form-grid {
    grid-template-columns: 1fr;
  }

  .essential-wide,
  .complement-wide,
  .appointment-people-panel,
  .appointment-notes-field {
    grid-column: span 1;
  }

  .hero-card {
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
  }

  .history-toolbar {
    grid-template-columns: 1fr;
  }

  .section-heading-actions {
    flex-direction: column;
  }

  .section-action-stack {
    width: 100%;
    justify-content: flex-start;
  }

  .appointment-toolbar,
  .appointment-form,
  .appointment-form-block,
  .appointment-schedule-block {
    grid-template-columns: 1fr;
  }

  .appointment-person-row {
    grid-template-columns: 1fr;
  }

  .custody-control-head,
  .custody-control-filters {
    grid-template-columns: 1fr;
  }

  .appointment-field-wide {
    grid-column: auto;
  }

  .dashboard-toolbar,
  .dashboard-cards,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .side-nav-card {
    position: static;
    order: -1;
  }

  .side-nav {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 720px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 20px;
  }

  .panel-card,
  .hero-card,
  .side-nav-card {
    padding: 18px;
  }

  .button-row {
    flex-direction: column;
  }

  .manual-procedure-grid {
    grid-template-columns: 1fr;
  }

  .shift-message-controls {
    grid-template-columns: 1fr;
  }

  .appointment-slot {
    grid-template-columns: 1fr;
  }

  .appointment-slot-time {
    min-height: 44px;
  }

  .appointment-item-head {
    flex-direction: column;
  }

  .appointment-actions {
    justify-content: flex-start;
  }

  body.reception-mode .reception-top-nav {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100vw;
    padding-inline: 10px;
    scroll-padding-inline: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body.reception-mode .reception-top-nav::-webkit-scrollbar {
    display: none;
  }

  .report-top-nav {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100vw;
    padding-inline: 10px;
    scroll-padding-inline: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .report-top-nav::-webkit-scrollbar {
    display: none;
  }

  .report-top-nav-title,
  .report-top-nav-link,
  .reception-top-nav .report-top-nav-title,
  .reception-top-nav a {
    flex: 0 0 auto;
  }

  .btn,
  .icon-btn {
    width: 100%;
  }

  .history-table .btn-compact {
    width: auto;
  }

  .document-preview {
    padding: 24px 18px;
  }

  .doc-header {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .doc-title {
    font-size: 1.35rem;
  }

  .doc-dest {
    font-size: 1rem;
  }
}

@media print {
  @page {
    size: A4;
    margin: 1.2cm 1.35cm;
  }

  body.printing-report.management-mode #sec-previa {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
  }

  body.report-viewer-open .app-shell,
  body.report-viewer-open .report-top-nav,
  body.report-viewer-open .reception-top-nav,
  body.report-viewer-open .toast,
  body.report-viewer-open .report-viewer-toolbar {
    display: none !important;
  }

  body.report-viewer-open .report-viewer {
    position: static;
    display: block;
    background: #fff;
  }

  body.report-viewer-open .report-viewer-body {
    overflow: visible;
    padding: 0;
  }

  body.report-viewer-open .report-viewer-body .document-preview {
    width: auto;
    min-height: auto;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.printing-appointments .hero-card,
  body.printing-appointments .reception-top-nav,
  body.printing-appointments .report-top-nav,
  body.printing-appointments .side-nav-card,
  body.printing-appointments .panel-card:not(#sec-agendamentos),
  body.printing-appointments #sec-agendamentos .section-heading,
  body.printing-appointments #sec-agendamentos .appointment-toolbar,
  body.printing-appointments #sec-agendamentos .appointment-form,
  body.printing-appointments #sec-agendamentos .custody-control,
  body.printing-appointments .button-row,
  body.printing-appointments .toast {
    display: none !important;
  }

  body.printing-appointments #sec-agendamentos {
    display: block !important;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  body.printing-appointments #sec-agendamentos::before {
    content: "AGENDAMENTOS";
    display: block;
    margin-bottom: 12px;
    color: #111;
    font-size: 18pt;
    font-weight: 700;
    text-align: center;
  }

  body.printing-appointments .appointment-list-heading {
    display: none !important;
  }

  body.printing-appointments .appointment-timeline {
    gap: 10px;
    margin: 0;
  }

  body.printing-appointments .appointment-group,
  body.printing-appointments .appointment-slot,
  body.printing-appointments .appointment-item {
    break-inside: avoid;
    border: 1px solid #333;
    border-radius: 0;
    background: #fff !important;
    color: #111;
    box-shadow: none;
  }

  body.printing-appointments .appointment-group {
    padding: 10px;
    margin-bottom: 12px;
  }

  body.printing-appointments .appointment-group-head {
    border-bottom: 1px solid #333;
    background: #f2f2f2 !important;
  }

  body.printing-appointments .appointment-group-head h3,
  body.printing-appointments .appointment-group-head p,
  body.printing-appointments .appointment-slot-time,
  body.printing-appointments .appointment-item-title,
  body.printing-appointments .appointment-item-note,
  body.printing-appointments .appointment-badge {
    color: #111;
  }

  body.printing-appointments .appointment-slot {
    grid-template-columns: 72px 1fr;
    padding: 8px;
  }

  body.printing-appointments .appointment-slot-time,
  body.printing-appointments .appointment-badge {
    background: #f2f2f2 !important;
  }

  body.printing-appointments .appointment-actions {
    display: none !important;
  }

  body.printing-appointments .appointment-table-wrap {
    overflow: visible !important;
    border: 0;
  }

  body.printing-appointments .appointment-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 7.6pt;
  }

  body.printing-appointments .appointment-table th,
  body.printing-appointments .appointment-table td {
    padding: 4px 5px;
    border: 1px solid #444;
    color: #111 !important;
    vertical-align: top;
    overflow-wrap: anywhere;
  }

  body.printing-appointments .appointment-table th {
    background: #e8e8e8 !important;
    color: #111 !important;
    font-size: 6.8pt;
  }

  body.printing-appointments .appointment-table th:nth-child(1),
  body.printing-appointments .appointment-table td:nth-child(1) {
    width: 8%;
  }

  body.printing-appointments .appointment-table th:nth-child(2),
  body.printing-appointments .appointment-table td:nth-child(2) {
    width: 18%;
  }

  body.printing-appointments .appointment-table th:nth-child(3),
  body.printing-appointments .appointment-table td:nth-child(3) {
    width: 7%;
  }

  body.printing-appointments .appointment-table th:nth-child(4),
  body.printing-appointments .appointment-table td:nth-child(4) {
    width: 14%;
  }

  body.printing-appointments .appointment-table th:nth-child(5),
  body.printing-appointments .appointment-table td:nth-child(5) {
    width: 27%;
  }

  body.printing-appointments .appointment-table th:nth-child(6),
  body.printing-appointments .appointment-table td:nth-child(6) {
    width: 14%;
  }

  body.printing-appointments .appointment-table th:nth-child(7),
  body.printing-appointments .appointment-table td:nth-child(7) {
    width: 12%;
  }

  body.printing-appointments .appointment-table th:nth-child(8),
  body.printing-appointments .appointment-table td:nth-child(8),
  body.printing-appointments .reds-core-copy-btn {
    display: none !important;
  }

  body.printing-appointments .appointment-table-status {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent !important;
    color: #111 !important;
    white-space: normal;
    font-weight: 700;
  }

  body.printing-appointments .appointment-row-note {
    display: none !important;
  }

  body.printing-appointments .app-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  body.printing-appointments .app-layout,
  body.printing-appointments .layout-grid {
    display: block;
  }

  body.printing-appointments .report-print-section,
  body.printing-appointments .document-preview {
    display: none !important;
  }

  body.printing-appointments {
    background: #fff;
  }

  body.printing-appointments * {
    color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #fff;
  }

  .hero-card,
  .report-top-nav,
  .reception-top-nav,
  .side-nav-card,
  .panel-card:not(.report-print-section),
  .report-print-section .section-heading,
  .button-row,
  .toast {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .report-print-section {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .document-preview {
    margin: 0;
    padding: 0;
    min-height: auto;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  body.printing-custody {
    background: #fff;
  }

  body.printing-custody .hero-card,
  body.printing-custody .reception-top-nav,
  body.printing-custody .report-top-nav,
  body.printing-custody .side-nav-card,
  body.printing-custody .panel-card:not(#sec-agendamentos),
  body.printing-custody #sec-agendamentos .section-heading,
  body.printing-custody #sec-agendamentos .appointment-toolbar,
  body.printing-custody #sec-agendamentos .appointment-form,
  body.printing-custody #sec-agendamentos > .button-row,
  body.printing-custody .appointment-list-heading,
  body.printing-custody .appointment-timeline,
  body.printing-custody .toast {
    display: none !important;
  }

  body.printing-custody #sec-agendamentos,
  body.printing-custody .custody-control {
    display: block !important;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  body.printing-custody #sec-agendamentos::before {
    content: "CONTROLE DE CONDUZIDOS";
    display: block;
    margin-bottom: 12px;
    color: #111;
    font-size: 18pt;
    font-weight: 700;
    text-align: center;
  }

  body.printing-custody .custody-control-filters,
  body.printing-custody .custody-bulk-actions,
  body.printing-custody .custody-print-btn,
  body.printing-custody .custody-table th:nth-child(1),
  body.printing-custody .custody-table td:nth-child(1),
  body.printing-custody .custody-table th:nth-child(12),
  body.printing-custody .custody-table td:nth-child(12) {
    display: none !important;
  }

  body.printing-custody .custody-control-head {
    display: block;
    padding: 0 0 10px;
    border-bottom: 1px solid #333;
  }

  body.printing-custody .custody-table-wrap {
    max-height: none;
    overflow: visible;
  }

  body.printing-custody .custody-table {
    min-width: 0;
    width: 100%;
    font-size: 8.5pt;
  }

  body.printing-custody .custody-table th,
  body.printing-custody .custody-table td {
    padding: 4px 5px;
    border: 1px solid #333;
    color: #111;
  }

  body.printing-custody .custody-table thead th {
    position: static;
    background: #e8e8e8 !important;
  }

  body.printing-custody .custody-control-head h3,
  body.printing-custody .custody-control-head p,
  body.printing-custody .custody-legend,
  body.printing-custody .custody-location-select,
  body.printing-custody .custody-status-select {
    color: #111;
  }

  body.printing-custody .custody-location-select,
  body.printing-custody .custody-status-select {
    border: 0;
    background: transparent !important;
    padding: 0;
    min-height: 0;
    color: #111 !important;
  }
}

.night-shift-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.night-shift-panel {
  border: 1px solid #111;
  border-radius: 8px;
  padding: 16px;
  background: #f8f8f8;
}

.night-shift-panel h3,
.night-shift-history-head h3 {
  margin-bottom: 12px;
  color: #111;
  font-size: 1rem;
}

.night-shift-form,
.night-shift-generator {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.night-shift-form label,
.night-shift-generator label {
  display: grid;
  gap: 6px;
  color: #111;
  font-weight: 800;
}

.night-shift-form span,
.night-shift-generator span {
  color: #222;
  font-size: 0.85rem;
}

.night-shift-form input,
.night-shift-form select,
.night-shift-generator input,
.night-shift-generator select,
.night-shift-table input,
.night-shift-table select {
  width: 100%;
  border: 1px solid #222;
  border-radius: 8px;
  background: #fff;
  color: #111;
  padding: 9px 10px;
}

.night-shift-form input[type="color"] {
  min-height: 40px;
  padding: 4px;
}

.night-shift-checkbox {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.night-shift-checkbox input {
  width: auto;
}

.night-shift-wide,
.night-shift-notes {
  grid-column: span 2;
}

.night-shift-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.night-shift-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #c8c8c8;
  border-radius: 8px;
  background: #fff;
}

.night-shift-item small {
  display: block;
  margin-top: 2px;
  color: #444;
  font-weight: 700;
}

.night-shift-color {
  width: 16px;
  height: 16px;
  border: 1px solid #111;
  border-radius: 50%;
}

.night-shift-generator {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #fff;
}

.night-shift-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #222;
  border-radius: 8px;
  background: #f2f2f2;
  color: #111;
  font-weight: 800;
}

.night-shift-table-wrap {
  overflow-x: auto;
  border: 1px solid #111;
  border-radius: 8px;
  background: #fff;
}

.night-shift-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
}

.night-shift-table th,
.night-shift-table td {
  padding: 9px;
  border-bottom: 1px solid #d4d4d4;
  color: #111;
  vertical-align: middle;
}

.night-shift-table th {
  background: #111;
  color: #fff;
  text-align: left;
}

.night-shift-table td small {
  display: block;
  color: #555;
  font-weight: 700;
}

.night-shift-table tr.is-expediente td {
  background: #f5c7c7;
}

.night-shift-table tbody tr {
  border-left: 8px solid var(--shift-color, #9aa0a6);
}

.night-shift-table tbody tr td {
  background: var(--shift-bg, #fff);
}

.night-shift-table tbody tr.is-expediente td {
  background: linear-gradient(90deg, rgba(139, 0, 0, 0.24), #f7d3d3);
}

.night-shift-history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.night-shift-print-title {
  display: none;
}

.night-shift-print-leaves {
  display: none;
}

@media (max-width: 980px) {
  .night-shift-grid,
  .night-shift-form,
  .night-shift-generator {
    grid-template-columns: 1fr;
  }

  .night-shift-wide,
  .night-shift-notes {
    grid-column: auto;
  }

  .night-shift-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

@media print {
  body.printing-night-shift {
    background: #fff !important;
  }

  body.printing-night-shift .hero-card,
  body.printing-night-shift .reception-top-nav,
  body.printing-night-shift .report-top-nav,
  body.printing-night-shift .side-nav-card,
  body.printing-night-shift .panel-card:not(#sec-escala),
  body.printing-night-shift #sec-escala .night-shift-grid,
  body.printing-night-shift #sec-escala .night-shift-generator,
  body.printing-night-shift #sec-escala .night-shift-history-head,
  body.printing-night-shift #sec-escala #nightShiftHistoryList,
  body.printing-night-shift #sec-escala .section-heading .button-row,
  body.printing-night-shift .toast {
    display: none !important;
  }

  body.printing-night-shift .app-shell,
  body.printing-night-shift .app-layout,
  body.printing-night-shift .layout-grid {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  body.printing-night-shift #sec-escala {
    display: block !important;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  body.printing-night-shift #sec-escala .section-heading {
    margin: 0 0 10px;
    padding: 0 0 10px;
    border: 0;
    border-bottom: 1px solid #111;
    border-radius: 0;
    background: #fff;
  }

  body.printing-night-shift #sec-escala .section-heading h2,
  body.printing-night-shift #sec-escala .section-heading p,
  body.printing-night-shift .night-shift-summary {
    color: #111;
  }

  body.printing-night-shift .night-shift-summary {
    display: none !important;
  }

  body.printing-night-shift .night-shift-print-title {
    display: block;
    margin-bottom: 12px;
    color: #111;
    font-size: 16pt;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
  }

  body.printing-night-shift .night-shift-print-leaves {
    display: block;
    margin-top: 14px;
    color: #111;
  }

  body.printing-night-shift .night-shift-print-leaves h3 {
    margin: 0 0 6px;
    color: #111;
    font-size: 11pt;
  }

  body.printing-night-shift .night-shift-print-leaves p {
    color: #111;
    font-size: 9pt;
  }

  body.printing-night-shift .night-shift-print-leaves table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
  }

  body.printing-night-shift .night-shift-print-leaves th,
  body.printing-night-shift .night-shift-print-leaves td {
    padding: 4px 5px;
    border: 1px solid #333;
    color: #111;
    text-align: left;
  }

  body.printing-night-shift .night-shift-print-leaves th {
    background: #e8e8e8 !important;
  }

  body.printing-night-shift .night-shift-table-wrap {
    overflow: visible;
    border: 0;
  }

  body.printing-night-shift .night-shift-table {
    min-width: 0;
    width: 100%;
    font-size: 9pt;
  }

  body.printing-night-shift .night-shift-table th,
  body.printing-night-shift .night-shift-table td {
    padding: 5px 6px;
    border: 1px solid #333;
    color: #111;
  }

  body.printing-night-shift .night-shift-table th {
    background: #e8e8e8 !important;
    color: #111;
  }

  body.printing-night-shift .night-shift-table th:nth-child(5),
  body.printing-night-shift .night-shift-table td:nth-child(5) {
    display: none !important;
  }

  body.printing-night-shift .night-shift-table select,
  body.printing-night-shift .night-shift-table input {
    border: 0;
    background: transparent;
    color: #111;
    padding: 0;
    appearance: none;
  }
}
