/* ─── Dialogs ────────────────────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.dialog-container {
  background: var(--af-surface);
  border-radius: 8px;
  border: solid 2px var(--af-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  min-width: 300px;
  min-height: 150px;
  max-height: 99%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dialog-content {
  padding: 0;
  flex: 1;
  overflow-y: auto;
  color: var(--af-text);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 200px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 5px 5px 1em;
  border-bottom: 1px solid var(--af-border-subtle);
  background-color: var(--af-bg-toolbar);
  cursor: move;
  user-select: none;
}

.dialog-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--af-text);
}

.dialog-body {
  flex: 1;
  overflow: auto;
}

.dialog-header-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
}

.dialog-close-button,
.dialog-resize-button {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--af-text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.dialog-resize-button {
  margin-right: -1px;
}

.dialog-close-button::before,
.dialog-resize-button::before {
  content: '';
  display: inline-block;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-size: contain;
  mask-position: center;
}

.dialog-close-button::before {
  width: 20px;
  height: 20px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z'/%3E%3C/svg%3E");
}

.dialog-resize-button::before {
  width: 20px;
  height: 20px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4,4H20V20H4V4M6,8V18H18V8H6Z'/%3E%3C/svg%3E");
}

.dialog-close-button:hover  { background-color: #e81123; color: var(--af-surface); }
.dialog-resize-button:hover { background-color: #bbbbb5; color: var(--af-text); }

.dialog-maximized .dialog-resize-button::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4,8H8V4H20V16H16V20H4V8M16,8V14H18V6H10V8H16M6,12V18H14V12H6Z'/%3E%3C/svg%3E");
}
.dialog-maximized {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  transform: none !important;
  border-radius: 0 !important;
}

.dialog-information {
  text-align: center;
  padding: 20px 10px;
}

.confirmation-icon {
  color: var(--af-warning);
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.message-icon {
  color: var(--af-primary);
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.dialog-message {
  font-size: 16px;
  color: var(--af-text);
  margin-bottom: 24px;
  line-height: 1.5;
}

.dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: auto;
  padding: 10px 1em;
}

/* ─── Buttons ────────────────────────────────────────────────────── */

.btn {
  padding: 8px 24px;
  border-radius: 4px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
  background-color: var(--af-primary);
  color: var(--af-surface);
}

.btn-primary:hover {
  background-color: var(--af-primary-hov);
}

.btn-secondary {
  background-color: #f3f2f1;
  color: var(--af-text);
}

.btn-secondary:hover {
  background-color: #e1dfdd;
}

.form-button {
  align-items: center;
  background-color: #fcfcfd;
  border-radius: 4px;
  border-width: 0;
  box-shadow: rgba(45, 35, 66, 0.2) 0 2px 4px, rgba(45, 35, 66, 0.15) 0 7px 13px -3px, #d6d6e7 0 -3px 0 inset;
  box-sizing: border-box;
  color: #36395a;
  cursor: pointer;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  line-height: 1;
  list-style: none;
  overflow: hidden;
  padding-left: 16px;
  padding-right: 16px;
  position: relative;
  text-align: left;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
  font-size: 15px;
  margin-left: 10px;
  min-width: 100px;
}

.form-button:hover {
  box-shadow: rgba(45, 35, 66, 0.3) 0 4px 8px, rgba(45, 35, 66, 0.2) 0 7px 13px -3px, #d6d6e7 0 -3px 0 inset;
  transform: translateY(-2px);
  will-change: box-shadow, transform;
}

.btn-main {
  font-weight: bold;
  box-shadow: rgba(45, 35, 66, 0.3) 0 4px 8px, rgba(45, 35, 66, 0.2) 0 7px 13px -3px, var(--af-accent) 0 -3px 0 inset;
}


/* ─── Panels & Windows ───────────────────────────────────────────── */

.window-full {
  position: fixed;
  top: 1vh;
  left: 1vw;
  width: 98vw;
  height: 98vh;
  max-width: none;
  max-height: none;
  padding: 16px;
  box-sizing: border-box;
}

.panel-shadow {
  box-shadow: 0 2px 10px #383838;
}


/* ─── Profile / Nav Menu ─────────────────────────────────────────── */

.profile-container {
  display: flex;
  height: 100vh;
  min-height: 500px;
  overflow: hidden;
}

.profile-menu {
  background: var(--af-surface-muted);
  border-right: 1px solid #ddd;
  padding: 20px;
  height: 100%;
  overflow-y: auto;
}

.profile-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.workflow-container .profile-content {
  overflow: hidden !important;
}

.profile-folder {
  margin-bottom: 16px;
}

.profile-f-text {
  font-weight: bold;
  color: var(--af-text);
  margin-bottom: 8px;
  padding: 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-f-items {
  padding: 4px;
}

.profile-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  text-decoration: none;
  color: var(--af-text);
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.profile-item:hover {
  background-color: var(--af-nav-hover);
  color: var(--af-surface);
}

.profile-active {
  background-color: var(--af-nav-active);
  color: var(--af-surface);
}

.profile-active > .profile-i-icon {
  fill: var(--af-surface);
}

.profile-i-icon {
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.profile-i-text {
  font-size: 14px;
  font-weight: 400;
  flex: 1;
}


/* ─── Fluent Nav ─────────────────────────────────────────────────── */

.navmenu {
  background-color: var(--af-bg-nav);
}

.fluent-nav-link > .positioning-region {
  background-color: var(--af-bg-nav) !important;
  border-radius: 0 !important;
}

.fluent-nav-link > .positioning-region:hover {
  color: var(--af-surface);
  background-color: var(--af-nav-hover) !important;
}

.fluent-nav-link.active > .positioning-region {
  color: var(--af-surface);
  background-color: var(--af-nav-active) !important;
}

.fluent-nav-link.active .fluent-nav-icon {
  fill: var(--af-surface) !important;
}

.fluent-selected {
  background-color: var(--af-accent);
  color: var(--af-surface) !important;
}


/* ─── Forms ──────────────────────────────────────────────────────── */

.form {
  margin: 1em;
}

/* Tabs */
.form-tab-lbl {
  position: relative;
  top: 3px;
  height: 28px;
  margin-left: 2px;
  box-sizing: border-box;
  padding: 4px 2em 0;
  background-color: var(--af-surface-subtle);
  display: inline-block;
  border: solid 1px var(--af-border-control);
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 300px;
  text-transform: uppercase;
}

.form-tab-on {
  color: #474179;
  top: 0;
  height: 32px;
  margin-top: 0;
  padding-top: 3px;
  font-weight: bold;
  background-color: var(--af-surface);
  border-top: solid 3px #0076df;
  border-left: solid 1px var(--af-border-control);
  border-right: solid 1px var(--af-border-control);
  border-bottom: solid 1px var(--af-surface);
  cursor: default;
  margin-bottom: -1px;
}

.form-body {
  border: solid 1px var(--af-border-control);
  background-color: var(--af-surface);
  min-height: 60px;
  box-shadow: 0 0 5px #cbcbcb;
}

/* Sections & layout */
.form-section-label {
  font-size: 15px;
  color: var(--af-accent);
  font-weight: bold;
  border-bottom: solid 2px var(--af-accent);
  padding: 2px;
  margin: 5px;
  grid-column: 1 / -1;
}

.form-section {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  margin-bottom: 1em;
  padding-left: 10px;
  padding-right: 15px;
}

.form-section-filter {
  display: grid;
  gap: 0;
  margin-top: 5px;
  margin-bottom: 5px;
  padding-left: 2px;
  padding-right: 6px;
}

.form-layout-2 { grid-template-columns: 1fr 1fr; }
.form-layout-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-layout-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-cell-full   { grid-column: 1 / -1; }
.form-cell-full-2 { grid-column: span 2; }
.form-full-width  { grid-column: 1 / -1; }
.field-full-width { grid-column: 2 / -1; }

/* Cells */
.form-cell {
  grid-template-columns: 150px 1fr;
  display: grid;
  margin: 5px 0.5em 5px 1em;
  align-items: start;
}

.form-cell-top {
  display: block;
}

.form-layout-big > .form-cell     { margin: 15px 1em 15px 1.5em; }
.form-layout-compact > .form-cell { margin: 0 8px 0 12px; }

/* Labels */
.form-label {
  font-weight: bold;
  color: var(--af-label);
  display: inline-block;
  font-size: 14px;
  margin-top: 7px;
}

.form-label-top {
  font-weight: bold;
  color: var(--af-label);
  font-size: 14px;
  margin-top: 7px;
  margin-bottom: 5px;
}

.req {
  color: var(--af-required);
}

/* Data area */
.form-data {
  display: grid;
}

/* Toolbar */
.form-toolbar {
  background-color: var(--af-bg-toolbar);
  padding: 10px 10px 8px 10px;
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

/* Fields */
.form-field {
  border: solid 1px #efefef;
  border-radius: 3px;
  border-bottom-color: #929292;
  background-color: var(--af-surface);
  font-size: 14px;
}

.form-field:hover {
  border-top-color: #e5e5e5;
  border-left-color: #e5e5e5;
  border-right-color: #e5e5e5;
  background-color: var(--af-surface-subtle);
}

.form-field-dis {
  border: solid 1px #e1e1e1;
  border-radius: 3px;
  background-color: #f9f9f9;
  font-size: 14px;
  color: #3d3d3d;
  padding: 5px;
}

.form-field-req {
  border-bottom: solid 2px var(--af-required);
}


/* Errors */
.form-cell-msg {
  background-color: var(--af-error-bg);
  padding: 5px;
  border: solid 1px var(--af-error-border);
  margin-top: -1px;
  margin-right: 1px;
  border-radius: 2px;
  box-shadow: 1px 1px 2px #917a7a;
}

.form-error {
  background-color: var(--af-error-bg);
  padding: 1em;
  margin: 1em 7px 5px 5px;
  border: solid 1px var(--af-error-border);
  border-radius: 2px;
  box-shadow: 1px 1px 2px #917a7a;
}

/* Lookup */
.form-lookup {
  min-width: 100px;
  padding: 6px 5px 4px 5px;
  position: relative;
}

.form-lookup-btn {
  position: absolute;
  right: 4px;
  cursor: default;
}

.form-ico-dis {
  fill: #c9bdbd !important;
}

.form-lookup-none {
  color: #7c7c7c;
}

.form-lookup-item.link {
  border-bottom: solid 1px #005391;
  color: #005391;
  margin-bottom: -1px;
  cursor: pointer;
}

.form-lookup-search {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  margin: 0;
}

.form-lookup-search::placeholder {
  color: #999;
  opacity: 1;
}

/* Picklist */
.picklist-container {
  position: relative;
}

.picklist-panel {
  width: 100%;
  outline: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  background-color: var(--af-surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.list-item {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.15s;
}

.list-item:hover              { background-color: var(--af-surface-muted); }
.list-item.selected           { background-color: var(--af-primary); color: var(--af-surface); }
.list-item mark               { background-color: #ffeb3b; padding: 0 2px; border-radius: 2px; }
.list-item.selected mark      { background-color: #ffd700; color: #000; }

/* Checkboxes & radio */
.air-chk, .air-rb {
  outline: 0;
  padding: 0;
  margin: 0 5px 0 0;
  vertical-align: top;
  width: 16px;
  height: 16px;
  border: 0;
}

/* File button */
.form-file-btn {
  cursor: pointer;
  text-decoration: none;
}


/* ─── Data Grid ──────────────────────────────────────────────────── */

.fluent-data-grid {
  background-color: var(--af-surface);
  border: solid 1px var(--af-border-grid);
  height: max-content !important;
  user-select: none;
  -webkit-user-select: none;
  flex: none !important;
  margin: 0 1em;
}

.empty-content-row,
.loading-content-row {
  height: 80px !important;
}

.column-header:not(:last-child) {
  border-right: solid 1px var(--af-border-grid);
}

.grid-top {
  min-height: 42px;
  padding: 1em 1em 0 1em;
  margin-bottom: 12px;
}

.grid-filter-toolbar {
  padding: 0 1em 8px 1em;
}

.grid-filter-cell {
  grid-template-columns: 130px 1fr;
  display: grid;
  margin: 2px 0.5em 2px 1em;
}

.grid-button {
  padding: 4px 1em;
  align-items: center;
  background-color: var(--af-surface);
  border-radius: 3px;
  border: solid 1px #efefef;
  box-sizing: border-box;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
}

.grid-button:hover:not([disabled]) {
  border-color: #f3f3f3;
  background-color: var(--af-surface-muted);
  cursor: pointer;
}

.grid-page {
  padding: 1px 12px 9px 12px;
  font-size: 18pt;
}

.paginator {
  padding: 0 1em !important;
}

.grid-paginator {
  display: flex;
  margin-top: 0.5rem;
  align-items: center;
  padding: 0 1em;
}

.grid-paginator-nav {
  padding: 0;
  display: flex;
  margin-inline-start: auto;
  margin-inline-end: 0;
  gap: 0.5rem;
  align-items: center;
}

.form-data > .fluent-data-grid,
.form-data > .paginator {
  margin-left: 0;
  margin-right: 0;
}

.form-data > .grid-paginator {
  padding: 0;
}

.grid-ico-btn {
  width: 16px;
  height: 16px;
  margin: 4px 0;
  display: inline-block;
  cursor: pointer;
}

.grid-ico {
  width: 16px;
  height: 16px;
  margin: 4px 0;
  display: inline-block;
}

.ico-delete { background-image: url(images/ico/16_delete.png); }
.ico-open   { background-image: url(images/ico/16_edit.png); }
.ico-true   { background-image: url(images/ico/16_bool_true.png); }
.ico-false  { background-image: url(images/ico/16_bool_false.png); }

.grid-container {
  width: 100%;
  height: max-content !important;
  user-select: none;
  -webkit-user-select: none; /* Safari */
}

.grid-table {
  width: 100%;
  table-layout: fixed;
  background-color: var(--af-surface);
  border: solid 1px var(--af-border-grid);
}

.grid-hcell {
  position: sticky;
  top: 0;
  background-color: var(--neutral-fill-stealth-rest);
  padding: 10px;
  border-right: solid 1px var(--af-border-grid);
  border-bottom: solid 1px var(--af-border-grid);
}

.grid-header {
  background-color: var(--af-border-row);
}

.grid-row {
  border-bottom: solid 1px var(--af-border-row);
}

.grid-row > td {
  padding: 6px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-content: center;
}

.grid-selected {
  background-color: var(--af-accent);
  color: var(--af-surface) !important;
}


/* ─── Process ────────────────────────────────────────────────────── */

.process-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

.process-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 20px;
  background: var(--af-process-dark);
  color: var(--af-surface);
  font-weight: 600;
}

.process-title       { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.process-description { font-size: 14px; font-weight: 400; opacity: 0.85; margin-left: 1em; }

.process-content {
  flex: 1;
  background: #f5f6fa;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 200px;
}

.process-panel {
  min-width: 500px;
  margin: 5% auto 0 auto;
  padding: 40px 30px;
  text-align: center;
  background: var(--af-surface);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.process-t-hdr {
  font-size: 24px;
  font-weight: 600;
  color: var(--af-process-dark);
  margin-bottom: 16px;
  line-height: 2em;
}

.process-t-desc {
  font-size: 16px;
  color: #7f8c8d;
  margin-bottom: 32px;
  line-height: 1.5;
}

.process-t-buttons {
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 1em;
  align-items: center;
  flex-wrap: wrap;
}

.process-t-btn {
  min-width: 300px;
}

.process-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 1em;
  margin: 2em;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  color: #991b1b;
  font-size: 1.2em;
  line-height: 1.5;
}

.process-error::before {
  content: "⚠";
  font-size: 46px;
  margin-right: 5px;
  color: #ef4444;
  flex-shrink: 0;
}
