*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: #0b1220;
  --ink-soft: #5b6573;
  --line: #e6eaf0;
  --paper: #ffffff;
  --canvas: #f3f5f8;
  --brand: #1a5fb4;
  --brand-deep: #0d3d7a;
  --ok: #0f766e;
  --ok-hover: #0d9488;
  --danger: #b42318;
  --save: #b42318;
  --save-hover: #912018;
  --pdf: #15803d;
  --pdf-hover: #166534;
  --sidebar: #0b1220;
  --sidebar-muted: #9aa6b8;
  --radius: 14px;
  --touch: 44px;
  --sidebar-w: 248px;
  --shadow: 0 1px 2px rgba(11, 18, 32, 0.04), 0 8px 24px rgba(11, 18, 32, 0.04);
  --font: "DM Sans", "Segoe UI", sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100dvh;
  letter-spacing: -0.01em;
}

body.guest {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  background: #15191c;
}

body.app {
  height: 100%;
  overflow: hidden;
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.brand-mark span {
  line-height: 1;
}

/* Login */
.login {
  --login-teal: #26b1b9;
  --login-teal-deep: #0c4a50;
  --login-ink: #15191c;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  padding: 1.25rem;
}

.login__aside {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--login-ink);
}

.login__aside-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 95% 75% at 82% 8%, rgba(56, 198, 206, 0.42), transparent 55%),
    radial-gradient(ellipse 70% 55% at 8% 92%, rgba(38, 177, 185, 0.22), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 48%, rgba(38, 177, 185, 0.12), transparent 70%),
    linear-gradient(165deg, #105860 0%, #0b3c41 38%, #081f23 72%, #050e10 100%);
}

.login__aside-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.05) 49%, transparent 58%);
  mix-blend-mode: soft-light;
  animation: login-sheen 12s ease-in-out infinite;
  pointer-events: none;
}

.login__aside-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  pointer-events: none;
}

.login__aside-glow--a {
  top: -12%;
  right: -8%;
  width: 26rem;
  height: 26rem;
  background: radial-gradient(circle, rgba(64, 210, 218, 0.45) 0%, transparent 70%);
  animation: login-glow-a 11s ease-in-out infinite alternate;
}

.login__aside-glow--b {
  bottom: -18%;
  left: -12%;
  width: 22rem;
  height: 22rem;
  background: radial-gradient(circle, rgba(38, 177, 185, 0.28) 0%, transparent 72%);
  animation: login-glow-b 14s ease-in-out infinite alternate;
}

.login__aside-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
  opacity: 0.55;
  pointer-events: none;
}

.login__aside-ring {
  position: absolute;
  top: 50%;
  left: 62%;
  width: min(70vw, 34rem);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(38, 177, 185, 0.22);
  box-shadow:
    0 0 0 12px rgba(38, 177, 185, 0.04),
    inset 0 0 60px rgba(38, 177, 185, 0.08);
  animation: login-ring 7s ease-in-out infinite;
  pointer-events: none;
}

.login__aside-ring::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login__aside-ring::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 42%;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(120, 230, 236, 0.85), transparent);
  filter: blur(0.5px);
}

.login__aside-devices {
  position: absolute;
  inset: 6% 2% 8% 28%;
  width: auto;
  height: auto;
  margin: auto;
  color: rgba(140, 230, 236, 0.48);
  opacity: 0.45;
  pointer-events: none;
  animation: login-devices 22s ease-in-out infinite alternate;
}

.login__aside-device--ct {
  animation: login-ct-pulse 8s ease-in-out infinite;
  transform-origin: 318px 248px;
}

.login__aside-device--mri { opacity: 0.75; }
.login__aside-device--xray { opacity: 0.8; }
.login__aside-device--scan { animation: login-scan 6s ease-in-out infinite; }

.login__aside-focal {
  display: none;
}

.login__aside-stage {
  position: relative;
  width: 100%;
  padding: 2rem 2.25rem 2.2rem;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(236, 250, 250, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 28px 70px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(38, 177, 185, 0.14);
}

.login__aside-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.55) 0%, transparent 42%);
  pointer-events: none;
}

.login__aside-stage::after {
  content: "";
  position: absolute;
  left: 2.25rem;
  right: 2.25rem;
  bottom: 1.15rem;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, var(--login-teal) 50%, transparent 100%);
  opacity: 0.65;
}

.login__aside-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  margin-bottom: 0.4rem;
}

.login__panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(26rem, 100%);
  max-height: calc(100dvh - 2.5rem);
  overflow-y: auto;
  padding: 1.75rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 24px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.login__panel-brand {
  margin-bottom: 1.35rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(38, 177, 185, 0.12), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f3fbfb 100%);
  border: 1px solid rgba(38, 177, 185, 0.18);
}

.login__panel-logo {
  display: block;
  width: min(100%, 14.5rem);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.login__title {
  font-size: 1.7rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.login__lede {
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

@keyframes login-sheen {
  0%, 100% { transform: translateX(-8%); opacity: 0.35; }
  50% { transform: translateX(8%); opacity: 0.7; }
}

@keyframes login-glow-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-10%, 12%) scale(1.1); }
}

@keyframes login-glow-b {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(12%, -8%) scale(1.12); }
}

@keyframes login-ring {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  50% { transform: translate(-50%, -50%) scale(1.035); opacity: 1; }
}

@keyframes login-devices {
  from { transform: translateY(0) scale(1); opacity: 0.4; }
  to { transform: translateY(-10px) scale(1.02); opacity: 0.62; }
}

@keyframes login-ct-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

@keyframes login-scan {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

@keyframes login-focal {
  from { opacity: 0; transform: translateY(-46%) scale(0.97); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}


.form {
  display: grid;
  gap: 1rem;
}

.form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.field {
  display: grid;
  gap: 0.55rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.25rem;
}

.field__head label {
  margin: 0;
}

.btn-text--inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 0;
  padding: 0;
  line-height: 1;
  white-space: nowrap;
}

.icon--sm {
  width: 0.95rem;
  height: 0.95rem;
}

.field input:not([type="checkbox"]),
.field select,
.field textarea {
  min-height: var(--touch);
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}

.field textarea {
  min-height: 5rem;
  resize: vertical;
}

.field input:not([type="checkbox"]):focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.16);
}

.field input.is-invalid,
.field select.is-invalid,
.field textarea.is-invalid,
.field input.is-invalid:focus,
.field select.is-invalid:focus,
.field textarea.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.22);
}

.field__error {
  color: var(--danger);
  font-size: 0.8rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.perm-modules {
  display: grid;
  gap: 0.85rem;
}

#userMemberModules {
  display: grid;
  gap: 0.85rem;
}

.perm-module {
  display: grid;
  gap: 0.45rem;
}

.perm-module[hidden],
#userMemberModules[hidden] {
  display: none;
}

.perm-module__title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.perm {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--touch);
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  cursor: pointer;
}

.perm input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--brand-deep);
}

.perm:has(input:checked) {
  border-color: var(--brand);
  background: #eef3f9;
}

.perm:has(input:disabled) {
  cursor: default;
  opacity: 0.55;
}

.perm-modules--locked {
  pointer-events: none;
}

.perm-modules--locked .perm {
  cursor: default;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0.55rem 1.05rem;
  border: 0;
  border-radius: 10px;
  background: var(--brand-deep);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--brand);
}

.btn--ghost {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn--ghost:hover {
  background: var(--canvas);
}

.btn--keep-open {
  background: var(--brand-deep);
  color: #fff;
}

.btn--keep-open:hover {
  background: var(--brand);
}

.btn--save {
  background: var(--ok);
  color: #fff;
}

.btn--save,
.btn--save:hover,
.btn--save:focus,
.btn--save:active,
.btn--save:disabled,
.btn--save.is-saving {
  background: var(--ok);
  color: #fff;
  opacity: 1;
}

.btn--save:disabled,
.btn--save.is-saving {
  cursor: default;
}

.btn-spin {
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: ajax-spin 0.7s linear infinite;
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  background: var(--save-hover);
}

.btn--pdf {
  background: var(--pdf);
  color: #fff;
}

.btn--pdf:hover {
  background: var(--pdf-hover);
}

.btn--new {
  gap: 0.3rem;
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: var(--brand-deep);
  color: #fff;
  font-size: 0.8rem;
}

.btn--new:hover {
  background: var(--brand);
}

.btn--block {
  width: 100%;
}

.form__actions .btn,
.modal__toolbar .btn {
  min-width: 6.5rem;
}

.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #ecfdf5;
  color: var(--ok);
  font-size: 0.9rem;
}

/* Shell */
.shell {
  display: flex;
  width: 100%;
  height: 100svh;
  max-height: 100svh;
  overflow: hidden;
}

@supports (height: 100dvh) {
  .shell {
    height: 100dvh;
    max-height: 100dvh;
  }
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: min(var(--sidebar-w), 86vw);
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #e8edf5;
  padding: calc(1rem + env(safe-area-inset-top, 0px)) 0.85rem calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-105%);
  transition: transform 0.22s ease;
}

body.is-sidebar-open .sidebar {
  transform: translateX(0);
}

body.is-sidebar-open .sidebar-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(11, 18, 32, 0.46);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.2rem 0.55rem 1.25rem;
  text-decoration: none;
  color: inherit;
}

.sidebar__mark {
  display: block;
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
  background: #fff;
}

.sidebar__logo {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sidebar__tag {
  display: block;
  font-size: 0.72rem;
  color: var(--sidebar-muted);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin-bottom: 0.35rem;
}

.sidebar__group-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: #f4f7fb;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
}

a.sidebar__group-label:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

a.sidebar__group-label.is-active {
  background: rgba(26, 95, 180, 0.28);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar__group-label .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.sidebar__link--sub {
  min-height: 2.4rem;
  margin-left: 1.35rem;
  padding-left: 1.15rem;
  font-size: 0.88rem;
}

.sidebar__link,
.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--touch);
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  color: #c9d3e2;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  font-size: 0.92rem;
}

.sidebar__link:hover,
.sidebar__logout:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar__link.is-active {
  background: rgba(26, 95, 180, 0.28);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar__foot {
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__who {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem 0.7rem;
}

.sidebar__avatar,
.person__avatar {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: rgba(26, 95, 180, 0.35);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar__name,
.person__name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.sidebar__role {
  display: block;
  font-size: 0.7rem;
  color: var(--sidebar-muted);
  text-transform: capitalize;
}

.sidebar__logout {
  width: 100%;
  border: 0;
  background: none;
  cursor: pointer;
}

.workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
}

.workspace__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 3.5rem;
  padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 1rem 0.55rem;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.workspace__titles {
  min-width: 0;
  flex: 1;
}

.workspace__crumb {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand);
}

.workspace__title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.workspace__actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.toolbar__search {
  flex: 1 1 12rem;
  min-width: 0;
}

.field__hint {
  font-size: 0.8rem;
}

.field__hint a {
  color: var(--brand);
}

.upload-progress {
  display: none;
  gap: 0.4rem;
  margin: 0.25rem 0 0.85rem;
}

.upload-progress:not([hidden]) {
  display: grid;
}

.upload-progress__track {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.upload-progress__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-deep) 100%);
  transition: width 0.12s linear;
}

.upload-progress__label {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.combobox {
  position: relative;
}

.combobox__list {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: 16rem;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.combobox__list button {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
}

.combobox__list button:hover,
.combobox__list button.is-active {
  background: rgba(26, 95, 180, 0.08);
}

.combobox__empty {
  padding: 0.65rem 0.75rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.field input[readonly],
.field textarea[readonly] {
  background: #f8fafc;
  color: var(--ink-soft);
}

.table__link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.table__link:hover {
  color: var(--brand);
}

.menu-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--touch);
  height: var(--touch);
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
}

.workspace__main {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.75rem 0.75rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.panel,
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 0;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}

.panel__bar {
  display: flex;
  justify-content: flex-end;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.list-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: min(16rem, 100%);
  min-height: 2.15rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--ink-soft);
}

.list-search:focus-within {
  border-color: var(--brand);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.16);
  color: var(--ink);
}

.list-search__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.list-search__icon .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.list-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
}

.list-search input::placeholder {
  color: var(--ink-soft);
}

.list-search input::-webkit-search-decoration,
.list-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-hit {
  background: #fde68a;
  color: inherit;
  border-radius: 3px;
  padding: 0 0.12em;
}

.panel--narrow {
  max-width: 32rem;
  padding: 1.25rem;
}

.panel--form {
  width: 100%;
  padding: 1.25rem;
}

.empty {
  max-width: 28rem;
  margin: 12vh auto 0;
  text-align: center;
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: #e8f0fa;
  color: var(--brand-deep);
}

.empty__icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.empty__title {
  font-size: 1.2rem;
  font-weight: 650;
  margin-bottom: 0.35rem;
}

.empty__copy {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.list-cards {
  display: none;
  gap: 0.75rem;
}

.list-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.list-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.list-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.list-card__sub {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.list-card__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
}

.list-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.list-card__rows {
  display: grid;
  gap: 0.35rem;
}

.list-card__row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.5rem;
  font-size: 0.86rem;
}

.list-card__label {
  color: var(--ink-soft);
  font-weight: 600;
}

.list-card__value {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.list-card__empty {
  padding: 1.1rem 0.25rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  text-align: center;
}

@media (max-width: 767px) {
  .table-wrap:has(+ .list-cards) {
    display: none;
  }

  .list-cards {
    display: grid;
  }
}

@media (min-width: 768px) {
  .list-cards {
    display: none !important;
  }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.1rem 0.2rem;
}

.pager__meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.pager__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pager__btn {
  min-height: 2.15rem;
  min-width: 2.15rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.pager__btn:hover:not(:disabled) {
  background: var(--canvas);
}

.pager__btn.is-current {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #fff;
  cursor: default;
}

.pager__btn:disabled:not(.is-current) {
  opacity: 0.45;
  cursor: default;
}

.pager__ellipsis {
  padding: 0 0.2rem;
  color: var(--ink-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  table-layout: fixed;
}

.table th,
.table td {
  overflow-wrap: anywhere;
}

.table th {
  text-align: left;
  padding: 0.45rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.table td {
  text-align: left;
  padding: 0.35rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table .icon-btn {
  width: 2rem;
  height: 2rem;
}

#knowledgeListTable {
  table-layout: fixed;
}

#knowledgeListTable .col-description {
  width: 38%;
}

#knowledgeListTable .col-tag {
  width: 16%;
}

#knowledgeListTable .col-file {
  width: 24%;
}

#knowledgeListTable .col-date {
  width: 12%;
}

#knowledgeListTable .col-actions {
  width: 10%;
}

#knowledgeListTable th {
  white-space: nowrap;
}

#knowledgeListTable td {
  overflow-wrap: anywhere;
}

#knowledgeListTable .cell-file {
  overflow: visible;
}

.cell-file {
  position: relative;
}

.cell-clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-file[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 1.1rem;
  max-width: 18rem;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  background: #111111;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cell-file[data-tooltip]:hover::after {
  opacity: 1;
}

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

.person {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.person__avatar {
  background: #e8f0fa;
  color: var(--brand-deep);
}

.cell-muted {
  color: var(--ink-soft);
}

.job-status {
  font-weight: 700;
}

.job-status--open {
  color: #15803d;
}

.job-status--closed {
  color: #b42318;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #eef3f9;
  color: var(--brand-deep);
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: capitalize;
}

@media (min-width: 1024px) {
  .login {
    place-items: center start;
    padding: 2.5rem max(2rem, 5vw);
  }

  .login__panel {
    width: min(26.5rem, 34vw);
    max-height: calc(100dvh - 5rem);
    padding: 2.35rem 2.15rem;
    margin-left: max(0.5rem, 2vw);
  }

  .login__panel-brand {
    display: none;
  }

  .login__aside-devices {
    inset: 4% 2% 6% 36%;
    opacity: 0.85;
    color: rgba(140, 230, 236, 0.52);
  }

  .login__aside-focal {
    display: block;
    position: absolute;
    z-index: 1;
    top: 50%;
    right: max(2.5rem, 7vw);
    width: min(28rem, 40vw);
    transform: translateY(-50%);
    animation: login-focal 0.95s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .login__aside-ring {
    left: 68%;
  }

  .menu-toggle {
    display: none;
  }

  .workspace__crumb {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    transform: none;
    height: 100%;
    overflow: auto;
    flex: 0 0 var(--sidebar-w);
  }

  body.is-sidebar-open .sidebar-backdrop {
    display: none;
  }

  .workspace__bar {
    padding: 1rem 1.75rem;
  }

  .workspace__title {
    font-size: 1.25rem;
  }

  .workspace__main {
    padding: 1.75rem;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.service-form {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.report-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-card--equipment {
  position: relative;
  isolation: isolate;
}

.report-card--equipment.is-locked::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.55);
}

.equipment-note {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 650;
  pointer-events: none;
}

.equipment-note[hidden] {
  display: none;
}

.grid {
  display: grid;
  gap: 0.75rem;
}

.grid--2,
.grid--3 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .workspace__main {
    padding: 1.25rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  .report-card {
    padding: 1.25rem;
    border-radius: var(--radius);
  }

  .grid--2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid--3 {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .radio-group {
    flex-flow: row wrap;
  }

  .radio-chip {
    flex: 1 1 12rem;
  }
}

.status-pair > .report-card {
  min-width: 0;
}

@media (min-width: 768px) {
  .status-pair .radio-group {
    flex-flow: column;
  }

  .status-pair .radio-chip {
    flex: none;
  }
}

@media (min-width: 1024px) {
  .service-form {
    max-width: none;
  }

  .workspace__main {
    padding: 1.75rem 2rem;
  }

  .panel--narrow {
    max-width: 48rem;
  }
}

@media (min-width: 1440px) {
  .workspace__main {
    padding: 2rem 2.5rem;
  }

  .panel--narrow {
    max-width: 56rem;
  }

  .grid--2,
  .grid--3 {
    gap: 1rem 1.5rem;
  }
}

@media (min-width: 1920px) {
  .workspace__main {
    padding: 2.25rem 3rem;
  }
}

.report-card--signature {
  border-color: var(--brand);
}

.proforma-gap {
  margin-bottom: 1.15rem;
}

.field.proforma-gap {
  margin-top: 1.15rem;
}

.proforma-gap.field,
.proforma-gap .field {
  gap: 0.65rem;
}

.report-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.report-card__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.report-card__head .report-card__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.report-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-deep);
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.radio-group {
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.radio-chip {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  min-height: var(--touch);
}

.radio-chip:has(input:checked) {
  border-color: var(--brand);
  background: rgba(26, 95, 180, 0.06);
}

.radio-chip input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  flex-shrink: 0;
}

.radio-chip span {
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.radio-group--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.status-strip {
  display: grid;
  gap: 0.65rem;
}

.status-strip__options {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.status-strip__cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  min-height: var(--touch);
}

.status-strip__cell:last-child {
  border-bottom: 0;
}

.status-strip__cell:has(input:checked) {
  background: rgba(26, 95, 180, 0.06);
}

.status-strip__cell input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  flex-shrink: 0;
}

.status-strip__cell span {
  font-size: 0.85rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.status-strip__time {
  margin: 0;
}

@media (min-width: 768px) {
  .status-strip {
    grid-template-columns: minmax(0, 3fr) minmax(10rem, 1fr);
    align-items: stretch;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
  }

  .status-strip__options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 0;
    border-radius: 0;
    border-right: 1px solid var(--line);
  }

  .status-strip__cell {
    border-bottom: 0;
    border-right: 1px solid var(--line);
    justify-content: flex-start;
  }

  .status-strip__cell:last-child {
    border-right: 0;
  }

  .status-strip__time {
    padding: 0.55rem 0.75rem;
    justify-content: center;
  }

  .status-strip__time label {
    font-size: 0.78rem;
  }
}

.service-form__meta .report-card__title {
  display: none;
}

.job-picker {
  display: grid;
  gap: 0.45rem;
}

@media (min-width: 768px) {
  .job-picker {
    grid-template-columns: minmax(6rem, 8rem) minmax(0, 1fr);
    align-items: center;
  }
}

.open-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  overflow: auto;
  padding: 0.15rem 0.1rem 0.5rem;
}

.open-job-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.open-job-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.open-job-card__status {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f766e;
}

.open-job-card__section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-deep);
}

.open-job-card__meta {
  display: grid;
  grid-template-columns: minmax(7rem, 34%) minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  margin: 0;
  font-size: 0.86rem;
}

.open-job-card__meta dt {
  margin: 0;
  color: var(--ink-soft);
}

.open-job-card__meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

button.open-job-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.open-job-card__actions {
  display: flex;
  justify-content: flex-end;
}

.sig-accordion {
  margin-top: 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.sig-accordion.is-open {
  border-color: var(--brand);
}

.sig-accordion.is-signed:not(.is-open) {
  border-color: #86b7fe;
}

.sig-accordion__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  min-height: var(--touch);
  border: none;
  background: #f8fafc;
  text-align: left;
  font: inherit;
}

.sig-accordion.is-open .sig-accordion__header {
  background: rgba(26, 95, 180, 0.06);
  border-bottom: 1px solid var(--line);
}

.sig-accordion__title {
  font-size: 0.95rem;
  font-weight: 700;
}

.sig-accordion__clear {
  margin-left: auto;
}

.sig-accordion__meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.sig-accordion__meta span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.sig-accordion__thumb {
  height: 28px;
  width: auto;
  max-width: 72px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.sig-accordion__chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-top: -4px;
}

.sig-accordion.is-open .sig-accordion__chevron {
  transform: rotate(-135deg);
  margin-top: 4px;
  border-color: var(--brand);
}

.sig-accordion__body {
  padding: 0.75rem;
}

.sig-accordion__toolbar {
  display: flex;
  justify-content: flex-end;
}

.btn-text {
  background: none;
  border: none;
  color: var(--brand);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  min-height: var(--touch);
}

.signature-pad-wrapper {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
  touch-action: none;
  overflow: hidden;
}

.signature-pad-wrapper.has-signature {
  border-color: var(--brand);
  border-style: solid;
}

.signature-pad-wrapper canvas {
  display: block;
  width: 100%;
  height: min(38vw, 160px);
  min-height: 120px;
  cursor: crosshair;
}

@media (min-width: 768px) {
  .signature-pad-wrapper canvas {
    height: 180px;
  }
}

@media (min-width: 1024px) {
  .signature-pad-wrapper canvas {
    height: 200px;
  }
}

@media (min-width: 1440px) {
  .signature-pad-wrapper canvas {
    height: 260px;
  }
}

@media (min-width: 1920px) {
  .signature-pad-wrapper canvas {
    height: 300px;
  }
}

.service-form__footer {
  margin-top: 0.5rem;
  padding: 1rem 0.25rem 0.25rem;
  border-top: 1px solid var(--line);
}

.service-form__disclaimer {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
  font-style: italic;
  text-align: center;
}

.service-form__contacts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.service-form__contacts li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  padding: 0.75rem 0.65rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
  border-right: 1px solid var(--line);
}

.service-form__contacts li:last-child {
  border-right: 0;
}

.service-form__contacts .icon {
  color: var(--brand-deep);
  flex-shrink: 0;
}

.service-form__contacts span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.service-form__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.service-form__actions-start,
.service-form__actions-end {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.service-form__actions-end {
  margin-left: auto;
}

.service-form__actions .btn {
  min-width: 6.5rem;
  height: var(--touch);
  margin: 0;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.service-form__actions-end .btn {
  min-width: 8.5rem;
}

.report-card--output {
  border-style: dashed;
}

.payload {
  margin: 0;
  max-height: 28rem;
  overflow: auto;
  padding: 0.875rem;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal {
  position: fixed;
  inset: auto;
  top: var(--modal-top, 0px);
  left: var(--modal-left, 0px);
  box-sizing: border-box;
  width: var(--modal-width, 100vw);
  height: var(--modal-height, 100dvh);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 1.5rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
  z-index: 200;
}

.modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal::backdrop {
  background: rgba(11, 18, 32, 0.46);
}

.modal--confirm {
  overflow: hidden;
}

.modal--confirm[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal--confirm::backdrop {
  animation: confirm-backdrop 0.28s ease both;
}

.modal__body--confirm {
  width: min(28rem, 100%);
  padding: 1.35rem 1.25rem 1.15rem;
  text-align: center;
  animation: confirm-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal__body--confirm .modal__title {
  margin-bottom: 0.4rem;
}

.modal__body--confirm .modal__toolbar {
  justify-content: center;
  border-top: 0;
  padding-top: 1.1rem;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.85rem;
  border-radius: 999px;
  background: #fdecea;
  color: var(--danger);
}

.confirm-icon .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.modal__copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

@keyframes confirm-in {
  from {
    opacity: 0;
    transform: translateX(46vw);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes confirm-backdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal__body {
  display: flex;
  flex-direction: column;
  width: min(48rem, 100%);
  max-height: 100%;
  margin: auto;
  overflow: auto;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal__body > .form,
.modal__body--form .service-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

form.modal__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.modal__body--form {
  width: min(88rem, 100%);
  height: auto;
  max-height: 100%;
}

.modal__body--preview {
  width: min(68rem, 100%);
  height: min(92dvh, calc(100dvh - 1.5rem));
}

.proforma-preview {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 1.25rem;
  justify-items: center;
  padding: 1rem;
  background: #e8eaed;
  border-radius: 8px;
}

.proforma-preview__page {
  width: min(100%, 58rem);
  background: #fff;
  box-shadow: 0 8px 28px rgba(11, 18, 32, 0.14);
}

.proforma-preview__page img {
  display: block;
  width: 100%;
  height: auto;
}

.modal__body--confirm {
  display: block;
  overflow: visible;
  max-height: none;
}

.modal__toolbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin: 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.service-form--readonly fieldset:disabled,
.service-form--readonly fieldset:disabled .radio-chip {
  opacity: 1;
  color: inherit;
}

.service-form--readonly .radio-chip {
  cursor: default;
  pointer-events: none;
}

.service-form--readonly .proforma-settings {
  display: none;
}

.signature-preview {
  display: block;
  width: 100%;
  height: 10rem;
  object-fit: contain;
  background: #fafbfc;
}

.signature-pad-wrapper:not(.has-signature) {
  min-height: 10rem;
}

.signature-pad-wrapper:not(.has-signature) .signature-preview {
  display: none;
}

.signature-pad__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  color: var(--ink-soft);
  pointer-events: none;
}

.signature-pad-wrapper.has-signature .signature-pad__empty {
  display: none;
}

.modal__title {
  font-size: 1.1rem;
  font-weight: 650;
  margin-bottom: 1rem;
}

.table td.table__actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  background: #eef3f9;
  color: var(--brand-deep);
}

.icon-btn--danger {
  color: var(--danger);
}

.icon-btn--danger:hover {
  background: #fdecea;
  color: var(--save-hover);
}

.icon-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  top: auto;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  background: #111111;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.icon-btn[data-tooltip]:hover::after,
.icon-btn[data-tooltip]:focus-visible::after {
  opacity: 1;
}

.detail-list {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1.25rem;
}

.detail-list > div {
  min-width: 0;
}

.detail-list dt {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-signature {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 8rem;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.modal__body--preview {
  width: 100%;
  max-width: none;
  height: auto;
  max-height: none;
  min-height: 0;
  align-self: stretch;
  margin: 0;
  overflow: hidden;
}

#clientViewDialog .modal__body {
  width: min(68rem, 100%);
  height: 100%;
  max-height: 100%;
  margin: auto;
  overflow: hidden;
  padding-top: 0.85rem;
}

#clientViewDialog .split-tabs {
  margin-left: -0.15rem;
  margin-right: -0.15rem;
}

#clientViewDialog .split-tabs,
#clientViewDialog .modal__toolbar {
  flex: 0 0 auto;
}

#clientViewDialog [data-client-panel]:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.client-section__rule {
  margin: 1.25rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.split-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0 0 1.15rem;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.split-tab {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.split-tab:hover {
  color: var(--brand-deep);
  background: rgba(26, 95, 180, 0.04);
}

.split-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.split-tab.is-active {
  color: var(--brand-deep);
  background: transparent;
  box-shadow: none;
}

.split-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
}

[data-client-panel][hidden] {
  display: none;
}

#knowledgeViewDialog .modal__body--preview {
  flex: 0 1 auto;
  width: min(88rem, 100%);
  height: auto;
  max-width: none;
  max-height: 100%;
  min-height: 0;
  margin: auto;
  align-self: center;
  overflow: auto;
}

#knowledgeViewDialog .modal__body--preview > #knowledgeFormView {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}

#knowledgeFormView.form--knowledge-view {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

#knowledgeFormView.form--knowledge-view textarea {
  min-height: var(--touch);
  height: var(--touch);
  resize: none;
}

.modal__body--preview > .form {
  flex: 0 1 auto;
  max-height: 11rem;
  min-height: 0;
  overflow: auto;
}

.modal__body--preview > .form {
  flex: 0 0 auto;
  max-height: none;
  min-height: auto;
  overflow: visible;
}

.modal__body--preview > .file-preview {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.85rem;
  overflow: hidden;
}

.file-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.85rem;
  overflow: hidden;
}

.file-preview.is-loading {
  min-height: 0;
}

.file-preview__loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  place-items: center;
  background: rgba(11, 18, 32, 0.62);
  border-radius: 10px;
}

.file-preview__loading:not([hidden]) {
  display: grid;
}

.ajax-spin {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: ajax-spin 0.7s linear infinite;
}

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

.file-preview__status {
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.modal__body--preview .file-preview__stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.file-preview__stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  background: #fff;
}

.file-preview__image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.file-preview__sheets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.45rem;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}

.file-preview__sheet-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.file-preview__sheet-btn.is-active {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: #e8f1fb;
}

.file-preview table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.file-preview th,
.file-preview td {
  border: 1px solid var(--line);
  padding: 0.3rem 0.45rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.file-preview__doc {
  padding: 1rem 1.15rem 1.25rem;
  line-height: 1.5;
}

.file-preview__doc p,
.file-preview__doc h1,
.file-preview__doc h2,
.file-preview__doc h3,
.file-preview__doc h4,
.file-preview__doc li {
  margin: 0 0 0.7rem;
}

.file-preview__doc * {
  position: static !important;
  float: none !important;
  max-width: 100%;
}

.file-preview__doc img {
  display: block;
  width: auto !important;
  height: auto !important;
  margin: 0.4rem 0 0.8rem;
}

.file-preview__doc table {
  display: table;
  width: 100% !important;
  max-width: 100%;
  margin: 0.6rem 0 0.9rem;
  table-layout: fixed;
}

.file-preview__doc th,
.file-preview__doc td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 768px) {
  .modal {
    padding: 1.5rem;
  }

  .modal__body {
    width: min(58rem, 100%);
    padding: 1.25rem;
  }

  .modal__body--form,
  .modal__body--preview {
    width: min(88rem, 100%);
  }

  .modal__body--preview {
    width: min(68rem, 100%);
  }

  .detail-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1440px) {
  .modal__body {
    width: min(70rem, 100%);
    padding: 1.5rem;
  }

  .modal__body--form,
  .modal__body--preview {
    width: min(88rem, 100%);
  }

  .modal__body--preview {
    width: min(72rem, 100%);
  }
}

.info-pair {
  display: grid;
  gap: 0.75rem;
}

.info-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  min-width: 0;
}

.info-box__title {
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: #f3f4f6;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  border-bottom: 1px solid var(--line);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
  line-height: 1.35;
}

.info-table th,
.info-table td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
  vertical-align: middle;
  overflow-wrap: anywhere;
  font-size: inherit;
  line-height: inherit;
  font-family: inherit;
}

.info-table th {
  width: 42%;
  background: #f8fafc;
  font-weight: 700;
  text-align: left;
  color: var(--ink);
}

.info-table td {
  width: 58%;
  font-weight: 400;
  color: var(--ink);
}

.info-table td .combobox,
.info-table td input {
  width: 100%;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
}

@media (min-width: 768px) {
  .info-pair {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto repeat(5, auto);
    column-gap: 0.75rem;
    row-gap: 0;
  }

  .info-pair > .info-box {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: 1 / -1;
  }

  .info-pair .info-table,
  .info-pair .info-table tbody {
    display: contents;
  }

  .info-pair .info-table tr {
    display: grid;
    grid-template-columns: minmax(9rem, 42%) minmax(0, 1fr);
  }

  .info-pair .info-table th,
  .info-pair .info-table td {
    width: auto;
    height: 100%;
  }
}

.lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.lines-table th,
.lines-table td {
  border: 1px solid var(--line);
  padding: 0.35rem;
  vertical-align: middle;
}

.lines-table th {
  background: #f3f4f6;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.lines-table__no {
  width: 5.75rem;
  white-space: nowrap;
  text-align: center;
}

.lines-table td.lines-table__no {
  color: var(--ink-soft);
}

.lines-table__unit,
.line-unit {
  width: 5.5rem;
  text-align: center;
}

.lines-table__action {
  width: 3.25rem;
  text-align: center;
  padding: 0;
}

.lines-table__action .icon-btn {
  width: 2.25rem;
  height: 2.25rem;
}

.lines-table input {
  min-height: 2.4rem;
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 0.25rem 0.35rem;
}

.lines-table input:not([readonly]) {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(13, 61, 122, 0.04);
}

.lines-table input:not([readonly]):hover {
  border-color: #c5d0de;
}

.lines-table input:not([readonly]):focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.16);
}

.lines-table input[type="number"] {
  text-align: right;
}

.lines-table input.line-unit {
  text-align: center;
}

.service-form--readonly .lines-table input {
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.line-total {
  text-align: right;
  white-space: nowrap;
  padding-right: 0.6rem;
  font-weight: 650;
}

.lines-total {
  margin: 0.75rem 0 0;
  text-align: right;
  font-weight: 650;
}

.editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.editor__btn {
  min-height: 2.25rem;
  min-width: 2.25rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.editor__btn:hover {
  background: var(--canvas);
}

.editor__surface,
.editor__surface * {
  color: var(--ink);
}

.editor__surface {
  min-height: 12rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: #fff;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  font-family: Calibri, Carlito, sans-serif;
  font-size: 11pt;
  line-height: 1.4;
}

.editor__surface:focus {
  border-color: var(--brand);
}

.editor__surface h2 {
  font-size: 11pt;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.editor__surface p {
  margin: 0 0 0.35rem;
  font-size: 11pt;
}

.editor__surface ul {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}
