/* GetXtra Tools 2.0 — UI components. See /styleguide for a live preview of each. */

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  --btn-hover: var(--bg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
  user-select: none;
}

.btn:hover {
  background: var(--btn-hover);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-offset), var(--ring);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
  box-shadow: none;
}

.btn-primary {
  --btn-bg: var(--brand);
  --btn-fg: var(--brand-fg);
  --btn-border: transparent;
  --btn-hover: var(--brand-hover);
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.12), inset 0 1px 0 rgb(255 255 255 / 0.12);
}

.btn-secondary {
  --btn-bg: var(--bg-muted);
  --btn-border: transparent;
  --btn-hover: var(--border);
  box-shadow: none;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-hover: var(--bg-muted);
  box-shadow: none;
}

.btn-danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-border: transparent;
  --btn-hover: color-mix(in srgb, var(--danger) 88%, #000);
}

[data-theme="dark"] .btn-danger {
  --btn-fg: #1a0705;
}

.btn-sm {
  min-height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}

.btn-lg {
  min-height: 48px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
}

.btn-xl {
  min-height: 56px;
  padding: 0 var(--space-8);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
}

.btn-icon {
  width: 40px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
}

.btn-block {
  width: 100%;
}

.btn .spinner {
  width: 1em;
  height: 1em;
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: var(--space-2);
}

.field + .field {
  margin-top: var(--space-5);
}

.label {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}

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

.field-error {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-base);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}

.textarea {
  min-height: 120px;
  padding: var(--space-3);
  line-height: var(--leading-normal);
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-subtle);
  opacity: 0.85;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-subtle));
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--danger);
}

.select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

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

.input-group > .icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-subtle);
  pointer-events: none;
}

.input-group > .input {
  padding-left: 2.5rem;
}

.input-group .input-addon {
  position: absolute;
  right: var(--space-2);
}

.input-color {
  width: 48px;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

/* Checkbox & radio */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
}

.check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* Toggle switch: <label class="switch"><input type="checkbox" role="switch"><span class="switch-track"></span> Text</label> */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: background-color var(--duration) var(--ease);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform var(--duration) var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--brand);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: var(--ring-offset), var(--ring);
}

/* Range slider */
.range {
  width: 100%;
  height: 24px;
  accent-color: var(--brand);
  cursor: pointer;
}

.range-value {
  min-width: 3.5ch;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: var(--text-sm);
  text-align: right;
}

/* Segmented control: radio buttons styled as a pill group */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--bg-muted);
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.segmented span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 34px;
  padding: 0 var(--space-3);
  border-radius: calc(var(--radius) - 3px);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 550;
  transition: background-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented input:focus-visible + span {
  box-shadow: var(--ring);
}

.segmented-block {
  display: flex;
}

.segmented-block label {
  flex: 1;
}

.segmented-block span {
  width: 100%;
  justify-content: center;
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card-body {
  padding: var(--space-6);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
  font-size: var(--text-base);
  font-weight: 650;
}

.card-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Tool card */
.tool-card {
  position: relative;
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.tool-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.tool-card:focus-visible {
  outline: none;
  box-shadow: var(--ring-offset), var(--ring);
}

.tool-card h3 {
  font-size: var(--text-base);
  font-weight: 650;
}

.tool-card p {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.tool-card .badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

.tool-icon {
  --tile: var(--brand-soft);
  --tile-fg: var(--brand-text);
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--tile);
  color: var(--tile-fg);
}

.tool-icon .icon {
  width: 22px;
  height: 22px;
}

/* ---------- Shortcuts (landing pages such as "PNG to JPG") ---------- */
.shortcuts-section {
  margin-top: var(--space-12);
}

.shortcuts-section h2 {
  margin-bottom: var(--space-4);
  font-size: var(--text-xl);
}

.shortcut-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.shortcut-list li[hidden] {
  display: none;
}

.shortcut {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  min-height: 44px;
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 550;
  text-decoration: none;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}

.shortcut:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.shortcut:focus-visible {
  outline: none;
  box-shadow: var(--ring-offset), var(--ring);
}

.tool-icon-sm {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
}

.tool-icon-sm .icon {
  width: 16px;
  height: 16px;
}

.tool-icon-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.tool-icon-lg .icon {
  width: 28px;
  height: 28px;
}

.cat-pdf {
  --tile: var(--cat-pdf-soft);
  --tile-fg: var(--cat-pdf);
}

.cat-image {
  --tile: var(--cat-image-soft);
  --tile-fg: var(--cat-image);
}

.cat-ai {
  --tile: var(--cat-ai-soft);
  --tile-fg: var(--cat-ai);
}

.cat-other {
  --tile: var(--cat-other-soft);
  --tile-fg: var(--cat-other);
}

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-brand {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 550;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
  text-decoration: none;
}

.chip[aria-pressed="true"],
.chip[aria-current="page"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.chip .count {
  color: inherit;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--info-soft);
  color: var(--text);
  font-size: var(--text-sm);
}

.alert > .icon {
  margin-top: 1px;
  color: var(--info);
}

.alert-success {
  background: var(--success-soft);
}

.alert-success > .icon {
  color: var(--success);
}

.alert-warning {
  background: var(--warning-soft);
}

.alert-warning > .icon {
  color: var(--warning);
}

.alert-danger {
  background: var(--danger-soft);
}

.alert-danger > .icon {
  color: var(--danger);
}

/* ---------- Tabs ---------- */
.tabs [role="tablist"] {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs [role="tab"] {
  position: relative;
  padding: var(--space-3) var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.tabs [role="tab"]:hover {
  color: var(--text);
}

.tabs [role="tab"][aria-selected="true"] {
  color: var(--text);
}

.tabs [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-2);
  right: var(--space-2);
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.tabs [role="tabpanel"] {
  padding-top: var(--space-5);
}

/* ---------- Accordion (native <details>) ---------- */
.accordion {
  border-top: 1px solid var(--border);
}

.accordion details {
  border-bottom: 1px solid var(--border);
}

.accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-1);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

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

.accordion summary .icon {
  color: var(--text-subtle);
  transition: transform var(--duration) var(--ease);
}

.accordion details[open] summary .icon {
  transform: rotate(180deg);
}

.accordion summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.accordion .accordion-body {
  padding: 0 var(--space-1) var(--space-5);
  color: var(--text-muted);
}

/* ---------- Dropdown menu ---------- */
.dropdown {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: var(--z-dropdown);
  min-width: 220px;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: pop-in var(--duration) var(--ease);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}

.menu-item .icon {
  color: var(--text-subtle);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--bg-muted);
  text-decoration: none;
  outline: none;
}

.menu-sep {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--border);
}

.menu-label {
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-4px);
  }
}

/* ---------- Modal (native <dialog>) ---------- */
.modal {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-xl);
}

.modal::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(3px);
}

.modal[open] {
  animation: pop-in var(--duration) var(--ease);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6) 0;
}

.modal-header h2 {
  font-size: var(--text-lg);
}

.modal-body {
  padding: var(--space-4) var(--space-6);
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6) var(--space-6);
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: min(400px, 100%);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in var(--duration-slow) var(--ease);
}

.toast > .icon {
  margin-top: 1px;
  color: var(--info);
}

.toast-success > .icon {
  color: var(--success);
}

.toast-error > .icon {
  color: var(--danger);
}

.toast-warning > .icon {
  color: var(--warning);
}

.toast p {
  flex: 1;
}

.toast .btn {
  margin: -4px -8px -4px 0;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--duration) var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  list-style: none;
  color: var(--text-subtle);
  font-size: var(--text-sm);
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.breadcrumbs li + li::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  opacity: 0.6;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--text-subtle);
  font-size: var(--text-sm);
}

.pagination-links {
  display: flex;
  gap: var(--space-1);
}

.pagination-links a,
.pagination-links span {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 550;
  text-decoration: none;
}

.pagination-links a:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.pagination-links [aria-current="page"] {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Tables ---------- */
.table-wrap {
  position: relative; /* keeps visually hidden labels inside the scroll box */
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

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

.table th {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

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

.table tbody tr:hover {
  background: var(--bg-subtle);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Empty state ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-muted);
  color: var(--text-subtle);
}

.empty h3 {
  color: var(--text);
  font-size: var(--text-lg);
}

/* ---------- Skeleton & spinner ---------- */
.skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--border) 37%, var(--bg-muted) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .spinner {
    animation-duration: 2.5s;
  }
}

/* ---------- Progress ---------- */
.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #22d3ee));
  transition: width var(--duration-slow) var(--ease);
}

.progress[data-indeterminate] .progress-bar {
  width: 35%;
  animation: indeterminate 1.2s var(--ease) infinite;
}

@keyframes indeterminate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(300%);
  }
}

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-xl);
}

/* ---------- Stat ---------- */
.stat {
  padding: var(--space-5);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-subtle);
  font-size: var(--text-sm);
  font-weight: 500;
}

.stat-value {
  margin-top: var(--space-2);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}

/* ---------- Description list ---------- */
.dl {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: max-content minmax(0, 1fr);
  font-size: var(--text-sm);
}

.dl dt {
  color: var(--text-subtle);
}

.dl dd {
  margin: 0;
  font-weight: 500;
}

/* Password field with a show/hide button */
.input-password > .input {
  padding-left: var(--space-3);
  padding-right: 2.75rem;
}

/* ---------- Tool card with favourite star (Phase 3) ---------- */
.tool-card-wrap {
  position: relative;
  display: grid;
}

.tool-card-wrap[hidden] {
  display: none;
}

.tool-card-wrap > .tool-card {
  height: 100%;
  padding-right: calc(var(--space-5) + 32px);
}

.tool-card-wrap > .fav-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

.fav-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--text-subtle);
  transition: color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}

.fav-btn:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.fav-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-offset), var(--ring);
}

.fav-btn:active {
  transform: scale(0.92);
}

.fav-btn .fav-icon {
  width: 18px;
  height: 18px;
}

.fav-btn[aria-pressed="true"] {
  color: #d99a00;
}

.fav-btn[aria-pressed="true"] .fav-icon {
  fill: currentColor;
}

[data-theme="dark"] .fav-btn[aria-pressed="true"] {
  color: #f5c542;
}

.fav-btn.fav-btn-text {
  display: inline-flex;
  width: auto;
  height: auto;
  min-height: 36px;
  gap: var(--space-2);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.fav-btn.fav-btn-text[aria-pressed="true"] .fav-icon {
  color: #d99a00;
}

[data-theme="dark"] .fav-btn.fav-btn-text[aria-pressed="true"] .fav-icon {
  color: #f5c542;
}

/* ---------- Avatars with pictures ---------- */
.avatar-img {
  object-fit: cover;
  background: var(--bg-muted);
}

.avatar-xl {
  width: 72px;
  height: 72px;
  font-size: var(--text-2xl);
}

/* ---------- Sign in with Google ---------- */
.btn-google {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  --btn-hover: var(--bg-muted);
}

.google-logo {
  flex: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-4);
  color: var(--text-subtle);
  font-size: var(--text-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* A button that looks like a link (for small secondary actions). */
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-text);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-button:hover {
  text-decoration-thickness: 2px;
}

.card-danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.card-danger .card-header h2 {
  color: var(--danger);
}

/* ---------- Support tickets (Phase 3 batch C): conversation, attachments ---------- */
.thread {
  margin: 0;
  padding: 0;
  list-style: none;
}

.thread-item {
  padding: var(--space-4) var(--space-5);
}

.thread-item + .thread-item {
  border-top: 1px solid var(--border);
}

.thread-staff {
  background: var(--bg-subtle);
}

.thread-note {
  background: var(--warning-soft, #fff7e6);
}

.thread-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

.thread-who {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.thread-head time {
  margin-left: auto;
}

.thread-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  text-decoration: none;
}

.attachment span:first-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.input-file {
  padding-block: 7px;
  height: auto;
}

.ticket-meta {
  margin-bottom: var(--space-4);
}

.ticket-layout {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 1100px) {
  .ticket-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

.ticket-cell {
  display: grid;
  gap: 2px;
  min-width: 14rem;
  color: var(--text);
}

.bulk-bar {
  margin-bottom: var(--space-3);
}

.bulk-bar .select {
  width: auto;
  min-width: 0;
  max-width: 100%;
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.canned-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
