:root {
  --im-primary: #1e3a8a;
  --im-primary-dark: #172b63;
  --im-accent: #3b82f6;
  --im-bg: #f4f6fb;
  --im-text: #1f2937;
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}

body.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--im-bg);
  color: var(--im-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.app-main {
  flex: 1 0 auto;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* Fejléc */
.app-navbar {
  background: linear-gradient(135deg, var(--im-primary-dark) 0%, var(--im-primary) 60%, #2553b8 100%);
  box-shadow: 0 2px 12px rgba(23, 43, 99, 0.25);
}

.app-navbar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
  color: #fff;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
}

.app-brand:hover {
  color: #fff;
}

.app-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.app-brand-text {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app-user-chip {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.9rem;
}

.app-footer {
  flex-shrink: 0;
  color: #6b7280;
  font-size: 0.85rem;
}

/* Kártyák, táblázatok */
.app-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  box-shadow: 0 4px 18px rgba(31, 41, 55, 0.06);
}

.app-card .card-header {
  background: transparent;
  border-bottom: 1px solid #eef0f4;
  font-weight: 600;
}

.app-page-title {
  font-weight: 700;
  color: var(--im-primary-dark);
}

/* Rendszerbeállítások csempék */
.app-settings-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.app-settings-tile:hover,
.app-settings-tile:focus {
  color: inherit;
  box-shadow: 0 8px 26px rgba(31, 41, 55, 0.14);
  transform: translateY(-2px);
}

.app-settings-tile h2 {
  color: #1f2937;
}

.app-settings-tile-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.table.app-table > :not(caption) > * > * {
  vertical-align: middle;
}

.role-badge {
  background: #e8efff;
  color: var(--im-primary);
  border-radius: 0.5rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 0.25rem;
  display: inline-block;
}

.status-badge-active {
  background: #dcfce7;
  color: #166534;
}

.status-badge-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge {
  border-radius: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.btn-primary {
  background-color: var(--im-primary);
  border-color: var(--im-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--im-primary-dark);
  border-color: var(--im-primary-dark);
}

/* Bejelentkező képernyő */
body.login-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(59, 130, 246, 0.35), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(37, 83, 184, 0.45), transparent 55%),
    linear-gradient(135deg, #0f1d4d 0%, var(--im-primary-dark) 45%, var(--im-primary) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 1.1rem;
  box-shadow: 0 24px 60px rgba(2, 8, 36, 0.45);
  padding: 2.5rem 2.25rem;
  margin: 1rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.login-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, var(--im-primary) 0%, var(--im-accent) 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.login-brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--im-primary-dark);
  margin: 0;
}

.login-subtitle {
  color: #6b7280;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
}

.login-card .form-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}

.login-card .form-control {
  padding: 0.65rem 0.85rem;
  border-radius: 0.6rem;
}

.login-card .form-control:focus {
  border-color: var(--im-accent);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

.btn-login {
  width: 100%;
  padding: 0.7rem;
  font-weight: 600;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, var(--im-primary) 0%, #2553b8 100%);
  border: none;
  color: #fff;
}

.btn-login:hover,
.btn-login:focus {
  background: linear-gradient(135deg, var(--im-primary-dark) 0%, var(--im-primary) 100%);
  color: #fff;
}

.login-card .login-footnote {
  text-align: center;
  margin-top: 1.5rem;
  margin-bottom: 0;
  color: #9ca3af;
  font-size: 0.8rem;
}

/* Sablonkezelő szerkesztők – munkaterület húzd-és-ejtsd átrendezése */
.workspace-drag-handle {
  cursor: grab;
  user-select: none;
  line-height: 1;
}

.workspace-item.dragging {
  opacity: 0.5;
  border-style: dashed !important;
}

/* Összetett komponens szerkesztő – dokumentum-előnézet */
.app-doc-preview {
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  color: #1f2937;
}

.app-doc-preview .preview-field {
  background: #f0f4ff;
  border-bottom: 1px solid #94a3b8;
  border-radius: 0.15rem;
  padding: 0 0.25rem;
  margin: 0 0.15rem;
  white-space: nowrap;
}

/* Statikus szöveg szerkesztő – Word-szerű „Betűtípus” eszköztár */
.static-editor {
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  background: #fff;
}

.static-editor:focus-within {
  border-color: var(--im-accent);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

.static-toolbar {
  padding: 0.45rem 0.55rem;
  background: linear-gradient(#fbfcfd, #f3f5f8);
  border-bottom: 1px solid #e3e6ea;
  border-radius: 0.5rem 0.5rem 0 0;
}

.static-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.static-toolbar-row + .static-toolbar-row {
  margin-top: 0.35rem;
}

.static-toolbar-font {
  width: auto;
  max-width: 14rem;
}

.static-toolbar-size {
  width: 4.6rem;
}

.static-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0 0.35rem;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  background: transparent;
  color: #3b3f46;
  font-size: 0.9rem;
  line-height: 1;
}

.static-toolbar-btn:hover {
  background: #e8ebf0;
  border-color: #d6dae1;
}

.static-toolbar-btn.is-active {
  background: #dbe7ff;
  border-color: #9db8e8;
  color: var(--im-primary-dark);
}

.static-toolbar-sep {
  width: 1px;
  height: 1.4rem;
  background: #d6dae1;
  margin: 0 0.35rem;
}

.static-step-mark {
  font-size: 0.5em;
  vertical-align: 0.7em;
  margin-left: 1px;
}

.static-color-group {
  display: inline-flex;
  align-items: center;
}

.static-color-btn {
  flex-direction: column;
  gap: 2px;
  padding-top: 3px;
}

.static-color-letter {
  font-weight: 600;
  line-height: 1;
}

.static-color-bar {
  display: block;
  width: 1rem;
  height: 0.25rem;
  border-radius: 1px;
  background: #c00000;
}

.static-color-caret {
  min-width: 1.1rem;
  padding: 0 0.15rem;
}

.static-color-menu {
  min-width: 12rem;
}

.static-color-menu .dropdown-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.static-color-grid {
  display: flex;
  gap: 0.3rem;
}

.static-color-swatch {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 0.2rem;
}

.static-color-grid .static-color-swatch:hover,
.static-color-grid .static-color-swatch:focus {
  outline: 2px solid var(--im-accent);
  outline-offset: 1px;
}

.static-color-input {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background: none;
}

.static-editor-area {
  min-height: 8rem;
  height: auto;
  border: 0;
  border-radius: 0 0 0.5rem 0.5rem;
}

.static-editor-area:focus {
  box-shadow: none;
  outline: none;
}

/* Egysoros formázható mező (pl. választólista-címke) alacsonyabb
   szerkesztőterülettel. */
.static-editor-area-compact {
  min-height: 2.4rem;
}

/* Beszélgetés-alapú kitöltő képernyő (specifikáció 5. fejezet) */
.fill-transcript {
  height: 260px;
  overflow-y: auto;
  font-size: 0.875rem;
}

.fill-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1rem 0 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #e3e6ea;
}

.fill-component-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.5rem 0 0.25rem;
}

.fill-field {
  padding: 0.4rem 0.5rem;
  border-radius: 0.35rem;
  margin-bottom: 0.35rem;
  border: 1px solid transparent;
}

.fill-field .fill-status-icon {
  width: 1.1rem;
  text-align: center;
}

.fill-field .fill-field-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.fill-status-filled {
  background: #f2fbf5;
}

.fill-status-filled .fill-status-icon {
  color: #198754;
}

.fill-status-uncertain {
  background: #fff9e8;
}

.fill-status-uncertain .fill-status-icon {
  color: #b58500;
}

.fill-status-unfilled .fill-status-icon {
  color: #9ca3af;
}

/* A varázsló fókusza: a legkisebb sorszámú, még kitöltetlen mező (5.3.). */
.fill-focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

/* Az összegzésből kijelölt, még hiányzó mező kiemelése: halvány piros háttér
   és piros keret, hogy a felhasználó keresgélés nélkül lássa, hol van hiány. */
.fill-missing-jump {
  border-color: #dc3545;
  background: #fdf0f1;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.2);
  animation: fill-missing-pulse 1.1s ease-out 2;
}

@keyframes fill-missing-pulse {
  0% { box-shadow: 0 0 0 0.05rem rgba(220, 53, 69, 0.35); }
  50% { box-shadow: 0 0 0 0.4rem rgba(220, 53, 69, 0.25); }
  100% { box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.2); }
}

.fill-hint {
  color: #0d6efd;
  margin: 0.15rem 0;
}

.fill-group .fill-field {
  margin-bottom: 0.25rem;
}

/* Dokumentumsablon – oldalbeállítások margó-diagramja. A négy margómező egy
   papírlapot ábrázoló rajz köré rendeződik (Felső / Alsó / Bal / Jobb), így
   a mezők igazítása stabil marad a szűk tulajdonság-panelben is. */
.page-margins {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    ".    top    ."
    "left sheet  right"
    ".    bottom .";
  align-items: center;
  justify-items: center;
  gap: 0.5rem 0.6rem;
  padding: 0.85rem 0.75rem;
  max-width: 21rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
}

.page-margin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: 3.75rem;
}

.page-margin--top {
  grid-area: top;
}

.page-margin--bottom {
  grid-area: bottom;
}

.page-margin--left {
  grid-area: left;
}

.page-margin--right {
  grid-area: right;
}

/* A kompakt, középre zárt margómezőkben a lépegető nyilak elvennék a helyet a
   háromjegyű értékek elől, ezért elrejtjük őket. */
.page-margin .form-control {
  text-align: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  -moz-appearance: textfield;
  appearance: textfield;
}

.page-margin .form-control::-webkit-outer-spin-button,
.page-margin .form-control::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-margin-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  line-height: 1;
}

/* A középső papírlap a margók közötti törzsterületet (szaggatott keret) is
   érzékelteti, halvány sortükör-mintázattal. */
.page-margin-sheet {
  grid-area: sheet;
  position: relative;
  width: 100%;
  align-self: stretch;
  min-height: 6rem;
  background: #fff;
  border: 1px solid #d4dbe6;
  border-radius: 0.3rem;
  box-shadow: 0 1px 3px rgba(31, 41, 55, 0.08);
}

.page-margin-sheet::before {
  content: "";
  position: absolute;
  inset: 0.55rem;
  border: 1px dashed #b9c4d6;
  border-radius: 0.15rem;
}

.page-margin-sheet::after {
  content: "";
  position: absolute;
  inset: 0.95rem;
  background: repeating-linear-gradient(
    to bottom,
    #dfe6f0 0,
    #dfe6f0 2px,
    transparent 2px,
    transparent 9px
  );
}

/* Partner-választó (autocomplete) a felhasználókezelésben. */
.partner-picker-results {
  max-height: 280px;
  overflow-y: auto;
}

.partner-picker-chip {
  font-size: 0.875rem;
}

.partner-picker-chip .btn-close {
  font-size: 0.6rem;
}
