/* Global component styles */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--hub-space-xs);
  min-height: var(--hub-control-min);
  border: 1px solid var(--hub-border);
  border-radius: 999px;
  padding: var(--hub-pad-btn-y) var(--hub-pad-btn-x);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  background: var(--hub-surface);
  color: var(--hub-text);
}
.btn:hover {
  background: var(--hub-hover, color-mix(in srgb, var(--hub-primary) 12%, var(--hub-surface)));
  border-color: var(--hub-primary);
  color: var(--hub-text);
}
.btn-primary {
  background: var(--hub-primary);
  color: var(--hub-brand-ink);
  border-color: transparent;
}
.btn-primary:hover {
  background: var(--hub-primary-hover);
  color: var(--hub-brand-ink);
  border-color: transparent;
}
.btn-small {
  min-height: var(--hub-control-sm);
  padding: var(--hub-pad-btn-sm-y) var(--hub-pad-btn-sm-x);
  font-size: 0.88rem;
}

.panel,
.auth-panel,
.workflow-card {
  background: var(--hub-surface);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius);
  box-shadow: var(--hub-shadow);
}

.panel { padding: calc(1.2rem * var(--hub-density)) calc(1.3rem * var(--hub-density)); }
.auth-panel { padding: calc(1.5rem * var(--hub-density)); margin: 2rem auto; }

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: calc(0.9rem * var(--hub-density));
}
.workflow-card {
  display: block;
  padding: var(--hub-space-lg) calc(1.1rem * var(--hub-density));
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.workflow-card:hover {
  transform: translateY(-2px);
  border-color: var(--hub-primary);
  color: inherit;
}
.workflow-card h2,
.workflow-card__title {
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
  font-family: inherit;
  font-weight: 700;
}
.workflow-card p {
  margin: 0;
  color: var(--hub-muted);
  font-size: 0.92rem;
}

.module-home__section {
  margin: 1.75rem 0 0;
}
.module-home__section:first-of-type {
  margin-top: 0.5rem;
}
.module-home__section-title {
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hub-muted);
  margin: 0 0 0.65rem;
}

.stack-form,
.auth-form {
  display: grid;
  gap: calc(0.85rem * var(--hub-density));
  max-width: 520px;
}
.helpdesk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hub-space-md);
  margin: 0 0 var(--hub-space-xl);
  align-items: center;
}
.helpdesk-actions > form {
  display: inline-flex;
  margin: 0;
}
.stack-form .helpdesk-actions {
  margin-bottom: 0;
}
.stack-form label,
.auth-form label {
  display: grid;
  gap: calc(0.3rem * var(--hub-density));
  font-size: 0.92rem;
}

/* Operator field locks: tiny lock immediately left of the value control */
.field-lockable {
  display: grid;
  gap: calc(0.3rem * var(--hub-density));
  font-size: 0.92rem;
}
.field-lock-caption {
  line-height: 1.2;
}
.field-lock-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
}
.field-lockable:has(textarea) .field-lock-row {
  align-items: start;
}
.field-lockable:has(textarea) .field-lock {
  margin-top: 0.7rem;
}
.field-lock-body {
  min-width: 0;
  display: grid;
  gap: calc(0.3rem * var(--hub-density));
}
.field-lock-body > input,
.field-lock-body > select,
.field-lock-body > textarea {
  width: 100%;
  max-width: 100%;
}
.field-lock {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--hub-muted);
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
  opacity: 0.55;
}
.field-lock:hover,
.field-lock:focus-visible {
  color: var(--hub-text);
  opacity: 1;
  outline: none;
  background: transparent;
}
.field-lockable.is-locked .field-lock {
  color: var(--hub-accent, var(--hub-primary, #2563eb));
  opacity: 1;
}
.field-lock__icon {
  width: 0.85rem;
  height: 0.85rem;
  display: block;
}
.auth-form label.hub-check {
  display: inline-flex;
  align-items: center;
  gap: var(--hub-space-sm);
  grid-template-columns: none;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="image"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
textarea,
select {
  font: inherit;
  min-height: var(--hub-control-min);
  padding: var(--hub-pad-cell-y) var(--hub-pad-cell-x);
  border: 1px solid var(--hub-border);
  border-radius: 10px;
  background: var(--hub-input-bg, var(--hub-surface));
  color: var(--hub-text);
  max-width: 100%;
  box-sizing: border-box;
}
input::placeholder,
textarea::placeholder {
  color: var(--hub-muted);
  opacity: 0.85;
}
input[type="submit"],
input[type="button"],
input[type="reset"] {
  font: inherit;
  min-height: var(--hub-control-min);
  padding: var(--hub-pad-btn-y) var(--hub-pad-btn-x);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-sizing: border-box;
}
input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: var(--hub-check);
  height: var(--hub-check);
  min-width: var(--hub-check);
  min-height: var(--hub-check);
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  border: var(--hub-check-border) solid var(--hub-border);
  background-color: var(--hub-surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 68% 68%;
  color: var(--hub-brand-ink);
  vertical-align: middle;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}
input[type="checkbox"] {
  border-radius: var(--hub-check-radius);
}
input[type="radio"] {
  border-radius: 50%;
}
input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: var(--hub-primary);
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--hub-primary) 55%, transparent);
  outline-offset: 2px;
}
input[type="checkbox"]:checked {
  background-color: var(--hub-primary);
  border-color: var(--hub-primary);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f4fff9' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E");
}
input[type="checkbox"]:indeterminate {
  background-color: var(--hub-primary);
  border-color: var(--hub-primary);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f4fff9' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3.5 8h9'/%3E%3C/svg%3E");
}
input[type="radio"]:checked {
  border-color: var(--hub-primary);
  background-color: var(--hub-surface);
  background-image: radial-gradient(
    circle at center,
    var(--hub-primary) 0 35%,
    transparent 38%
  );
  background-size: 100% 100%;
}
input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hub-check,
.prefs-field--check,
.db-admin__check {
  display: inline-flex;
  align-items: center;
  gap: var(--hub-space-sm);
  cursor: pointer;
  min-height: var(--hub-control-min);
}
.prefs-field--check {
  display: flex;
  width: 100%;
}
.hub-check input[type="checkbox"],
.hub-check input[type="radio"],
.prefs-field--check input[type="checkbox"],
.prefs-field--check input[type="radio"],
.db-admin__check input[type="checkbox"],
.db-admin__check input[type="radio"] {
  margin-top: 0;
}

.stack-form select,
.auth-form select,
.prefs-field select,
.people-card .stack-form select,
.hub-dialog .stack-form select {
  width: 100%;
}
textarea {
  min-height: calc(4.5rem * var(--hub-density));
  resize: vertical;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--hub-space-md);
  max-width: 520px;
  margin: var(--hub-space-xl) 0;
  color: var(--hub-muted);
  font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--hub-border);
}
.auth-form--sap { max-width: 520px; }
.auth-form .auth-form__row,
.stack-form .auth-form__row,
.hub-dialog__body .stack-form .auth-form__row {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  column-gap: calc(0.85rem * var(--hub-density));
  row-gap: 0.5rem;
  align-items: end;
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
}
.auth-form .auth-form__row > label,
.stack-form .auth-form__row > label,
.hub-dialog__body .stack-form .auth-form__row > label {
  display: grid !important;
  gap: calc(0.3rem * var(--hub-density));
  width: auto !important;
  min-width: 0;
  max-width: none;
  margin-bottom: 0 !important;
}
.auth-form .auth-form__row input,
.auth-form .auth-form__row input.auth-form__id,
.stack-form .auth-form__row input,
.stack-form .auth-form__row input.auth-form__id,
.hub-dialog__body .stack-form .auth-form__row input,
input.auth-form__id {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--hub-surface);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius);
  table-layout: auto;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: calc(0.65rem * var(--hub-density)) var(--hub-space-md);
  border-bottom: 1px solid var(--hub-border);
  font-size: 0.92rem;
  vertical-align: top;
}
.data-table th {
  background: color-mix(in srgb, var(--hub-primary) 10%, transparent);
  font-weight: 600;
}

.bulletin-list { list-style: none; margin: 0; padding: 0; }
.bulletin-list li {
  padding: var(--hub-space-md) 0;
  border-bottom: 1px solid var(--hub-border);
}
.bulletin-list li:last-child { border-bottom: 0; }

.alert,
.hub-toast {
  padding: calc(0.7rem * var(--hub-density)) calc(0.9rem * var(--hub-density));
  border-radius: 10px;
  border: 1px solid var(--hub-border);
  background: var(--hub-surface);
  color: var(--hub-text);
  box-shadow: var(--hub-shadow);
}
.alert-danger,
.hub-toast--danger {
  border-color: color-mix(in srgb, var(--hub-danger) 45%, var(--hub-border));
  background: color-mix(in srgb, var(--hub-danger) 8%, var(--hub-surface));
  color: var(--hub-danger);
}
.alert-success,
.hub-toast--success {
  border-color: color-mix(in srgb, var(--hub-ok) 45%, var(--hub-border));
  background: color-mix(in srgb, var(--hub-ok) 8%, var(--hub-surface));
  color: var(--hub-ok);
}
.alert-warning,
.hub-toast--warning {
  border-color: color-mix(in srgb, var(--hub-warn) 45%, var(--hub-border));
  background: color-mix(in srgb, var(--hub-warn) 8%, var(--hub-surface));
  color: var(--hub-warn);
}
.alert-info,
.hub-toast--info {
  border-color: color-mix(in srgb, var(--hub-primary) 40%, var(--hub-border));
  background: color-mix(in srgb, var(--hub-primary) 8%, var(--hub-surface));
  color: var(--hub-primary);
}

.hub-toasts {
  position: fixed;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  width: min(32rem, calc(100vw - 1.5rem));
  pointer-events: none;
}
.hub-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.65rem;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-0.55rem);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.hub-toast.is-in {
  opacity: 1;
  transform: translateY(0);
}
.hub-toast.is-out {
  opacity: 0;
  transform: translateY(-0.4rem);
}
.hub-toast__msg {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.hub-toast__close {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
}
.hub-toast__close:hover {
  opacity: 1;
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.landing__hero { margin-bottom: 1.5rem; }
.brand-hero {
  margin: 0;
  font-family: var(--hub-font-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  letter-spacing: 0.06em;
  color: var(--hub-primary);
  line-height: 0.9;
}
.landing__grid {
  display: grid;
  gap: var(--hub-space-xl);
  grid-template-columns: 1.1fr 1fr;
}
@media (max-width: 860px) {
  .landing__grid { grid-template-columns: 1fr; }
}

.status-list { line-height: 1.8; }
.module-home__header {
  position: relative;
  margin-bottom: 1rem;
}
.module-home__title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.module-home__name {
  min-width: 0;
}
.module-home__help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--hub-primary) 45%, var(--hub-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--hub-primary) 10%, var(--hub-surface, #fff));
  color: var(--hub-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transform: rotate(-8deg);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.module-home__help:hover,
.module-home__help:focus-visible {
  transform: rotate(8deg) scale(1.06);
  background: color-mix(in srgb, var(--hub-primary) 18%, var(--hub-surface, #fff));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--hub-primary) 22%, transparent);
  outline: none;
}
.module-home__help[aria-expanded="true"] {
  transform: rotate(0deg);
  background: var(--hub-primary);
  color: var(--hub-brand-ink, #fff);
  border-color: var(--hub-primary);
}
.module-home__help-face {
  display: block;
  translate: 0 0.02em;
}
.module-home__tip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.45rem);
  z-index: 20;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--hub-border);
  border-radius: 8px;
  background: var(--hub-surface, #fff);
  color: var(--hub-text);
  box-shadow: var(--hub-shadow, 0 8px 24px rgba(0, 0, 0, 0.12));
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.4;
}
.module-home__tip[hidden] {
  display: none !important;
}
.inline-form { display: inline; }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hub-space-xs) var(--hub-space-sm);
  align-items: center;
  margin: 0 0 var(--hub-space-sm);
}
.admin-toolbar label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--hub-muted);
  white-space: nowrap;
}
.admin-toolbar input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.admin-toolbar select {
  width: auto;
  min-width: 0;
  max-width: min(14rem, 100%);
  min-height: var(--hub-control-xs);
  padding: var(--hub-pad-chrome-y) var(--hub-pad-chrome-x);
  font-size: 0.85rem;
  line-height: 1.25;
  border-radius: 8px;
}
.admin-toolbar input[type="search"] {
  min-width: min(11rem, 100%);
}
.admin-toolbar .btn {
  min-height: var(--hub-control-xs);
  padding: var(--hub-pad-chrome-y) var(--hub-pad-btn-sm-x);
  font-size: 0.85rem;
}
.table-actions .inline-form {
  display: inline-flex;
  gap: var(--hub-space-xs);
  flex-wrap: wrap;
}

.notify-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--hub-space-md);
}
.notify-list__item {
  padding: calc(0.85rem * var(--hub-density)) var(--hub-space-lg);
  border: 1px solid var(--hub-border);
  background: var(--hub-surface);
}
.notify-list__item.is-unread {
  border-left: 3px solid var(--hub-accent);
}
.notify-list__head {
  display: flex;
  justify-content: space-between;
  gap: var(--hub-space-lg);
  margin-bottom: var(--hub-space-xs);
}
.notify-list__actions {
  display: flex;
  gap: var(--hub-space-md);
  align-items: center;
  margin-top: var(--hub-space-sm);
}

.u-mt-0 { margin-top: 0; }
.u-mt-05 { margin-top: var(--hub-space-sm); }
.u-mt-075 { margin-top: var(--hub-space-md); }
.u-mt-1 { margin-top: var(--hub-space-lg); }
.u-flex-gap-wrap {
  display: flex;
  gap: var(--hub-space-sm);
  flex-wrap: wrap;
}
.u-aspect-square {
  aspect-ratio: 1;
  width: 100%;
  height: auto;
}
.hub-card__title.u-flush { margin: 0; }

html.hub-dialog-open,
body.hub-dialog-open {
  overflow: hidden;
}
.hub-dialog {
  border: 1px solid var(--hub-border, #ddd);
  border-radius: 0.5rem;
  padding: 0;
  background: transparent;
  color: var(--hub-text, #111);
  width: min(28rem, calc(100vw - 2rem));
  max-height: min(90vh, calc(100vh - 2rem));
  overflow: hidden;
}
.hub-dialog::backdrop {
  background: rgba(20, 24, 22, 0.45);
}
.hub-dialog__panel {
  background: var(--hub-surface, #fff);
  border-radius: 0.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  max-height: min(90vh, calc(100vh - 2rem));
  overflow: hidden;
}
.hub-dialog__header,
.hub-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hub-space-md);
  padding: calc(0.85rem * var(--hub-density)) var(--hub-space-lg);
  border-bottom: 1px solid var(--hub-border, #ddd);
}
.hub-dialog__footer {
  border-bottom: 0;
  border-top: 1px solid var(--hub-border, #ddd);
  justify-content: flex-end;
}
.hub-dialog__header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.hub-dialog__close {
  border: 0;
  background: transparent;
  color: var(--hub-muted, #6b7280);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  min-width: var(--hub-control-min);
  min-height: var(--hub-control-min);
  padding: var(--hub-space-2xs) var(--hub-space-xs);
  border-radius: 0.25rem;
}
.hub-dialog__body {
  padding: var(--hub-space-lg);
  overflow: auto;
}
.hub-dialog__body .stack-form label {
  display: block;
  margin-bottom: var(--hub-space-md);
}
.hub-dialog__body .stack-form input {
  width: 100%;
}
.note-log {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 0;
  max-height: 24rem;
  overflow: auto;
  border: 1px solid var(--hub-border, #ddd);
  border-radius: 0.35rem;
  padding: 0.75rem;
}
