:root {
  --blue-900: #081426;
  --blue-800: #0d2344;
  --blue-700: #1d4f91;
  --blue-600: #2672c7;
  --blue-500: #438cf0;
  --blue-400: #78adff;
  --blue-100: #173b68;
  --blue-050: #142a49;
  --ink: #e8eef7;
  --muted: #a9b7ca;
  --border: #344763;
  --bg: #0b1220;
  --card: #121c2d;
  --danger: #d92d20;
  --danger-bg: #4a1f27;
  --warn: #f0a35b;
  --warn-bg: #49321d;
  --ok: #4fd17b;
  --ok-bg: #193c2c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(circle at top, var(--blue-050), var(--bg) 55%);
}

body.auth-required > .topbar,
body.auth-required > .tabs,
body.auth-required > main,
body.auth-required > footer,
body.auth-required > .modal-backdrop,
body.auth-required > .toast-stack,
body.auth-required > dialog { display: none !important; }
body:not(.auth-required) > .auth-gate { display: none; }
.auth-topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.auth-form input { width: 100%; min-height: 2.75rem; }
@media (max-width: 600px) {
  .auth-card { padding: 1.5rem; }
  .auth-topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
}

.auth-card {
  width: min(100%, 28rem);
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-card .brand-mark { margin-bottom: 1rem; }
.auth-card h1 { margin: 0 0 0.5rem; }
.auth-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.auth-form label { display: grid; gap: 0.4rem; }
.auth-message { min-height: 1.4rem; color: var(--danger); }
.auth-user-label { color: var(--ink); font-size: 0.9rem; white-space: nowrap; }
.auth-change-password, .auth-logout { white-space: nowrap; }
.auth-logout { white-space: nowrap; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: linear-gradient(120deg, var(--blue-900), var(--blue-700));
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 1.2rem;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
}

.env-dot { width: 8px; height: 8px; border-radius: 50%; background: #7cf29a; }

nav.tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.6rem 1.5rem 0;
  background: var(--blue-050);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

nav.tabs button {
  border: none;
  background: transparent;
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

nav.tabs button.active {
  color: var(--blue-400);
  border-bottom-color: var(--blue-600);
}

main { padding: 1.25rem 1.5rem 3rem; max-width: 1180px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.master-accordions { display: grid; gap: 1rem; width: 100%; }
.master-accordion { width: 100%; padding: 0; overflow: hidden; }
.master-accordion-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1rem; }
.master-toggle { display: flex; align-items: center; gap: .65rem; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; padding: .2rem 0; }
.master-arrow { display: inline-block; width: 1rem; color: var(--blue-700); }
.master-count { min-width: 1.7rem; padding: .12rem .45rem; border-radius: 999px; background: var(--blue-050); color: var(--blue-400); font-size: .78rem; text-align: center; }
.master-accordion-panel { border-top: 1px solid var(--border); padding: 1rem; }
.calls-department-groups { display: grid; gap: .75rem; min-width: 0; }
.calls-department-group { min-width: 0; }
.calls-department-summary { cursor: pointer; list-style: none; min-height: 48px; }
.calls-department-summary::-webkit-details-marker { display: none; }
.calls-department-title { display: inline-flex; align-items: center; gap: .65rem; min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.calls-department-group[open] .calls-department-summary .master-arrow { transform: rotate(90deg); }
.calls-department-group .master-accordion-panel { padding: 0; min-width: 0; }
.calls-department-group .table-scroll { max-width: 100%; }

/* Berichte: native independent accordions, styled like the existing grouped cards. */
#view-reports .reports-accordion { padding: 0; overflow: hidden; min-width: 0; }
#view-reports .reports-accordion-summary { min-height: 48px; cursor: pointer; list-style: none; }
#view-reports .reports-accordion-summary::-webkit-details-marker { display: none; }
#view-reports .reports-accordion-summary::marker { content: ''; }
#view-reports .reports-accordion-summary h3 { display: flex; align-items: center; gap: .65rem; margin: 0; font-size: 1.05rem; }
#view-reports .reports-accordion[open] .reports-accordion-summary .master-arrow { transform: rotate(90deg); }
#view-reports .reports-accordion-summary:hover { background: rgba(255, 255, 255, .035); }
#view-reports .reports-accordion-summary:focus-visible { outline: 2px solid var(--blue-400); outline-offset: -2px; }
#view-reports .reports-accordion-panel { min-width: 0; }

/* Keep the existing asset table inside the card, including its complete action column. */
.master-accordion[data-master-section="machinesMaster"] { padding: 0; }
#master-panel-machinesMaster .table-scroll { max-width: 100%; overflow-x: auto; }
#master-panel-machinesMaster table { table-layout: fixed; width: 100%; }
#master-panel-machinesMaster th, #master-panel-machinesMaster td { padding: .5rem .35rem; overflow-wrap: anywhere; }
#master-panel-machinesMaster th { font-size: .7rem; letter-spacing: .02em; hyphens: auto; }
#master-panel-machinesMaster th:first-child { width: 15%; }
#master-panel-machinesMaster th:nth-last-child(2) { width: 6.5rem; }
#master-panel-machinesMaster th:last-child { width: 8.25rem; }
#master-panel-machinesMaster td:last-child .tag-row { margin: 0; gap: .35rem; }
#master-panel-machinesMaster td:last-child .btn { max-width: 100%; white-space: normal; }
.master-production-toggle { display: flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; cursor: pointer; }
.master-production-toggle input { appearance: auto; flex: 0 0 20px; width: 20px; height: 20px; padding: 0; accent-color: var(--blue-400); cursor: pointer; }
.master-production-toggle:has(input:disabled) { cursor: progress; opacity: .65; }
.master-production-toggle input:disabled { cursor: progress; }
@media (max-width: 700px) {
  #master-panel-machinesMaster table { min-width: 900px; }
  #master-panel-machinesMaster th:first-child { width: 8rem; }
  #master-panel-machinesMaster th:nth-last-child(2) { width: 4rem; }
  #master-panel-machinesMaster th:last-child { width: 8rem; }
  #master-panel-machinesMaster th:last-child, #master-panel-machinesMaster td:last-child { position: sticky; right: 0; background: var(--card); border-left: 1px solid var(--border); z-index: 1; }
  #master-panel-machinesMaster th:nth-last-child(2), #master-panel-machinesMaster td:nth-last-child(2) { position: sticky; right: 8rem; background: var(--card); border-left: 1px solid var(--border); z-index: 1; }
}

/* Wartungsanalyse: scoped, read-only summary and source cards. */
#view-maintenance-analysis, #view-maintenance-analysis * { min-width: 0; }
.maintenance-analysis-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .8rem; margin-top: 1rem; }
.maintenance-analysis-filters label { display: grid; gap: .3rem; }
.maintenance-analysis-filters select, .maintenance-analysis-filters input { width: 100%; min-height: 2.7rem; padding: .5rem; color: var(--ink); background: #182438; border: 1px solid var(--border); border-radius: .5rem; font: inherit; }
.maintenance-analysis-filters .ma-custom-date[hidden] { display: none; }
.ma-filter-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
.ma-filter-actions .btn { min-height: 2.7rem; }
.maintenance-analysis-sections { display: grid; gap: .8rem; margin-top: 1rem; }
.ma-section { padding: 0; overflow: hidden; }
.ma-section > summary { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: 3rem; padding: .8rem 1rem; cursor: pointer; font-weight: 700; overflow-wrap: anywhere; }
.ma-section > summary::marker { content: ''; }
.ma-section > summary::before { content: '▸'; color: var(--blue-400); flex: none; }
.ma-section[open] > summary::before { content: '▾'; }
.ma-section > summary > span:first-child { flex: 1 1 auto; }
.ma-section > summary:focus-visible { outline: 2px solid var(--blue-400); outline-offset: -2px; }
.ma-summary { color: var(--muted); text-align: right; font-size: .85rem; font-weight: 400; }
.ma-section-body { padding: .2rem 1rem 1rem; border-top: 1px solid var(--border); }
.ma-result { padding: .8rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.ma-result:last-child { border-bottom: 0; }
.ma-result h4 { margin: 0 0 .35rem; }
.ma-other-heading { margin: 1.2rem 0 .2rem; color: var(--muted); }
.ma-result p { margin: .25rem 0 .55rem; }
.ma-result ul { margin: .35rem 0 .6rem; padding-left: 1.3rem; }
.ma-result .btn { min-height: 2.5rem; }
.ma-unassigned, .ma-sources { margin-top: 1rem; overflow-wrap: anywhere; }
.ma-evidence-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .65rem 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.ma-evidence-row > span { min-width: 0; }
@media (max-width: 700px) {
  #view-maintenance-analysis .section-head { display: block; }
  #view-maintenance-analysis .section-head .small-note { display: block; margin-top: .3rem; }
  .maintenance-analysis-filters { grid-template-columns: minmax(0, 1fr); }
  .ma-filter-actions .btn { width: 100%; min-height: 44px; }
  .ma-section > summary { flex-wrap: wrap; min-height: 48px; }
  .ma-summary { flex-basis: 100%; text-align: left; }
  .ma-evidence-row { align-items: stretch; flex-direction: column; }
  .ma-evidence-row .btn { width: 100%; min-height: 44px; }
}

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}

.card h2, .card h3 { margin-top: 0; }

.stat-card { display: flex; flex-direction: column; gap: 0.35rem; }
#dash-cards .stat-card { flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 1rem; text-align: left; }
#dash-cards .stat-card .stat-label { flex: 1; }
#dash-cards .stat-card .stat-value { flex-shrink: 0; text-align: right; }
#dash-cards .stat-card .stat-label, #dash-cards .stat-card .stat-value { font-size: 1rem; line-height: 1.5; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--blue-400); }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.6rem 0 0.75rem;
}
.section-head h2 { margin: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-normal { background: var(--blue-100); color: var(--blue-400); }
.badge-high { background: var(--warn-bg); color: var(--warn); }
.badge-critical { background: var(--danger-bg); color: var(--danger); }
.badge-open { background: var(--blue-100); color: var(--blue-400); }
.badge-closed { background: var(--ok-bg); color: var(--ok); }
.badge-new { background: #263246; color: var(--muted); }
.badge-in_progress { background: var(--blue-100); color: var(--blue-400); }
.badge-waiting_for_parts { background: var(--warn-bg); color: var(--warn); }
.badge-running { background: var(--ok-bg); color: var(--ok); }
.badge-stopped { background: #263246; color: var(--muted); }
.badge-damaged { background: var(--danger-bg); color: var(--danger); }
.badge-waiting-parts { background: var(--warn-bg); color: var(--warn); }
.badge-replaced { background: #263246; color: var(--muted); }
.badge-moved { background: var(--blue-100); color: var(--blue-400); }
.badge-unknown { background: #263246; color: var(--muted); }
.job-state-planned { background: var(--blue-100); color: var(--blue-400); }
.job-state-due { background: var(--warn-bg); color: var(--warn); }
.job-state-done { background: var(--ok-bg); color: var(--ok); }
.job-state-not_possible, .job-state-missed { background: var(--danger-bg); color: #ffb4ab; }
.job-state-unscheduled { background: #263246; color: var(--muted); }
.job-state-archived { background: #263246; color: #cbd5e1; }
.status-select { min-width: 10.5rem; min-height: 2.35rem; border-color: transparent; font-weight: 700; }
.status-select.status-running { background: #176b3a; color: #d9ffe8; }
.status-select.status-stopped { background: #b42318; color: #fff1f0; }
.status-select.status-paused { background: #a77b00; color: #fff9d6; }
.status-select.status-delayed { background: #c65d12; color: #fff3e8; }
.status-select.status-waiting_for_parts { background: var(--blue-600); color: #eef6ff; }
.status-select.status-damaged { background: #7a1712; color: #ffe8e6; }
.status-select.status-not_checked { background: #3c4655; color: #eef1f5; }
.status-select.status-maintenance { background: #1d4ed8; color: #eef6ff; }
.status-select.status-cleaning { background: #0f766e; color: #e6fffb; }
.status-select.status-specialist_working { background: #6d28d9; color: #f5edff; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:hover { background: var(--blue-050); cursor: pointer; }
tbody tr.static:hover { background: transparent; cursor: default; }

.list-card { padding: 0; overflow: hidden; }
.list-card .table-scroll { overflow-x: auto; }
.job-actions { min-width: 18rem; }
.checklist-manager { margin-top: 1rem; }
.checklist-manager .section-head { padding: 1rem 1rem 0; margin: 0; }
.duty-manager { margin-bottom: 1rem; }
.duty-manager .section-head { padding: 1rem 1rem 0; margin: 0; align-items: center; }
.duty-manager .section-head h3 { margin: 0; }
.duty-filter { display: flex; flex-direction: row; align-items: center; gap: .5rem; }
.duty-filter select { min-width: 9rem; }
.duty-help { margin: .55rem 1rem .75rem; }
.duty-checkbox { appearance: auto; width: 1.25rem !important; height: 1.25rem; padding: 0; accent-color: var(--blue-400); cursor: pointer; }
.duty-checkbox:disabled { cursor: not-allowed; }
.duty-description { margin-top: .25rem; white-space: pre-wrap; }
.duty-actions { min-width: 19rem; margin: 0; }
.duty-archived { opacity: .76; }
.checklist-answer { border: 1px solid var(--border); border-radius: 8px; padding: .8rem; margin: .7rem 0; }
.checklist-answer legend { padding: 0 .35rem; color: var(--ink); font-weight: 600; }
.checklist-history { padding-left: 1.4rem; }
.checklist-history li { margin: .7rem 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.9rem; }
.toolbar select, .toolbar input { padding: 0.45rem 0.6rem; border-radius: 8px; border: 1px solid var(--border); background: #182438; color: var(--ink); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--blue-600);
  background: var(--blue-600);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
/* Decorative delete icons preserve the existing button labels and actions. */
.delete-action::after {
  content: "";
  display: inline-block;
  flex: 0 0 1rem;
  width: 1rem;
  height: 1rem;
  vertical-align: -0.15em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.btn:hover { background: var(--blue-700); }
.btn.secondary { background: #182438; color: var(--blue-400); }
.btn.secondary:hover { background: var(--blue-050); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #b3261e; }
/* Closing is a successful workflow action, not a destructive one. */
#modal-body #act-close,
#modal-body form:has(textarea[name="resolution"]) button[type="submit"] {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--blue-900);
}
#modal-body #act-close:hover,
#modal-body form:has(textarea[name="resolution"]) button[type="submit"]:hover {
  background: #38b96a;
  border-color: #38b96a;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

form.form-grid { display: grid; gap: 0.8rem; grid-template-columns: 1fr 1fr; }
form.form-grid .full { grid-column: 1 / -1; }
form.stacked-form { display: flex; flex-direction: column; gap: 0.9rem; }
form.stacked-form label, form.stacked-form input, form.stacked-form select, form.stacked-form textarea { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.2rem; }
.writing-assistant-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .35rem; }
.writing-assistant-status { min-height: 1.1rem; }
.writing-assistant-privacy { flex: 1 1 100%; overflow-wrap: anywhere; }
.writing-assistant-privacy a { color: var(--blue-400); }
.writing-preview { max-width: 100%; }
.writing-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: .8rem 0; }
.writing-preview-grid section, .writing-suggestion, .writing-translation-warnings { border: 1px solid var(--border); border-radius: 8px; padding: .75rem; background: #101b2d; }
.writing-translation-warnings { margin-top: .8rem; }
.writing-translation-warnings ul { margin: .45rem 0 0 1.2rem; padding: 0; }
.writing-preview-text { min-height: 4rem; margin-top: .35rem; overflow-wrap: anywhere; }
.writing-suggestions { display: grid; gap: .55rem; padding-left: 1.4rem; }
.writing-suggestion { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.writing-suggestion.is-accepted { border-color: var(--ok); }
.writing-suggestion.is-ignored { opacity: .6; }
.writing-preview-actions { flex-wrap: wrap; }
@media (max-width: 700px) { form.form-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .writing-preview-grid { grid-template-columns: 1fr; }
  .writing-suggestion { align-items: flex-start; flex-direction: column; }
  .writing-preview-actions .btn { flex: 1 1 10rem; min-height: 44px; }
}

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
input, select, textarea {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #182438;
  color: var(--ink);
}
select option { background: #182438; color: var(--ink); }
input::placeholder, textarea::placeholder { color: #8190a6; }
textarea { resize: vertical; min-height: 70px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 8, 18, 0.78);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 1rem; overflow-y: auto; z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 640px; width: 100%; padding: 1.4rem 1.5rem 1.6rem;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.modal-head h3 { margin: 0; }
.modal-close { border: none; background: transparent; font-size: 1.3rem; cursor: pointer; color: var(--muted); line-height: 1; }

/* Ticket detail, edit and closing only; other shared modals keep their layout. */
.modal:has(.call-ticket-detail, .call-ticket-form) { max-height: 92dvh; overflow-y: auto; }
.modal:has(.call-ticket-detail, .call-ticket-form) .modal-head { align-items: flex-start; gap: 1rem; }
.modal:has(.call-ticket-detail, .call-ticket-form) .modal-head h3 { font-size: 1.1rem; overflow-wrap: anywhere; }
.modal:has(.call-ticket-detail, .call-ticket-form) .modal-close { min-width: 44px; min-height: 44px; margin: -.6rem -.6rem 0 0; }
.call-ticket-detail { overflow-wrap: anywhere; }
.call-ticket-detail h4 { margin: 0 0 .85rem; font-size: 1.2rem; font-weight: 700; line-height: 1.35; }
.call-ticket-detail .call-ticket-subject { margin: .8rem 0 .45rem; font-size: 1.3rem; line-height: 1.35; }
.call-ticket-detail .small-note { margin: .45rem 0 0; }
.call-ticket-section { margin-top: 1.4rem; }
.call-ticket-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; margin: 0; }
.call-ticket-facts > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; align-items: baseline; }
.call-ticket-facts dt, .call-ticket-facts dd { color: var(--ink); font-size: .95rem; font-weight: 400; line-height: 1.5; margin: 0; }
.call-ticket-facts dd { margin: 0; }
.call-ticket-wide { grid-column: 1 / -1; }
.call-ticket-detail .timeline { margin: 0; }
.call-ticket-history .timeline li:first-child { margin-bottom: 1rem; }
.call-ticket-history .timeline li { border: 0; padding-left: 0; }
.call-ticket-entry { border-left: 2px solid var(--blue-400); padding-left: .8rem; }
.call-ticket-detail .timeline { font-size: .9rem; line-height: 1.55; }
.call-ticket-detail .call-ticket-date { font-size: 1rem; font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: .25rem; }
.call-ticket-detail .timeline .meta { margin-bottom: .35rem; }
.call-ticket-detail .timeline .preserve-lines { line-height: 1.55; }
.call-ticket-opening { border-left: 0; padding-left: 0; }
.call-ticket-opening-meta { display: grid; gap: .65rem; margin: 0 0 1rem; }
.call-ticket-opening-meta > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .75rem; align-items: baseline; }
.call-ticket-opening-meta dt, .call-ticket-opening-meta dd, .call-ticket-opening-label { margin: 0; font-size: 1rem; font-weight: 400; color: var(--ink); line-height: 1.5; }
.call-ticket-opening-label { margin-bottom: .5rem; }
.call-ticket-opening-note { width: 100%; min-width: 0; padding: .8rem; border: 1px solid var(--border); border-radius: 8px; background: #182438; }
.call-ticket-photos { display: grid; gap: 1rem; margin-top: 1rem; }
.call-ticket-photo-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 1rem; align-items: start; }
.call-ticket-photo-row > div { min-width: 0; }
.call-ticket-photo-row h5 { font-size: 1rem; font-weight: 400; line-height: 1.5; margin: 0 0 .5rem; color: var(--ink); }
.call-ticket-photo-row .call-photo-thumbnails { margin: 0; }
.call-ticket-photo-row .photo-thumb-button { width: 100%; height: 110px; }
.call-ticket-photo-row .photo-thumb-button img { object-fit: contain; }
.call-ticket-photo-note { padding: .8rem; border: 1px solid var(--border); border-radius: 8px; background: #182438; overflow-wrap: anywhere; }
.call-ticket-actions { border-top: 1px solid var(--border); padding-top: 1rem; }
.call-ticket-actions > .tag-row { display: flex; flex-direction: column; align-items: stretch; gap: .6rem; margin: 0; }
.call-ticket-actions > .tag-row + .tag-row { margin-top: .6rem; }
.call-ticket-actions .btn { width: 100%; min-height: 44px; text-align: left; }
.call-ticket-actions #act-delete-call { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.call-ticket-actions #act-delete-call svg { flex-shrink: 0; }
.call-ticket-actions .small-note:empty { display: none; }
.call-ticket-form h4 { margin: .5rem 0 0; font-size: .9rem; }
.call-ticket-form h4:first-child { margin-top: 0; }
.call-ticket-form label, .call-ticket-form input, .call-ticket-form select, .call-ticket-form textarea { min-width: 0; width: 100%; }
.call-ticket-form textarea { min-height: 110px; }
.call-ticket-form .form-actions { flex-wrap: wrap; margin-top: .5rem; }
@media (max-width: 700px) {
  .call-ticket-detail .btn, .call-ticket-form .btn { min-height: 44px; white-space: normal; }
  .call-ticket-action-row .btn, .call-ticket-form .form-actions .btn { flex: 1 1 100%; }
  .call-ticket-form input, .call-ticket-form select, .call-ticket-form textarea { min-height: 44px; font-size: 16px; }
}

.call-photo-picker { min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: .8rem; background: rgba(8, 16, 30, .45); }
.photo-picker-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.photo-file-input { display: none !important; }
.photo-pending-list { display: grid; grid-template-columns: 1fr; gap: .65rem; margin-top: .65rem; }
.photo-pending-item { display: grid; grid-template-columns: minmax(72px, 120px) minmax(0, 1fr); gap: .75rem; align-items: start; border: 1px solid var(--border); border-radius: 8px; padding: .55rem; min-width: 0; }
.photo-pending-item > img { width: 100%; max-height: 100px; object-fit: contain; border-radius: 6px; background: #080f1c; }
.photo-pending-fields { display: grid; gap: .45rem; min-width: 0; }
.photo-pending-fields input, .photo-pending-fields select { width: 100%; }
.photo-upload-status { min-height: 1.2em; color: var(--blue-300); font-size: .82rem; overflow-wrap: anywhere; }
.call-photo-thumbnails { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.photo-thumb-button { border: 1px solid var(--border); border-radius: 7px; background: #08101e; padding: 2px; cursor: pointer; width: 68px; height: 60px; overflow: hidden; }
.photo-thumb-button img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 5px; }
.photo-viewer-stage { max-height: 68vh; overflow: auto; border-radius: 8px; background-color: #080f1c; background-position: center; background-repeat: no-repeat; background-size: contain; }
.photo-viewer-image { display: block; width: 100%; max-height: 68vh; object-fit: contain; }
.photo-viewer-image.photo-zoomed { max-width: none; max-height: none; }
.photo-viewer-meta { margin-top: .75rem; overflow-wrap: anywhere; }
.photo-editor-modal { width: min(1100px, 96vw); max-width: 1100px; max-height: 92vh; overflow-y: auto; }
.photo-viewer-modal { width: min(960px, 96vw); max-width: 960px; max-height: 92vh; overflow-y: auto; }
.photo-editor-toolbar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: end; margin: .7rem 0; }
.photo-editor-toolbar label { min-width: 190px; }
.photo-canvas-wrap { max-height: 68vh; overflow: auto; display: flex; justify-content: center; background: #070d17; border: 1px solid var(--border); border-radius: 8px; }
.photo-canvas-wrap canvas { display: block; width: auto; max-width: none; max-height: none; height: auto; object-fit: contain; touch-action: none; user-select: none; margin: 0 auto; }
.photo-editor-actions { justify-content: flex-end; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.timeline li { border-left: 3px solid var(--blue-300, var(--blue-400)); padding-left: 0.8rem; }
.timeline .meta { font-size: 0.78rem; color: var(--muted); }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }

.empty-state { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.toast-stack { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 100; }
.toast {
  background: var(--blue-900); color: #fff; padding: 0.65rem 1rem; border-radius: 8px;
  box-shadow: var(--shadow); font-size: 0.88rem; max-width: 320px;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

.pill-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.85em; }

.small-note { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; }
.alias-editor { display: flex; flex-direction: column; gap: .45rem; }
.field-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.alias-row { display: flex; gap: .45rem; align-items: center; }
.alias-row input { flex: 1; }
.quick-capture-card { margin-bottom: 1rem; }
.quick-capture-form, .quick-form-actions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.quick-capture-form label { flex: 1 1 220px; }
.quick-capture-form .full { flex-basis: 100%; }
.quick-filter-toolbar input, .quick-filter-toolbar select { min-width: 115px; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 2rem 1rem 3rem;
}

.floor-card { overflow: auto; padding: 0; background: #0d1727; }
#floor-canvas { display: block; width: 100%; min-width: 760px; height: min(68vh, 760px); background-color: #101b2d; user-select: none; }
.floor-shape { cursor: move; stroke: #9fc5ff; stroke-width: 2; fill-opacity: .74; }
.floor-shape.selected { stroke: #d92d20; stroke-width: 4; }
.floor-label { pointer-events: none; font-size: 16px; font-weight: 700; fill: #f1f5fb; text-anchor: middle; dominant-baseline: middle; }
.floor-handle { fill: #182438; stroke: #ff8b83; stroke-width: 2; cursor: nwse-resize; }
.floor-connection { cursor: pointer; pointer-events: stroke; }
.floor-connection.selected { filter: drop-shadow(0 0 3px #d92d20); }
.floor-junction { fill: #58451f; stroke: #f2c35d; stroke-width: 3; cursor: move; }
.floor-machine-panel { margin-top: .75rem; display: grid; gap: .45rem; }
.floor-toolbar { align-items: end; flex-wrap: wrap; }
.floor-object-picker { position: relative; z-index: 30; }
.floor-object-menu { position: absolute; top: calc(100% + .45rem); left: 0; z-index: 40; width: min(39rem, calc(100vw - 2rem)); max-height: min(70vh, 34rem); overflow-y: auto; padding: .85rem; border: 1px solid var(--border-strong, var(--border)); border-radius: .7rem; background: var(--card); box-shadow: var(--shadow); }
.floor-object-menu section + section { margin-top: .85rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.floor-object-menu h4 { margin: 0 0 .5rem; color: var(--muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.floor-object-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.floor-object-option { display: flex; min-height: 5.2rem; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; padding: .45rem .35rem; border: 1px solid var(--border); border-radius: .55rem; background: var(--surface-1, var(--surface)); color: var(--text); font: inherit; font-size: .78rem; text-align: center; cursor: pointer; }
.floor-object-option:hover, .floor-object-option:focus-visible, .floor-object-option[aria-current="true"] { border-color: var(--blue-400); background: rgba(37, 99, 235, .18); outline: none; }
.floor-object-option svg { width: 2.35rem; height: 1.75rem; overflow: visible; fill: none; stroke: var(--blue-300, #9fc5ff); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.floor-object-option svg text { fill: var(--blue-300, #9fc5ff); stroke: none; font-size: 1.15rem; font-weight: 700; }
.floor-object-option[data-floor-object="area"] svg { fill: rgba(37, 99, 235, .22); }
.floor-object-option[data-floor-object="department"] svg { fill: rgba(37, 99, 235, .18); }
.floor-object-option[data-floor-object="work_area"] svg { fill: rgba(15, 118, 110, .22); }
.floor-object-option[data-floor-object="production_line"] svg, .floor-object-option[data-floor-object="conveyor"] svg { fill: #475569; }
.floor-object-option[data-floor-object="location"] svg { fill: rgba(124, 58, 237, .25); }
.floor-object-option[data-floor-object="text"] svg { fill: transparent; }
.floor-object-picker + .inline-field { margin-left: .1rem; }
.save-state { font-size: .82rem; font-weight: 700; color: var(--ok); }
.save-state.dirty { color: var(--warn); }
.inline-field { flex-direction: row; align-items: center; gap: .35rem; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.floor-machine-panel #floor-quick-capture { display: none !important; }
.floor-view-toolbar { align-items: center; }
.floor-layer-controls { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.floor-layer-toggle { flex-direction: row; gap: .25rem; white-space: nowrap; }
.floor-properties { margin-top: .75rem; padding: 1rem; }
.floor-properties-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.floor-properties-grid .full { grid-column: 1 / -1; }
#floor-canvas.floor-view-mode .floor-handle { display: none; }
#floor-canvas.floor-view-mode .floor-shape { cursor: pointer; }
@media (max-width: 720px) {
  .floor-object-menu { position: fixed; top: auto; left: .75rem; right: .75rem; bottom: .75rem; width: auto; max-height: 72vh; }
  .floor-object-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .floor-object-option { min-height: 4.7rem; font-size: .84rem; }
  .floor-properties-grid { grid-template-columns: 1fr; }
  .floor-properties-grid .full { grid-column: auto; }
  .floor-layer-controls { width: 100%; }
  .floor-layer-toggle { min-height: 2.5rem; }
}
.inspection-actions { margin: .75rem 0; align-items: center; }
.inspection-status { min-width: 11rem; }
.overview-bar { width: 100%; margin-bottom: 1rem; }
.overview-accordion { overflow: hidden; padding: 0; }
.overview-accordion[data-overview-accordion="summary"] { overflow: visible; }
.overview-accordion-header { width: 100%; min-height: 3.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.1rem; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 700; font-size: 1.05rem; text-align: left; cursor: pointer; }
.overview-accordion-header:hover { background: rgba(255,255,255,.035); }
.accordion-arrow { color: var(--blue-400); font-size: 1.3rem; line-height: 1; }
.overview-accordion-content { border-top: 1px solid var(--border); padding: 1rem; }
.overview-accordion-content > .section-head { margin: 0 0 .75rem; }
.overview-summary { display: flex; flex-wrap: nowrap; align-items: center; gap: 0; white-space: nowrap; }
.overview-summary-item { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; }
.overview-summary-item:not(:last-child)::after { content: "|"; padding: 0 .12rem; color: var(--border-strong, var(--muted)); }
.overview-summary-button { display: inline-flex; align-items: center; gap: .28rem; min-height: 2.5rem; padding: .4rem .48rem; border: 0; border-radius: .4rem; background: transparent; color: var(--text); font: inherit; font-size: .95rem; cursor: pointer; white-space: nowrap; }
.overview-summary-button:hover, .overview-summary-button[aria-expanded="true"] { background: var(--surface-2); }
.overview-summary-button strong { color: var(--text); font-size: 1.05rem; }
.overview-summary-arrow { color: var(--blue-400); }
.overview-summary-dropdown { position: absolute; top: calc(100% + .25rem); left: 0; z-index: 20; width: min(25rem, calc(100vw - 2rem)); max-height: 16rem; padding: .4rem; overflow-y: auto; border: 1px solid var(--border); border-radius: .55rem; background: var(--surface-2); box-shadow: var(--shadow); white-space: normal; }
.overview-summary-item:last-child .overview-summary-dropdown { right: 0; left: auto; }
.overview-summary-list { display: grid; gap: .25rem; }
.overview-summary-entry { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .7rem; border: 1px solid transparent; border-radius: .4rem; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.overview-summary-entry:hover, .overview-summary-entry:focus-visible { border-color: var(--border); background: var(--surface-1, var(--surface)); }
.overview-summary-entry > span:first-child { display: grid; gap: .12rem; min-width: 0; }
.overview-summary-entry .small-note { overflow-wrap: anywhere; }
.overview-summary-empty { margin: .45rem .7rem; }
.report-toolbar { align-items: end; }
.report-toolbar label { min-width: 13rem; }
#overview-report-content { min-height: 8rem; margin-top: .75rem; padding: 1rem; border: 1px solid var(--border); border-radius: .55rem; background: var(--surface-2); white-space: pre-wrap; }
.production-report-error { color: var(--danger); font-size: .82rem; white-space: normal; }
.production-snapshot-section { margin: 1rem 0; }
.production-snapshot-section h4 { margin: 0; padding: .6rem .75rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.production-snapshot-table { table-layout: fixed; width: 100%; }
.production-snapshot-table th, .production-snapshot-table td { padding: .6rem .5rem; overflow-wrap: anywhere; }
.production-snapshot-table th:first-child { width: 43%; }
.production-snapshot-table th:nth-child(2) { width: 35%; }
.production-snapshot-table th:last-child, .production-snapshot-table td:last-child { width: 22%; text-align: right; }
.production-snapshot-status.status-select { display: inline-block; min-width: 0; min-height: 0; padding: .35rem .5rem; border-radius: .4rem; font-size: inherit; }
@media (max-width: 720px) {
  .production-snapshot-table { font-size: .8rem; }
  .production-snapshot-table th, .production-snapshot-table td { padding: .5rem .3rem; }
  .production-snapshot-table th:first-child { width: 32%; }
  .production-snapshot-table th:nth-child(2) { width: 38%; }
  .production-snapshot-table th:last-child, .production-snapshot-table td:last-child { width: 30%; }
}
.report-settings { margin-bottom: 1rem; }
.report-form { display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(14rem, 1fr); gap: .9rem 1rem; align-items: start; }
.report-form > label, .report-custom-range > label { display: flex; flex-direction: column; gap: .38rem; min-width: 0; color: var(--text); }
.report-form select, .report-form input[type="datetime-local"], .report-form input[type="date"] { width: 100%; min-height: 2.7rem; }
.report-scope-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; min-width: 0; }
.report-scope-grid[hidden], .report-scope-grid label[hidden] { display: none; }
.report-scope-grid label { display: flex; flex-direction: column; gap: .38rem; min-width: 0; color: var(--text); }
.report-scope-grid select { width: 100%; min-width: 0; min-height: 2.7rem; }
.report-custom-range { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; width: 100%; }
.report-custom-range[hidden] { display: none; }
.report-custom-range > .report-end-mode { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: .5rem; font-size: .86rem; }
.report-end-mode input { width: auto; margin: 0; }
.report-includes { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; min-width: 0; margin: 0; padding: .85rem 1rem 1rem; border: 1px solid var(--border); border-radius: .6rem; }
.report-includes legend { padding: 0 .35rem; color: var(--text); font-weight: 650; }
.report-includes label { display: flex; align-items: flex-start; gap: .55rem; min-width: 0; color: var(--text); }
.report-includes input[type="checkbox"] { width: 1.1rem; min-width: 1.1rem; height: 1.1rem; margin-top: .15rem; accent-color: var(--blue-500); }
.report-actions { grid-column: 1 / -1; align-items: center; }
.report-actions .small-note { flex: 1 1 20rem; overflow-wrap: anywhere; }
.report-preview { margin-top: 1rem; min-width: 0; overflow: hidden; }
.report-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.report-preview-head h3 { margin: 0 0 .4rem; }
.report-preview-head p { margin: .25rem 0; }
.report-preview-section { margin: 1rem 0 1.25rem; min-width: 0; }
.report-preview-section > h3 { margin: 0 0 .55rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.report-photo-includes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.report-photo-includes label { min-width: 0; }
.report-photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.report-photo-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: .65rem; background: var(--surface-2); }
.report-photo-preview { display: grid; place-items: center; min-height: 130px; max-height: 240px; overflow: hidden; background: #0b1220; }
.report-photo-preview img { display: block; max-width: 100%; max-height: 240px; object-fit: contain; }
.report-photo-meta { display: grid; gap: .3rem; padding: .7rem; overflow-wrap: anywhere; }
.report-photo-meta label { display: flex; align-items: center; gap: .45rem; }
.report-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .55rem; }
.report-summary-value { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-width: 0; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface-2); }
.report-summary-value span { overflow-wrap: anywhere; color: var(--muted); font-size: .9rem; }
.report-summary-value strong { font-size: 1.1rem; }
.report-preview-record { margin: .6rem 0; padding: .75rem .85rem; border: 1px solid var(--border); border-left: 3px solid var(--blue-500); border-radius: .5rem; background: var(--surface-2); }
.report-preview-record h4 { margin: 0 0 .45rem; }
.report-preview-record p { margin: .35rem 0; }
.report-preview-event { margin-left: .75rem !important; padding-left: .7rem; border-left: 1px solid var(--border-strong); }
.report-preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.report-preview .table-scroll { max-width: 100%; overflow-x: auto; }
.report-preview table { min-width: 680px; }
.report-preview-empty { margin: .45rem 0; padding: .7rem .8rem; border: 1px dashed var(--border-strong); border-radius: .45rem; color: var(--muted); }
.report-email-dialog { width: min(42rem, calc(100vw - 1.5rem)); max-width: calc(100vw - 1.5rem); max-height: calc(100dvh - 1.5rem); overflow: auto; padding: 1.15rem; border: 1px solid var(--border-strong); border-radius: .75rem; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.report-email-dialog::backdrop { background: rgba(2, 6, 23, .76); }
.report-email-dialog .section-head { align-items: center; gap: .75rem; }
.report-email-dialog .section-head h3 { margin: 0; }
.report-email-form { display: grid; gap: .8rem; min-width: 0; }
.report-email-form > label { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.report-email-form input:not([type="checkbox"]), .report-email-form textarea { width: 100%; min-width: 0; }
.report-email-confirm { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: .55rem !important; }
.report-email-confirm input { flex: 0 0 auto; margin-top: .2rem; }
.report-email-meta { display: grid; gap: .25rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface-2); overflow-wrap: anywhere; }
.production-accordion .list-card { margin: 0; }
.production-accordion table { min-width: 760px; }
.machine-groups { display: grid; gap: .8rem; min-width: 0; }
.machine-department-group { min-width: 0; overflow: hidden; border: 1px solid var(--border-strong); border-radius: .7rem; background: var(--surface); }
.machine-department-heading, .machine-area-heading { display: flex; align-items: center; gap: .75rem; width: 100%; min-width: 0; border: 0; color: var(--ink); text-align: left; cursor: pointer; }
.machine-department-heading { min-height: 3.1rem; padding: .75rem .9rem; background: var(--surface-2); font-size: 1rem; font-weight: 750; }
.machine-area-heading { min-height: 2.65rem; padding: .55rem .75rem; background: #111d30; font-weight: 650; }
.machine-department-heading > span:first-child, .machine-area-heading > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.machine-group-count { margin-left: auto; color: var(--muted); font-size: .83rem; font-weight: 550; white-space: nowrap; }
.machine-group-chevron { width: 1.3rem; flex: 0 0 auto; color: var(--blue-300); text-align: center; font-size: 1.2rem; }
.machine-department-content { padding: .45rem .65rem .65rem; }
.machine-area-group { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: .55rem; background: var(--surface-2); }
.machine-area-group + .machine-area-group { margin-top: .45rem; }
.machine-area-content { min-width: 0; }
.machine-status-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, auto) minmax(10rem, 13rem); align-items: center; gap: .8rem; min-width: 0; padding: .55rem .75rem; border-top: 1px solid var(--border); }
.machine-status-name { min-width: 0; overflow-wrap: anywhere; }
.machine-open-calls { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.machine-status-item .status-select { width: 100%; min-height: 2.55rem; }
.machine-groups-empty { padding: 1rem; }
.production-equipment-form { display: grid; gap: .8rem; min-width: 0; }
.production-equipment-form fieldset { min-width: 0; border: 1px solid var(--border); border-radius: .6rem; }
.production-equipment-form legend { color: var(--ink); font-weight: 700; }
.production-equipment-choice { display: flex; flex-direction: row; align-items: center; gap: .75rem; min-height: 44px; padding: .35rem .5rem; cursor: pointer; overflow-wrap: anywhere; }
form .production-equipment-choice input { flex: 0 0 20px; width: 20px; min-width: 20px; height: 20px; }
.production-equipment-form h4 { margin: .65rem .5rem .25rem; }
#view-machines > .section-head { flex-wrap: wrap; }
#btn-select-production-equipment { max-width: 100%; white-space: normal; }
.ticket-row.ticket-open { background: rgba(220, 38, 38, 0.16); border-left: 4px solid #ef4444; }
.calls-activity-toolbar { align-items: end; }
.calls-day-buttons { display: flex; flex-wrap: wrap; gap: .4rem; }
.calls-activity-toolbar label { display: grid; gap: .25rem; }
.calls-day-buttons [aria-pressed="true"] { background: var(--blue-600); color: white; }
.calls-activity-heading th { text-transform: none; text-align: left; background: #182438; }
.calls-activity-heading h3 { margin: .3rem 0; font-size: 1rem; position: sticky; left: .5rem; display: inline-block; }
.calls-activity-report-item { padding: .6rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.calls-activity-report-item p { margin: .35rem 0; }
@media (max-width: 700px) {
  .calls-activity-toolbar label { width: 100%; min-width: 0; }
  .calls-activity-toolbar input, .calls-activity-toolbar select { width: 100%; min-height: 44px; box-sizing: border-box; }
  .calls-day-buttons { width: 100%; }
  .calls-day-buttons .btn { flex: 1 1 42%; }
  #calls-activity-report { width: 100%; }
}
.ticket-row.ticket-closed { background: rgba(22, 163, 74, 0.16); border-left: 4px solid #22c55e; }
.ticket-row.ticket-open:hover, .ticket-row.ticket-closed:hover { filter: brightness(1.08); }
.view-calls .ticket-note-cell { min-width: 14rem; max-width: 24rem; white-space: normal; vertical-align: top; }
.view-calls .ticket-note-cell .btn { margin-top: .45rem; }
.view-calls .ticket-time-cell { min-width: 12rem; white-space: nowrap; vertical-align: top; }
.view-calls .ticket-time-cell > div + div { margin-top: .45rem; }
.view-calls #calls-search { min-width: 16rem; flex: 1 1 20rem; }
.tmi-assistant-card, .tmi-results { display: grid; gap: 1rem; }
.tmi-assistant-form { display: grid; gap: .85rem; }
.tmi-question-label { display: grid; gap: .4rem; font-weight: 700; }
.tmi-question-label textarea { width: 100%; min-height: 9rem; resize: vertical; }
.tmi-example-questions { display: grid; gap: .45rem; }
.tmi-example-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: .55rem; }
.tmi-example-button { text-align: left; min-height: 2.75rem; white-space: normal; overflow-wrap: anywhere; }
.tmi-result-meta, .tmi-answer, .tmi-warnings, .tmi-summary-groups, .tmi-evidence, .tmi-evidence-links { display: grid; gap: .55rem; }
.tmi-result-meta, .tmi-answer, .tmi-warnings { padding: .75rem .85rem; border: 1px solid var(--border); border-radius: .55rem; background: var(--surface-2); }
.tmi-result-meta p, .tmi-answer p { margin: 0; overflow-wrap: anywhere; }
.tmi-result-group { display: grid; gap: .65rem; }
.tmi-result-card { padding: .8rem; border: 1px solid var(--border); border-left: 3px solid var(--blue-500); border-radius: .55rem; background: var(--surface-2); overflow-wrap: anywhere; }
.tmi-result-card .section-head { align-items: center; }
.tmi-result-card h4, .tmi-result-group h4, .tmi-summary-group h4 { margin: 0; }
.tmi-result-card p { margin: .45rem 0; }
.tmi-history-list, .tmi-evidence-links ul { margin: 0; padding-left: 1.2rem; overflow-wrap: anywhere; }
.tmi-result-actions { align-items: center; }
.link-button { border: 0; padding: 0; color: var(--blue-300); background: transparent; text-decoration: underline; cursor: pointer; font: inherit; text-align: left; overflow-wrap: anywhere; }
.link-button:hover, .link-button:focus-visible { color: var(--text); }

@media (max-width: 700px) {
  .report-photo-includes { grid-template-columns: 1fr; }
  html, body { max-width: 100%; overflow-x: hidden; }
  main { width: 100%; padding: 1rem .65rem 2rem; }
  .topbar { padding: .7rem .75rem; }
  .brand { min-width: 0; font-size: 1rem; }
  .brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .env-pill { flex: 0 0 auto; font-size: .72rem; }
  nav.tabs { width: 100%; padding: .45rem .65rem 0; gap: .35rem; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--blue-600) var(--blue-050); }
  nav.tabs button { flex: 0 0 auto; min-height: 44px; padding: .65rem .85rem; white-space: nowrap; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .section-head { gap: .6rem; align-items: flex-start; }
  .section-head .btn { flex: 0 0 auto; }
  .duty-manager .section-head { flex-wrap: wrap; }
  .duty-filter { width: 100%; }
  .duty-filter select { flex: 1 1 auto; }
  .toolbar { width: 100%; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1 1 12rem; }
  .toolbar .btn { min-height: 44px; max-width: 100%; }
  .overview-summary { flex-wrap: wrap; }
  .overview-summary-button { padding-inline: .42rem; gap: .3rem; font-size: .93rem; }
  .overview-summary-item:not(:last-child)::after { padding-inline: .04rem; }
  .toolbar input, .toolbar select { max-width: 100%; }
  .machine-department-heading, .machine-area-heading { min-height: 44px; }
  .machine-department-heading { padding: .65rem .7rem; gap: .45rem; }
  .machine-area-heading { padding: .55rem .65rem; }
  .machine-department-content { padding: .35rem; }
  .machine-status-item { grid-template-columns: minmax(0, 1fr) auto; gap: .45rem .65rem; padding: .65rem; }
  .machine-status-name { grid-column: 1 / -1; font-size: 1rem; }
  .machine-open-calls { white-space: normal; }
  .machine-status-item .status-select { grid-column: 1 / -1; width: 100%; min-height: 44px; font-size: 1rem; }
  .table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--blue-600) var(--blue-050); padding-bottom: .25rem; border-bottom: 1px solid var(--blue-600); box-shadow: inset -14px 0 14px -16px var(--blue-400); }
  .table-scroll table { min-width: 680px; }
  .view-calls .table-scroll table { min-width: 1120px; }
  .modal-backdrop { padding: 1rem .5rem; align-items: flex-start; }
  .modal { width: min(100%, 640px); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1rem; }
  .photo-editor-modal, .photo-viewer-modal { width: 100%; max-width: 100%; max-height: calc(100vh - 1rem); padding: .8rem; }
  .photo-picker-actions .btn { flex: 1 1 100%; min-height: 44px; }
  .photo-pending-item { grid-template-columns: 72px minmax(0, 1fr); }
  .photo-thumb-button { width: 60px; height: 54px; }
  .photo-canvas-wrap { max-height: 58vh; }
  form.form-grid, form.stacked-form { grid-template-columns: 1fr; width: 100%; }
  form.form-grid .full { grid-column: auto; }
  .report-form { grid-template-columns: minmax(0, 1fr); }
  .report-scope-grid, .report-custom-range, .report-includes, .report-actions { grid-column: 1; }
  .report-scope-grid, .report-custom-range, .report-includes { grid-template-columns: minmax(0, 1fr); }
  .report-preview-head { flex-direction: column; }
  .report-email-dialog { width: calc(100vw - 1rem); max-width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); padding: .8rem; }
  .tmi-example-list { grid-template-columns: 1fr; }
  .tmi-result-actions .small-note { flex: 1 1 100%; }
  form label, form input, form select, form textarea { width: 100%; max-width: 100%; }
  .form-actions, .quick-form-actions, .tag-row { width: 100%; flex-wrap: wrap; }
  .form-actions .btn, .quick-form-actions .btn, .tag-row .btn { min-height: 44px; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1 1 10rem; }
  .toast-stack { left: .65rem; right: .65rem; bottom: .65rem; }
  .toast { max-width: none; }
}

/* Schichtberichte Phase 1 — scoped to the existing Berichte tab. */
.shift-reports, .shift-report-editor { margin-top: 1.2rem; min-width: 0; }
.shift-reports .section-head { align-items: flex-start; gap: .7rem; }
.shift-reports h3, .shift-report-editor h3 { margin: 0; }
.shift-reports .small-note { margin: .4rem 0; }
.shift-report-filters, .shift-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .7rem; min-width: 0; }
.shift-report-filters { padding: .85rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.shift-report-filters label, .shift-report-form label, .shift-upload-form label { display: grid; gap: .3rem; min-width: 0; }
.shift-report-filters input, .shift-report-filters select, .shift-report-form input, .shift-report-form select, .shift-report-form textarea, .shift-upload-form input { width: 100%; min-width: 0; min-height: 2.7rem; padding: .5rem .6rem; color: var(--ink); background: #182438; border: 1px solid var(--border); border-radius: .5rem; font: inherit; }
.shift-report-form textarea { resize: vertical; min-height: 5rem; white-space: pre-wrap; }
.shift-filter-search, .shift-form-grid .full { grid-column: 1 / -1; }
.shift-report-filters .btn { align-self: end; min-height: 2.7rem; }
.shift-report-list { display: grid; gap: .7rem; }
.shift-shift-accordion { min-width: 0; border: 1px solid var(--border); border-radius: .6rem; overflow: hidden; }
.shift-shift-summary { min-height: 48px; cursor: pointer; list-style: none; }
.shift-shift-summary::-webkit-details-marker { display: none; }
.shift-shift-summary::marker { content: ''; }
.shift-shift-summary:hover { background: rgba(255,255,255,.035); }
.shift-shift-summary:focus-visible { outline: 2px solid var(--blue-400); outline-offset: -2px; }
.shift-shift-title { display: inline-flex; align-items: center; gap: .65rem; min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.shift-shift-accordion[open] .shift-shift-summary .master-arrow { transform: rotate(90deg); }
.shift-shift-panel { display: grid; gap: .65rem; min-width: 0; border-top: 1px solid var(--border); padding: .7rem; }
.shift-report-card { min-width: 0; padding: .8rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--card); overflow-wrap: anywhere; }
.shift-report-card h4, .shift-report-card p { margin: .25rem 0 .55rem; }
.shift-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .45rem; margin-top: .5rem; }
.shift-report-form { display: grid; gap: .85rem; margin-top: 1rem; min-width: 0; }
.shift-form-section { min-width: 0; padding: .8rem; border: 1px solid var(--border); border-radius: .6rem; }
.shift-form-section h4 { margin: 0 0 .7rem; }
.shift-form-section > label { display: grid; gap: .3rem; }
.shift-form-section > label textarea { min-height: 10rem; }
.shift-form-section .small-note { margin: .45rem 0 0; }
.shift-editor-actions { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: flex-end; }
.shift-editor-actions .btn, .shift-attachment-row .btn { min-height: 2.7rem; }
.shift-form-grid > [hidden] { display: none; }
.shift-evidence { background: rgba(255,255,255,.025); }
.shift-evidence h4 { margin: 0 0 .4rem; }
.shift-attachment-entry { padding-bottom: .7rem; border-bottom: 1px solid var(--border); }
.shift-attachment-row { display: flex; justify-content: space-between; align-items: center; gap: .65rem; padding: .65rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.shift-attachment-row > div { min-width: 0; }
.shift-attachment-entry .shift-attachment-row { border-bottom: 0; }
.shift-extract-action { margin-top: .2rem; min-height: 2.7rem; }
.shift-extraction-slot > .small-note:empty, #shift-extraction-home > .small-note:empty { display: none; }
.shift-attachment-thumb { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: .4rem; flex: none; }
.shift-pdf-icon { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; flex: none; border: 1px solid var(--border); border-radius: .4rem; font-weight: 700; }
.shift-extraction-review { display: grid; gap: .6rem; min-width: 0; padding: .8rem; margin-top: .7rem; border: 1px solid var(--border); border-radius: .6rem; }
.shift-extraction-review[hidden], .shift-extraction-choice[hidden] { display: none; }
.shift-extraction-review label { font-weight: 700; }
.shift-extraction-review textarea { width: 100%; min-width: 0; min-height: 9rem; padding: .6rem; color: var(--ink); background: #182438; border: 1px solid var(--border); border-radius: .5rem; font: inherit; resize: vertical; white-space: pre-wrap; }
.shift-extraction-choice { padding: .7rem; background: rgba(255,255,255,.035); border: 1px solid var(--border); border-radius: .5rem; }
.shift-extraction-choice p { margin: 0 0 .6rem; }
.shift-upload-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; align-items: end; margin-top: .8rem; }
.shift-upload-form label:first-child { grid-column: 1 / -1; }
.shift-upload-form .btn { min-height: 2.7rem; }
.shift-image-dialog { max-width: min(94vw, 90rem); max-height: 94vh; padding: .7rem; color: var(--ink); background: var(--card); border: 1px solid var(--border); border-radius: .6rem; }
.shift-image-dialog::backdrop { background: rgba(0, 0, 0, .85); }
.shift-image-dialog img { display: block; max-width: 100%; max-height: calc(94vh - 4rem); object-fit: contain; margin: .5rem auto 0; }
.shift-report-editor[hidden], .shift-evidence[hidden], .shift-upload-form[hidden] { display: none !important; }

/* Ersatzteil Stammdaten photos; unrelated Meldung galleries keep their layout. */
#master-panel-parts .table-scroll { max-width: 100%; overflow-x: auto; }
.part-photo-list-thumb { display: inline-flex; align-items: center; gap: .35rem; border: 0; background: none; color: var(--ink); cursor: pointer; font: inherit; white-space: nowrap; }
.part-photo-list-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: .35rem; }
.part-photo-section { min-width: 0; padding: .75rem; border: 1px solid var(--border); border-radius: .6rem; }
.part-photo-section h4 { margin: 0 0 .4rem; }
.part-photo-gallery, .part-photo-pending { display: grid; gap: .6rem; min-width: 0; }
.part-photo-entry { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: .65rem; padding: .55rem 0; border-bottom: 1px solid var(--border); min-width: 0; }
.part-photo-entry > img, .part-photo-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: .4rem; }
.part-photo-thumb { padding: 0; border: 0; background: none; cursor: pointer; align-self: start; }
.part-photo-fields { display: grid; gap: .4rem; min-width: 0; }
.part-photo-fields label { min-width: 0; }
.part-photo-fields input, .part-photo-fields select { width: 100%; min-width: 0; }
.part-photo-picker { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0; }
.part-photo-dialog { width: min(94vw, 900px); max-height: 94vh; padding: .8rem; color: var(--ink); background: var(--card); border: 1px solid var(--border); border-radius: .6rem; }
.part-photo-dialog::backdrop { background: rgba(0, 0, 0, .82); }
.part-photo-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.part-photo-dialog .photo-viewer-stage { display: grid; place-items: center; min-height: 10rem; }
.part-photo-dialog .photo-viewer-stage img { display: block; max-width: none; width: 100%; height: auto; }
@media (max-width: 700px) {
  .part-photo-picker .btn { flex: 1 1 100%; min-height: 44px; }
  .part-photo-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
  .part-photo-dialog .tag-row .btn { min-height: 44px; }
}
@media (max-width: 700px) {
  .shift-report-filters, .shift-form-grid, .shift-upload-form { grid-template-columns: minmax(0, 1fr); }
  .shift-upload-form label:first-child { grid-column: 1; }
  .shift-filter-search, .shift-form-grid .full { grid-column: 1; }
  .shift-report-filters input, .shift-report-filters select, .shift-report-form input, .shift-report-form select, .shift-upload-form input, .shift-report-filters .btn { min-height: 44px; }
  .shift-reports .section-head, .shift-attachment-row { flex-wrap: wrap; }
  .shift-attachment-row .tag-row, .shift-attachment-row .btn { width: 100%; }
  .shift-extract-action, .shift-editor-actions #shift-editor-save { width: 100%; min-height: 44px; }
  .shift-editor-actions .btn { flex: 1 1 10rem; min-height: 44px; }
  .shift-extraction-review .tag-row .btn { width: 100%; min-height: 44px; }
}

#department-report-form [hidden],
#department-report-preview[hidden] {
  display: none !important;
}

/* Per-photo upload feedback stays readable on narrow phones. */
.part-photo-filename, .part-photo-fields [role="status"] { overflow-wrap: anywhere; }
.part-photo-entry[data-upload-state="error"] { border-color: #b42318; }
.part-photo-entry[data-upload-state="saved"] { border-color: #23834b; }

.call-ticket-detail #call-parts > li { border: 0; padding-left: 0; }
.call-ticket-detail .timeline { gap: 1.25rem; }

/* Shared photo presentation: notes, metadata and clearly grouped controls. */
.photo-viewer h4, .part-photo-dialog h4, .part-photo-fields h4, .report-photo-meta h4 { margin: 1rem 0 .6rem; font-size: 1rem; color: var(--ink); }
.photo-note-box { padding: .8rem; border: 1px solid var(--border); border-radius: 8px; background: #182438; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.photo-detail-list { display: grid; grid-template-columns: minmax(6rem, .35fr) minmax(0, 1fr); gap: .65rem 1rem; margin: 1rem 0; }
.photo-detail-list dt { font-weight: 600; font-size: 1rem; }
.photo-detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.photo-control-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0; align-items: center; }
.photo-control-row .btn { flex: 1 1 0; min-height: 44px; justify-content: center; }
.photo-action-stack { display: flex; flex-direction: column; gap: .6rem; margin-top: .8rem; }
.photo-action-stack .btn { width: 100%; min-height: 44px; text-align: left; }
.photo-action-stack .delete-action { margin-top: .8rem; justify-content: space-between; }
.photo-viewer [role="status"]:empty, [data-part-photo-loading]:empty { display: none; }
.part-photo-dialog { overflow-y: auto; }
.part-photo-dialog-head strong { font-size: 1.1rem; }
.part-photo-entry { grid-template-columns: minmax(72px, 120px) minmax(0, 1fr); gap: 1rem; padding: 1rem 0; }
.part-photo-thumb img, .part-photo-entry > img { width: 100%; height: 100px; object-fit: contain; background: #080f1c; }
.part-photo-fields .tag-row { flex-direction: column; align-items: stretch; }
.part-photo-fields .tag-row .btn { min-height: 44px; }
.part-photo-fields h4, .report-photo-meta h4 { margin-top: 0; }
.report-photo-meta { gap: .65rem; }
@media (max-width: 700px) {
  .photo-detail-list { grid-template-columns: 9rem minmax(0, 1fr); gap: .65rem; }
  .photo-viewer .photo-detail-list { grid-template-columns: max-content minmax(0, 1fr); }
  .part-photo-entry { grid-template-columns: 80px minmax(0, 1fr); gap: .7rem; }
  .photo-control-row .btn { padding-inline: .6rem; }
}

/* Overview filters: aligned labels and equal-width controls. */
.dash-filters { display: flex; flex-direction: column; align-items: stretch; gap: .65rem; max-width: 520px; }
.dash-filters .inline-field { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .75rem; margin: 0; }
.dash-filters select { width: 100%; min-width: 0; min-height: 44px; }
@media (max-width: 700px) {
  .dash-head { flex-wrap: wrap; gap: .75rem; }
  .dash-head > div { min-width: 0; }
  .dash-head h2 { overflow-wrap: anywhere; }
}

.dash-dates { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .65rem .75rem; margin: .8rem 0; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.dash-dates dt { font-weight: 600; }
.dash-dates dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Simple shift capture: compatibility controls stay out of the visible workflow. */
#shift-report-form [hidden] { display: none !important; }
#shift-entry-list { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Personen: contain wide tables/trees within the card and modal on mobile. */
#master-panel-people { min-width: 0; }
#master-panel-people .toolbar { flex-wrap: wrap; }
#master-panel-people .toolbar label { display: grid; gap: 4px; max-width: 100%; }
.people-directory-dialog { width: min(1100px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); box-sizing: border-box; padding: 20px; border: 1px solid #cbd5e1; border-radius: 12px; overflow: auto; color: #253247; background: #fff; }
.people-directory-dialog::backdrop { background: #14243b99; }
.people-directory-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.people-directory-head h2 { font-size: 1.25rem; margin: 0; }
.people-directory-head button { flex-shrink:0; }
.people-directory-dialog [data-actions] { margin-bottom: 12px; }
.people-org-scroll { overflow:auto; max-width:100%; padding: 8px 0 18px; }
.people-org-scroll svg { display:block; margin:0 auto; max-width:none; font-family:Arial,Helvetica,sans-serif; }
.people-org-node:focus { outline:none; }
.people-org-node:focus rect { stroke:#315a83; stroke-width:2px; }
.people-contact { border:1px solid #dfeaf7; border-radius:8px; padding:12px; background:#edf3fa; color:#17344f; margin:14px 0; }
.people-contact > div { display:grid; grid-template-columns:minmax(110px,35%) minmax(0,1fr); border-bottom:1px solid #b8cde3; }
.people-contact > div:last-child { border-bottom:0; }
.people-contact dt { padding:10px 8px 10px 0; color:#526b83; overflow-wrap:anywhere; }
.people-contact dd { margin:0; padding:10px 0 10px 12px; border-left:1px solid #b8cde3; overflow-wrap:anywhere; }
.people-contact > div:nth-child(-n+2) dd { font-weight:bold; }
.people-pdf-frame { display:block; width:100%; max-height:65vh; overflow:auto; border:1px solid #cbd5e1; box-sizing:border-box; background:#e5e9ef; }
.people-readable summary { cursor:pointer; padding:12px 0; }
@media(max-width:600px) { .people-directory-dialog { padding:12px; } .people-directory-head { align-items:flex-start; } .people-directory-head h2 { font-size:1.05rem; } .people-pdf-frame { max-height:55vh; } }

.people-pdf-frame canvas { display:block; width:100%; height:auto; background:#fff; }
.people-pdf-navigation { display:flex; align-items:center; justify-content:center; gap:12px; margin:12px 0; }
