/* SMRepair CRM — shell + Bootstrap extensions (tokens: bootstrap-theme.css) */

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

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

body {
  margin: 0;
  font-family: var(--bs-body-font-family);
  font-size: var(--bs-body-font-size);
  line-height: var(--bs-body-line-height);
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(var(--bs-primary-rgb), 0.08), transparent 55%),
    radial-gradient(ellipse 90% 50% at 100% 100%, rgba(var(--bs-primary-rgb), 0.05), transparent 45%);
  background-attachment: fixed;
}

body.app-nav-open,
body.app-dialog-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-3);
  font-weight: 600;
}

h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.25rem);
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--duration) var(--ease);
}

a:hover {
  color: var(--color-primary-hover);
}

/* ——— App shell ——— */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell > .app-layout {
  flex: 1;
  min-height: 0;
}

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: transparent;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--topbar-h);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  overflow: visible;
}

.app-topbar__start {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.app-topbar__end {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.app-topbar__mid {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 var(--space-2);
  overflow: visible;
}

/* Quick nav: ID-backed selectors so Bootstrap reboot / later sheets cannot flatten list/button styling */
#crmQuickNavRoot {
  position: relative;
  width: 100%;
  max-width: 420px;
  z-index: 20;
  isolation: isolate;
}

.app-quick-nav__input {
  width: 100%;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--surface);
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  font-size: var(--text-sm);
}

.app-quick-nav__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-muted);
  outline: none;
}

#crmQuickNavList.app-quick-nav__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  box-sizing: border-box;
  margin: 0;
  padding: var(--space-2);
  padding-inline-start: var(--space-2);
  list-style: none;
  list-style-type: none;
  max-height: min(72vh, 360px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 420;
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__item {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__item::marker {
  content: none;
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__item + .app-quick-nav__item {
  margin-top: 2px;
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  width: 100%;
  max-width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  margin: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  line-height: var(--leading-normal);
  cursor: pointer;
  min-height: 44px;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__btn:hover,
#crmQuickNavList.app-quick-nav__list .app-quick-nav__btn:focus-visible {
  background: var(--color-primary-muted);
  outline: none;
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__btn--active {
  background: var(--color-primary-muted);
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
}

#crmQuickNavList.app-quick-nav__list .app-quick-nav__sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
  opacity: 0.92;
}

@media (max-width: 767.98px) {
  .app-topbar__mid {
    max-width: 160px;
    flex: 1 1 auto;
    padding: 0 var(--space-1);
  }

  #crmQuickNavRoot {
    max-width: none;
  }

  .app-quick-nav__input {
    min-height: 44px;
    font-size: 0.8125rem;
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  .app-quick-nav__input::placeholder {
    font-size: 0.75rem;
  }
}

.app-topbar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.app-topbar__logo-img {
  max-height: 40px;
  width: auto;
  object-fit: contain;
}

.app-icon {
  display: block;
  flex-shrink: 0;
}

.app-dropdown {
  position: relative;
}

.app-dropdown > summary {
  list-style: none;
  cursor: pointer;
}

.app-dropdown > summary::-webkit-details-marker {
  display: none;
}

.app-dropdown__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  min-height: 44px;
}

.app-dropdown__summary:hover {
  background: var(--color-primary-muted);
}

.app-dropdown__summary--icon {
  position: relative;
  justify-content: center;
  width: 44px;
  padding: 0;
}

.app-notify-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-danger, #c0392b);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
}

.app-notify-badge:empty {
  display: none;
}

.app-dropdown__summary--user {
  gap: var(--space-3);
  padding-right: var(--space-3);
}

.app-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .app-user-name {
    display: none;
  }
}

.app-user-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-primary-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.app-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-user-avatar img.is-hidden {
  display: none;
}

.app-user-initial {
  display: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}

.app-user-initial.is-visible {
  display: block;
}

.app-dropdown__panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  padding: var(--space-2);
}

.app-dropdown__panel--right {
  right: 0;
}

.app-dropdown__link {
  display: block;
  padding: var(--space-3);
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.app-dropdown__link:hover {
  background: var(--color-primary-muted);
}

.app-notify-panel {
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
}

.app-notify-feed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--surface);
}

.app-notify-feed-head__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.app-notify-feed-head__title {
  font-size: var(--text-sm);
}

.app-notify-mute {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.app-notify-mute input {
  margin: 0;
}

.app-notify-mark-all-read {
  align-self: flex-start;
  margin-top: 4px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
}

.app-notify-mark-all-read:hover:not(:disabled) {
  text-decoration: underline;
}

.app-notify-mark-all-read:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app-notify-feed {
  padding: var(--space-3);
  max-height: min(52vh, 380px);
  overflow-y: auto;
  font-size: var(--text-sm);
}

.app-notify-feed-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  background: var(--app-bg);
}

.app-notify-foot-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.app-notify-foot-link:hover {
  text-decoration: underline;
}

.app-notify-section {
  margin-bottom: var(--space-4);
}

.app-notify-section:last-child {
  margin-bottom: 0;
}

.app-notify-section__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.app-notify-section__body {
  margin: 0;
}

.app-notify-pill {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.35;
}

.app-notify-pill--chat {
  background: rgba(14, 165, 233, 0.18);
  color: #0369a1;
}

.app-notify-pill--crm {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.app-notify-pill--cal {
  background: rgba(168, 85, 247, 0.15);
  color: #7e22ce;
}

.app-notify-feed__loading {
  margin: var(--space-2) 0;
}

.app-footer {
  margin-top: auto;
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--surface);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.sidebar__brand-icon {
  display: flex;
  color: rgba(255, 255, 255, 0.95);
}

.sidebar__brand-logo {
  display: block;
  max-height: 38px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar__brand-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sidebar__section {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
}

.sidebar__subsection {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
}

.sidebar__subsection:first-child {
  margin-top: 0;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar > .sidebar__brand ~ nav.sidebar__nav {
  margin-top: var(--space-4);
}

.sidebar > .sidebar__brand ~ nav.sidebar__nav .sidebar-link--logout {
  margin-top: 0;
}

.sidebar__group {
  margin-bottom: var(--space-2);
}

.sidebar__group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  cursor: pointer;
  list-style: none;
  padding: var(--space-2) var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.55);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  user-select: none;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.sidebar__group-summary::-webkit-details-marker {
  display: none;
}

.sidebar__group-summary::after {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid rgba(255, 255, 255, 0.45);
  border-bottom: 2px solid rgba(255, 255, 255, 0.45);
  transform: rotate(-45deg);
  margin-left: auto;
  flex-shrink: 0;
  transition: transform var(--duration) var(--ease);
}

.sidebar__group[open] > .sidebar__group-summary::after {
  transform: rotate(45deg);
}

.sidebar__group-summary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
}

.sidebar__group-summary:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.sidebar__group-title {
  min-width: 0;
}

.sidebar__group-summary-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.sidebar__icon--category {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.88;
}

.sidebar__group--nested .sidebar__icon--category {
  width: 15px;
  height: 15px;
}

.sidebar__group-body {
  padding: 2px 0 0;
}

.sidebar__group--nested {
  margin-bottom: 0;
}

.sidebar__group--nested .sidebar__group-summary {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  padding-left: calc(var(--space-4) + var(--space-1));
}

.sidebar__group--nested .sidebar__group-body {
  padding-left: var(--space-3);
}

.sidebar__group--nested .sidebar-link {
  padding-left: calc(var(--space-3) + var(--space-4));
}

.sidebar__group .sidebar__nav {
  margin-top: var(--space-1);
}

.sidebar__group--nested .sidebar__nav {
  margin-top: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.sidebar__icon {
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-link__label {
  flex: 1;
  min-width: 0;
}

.sidebar-badge {
  flex-shrink: 0;
  min-width: 1.35rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.25;
  background: #fbbf24;
  color: #422006;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  animation: sidebar-badge-attn 2.4s ease-in-out infinite;
}

@keyframes sidebar-badge-attn {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.45);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0);
  }
}

.sidebar-portal-notify {
  margin: 0.35rem calc(-1 * var(--space-2)) 0;
  padding: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.12) 100%);
  border: 1px solid rgba(251, 191, 36, 0.45);
  animation: sidebar-portal-notify-in 0.45s var(--ease) both;
}

@keyframes sidebar-portal-notify-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar-portal-notify__inner {
  padding: var(--space-3) var(--space-2);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.72rem;
  line-height: 1.35;
}

.sidebar-portal-notify__title {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fde68a;
  margin-bottom: 0.2rem;
}

.sidebar-portal-notify__text {
  margin: 0 0 var(--space-2);
  color: rgba(255, 255, 255, 0.88);
}

.sidebar-portal-notify__cta {
  display: inline-block;
  font-weight: 600;
  font-size: 0.72rem;
  color: #fff !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sidebar-portal-notify__cta:hover {
  color: #fef3c7 !important;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-link--active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

.sidebar-link--active .sidebar__icon {
  opacity: 1;
}

.sidebar-link--logout {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.app-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}

.app-menu-btn:hover {
  background: var(--color-primary-muted);
}

.app-menu-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.app-menu-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
  position: relative;
  top: 0;
}

.app-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: opacity var(--duration) var(--ease);
}

.app-brand:hover {
  opacity: 0.88;
  color: var(--color-primary);
}

.app-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
  pointer-events: none;
}

.app-backdrop.is-visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

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

.app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.sidebar-link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sidebar-link:active {
  transform: scale(0.99);
}

@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;
    z-index: var(--z-sidebar);
    transform: translateX(-100%);
    box-shadow: none;
    padding-top: calc(var(--space-5) + env(safe-area-inset-top, 0));
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
}

/* Main (padding from Bootstrap utilities on <main>) */
.main {
  flex: 1;
  min-width: 0;
  animation: app-main-in 0.35s var(--ease) both;
}

@media (min-width: 768px) {
  .main {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
  }

  .main.main--full-bleed {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
}

@keyframes app-main-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .main {
    animation: none;
  }
}

/* Cards: single-wrapper pattern (not using .card-body everywhere) */
main.main .card,
.auth-page .card {
  padding: var(--space-5);
}

main.main .card:hover {
  box-shadow: var(--shadow-md);
}

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

/* Ghost button (used in contract templates; not in Bootstrap) */
.btn-ghost {
  --bs-btn-color: var(--bs-primary);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--bs-primary-bg-subtle);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-hover-color: var(--bs-primary);
  --bs-btn-active-bg: var(--bs-primary-bg-subtle);
  --bs-btn-active-border-color: transparent;
}

/* Legacy .field wraps: spacing like mb-3 */
.field {
  margin-bottom: var(--space-4);
}

.field-label,
.form-label.field-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

/* Unstyled inputs in legacy markup: match Bootstrap form-control */
.main input[type='text']:not(.form-control):not(.form-check-input),
.main input[type='number']:not(.form-control),
.main input[type='date']:not(.form-control),
.main input[type='time']:not(.form-control),
.main input[type='email']:not(.form-control),
.main input[type='search']:not(.form-control),
.main textarea:not(.form-control),
.main select:not(.form-select) {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  background-clip: padding-box;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-shadow: var(--shadow-inner);
}

.main input:not(.form-control):hover,
.main textarea:not(.form-control):hover,
.main select:not(.form-select):hover {
  border-color: var(--color-border-strong);
}

.main input:focus-visible,
.main textarea:focus-visible,
.main select:focus-visible {
  border-color: rgba(var(--bs-primary-rgb), 0.65);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.2), var(--shadow-inner);
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-2) 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  border: 1px solid var(--color-border);
  padding: var(--space-3);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-muted);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

tbody tr {
  transition: background var(--duration) var(--ease);
}

tbody tr:hover {
  background: rgba(var(--bs-primary-rgb), 0.06);
}

pre {
  font-size: var(--text-xs);
  overflow-x: auto;
  padding: var(--space-3);
  background: var(--app-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.text-muted {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* Page structure — spacing and hierarchy */
.page-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.page-header {
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--page-header-border);
}

.page-header__title {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.3rem, 2.8vw, 1.6rem);
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.page-header__lead {
  margin: 0;
  max-width: 65ch;
}

.page-header--card {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
  border-left: 4px solid var(--color-primary);
  background: linear-gradient(105deg, var(--surface) 0%, var(--surface-muted) 100%);
  box-shadow: var(--shadow-sm), var(--shadow-inner);
}

/* Tabs + panels grouped on a muted “desk” surface */
.workspace {
  background: var(--surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.workspace .data-tabs,
.workspace .book-tabs {
  margin-top: 0;
  margin-bottom: var(--space-3);
  background: var(--surface-sunken);
  border-color: var(--color-border-strong);
}

.workspace .data-tab-panel.card:last-child,
.workspace .book-panel.card:last-child {
  margin-bottom: 0;
}

.workspace .chatz-panel.card:last-child {
  margin-bottom: 0;
}

.chatz-toolbar-strip {
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.data-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-3) var(--space-6);
  align-items: start;
  margin-bottom: var(--space-2);
}

.data-form-grid .field {
  margin-bottom: 0;
}

.data-form-grid .span-full {
  grid-column: 1 / -1;
}

.data-form-actions {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

/* Table reports: filter band + sunken grid */
.book-toolbar {
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.book-filters {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--color-border-strong);
}

.book-filters-row {
  margin: 0;
  align-items: flex-end;
}

.book-filters-row.toolbar {
  gap: var(--space-3) var(--space-4);
}

.book-filter-field {
  flex: 1 1 8.5rem;
  min-width: 0;
  margin-bottom: 0;
}

.book-filter-field--action {
  flex: 0 0 auto;
}

.book-filter-field__spacer {
  display: block;
  min-height: 1.15em;
  visibility: hidden;
}

.book-filter-field input:not(.form-control) {
  width: 100%;
}

.table-region {
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.table-region .table-wrap {
  margin: 0;
  border: none;
  background: var(--surface);
}

/* Dashboard mechanics grid: no unnecessary horizontal scrollbar; wrap DT toolbar */
.dashboard-datatable-region .dashboard-mechanic-table-wrap {
  overflow-x: visible;
  overflow-y: visible;
}

.dashboard-datatable-region .dataTables_wrapper {
  width: 100% !important;
  max-width: 100%;
  overflow-x: visible;
}

.dashboard-datatable-region .dataTables_wrapper .dt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-2);
}

.dashboard-datatable-region .dataTables_wrapper .dt-button {
  margin-right: 0 !important;
}

.dashboard-datatable-region table.dataTable {
  max-width: 100%;
}

@media (max-width: 768px) {
  .dashboard-datatable-region .dashboard-mechanic-table-wrap {
    overflow-x: auto;
  }
}

.card > h3.card__section-title,
.book-panel > h3.card__section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 1.05rem;
  color: var(--color-text);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 2px solid var(--color-primary-muted);
}

.card > h3.card__section-title::before,
.book-panel > h3.card__section-title::before {
  content: '';
  width: 4px;
  height: 1.15em;
  border-radius: 2px;
  background: var(--color-primary);
  flex-shrink: 0;
}

.card__subsection-title {
  margin: var(--space-4) 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

.flags-row--panel {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.book-panel__hint {
  margin: calc(-1 * var(--space-2)) 0 var(--space-4);
}

.book-panel__footer-actions {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

/* Toolbars — filters / actions row */
.toolbar,
.dashboard-filters,
.reprint-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
}

.toolbar .field,
.dashboard-filters .field,
.reprint-toolbar .field {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .toolbar,
  .dashboard-filters,
  .reprint-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.reprint-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.chatz-filter-grow {
  flex: 1 1 220px;
  min-width: min(100%, 200px);
}

.divider {
  margin: var(--space-5) 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

/* Login / legacy compact alerts (scoped — page banners use Bootstrap .alert-success etc.) */
.auth-page .alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 500;
  margin: 0 0 var(--space-3);
}

.auth-page .alert--info {
  background: var(--color-info-muted);
  border-color: rgba(var(--bs-primary-rgb), 0.28);
  color: var(--color-text);
}

.auth-page .alert--success {
  background: var(--color-success-muted);
  border-color: rgba(13, 122, 80, 0.28);
  color: #063d29;
}

.auth-page .alert--error {
  background: var(--color-danger-muted);
  border-color: rgba(180, 35, 24, 0.25);
  color: var(--color-danger);
}

.auth-page .alert--warning {
  background: var(--color-warning-muted);
  border-color: rgba(181, 71, 8, 0.28);
  color: #5c2e04;
}

.auth-page .alert.auth-signin__alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.auth-page .alert.auth-signin__alert .bi {
  flex-shrink: 0;
  margin-top: 0.12em;
  font-size: 1.1em;
}

/* Inline CRM status banners (Bootstrap alert + optional spacing) */
.crm-page-message:not([hidden]) {
  margin-top: var(--space-4);
}

.crm-floating-msg {
  position: fixed;
  top: calc(var(--topbar-height, 3.5rem) + 0.75rem);
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  z-index: 1080;
  max-width: min(24rem, calc(100vw - 1.5rem));
  pointer-events: none;
}

.crm-floating-msg:not([hidden]) {
  pointer-events: auto;
}

.crm-floating-msg__inner {
  margin: 0;
  box-shadow: var(--shadow-lg, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
}

.reprint-author-toolbar__group--save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2, 0.5rem);
}

.reprint-save-msg:not([hidden]) {
  flex: 1 1 100%;
  margin: 0 0 0.25rem;
  max-width: 100%;
}

.reprint-save-msg.alert {
  margin-bottom: 0;
}

.form-feedback {
  margin-top: var(--space-4);
  min-height: 1.25em;
}

.form-feedback--error {
  color: var(--color-danger);
  font-weight: 600;
}

.form-feedback--success {
  color: var(--color-success);
  font-weight: 600;
}

/* Staff login — split hero + sign-in */
body.auth-page-body {
  min-height: 100vh;
  margin: 0;
  font-family: 'Plus Jakarta Sans', var(--bs-body-font-family);
  background: var(--app-bg);
  background-image: none;
}

.auth-page.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.05fr);
  background: var(--app-bg);
}

.auth-hero {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: clamp(var(--space-6), 5vw, var(--space-8)) clamp(var(--space-5), 4vw, var(--space-8));
  color: #f4fbf9;
  background: radial-gradient(120% 90% at 20% 10%, rgba(45, 212, 191, 0.18), transparent 50%),
    radial-gradient(80% 70% at 90% 80%, rgba(13, 148, 136, 0.35), transparent 55%),
    linear-gradient(155deg, #042f2c 0%, #0d4f4a 42%, #0a3d38 100%);
  overflow: hidden;
}

.auth-hero__mesh {
  position: absolute;
  inset: -40%;
  background-image:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.06) 0, transparent 42%),
    radial-gradient(circle at 78% 72%, rgba(45, 212, 191, 0.08) 0, transparent 38%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.03) 50%, rgba(255, 255, 255, 0.03) 75%, transparent 75%);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  opacity: 0.85;
  pointer-events: none;
  animation: auth-mesh-shift 22s var(--ease) infinite alternate;
}

@keyframes auth-mesh-shift {
  from {
    transform: translate(0, 0) rotate(0deg);
  }
  to {
    transform: translate(-2%, 1%) rotate(1deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-hero__mesh {
    animation: none;
  }
}

.auth-hero__content {
  position: relative;
  z-index: 1;
  align-self: center;
  max-width: 26rem;
  width: 100%;
}

.auth-hero__brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.auth-hero__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: #042f2c;
  background: linear-gradient(145deg, #5eead4, #2dd4bf);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.auth-hero__eyebrow {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.72;
}

.auth-hero__title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
}

.auth-hero__lead {
  margin: 0 0 var(--space-6);
  font-size: var(--text-base);
  line-height: 1.55;
  color: rgba(244, 251, 249, 0.88);
  max-width: 36ch;
}

.auth-hero__features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.auth-hero__features li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: rgba(244, 251, 249, 0.9);
}

.auth-hero__features .bi {
  flex-shrink: 0;
  margin-top: 0.15em;
  color: #5eead4;
  font-size: 1.1rem;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(var(--space-5), 4vw, var(--space-8));
  background:
    radial-gradient(ellipse 85% 55% at 50% 0%, rgba(var(--bs-primary-rgb), 0.07), transparent 60%),
    var(--app-bg);
}

.auth-panel__sheet {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-5);
}

.auth-signin-card.card {
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
}

.auth-signin__head {
  margin-bottom: var(--space-5);
}

.auth-signin__title {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.35rem, 3vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.auth-signin__lead {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.45;
}

.auth-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap__icon {
  position: absolute;
  left: 1rem;
  z-index: 1;
  color: var(--color-text-muted);
  font-size: 1.05rem;
  pointer-events: none;
}

.auth-input-wrap .form-control {
  padding-left: 2.65rem;
}

.auth-input-wrap--password .form-control {
  padding-right: 3rem;
}

.auth-password-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}

.auth-password-toggle:hover {
  color: var(--color-primary);
  background: var(--color-primary-muted);
}

.auth-password-toggle:focus-visible {
  outline: 2px solid rgba(var(--bs-primary-rgb), 0.45);
  outline-offset: 2px;
}

.auth-submit.btn-lg {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-signin__hint {
  margin: var(--space-5) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.45;
}

.auth-panel__legal {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}

@media (max-width: 991.98px) {
  .auth-page.auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: auto;
    padding: var(--space-5) var(--space-5) var(--space-4);
  }

  .auth-hero__brand {
    margin-bottom: var(--space-4);
  }

  .auth-hero__lead {
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
  }

  .auth-hero__features {
    display: none;
  }

  .auth-panel {
    padding-top: var(--space-4);
  }
}

@media (max-width: 575.98px) {
  .auth-hero__lead {
    display: none;
  }
}

/* Chart / emphasis cards */
.card--chart {
  background: var(--surface-muted);
  border-color: var(--color-border);
}

.card--chart .dashboard-chart-title {
  color: var(--color-text);
}

.card--quiet {
  box-shadow: none;
}

.card--quiet:hover {
  box-shadow: var(--shadow-sm);
}

/* width: auto overrides Bootstrap’s .form-check-input { width: 1em } (lower specificity) and
   collapses custom checkboxes to a thin strip in flex/grid rows — scope width to legacy inputs only */
input[type='checkbox'],
input[type='radio'] {
  margin: 0 var(--space-2) 0 0;
  vertical-align: middle;
  accent-color: var(--color-primary);
}

input[type='checkbox']:not(.form-check-input),
input[type='radio']:not(.form-check-input) {
  width: auto;
}

.field--checkbox label {
  display: block;
  margin-bottom: var(--space-2);
}

.dashboard-charts__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
}

.dashboard-charts__grid > .card {
  margin-bottom: 0;
}

.dashboard-chart-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
}

/* Dashboard — legacy-style tab cards (printed δελτία / ραντεβού) */
.dashboard-legacy-dashcard {
  overflow: hidden;
  position: relative;
}

.dashboard-legacy-tabhdr {
  display: flex;
  gap: 0;
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-4);
  padding: 0;
  border-bottom: 1px solid var(--color-border);
}

.dashboard-tab-btn.tabButton {
  flex: 1;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--surface-muted);
  color: var(--color-text-muted);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.dashboard-tab-btn.tabButton:hover {
  background: var(--surface-sunken);
  color: var(--color-text);
}

.dashboard-tab-btn.tabButton.selectedButtn {
  background: var(--surface);
  color: var(--color-primary);
  box-shadow: inset 0 -2px 0 var(--color-primary);
}

.tabbb.tabClosed {
  position: absolute;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  width: 100%;
  left: 0;
  top: 0;
}

.tabbb:not(.tabClosed) {
  position: relative;
}

.dashboard-dual-chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  align-items: start;
}

.dashboard-dual-chart-col {
  min-width: 0;
}

.dashboard-chart-caption {
  text-align: center;
  font-weight: 600;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}

.dashboard-chart-canvas {
  position: relative;
  min-height: 220px;
}

.dashboard-chart-canvas--wide {
  min-height: 260px;
}

.dashboard-chart-canvas--tall {
  min-height: 320px;
}

.dashboard-appoint-heading {
  font-size: var(--text-base);
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}

/* Dashboard BI — KPI scorecards */
.dashboard-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}

.kpi-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 88px;
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.kpi-tile:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.kpi-tile__value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-primary);
  word-break: break-word;
}

.kpi-tile__label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

/* Dashboard BI — calendar heatmap */
.dashboard-heatmap-card {
  overflow: hidden;
}

.dashboard-heatmap-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.dashboard-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14px, 1fr));
  grid-auto-rows: 14px;
  gap: 3px;
  padding: var(--space-2);
  background: var(--surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.dashboard-heatmap__cell {
  display: inline-block;
  width: 100%;
  height: 14px;
  border-radius: 3px;
  background: var(--surface-sunken);
}

.dashboard-heatmap__cell--empty {
  visibility: hidden;
}

.dashboard-heatmap__cell--lvl0 {
  background: var(--surface-sunken);
}

.dashboard-heatmap__cell--lvl1 {
  background: rgba(15, 118, 110, 0.25);
}

.dashboard-heatmap__cell--lvl2 {
  background: rgba(15, 118, 110, 0.5);
}

.dashboard-heatmap__cell--lvl3 {
  background: rgba(15, 118, 110, 0.75);
}

.dashboard-heatmap__cell--lvl4 {
  background: rgba(15, 118, 110, 1);
}

.dashboard-heatmap-legend {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.dashboard-heatmap-legend .dashboard-heatmap__cell {
  width: 14px;
  flex: 0 0 auto;
}

.dashboard-heatmap-legend__label {
  margin: 0 var(--space-1);
}

/* --- Dashboard customization (per-user layout) --- */
.dashboard-edit-toolbar {
  --dash-tb-fg: var(--color-text, #1a1d24);
  --dash-tb-muted: var(--color-muted, #5c6570);
  --dash-tb-primary: var(--color-primary, #0f766e);
  --dash-tb-primary-soft: rgba(15, 118, 110, 0.08);
  --dash-tb-primary-soft-strong: rgba(15, 118, 110, 0.16);
  --dash-tb-border: var(--color-border, #d1d9d6);
  --dash-tb-surface: var(--surface-default, #fff);
  --dash-tb-surface-muted: var(--surface-muted, #f0f4f3);
  --dash-tb-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --dash-tb-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  position: relative;
  /* Above sibling .card sections so the cards dropdown stays visible */
  z-index: 20;
  margin: 0;
  padding: 0;
  border: 1px solid var(--dash-tb-border);
  border-radius: var(--radius-lg, 12px);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.04) 0%, rgba(15, 118, 110, 0) 60%),
    var(--dash-tb-surface);
  box-shadow: var(--dash-tb-shadow);
  overflow: visible;
  transition: box-shadow 200ms ease, border-color 200ms ease, background 200ms ease;
}

.dashboard-edit-toolbar.is-editing {
  border-color: var(--dash-tb-primary);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08) 0%, rgba(15, 118, 110, 0.02) 70%),
    var(--dash-tb-surface);
  box-shadow: 0 0 0 3px var(--dash-tb-primary-soft), var(--dash-tb-shadow-lg);
}

.dashboard-edit-toolbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4, 1rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
}

.dashboard-edit-toolbar__head {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  min-width: 0;
}

.dashboard-edit-toolbar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--dash-tb-primary-soft);
  color: var(--dash-tb-primary);
  flex: 0 0 auto;
  transition: background 200ms ease, transform 200ms ease;
}

.dashboard-edit-toolbar.is-editing .dashboard-edit-toolbar__icon {
  background: var(--dash-tb-primary);
  color: #fff;
  transform: rotate(90deg);
}

.dashboard-edit-toolbar__titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashboard-edit-toolbar__title {
  font-weight: 600;
  font-size: var(--font-size-md, 0.95rem);
  color: var(--dash-tb-fg);
  line-height: 1.2;
}

.dashboard-edit-toolbar__subtitle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: var(--font-size-sm, 0.85rem);
  color: var(--dash-tb-muted);
  line-height: 1.3;
}

.dashboard-edit-toolbar__pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dash-tb-primary);
  box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.6);
  animation: dashEditPulse 1.6s ease-in-out infinite;
  flex: 0 0 auto;
}

@keyframes dashEditPulse {
  0%   { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(15, 118, 110, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0); }
}

.dashboard-edit-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2, 0.5rem);
}

.dashboard-edit-toolbar__edit-only {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  animation: dashEditFadeIn 200ms ease both;
}

@keyframes dashEditFadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}

.dashboard-edit-toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--dash-tb-border);
  border-radius: 999px;
  background: var(--dash-tb-surface);
  color: var(--dash-tb-fg);
  font-size: var(--font-size-sm, 0.85rem);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease,
    transform 150ms ease, box-shadow 150ms ease;
  user-select: none;
}

.dashboard-edit-toolbar__btn svg {
  flex: 0 0 auto;
  display: block;
}

.dashboard-edit-toolbar__btn:hover {
  background: var(--dash-tb-surface-muted);
  border-color: var(--dash-tb-primary);
  color: var(--dash-tb-primary);
}

.dashboard-edit-toolbar__btn:active {
  transform: translateY(1px);
}

.dashboard-edit-toolbar__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--dash-tb-primary-soft-strong);
}

.dashboard-edit-toolbar__btn--toggle {
  background: var(--dash-tb-primary);
  border-color: var(--dash-tb-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.25);
}

.dashboard-edit-toolbar__btn--toggle:hover {
  background: #0c5d57;
  border-color: #0c5d57;
  color: #fff;
}

.dashboard-edit-toolbar__btn--toggle.is-active {
  background: var(--dash-tb-surface);
  color: var(--dash-tb-primary);
  border-color: var(--dash-tb-primary);
  box-shadow: 0 0 0 3px var(--dash-tb-primary-soft);
}

.dashboard-edit-toolbar__btn--toggle.is-active:hover {
  background: var(--dash-tb-primary-soft);
}

.dashboard-edit-toolbar__btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--dash-tb-muted);
}

.dashboard-edit-toolbar__btn--ghost:hover {
  background: var(--dash-tb-surface-muted);
  border-color: var(--dash-tb-border);
  color: var(--dash-tb-fg);
}

.dashboard-edit-toolbar__btn--primary {
  background: var(--dash-tb-primary);
  color: #fff;
  border-color: var(--dash-tb-primary);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.3);
}

.dashboard-edit-toolbar__btn--primary:hover {
  background: #0c5d57;
  color: #fff;
  border-color: #0c5d57;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.25);
}

.dashboard-edit-toolbar__label-edit,
.dashboard-edit-toolbar__label-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-edit-toolbar__cards {
  position: relative;
}

.dashboard-edit-toolbar__cards summary {
  list-style: none;
}

.dashboard-edit-toolbar__cards summary::-webkit-details-marker {
  display: none;
}

.dashboard-edit-toolbar__chev {
  margin-left: 2px;
  transition: transform 200ms ease;
}

.dashboard-edit-toolbar__cards[open] .dashboard-edit-toolbar__chev {
  transform: rotate(180deg);
}

.dashboard-edit-toolbar__cards-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  max-width: 320px;
  padding: var(--space-3, 0.75rem);
  background: var(--dash-tb-surface);
  border: 1px solid var(--dash-tb-border);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
  animation: dashEditFadeIn 160ms ease both;
}

.dashboard-edit-toolbar__cards-hint {
  margin: 0 0 var(--space-2, 0.5rem) 0;
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--dash-tb-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-edit-toolbar__cards-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.dashboard-edit-toolbar__cards-list li {
  margin: 0;
}

.dashboard-edit-toolbar__cards-list label {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  padding: 7px 8px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  font-size: var(--font-size-sm, 0.85rem);
  color: var(--dash-tb-fg);
  transition: background 120ms ease;
}

.dashboard-edit-toolbar__cards-list label:hover {
  background: var(--dash-tb-primary-soft);
}

.dashboard-edit-toolbar__cards-list input[type="checkbox"] {
  accent-color: var(--dash-tb-primary);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* --- Card hosts (drag/hide chrome on edit mode) --- */
.dashboard-card-host {
  position: relative;
  transition: outline-color 200ms ease, opacity 200ms ease, transform 200ms ease,
    box-shadow 200ms ease;
}

.dashboard-card-host.is-hidden {
  display: none;
}

.dashboard-card-host__handle {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  background: var(--surface-default, #fff);
  border: 1px solid var(--color-border, #d1d9d6);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.dashboard-card-host__handle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.dashboard-card-host__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  margin-right: 4px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  flex: 0 0 auto;
  letter-spacing: 0.02em;
}

.dashboard-card-host__status[data-state="hidden"] {
  background: rgba(180, 35, 24, 0.1);
  color: #b42318;
}

.dashboard-card-host__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.dashboard-card-host__status-on,
.dashboard-card-host__status-off {
  display: none;
}

.dashboard-card-host__status[data-state="visible"] .dashboard-card-host__status-on {
  display: inline;
}

.dashboard-card-host__status[data-state="hidden"] .dashboard-card-host__status-off {
  display: inline;
}

.dashboard-card-host__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-muted, #5c6570);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.dashboard-card-host__btn:hover {
  background: var(--surface-muted, #f0f4f3);
  color: var(--color-text, #1a1d24);
}

.dashboard-card-host__btn--drag {
  cursor: grab;
}

.dashboard-card-host__btn--drag:hover {
  color: var(--color-primary, #0f766e);
}

.dashboard-card-host__btn--drag:active {
  cursor: grabbing;
  transform: scale(0.94);
}

.dashboard-card-host__btn--hide:hover {
  background: rgba(180, 35, 24, 0.08);
  color: #b42318;
}

.dashboard-card-host__btn--show {
  display: none;
  color: #0f766e;
}

.dashboard-card-host__btn--show:hover {
  background: rgba(15, 118, 110, 0.1);
  color: #0c5d57;
}

.dashboard-card-host.is-faded .dashboard-card-host__btn--hide {
  display: none;
}

.dashboard-card-host.is-faded .dashboard-card-host__btn--show {
  display: inline-flex;
}

body.dashboard--editing .dashboard-card-host {
  outline: 2px dashed var(--color-primary, #0f766e);
  outline-offset: 6px;
  border-radius: var(--radius-md, 10px);
}

body.dashboard--editing .dashboard-card-host:hover {
  outline-style: solid;
  box-shadow: 0 6px 24px rgba(15, 118, 110, 0.12);
}

body.dashboard--editing .dashboard-card-host__handle {
  display: inline-flex;
}

body.dashboard--editing .dashboard-card-host.is-faded {
  opacity: 0.55;
  outline-style: dotted;
}

body.dashboard--editing .dashboard-card-host.is-faded:hover {
  opacity: 0.9;
}

.sortable-ghost {
  opacity: 0.35;
  background: rgba(15, 118, 110, 0.05) !important;
}

.sortable-chosen {
  outline: 2px solid var(--color-primary, #0f766e) !important;
  outline-offset: 6px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16) !important;
}

.sortable-drag {
  cursor: grabbing !important;
  transform: rotate(0.6deg);
}

@media (max-width: 640px) {
  .dashboard-edit-toolbar__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-edit-toolbar__actions {
    justify-content: flex-end;
  }

  .dashboard-edit-toolbar__cards-panel {
    right: auto;
    left: 0;
  }
}

/* Unified tab strips (data, book, chatz, uplod) */
.data-tabs,
.book-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  padding: var(--space-1);
  background: var(--surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.data-tab,
.book-tab {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.data-tab:hover,
.book-tab:hover {
  background: var(--surface);
  color: var(--color-text);
}

.data-tab:focus-visible,
.book-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.data-tab.is-active,
.book-tab.is-active {
  background: var(--surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.data-tab-panel[hidden],
.book-panel[hidden] {
  display: none !important;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
  margin-bottom: var(--space-4);
}

.field-row .field {
  margin-bottom: 0;
  min-width: 0;
}

.table-wrap--scroll {
  max-height: min(70vh, 560px);
  overflow: auto;
}

/* Book / Ιστορικό: DataTables Responsive child rows (legacy book.php used responsive: true) */
.book-panel .dataTables_wrapper {
  width: 100%;
}

/*
 * Let DataTables Responsive control the table width on the Ιστορικό panels.
 * The generic .table-wrap / .table-wrap--scroll wrappers add overflow:auto and a
 * max-height which let the table grow horizontally — the responsive plugin then
 * thinks nothing needs to be hidden, so clicking the "+" toggle has no child
 * row to show. Removing the overflow constraint here forces responsive to hide
 * overflowing columns and the "+" button correctly expands the child row.
 */
.book-panel .table-wrap,
.book-panel .table-wrap--scroll {
  overflow: visible;
  max-height: none;
  border: none;
  margin: 0;
}

.book-panel table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-hidden,
.book-panel table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-hidden {
  display: none !important;
}

/* Replace default “arrow” responsive control with a small + / − pill (book tables only) */
.book-panel table.dataTable tbody > tr > td.dtr-control,
.book-panel table.dataTable tbody > tr > th.dtr-control {
  cursor: pointer;
  vertical-align: middle !important;
}

.book-panel table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
.book-panel table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before,
.book-panel table.dataTable > tbody > tr > td.dtr-control:before,
.book-panel table.dataTable > tbody > tr > th.dtr-control:before {
  border: none !important;
  background: rgba(var(--bs-primary-rgb), 0.14) !important;
  color: var(--bs-primary) !important;
  content: '+' !important;
  font-family: inherit !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.85rem !important;
  height: 1.85rem !important;
  min-width: 1.85rem !important;
  margin-right: var(--space-2) !important;
  vertical-align: middle !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.35) !important;
}

.book-panel table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
.book-panel table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before,
.book-panel table.dataTable > tbody > tr.dtr-expanded > td.dtr-control:before,
.book-panel table.dataTable > tbody > tr.dtr-expanded > th.dtr-control:before,
.book-panel table.dataTable > tbody > tr.parent > td.dtr-control:before,
.book-panel table.dataTable > tbody > tr.parent > th.dtr-control:before {
  content: '\2212' !important;
  background: var(--bs-primary) !important;
  color: #fff !important;
  border-color: var(--bs-primary) !important;
}

.book-panel table.dataTable tbody td {
  white-space: normal;
  word-break: break-word;
}

.book-panel ul.dtr-details {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  list-style: none;
  font-size: var(--text-sm);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
}

.book-panel ul.dtr-details li {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-2) 0;
}

.book-panel ul.dtr-details li:last-child {
  border-bottom: none;
}

table.data-table {
  font-size: var(--text-xs);
}

/* DataTables — align with app tables */
table.dataTable {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: var(--text-sm);
}

table.dataTable thead th {
  background: var(--surface-muted);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: var(--space-3);
  font-weight: 600;
}

table.dataTable tbody td {
  border: 1px solid var(--color-border);
  padding: var(--space-3);
  vertical-align: top;
}

table.dataTable tbody tr:hover {
  background: rgba(var(--bs-primary-rgb), 0.06);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
}

.dataTables_wrapper .dataTables_filter input {
  margin: 0 0 0 var(--space-2);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--color-border) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--color-primary-muted) !important;
  color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

/* Topbar notifications (live data) */
.app-notify-item {
  display: block;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--app-bg);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border: none;
  box-sizing: border-box;
  width: 100%;
  text-align: inherit;
}

.app-notify-item--feed:last-child {
  margin-bottom: 0;
}

a.app-notify-item:hover {
  filter: brightness(0.97);
}

a.app-notify-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.app-notify-item--unread {
  background: #fde8e8;
}

.app-notify-item__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.app-notify-item__title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
}

.app-notify-item__text {
  font-weight: 600;
  color: var(--color-text);
}

.app-notify-item__meta {
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  padding-left: calc(0.62rem + 0.45rem * 2 + var(--space-2));
}

.app-notify-empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.app-notify-item--ap {
  cursor: default;
}

.app-notify-item__notes {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  white-space: pre-wrap;
}

.reprint-tool-title {
  margin-bottom: var(--space-2);
}

.reprint-preview-card > h3 {
  margin-top: 0;
}

.reprint-share-email-status strong {
  font-weight: 600;
}

/* Reprint / print — service bulletin layout */
.reprint-print-root {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.reprint-print-page-footer {
  display: none !important;
}

.reprint-keep {
  break-inside: avoid;
  page-break-inside: avoid;
}

.reprint-machine-card,
.reprint-tool-block,
.reprint-spare-block {
  break-inside: avoid;
  page-break-inside: avoid;
}

.reprint-service-grid,
.reprint-sheet__signatures {
  break-inside: avoid;
  page-break-inside: avoid;
}

.reprint-signature {
  break-inside: avoid;
  page-break-inside: avoid;
}

.reprint-field img {
  break-inside: avoid;
  page-break-inside: avoid;
}

.reprint-sheet {
  --reprint-blue: #0f766e;
  --reprint-border: #5eead4;
  --reprint-pill-bg: #f0fdfa;
  flex: 0 1 auto;
  width: 100%;
  max-width: min(720px, 100%);
  margin: 0 auto;
  padding: var(--space-5) var(--space-6);
  background: #fff;
  border: 2px solid var(--reprint-border);
  border-radius: var(--radius-lg);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* html2canvas + html2pdf: rounded corners often lose right/bottom edges; square corners in PDF clone only */
.reprint-sheet.reprint-sheet--pdf {
  border-radius: 0;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.reprint-sheet__header {
  break-inside: avoid;
  page-break-inside: avoid;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--reprint-blue);
}

.reprint-sheet__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  break-inside: avoid;
  page-break-inside: avoid;
}

.reprint-sheet__logo {
  display: block;
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

.reprint-sheet__contact {
  margin: 0;
  font-size: var(--text-xs);
  font-style: normal;
  text-align: right;
  color: var(--color-text);
  line-height: var(--leading-normal);
}

.reprint-sheet__doc-title {
  margin: 0 0 var(--space-5);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--reprint-blue);
}

.reprint-sheet__section {
  margin-bottom: var(--space-5);
}

.reprint-sheet__section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--reprint-blue);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--reprint-border);
}

.reprint-row {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  margin-bottom: var(--space-3);
}

.reprint-row:last-child {
  margin-bottom: 0;
}

.reprint-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.reprint-block:last-child {
  margin-bottom: 0;
}

.reprint-row__label {
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--color-text);
}

.reprint-row--dates {
  grid-template-columns: 1fr 1fr;
}

.reprint-row--dates > .reprint-row__half {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.reprint-field {
  min-height: 2rem;
  padding: var(--space-2) var(--space-3);
  background: var(--reprint-pill-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  white-space: pre-wrap;
  word-break: break-word;
}

.reprint-field--tall {
  min-height: 4.5rem;
}

.reprint-service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-6);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-5);
  border-top: 1px solid var(--reprint-border);
  border-bottom: 1px solid var(--reprint-border);
}

.reprint-service-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.reprint-cb {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid var(--reprint-blue);
  border-radius: 3px;
  background: #fff;
  box-sizing: border-box;
}

.reprint-cb--on {
  background: var(--reprint-blue);
  box-shadow: inset 0 0 0 2px #fff;
}

.reprint-tool-block {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px dashed var(--color-border);
}

.reprint-tool-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.reprint-machine-card {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--reprint-border);
}

.reprint-machine-card:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.reprint-machine-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--reprint-blue);
}

.reprint-spare-block {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
}

.reprint-spare-block__label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.reprint-hours {
  padding-top: var(--space-2);
}

.reprint-sheet__signatures {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-6);
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--reprint-border);
}

.reprint-signature {
  flex: 1 1 240px;
  min-width: min(100%, 240px);
  max-width: 100%;
  text-align: center;
}

.reprint-signature strong {
  display: block;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

.reprint-signature__line {
  height: 48px;
  border-bottom: 1px solid var(--color-text);
}

.reprint-sig-canvas {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: 320 / 120;
  margin: 0 auto;
  border: 1px solid var(--reprint-border);
  border-radius: var(--radius-sm, 4px);
  background: #fff;
  touch-action: none;
  -ms-touch-action: none;
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
}

.reprint-sig-profile-wrap {
  display: flex;
  justify-content: center;
}

.reprint-sig-profile-canvas {
  width: 100%;
  max-width: 320px;
}

@media (max-width: 640px) {
  .reprint-sheet__signatures {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-5);
  }

  .reprint-signature {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .reprint-sig-canvas {
    max-width: none;
  }
}

.reprint-status-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.reprint-author-toolbar {
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  align-items: center;
}

.reprint-author-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.reprint-author-toolbar__group:not(:first-child) {
  padding-left: var(--space-3);
  border-left: 1px solid var(--color-border, #dee2e6);
}

.reprint-author-toolbar__group--save {
  margin-left: auto;
}

@media (max-width: 640px) {
  .reprint-author-toolbar__group:not(:first-child) {
    padding-left: 0;
    border-left: none;
  }

  .reprint-author-toolbar__group--save {
    margin-left: 0;
    width: 100%;
  }

  .reprint-author-toolbar__group--save .btn {
    width: 100%;
  }
}

.reprint-signature-toolbar {
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  align-items: center;
}

.reprint-signature-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* === Editable preview (reprintlive.php authoring mode) === */
.reprint-edit-toolbar {
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  align-items: center;
}

.reprint-edit-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.reprint-field--edit {
  position: relative;
  padding: 0;
}

.reprint-field--edit .rp-edit-input,
.reprint-field--edit input[type="date"],
.reprint-field--edit input[type="time"],
.reprint-field--edit input[type="text"],
.reprint-field--edit textarea,
.reprint-field--edit select {
  width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--reprint-pill-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--color-text);
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.reprint-field--edit textarea {
  min-height: 2rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.reprint-field--edit.reprint-field--tall textarea {
  min-height: 4.5rem;
}

.reprint-field--edit input:focus,
.reprint-field--edit textarea:focus,
.reprint-field--edit select:focus {
  outline: none;
  border-color: var(--color-primary, #0f766e);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.18);
}

.reprint-edit-tools-list,
.reprint-edit-mech-host {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.reprint-edit-tool-row,
.reprint-edit-mech-row,
.reprint-edit-spare-row {
  display: grid;
  align-items: start;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--reprint-pill-bg, #f8fafc);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
}

.reprint-edit-tool-row {
  grid-template-columns: 1fr 1fr auto;
}

.reprint-edit-spare-row {
  grid-template-columns: 1fr 1fr 80px auto;
}

.reprint-edit-mech-row {
  grid-template-columns: 1fr auto;
}

.reprint-machine-card--edit {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

/* Incoming pipeline: vertical step-by-step (reprint editable) */
.incoming-pipeline {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 2px dashed var(--reprint-border, #5eead4);
}

.incoming-pipeline__title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--reprint-blue, #0f766e);
  margin: 0 0 var(--space-3);
  letter-spacing: 0.02em;
}

.incoming-pipeline__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.incoming-pipeline__step {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: var(--space-3);
  align-items: stretch;
}

.incoming-pipeline__step-marker {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--reprint-blue, #0f766e);
  color: var(--reprint-blue, #0f766e);
  font-size: var(--text-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--reprint-pill-bg, #f0fdfa);
}

.incoming-pipeline__step-card {
  border: 1px solid var(--reprint-border, #5eead4);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.06);
}

.incoming-pipeline__step-heading {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.incoming-pipeline__step-control {
  max-width: 100%;
}

button.incoming-pipeline__step-control.rp-pipe-check {
  min-height: 2.75rem;
  font-weight: 600;
}

.incoming-pipeline__admin-row {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-muted, #f8fafc);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.incoming-pipeline__actions {
  margin-top: var(--space-3);
  display: flex;
  justify-content: flex-start;
}

.reprint-edit-spares {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.reprint-edit-only {
  /* Visible only on screen; hidden in @media print and removed from PDF clone */
}

@media print {
  /* Standalone certificate / internal reprint-sheet: hide screen-only controls */
  .certificate-public__actions {
    display: none !important;
  }

  .app-sidebar,
  .app-topbar,
  .app-footer,
  .reprint-toolbar,
  .reprint-author-toolbar,
  .reprint-signature-toolbar,
  .reprint-edit-toolbar,
  .reprint-edit-only,
  .reprint-preview-card > h3,
  .card:not(.reprint-preview-wrap) {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .reprint-preview-wrap {
    box-shadow: none !important;
    border: none !important;
    max-width: none !important;
    width: 100% !important;
  }

  .reprint-print-root {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .reprint-sheet {
    border: 2px solid var(--reprint-border);
    max-width: 190mm;
    width: 100%;
  }

  /* Edit-mode inputs/textareas/selects render as plain pills in print */
  .reprint-field--edit {
    padding: var(--space-2) var(--space-3) !important;
  }
  .reprint-field--edit .rp-edit-input,
  .reprint-field--edit input,
  .reprint-field--edit textarea,
  .reprint-field--edit select {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    resize: none !important;
  }
  .reprint-edit-tool-row,
  .reprint-edit-mech-row,
  .reprint-edit-spare-row {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
  }
  .reprint-machine-card--edit {
    border: none !important;
    padding: 0 !important;
  }

  .reprint-print-page-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    box-sizing: border-box;
    padding: 6px 12px;
    text-align: center;
    font-size: 9pt;
    line-height: 1.3;
    color: var(--color-text, #0f172a);
    background: #fff;
    border-top: 1px solid var(--reprint-border, #5eead4);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.btn-sm { padding: 4px 10px; font-size: var(--text-xs); }

/* In-app modal dialogs (AppDialog) */
.app-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.app-dialog-overlay[hidden] {
  display: none !important;
}

.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.45);
}

.app-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: min(90vh, 640px);
  overflow: auto;
  margin: 0;
  padding: var(--space-5);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.app-dialog__title {
  font-size: var(--text-base);
  margin: 0 0 var(--space-3);
}

.app-dialog__message {
  margin: 0 0 var(--space-3);
  color: var(--color-text);
  font-size: var(--text-sm);
  white-space: pre-wrap;
}

.app-dialog__message[hidden] {
  display: none !important;
}

.app-dialog__field {
  margin-bottom: var(--space-4);
}

.app-dialog__field[hidden] {
  display: none !important;
}

.app-dialog__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.app-dialog__input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.app-dialog__textarea {
  resize: vertical;
  min-height: 100px;
  line-height: var(--leading-normal);
}

.app-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-2);
}

