/* Reusable components. Specs from the design's Components tab (tokens only). */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h-sm);
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--fs-md);
  white-space: nowrap;
  text-decoration: none;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.button:disabled,
.button[aria-disabled='true'] {
  background: var(--surface-3);
  color: var(--text-3);
  border-color: transparent;
  cursor: not-allowed;
}
.button--primary {
  background: var(--primary);
  color: var(--on-primary);
}
.button--primary:not(:disabled):hover {
  background: var(--primary-hover);
}
.button--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.button--secondary:not(:disabled):hover {
  background: var(--surface-2);
}
.button--soft {
  background: var(--primary-soft);
  color: var(--primary-text);
}
.button--danger {
  background: var(--surface);
  color: var(--red);
  border-color: var(--red);
}
.button--danger:not(:disabled):hover {
  background: var(--red-soft);
}
.button--ghost {
  background: transparent;
  color: var(--text-2);
}
.button--ghost:not(:disabled):hover {
  background: var(--surface-2);
  color: var(--text);
}
.button--lg {
  height: var(--control-h-lg);
  padding: 0 20px;
  font-size: var(--fs-lg);
}
.button--md {
  height: var(--control-h);
}
.button--block {
  width: 100%;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-xl);
  line-height: 1;
}
.icon-button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
}
.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.field__error {
  font-size: var(--fs-xs);
  color: var(--red);
  font-weight: 600;
}
.input,
.select,
.textarea {
  width: 100%;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.textarea {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}
.input::placeholder {
  color: var(--text-2);
  opacity: 0.9;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--primary);
}
.input--error {
  border-color: var(--red);
  background: var(--red-soft);
}
.input:disabled,
.select:disabled {
  background: var(--surface-3);
  color: var(--text-3);
}
.input--lg {
  height: 44px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.toggle {
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--border-strong);
  transition: background 0.15s;
  flex: none;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: inset-inline-start 0.15s;
}
.toggle[aria-checked='true'] {
  background: var(--green);
}
.toggle[aria-checked='true']::after {
  inset-inline-start: 19px;
}
.toggle--primary[aria-checked='true'] {
  background: var(--primary);
}
.toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-2);
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--tone-soft);
  /* Label in --text, not --tone: the design's tone colours fail AA at 12 px on the soft
     backgrounds (3.2–4.4:1). The dot carries the colour. See docs/design-deviations.md. */
  color: var(--text);
}
.status-chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tone);
}
.tone-green {
  --tone: var(--green);
  --tone-soft: var(--green-soft);
}
.tone-amber {
  --tone: var(--amber);
  --tone-soft: var(--amber-soft);
}
.tone-red {
  --tone: var(--red);
  --tone-soft: var(--red-soft);
}
.tone-grey {
  --tone: var(--grey);
  --tone-soft: var(--grey-soft);
}
.tone-blue {
  --tone: var(--blue);
  --tone-soft: var(--blue-soft);
}
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  gap: 2px;
}
.segmented__item {
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  height: 30px;
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  font-size: var(--fs-sm);
}
.segmented__item[aria-pressed='true'] {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-1);
}
.tabs {
  display: flex;
  gap: var(--sp-4);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; /* seven tabs do not fit a phone: scroll, never clip */
  scrollbar-width: thin;
}
.tabs__tab {
  flex-shrink: 0;
  white-space: nowrap;
  border: 0;
  background: transparent;
  padding: 10px 2px;
  margin-bottom: -1px;
  color: var(--text-2);
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.tabs__tab[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--primary);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-1);
}
.card__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--sp-3);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}
.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--tone);
  background: var(--tone-soft);
  color: var(--text);
}
.alert .icon {
  color: var(--tone);
}
.hint-strip {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--blue-soft);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--text-2);
  text-align: center;
}
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(
    90deg,
    var(--surface-3) 25%,
    var(--surface-2) 50%,
    var(--surface-3) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
  min-height: 14px;
}
.error-box {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--red-soft);
  border: 1px solid var(--red);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
[dir='rtl'] .table th {
  letter-spacing: normal;
  text-transform: none;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:hover td {
  background: var(--surface-2);
}

/* Page guide (G1). The dimming never catches clicks: saving and publishing stay possible. */
.page-help {
  display: none;
}
html[data-guide-page] .page-help {
  display: inline-flex;
}
.topbar__slot {
  display: inline-flex;
}
.guide {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}
.guide__scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 10, 0.45);
}
.guide__spot {
  position: fixed;
  border-radius: var(--r-md);
  box-shadow:
    0 0 0 3px var(--primary),
    0 0 0 9999px rgba(20, 16, 10, 0.45);
  transition:
    top 0.2s ease,
    left 0.2s ease,
    width 0.2s ease,
    height 0.2s ease;
}
.guide__card {
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 28px);
  pointer-events: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.guide__card--sheet {
  inset: auto 0 0 0;
  width: auto;
  max-width: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
}
.guide__count {
  font-size: var(--fs-xs);
  color: var(--text-2);
  margin: 0;
}
.guide__title {
  font-size: var(--fs-lg);
  margin: 0;
}
.guide__body {
  margin: 0;
  color: var(--text-2);
  line-height: 1.5;
}
.guide__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.guide__actions .grow {
  flex: 1;
}
@media (prefers-reduced-motion: reduce) {
  .guide__spot {
    transition: none;
  }
}
