/**
 * RADEXEL Design System - Wehago Form Generator Page
 *
 * Comprehensive styles for the electronic approval form generator (8 expense types).
 * Card/grid item views, summary bar, form builder layout, autocomplete,
 * preview modal, AI analyzer, guide panel.
 * Migrated from GAS (Google Apps Script) WehagoForm v6.1.
 */

/* ==========================================================================
   Page Layout & Header
   ========================================================================== */

.wehago-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.wehago-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface);
  flex-shrink: 0;
}

.wehago-page__header-left {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.wehago-page__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin: 0;
}

.wehago-page__subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.wehago-page__header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Empty state */
.wehago-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-4);
  padding: var(--space-16);
  color: var(--color-text-muted);
}

.wehago-empty__icon {
  font-size: 64px;
  opacity: 0.3;
}

.wehago-empty__text {
  font-size: var(--font-size-md);
  text-align: center;
}

/* Loading */
.wehago-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-4);
  color: var(--color-text-muted);
}

.wehago-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--rdx-blue);
  border-radius: 50%;
  animation: wehago-spin 0.8s linear infinite;
}

.wehago-loading--sm {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.wehago-loading__spinner--sm {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--rdx-blue);
  border-radius: 50%;
  animation: wehago-spin 0.8s linear infinite;
}

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


/* ==========================================================================
   Buttons
   ========================================================================== */

.wehago-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-sans);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    border-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default),
    box-shadow var(--duration-fast) var(--ease-default);
}

.wehago-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wehago-btn--primary {
  background: var(--rdx-blue);
  color: var(--color-text-inverse);
  border-color: var(--rdx-blue);
}

.wehago-btn--primary:hover:not(:disabled) {
  background: var(--rdx-blue-dark);
  border-color: var(--rdx-blue-dark);
}

.wehago-btn--success {
  background: var(--color-success);
  color: var(--color-text-inverse);
  border-color: var(--color-success);
}

.wehago-btn--outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.wehago-btn--outline:hover:not(:disabled) {
  background: var(--color-surface-hover);
  border-color: var(--color-border-focus);
}

.wehago-btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.wehago-btn--ghost:hover:not(:disabled) {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.wehago-btn--sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
}

.wehago-btn--full {
  width: 100%;
}

.wehago-btn .material-symbols-outlined {
  font-size: 20px;
}


/* ==========================================================================
   Badges
   ========================================================================== */

.wehago-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
}

.wehago-badge--sm {
  padding: 2px var(--space-2);
  font-size: 11px;
}

.wehago-badge--success {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.wehago-badge--outline {
  background: transparent;
  border: 1px solid var(--color-border);
}


/* ==========================================================================
   PIN Badge (Common Field Indicator)
   ========================================================================== */

.wehago-pin-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
  color: var(--rdx-blue);
  background: var(--color-info-light);
  border-radius: var(--radius-sm);
  margin-left: var(--space-2);
  vertical-align: middle;
}


/* ==========================================================================
   Form Type Selector
   ========================================================================== */

.wehago-type-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.wehago-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  background: var(--color-surface);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
  transition:
    border-color var(--duration-fast) var(--ease-default),
    background-color var(--duration-fast) var(--ease-default),
    box-shadow var(--duration-fast) var(--ease-default),
    transform var(--duration-fast) var(--ease-default);
}

.wehago-type-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.wehago-type-card:focus-visible {
  outline: 2px solid var(--rdx-blue);
  outline-offset: 2px;
}

.wehago-type-card.selected {
  border-color: var(--rdx-blue);
  background: var(--color-info-light);
  box-shadow: 0 0 0 1px var(--rdx-blue);
}

.wehago-type-card__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: background-color var(--duration-fast) var(--ease-default);
}

.wehago-type-card.selected .wehago-type-card__icon {
  background: rgba(44, 92, 163, 0.15);
  color: var(--rdx-blue);
}

.wehago-type-card__name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  line-height: var(--line-height-tight);
}

.wehago-type-card__description {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}


/* ==========================================================================
   Form Builder
   ========================================================================== */

.wehago-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-4) var(--space-6);
  padding-bottom: 120px; /* room for sticky summary bar */
}

.wehago-form__section {
  margin-bottom: var(--space-6);
}

.wehago-form__section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-light);
}

.wehago-form__section-title .material-symbols-outlined {
  font-size: 20px;
  color: var(--rdx-blue);
}

.wehago-form__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-light);
}

.wehago-form__section-header .wehago-form__section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}


/* ==========================================================================
   Common Data Fields
   ========================================================================== */

.wehago-common-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.wehago-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.wehago-field--compact {
  gap: 2px;
}

.wehago-field--compact label {
  font-size: var(--font-size-xs);
}

.wehago-field label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  display: flex;
  align-items: center;
}

.wehago-field label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.wehago-field__input,
.wehago-field input,
.wehago-field select,
.wehago-field textarea {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-base);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--duration-fast) var(--ease-default),
    box-shadow var(--duration-fast) var(--ease-default);
}

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

.wehago-field__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.wehago-field__hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}


/* ==========================================================================
   Expense Items (Grid View)
   ========================================================================== */

.wehago-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wehago-items--grid {
  gap: 0;
}

.wehago-items__empty-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8);
  color: var(--color-text-muted);
  text-align: center;
}

.wehago-items__empty-msg .material-symbols-outlined {
  font-size: 48px;
  opacity: 0.3;
}

.wehago-item {
  display: grid;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.wehago-items--grid .wehago-item {
  border-radius: 0;
  border-bottom: none;
}

.wehago-items--grid .wehago-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.wehago-items--grid .wehago-item:last-child {
  border-bottom: 1px solid var(--color-border-light);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.wehago-item--header {
  background: var(--color-bg-tertiary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
}

.wehago-item--total {
  background: var(--color-info-light);
  font-weight: var(--font-weight-bold);
}

.wehago-item__cell--header {
  text-align: center;
}

.wehago-item__cell--total-value {
  text-align: right;
  color: var(--rdx-blue);
  font-size: var(--font-size-md);
}

.wehago-item:hover {
  border-color: var(--color-border);
}

.wehago-item__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
}

.wehago-item__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);
}

.wehago-item__remove:hover {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* Grid input */
.wehago-grid-input {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.wehago-grid-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  background: var(--color-bg);
}

.wehago-grid-input:hover:not(:focus) {
  border-color: var(--color-border-light);
}


/* ==========================================================================
   Card View
   ========================================================================== */

.wehago-items--cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

.wehago-items--empty {
  display: flex;
  justify-content: center;
}

.wehago-item-card {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  transition:
    border-color var(--duration-fast) var(--ease-default),
    box-shadow var(--duration-fast) var(--ease-default);
}

.wehago-item-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.wehago-item-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.wehago-item-card__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wehago-item-card__amount {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--rdx-blue);
  text-align: right;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-light);
}


/* ==========================================================================
   Summary Bar (Sticky Bottom)
   ========================================================================== */

.wehago-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
}

.wehago-summary__info {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.wehago-summary__stat {
  display: flex;
  flex-direction: column;
}

.wehago-summary__stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.wehago-summary__stat-value {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.wehago-summary__total {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--rdx-blue);
}

.wehago-summary__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}


/* ==========================================================================
   Vendor Autocomplete
   ========================================================================== */

.wehago-autocomplete {
  position: relative;
}

.wehago-autocomplete__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.wehago-autocomplete__input {
  width: 100%;
}

.wehago-autocomplete__spinner {
  position: absolute;
  right: 10px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--rdx-blue);
  border-radius: 50%;
  animation: wehago-spin 0.8s linear infinite;
}

.wehago-autocomplete__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 240px;
  overflow-y: auto;
}

.wehago-autocomplete__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.wehago-autocomplete__item:hover,
.wehago-autocomplete__item.highlighted {
  background: var(--color-surface-hover);
}

.wehago-autocomplete__item-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.wehago-autocomplete__item-detail {
  display: flex;
  gap: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.wehago-autocomplete__empty {
  padding: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
}


/* ==========================================================================
   Preview Modal
   ========================================================================== */

.wehago-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  padding: var(--space-6);
  animation: wehago-fade-in 0.2s var(--ease-default);
}

@keyframes wehago-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.wehago-modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  width: 100%;
  max-width: 800px;
  animation: wehago-slide-up 0.3s var(--ease-out);
}

.wehago-modal--lg {
  max-width: 960px;
}

@keyframes wehago-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.wehago-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.wehago-modal__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin: 0;
}

.wehago-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.wehago-modal__close:hover {
  background: var(--color-surface-hover);
}

.wehago-modal__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.wehago-modal__meta-total {
  margin-left: auto;
  font-weight: var(--font-weight-semibold);
  color: var(--rdx-blue);
}

.wehago-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-6);
}

.wehago-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
}

.wehago-preview-container {
  overflow-x: auto;
}

.wehago-preview-container table {
  width: 100%;
}


/* ==========================================================================
   Side Panel (AI Analyzer, Guide Panel)
   ========================================================================== */

.wehago-panel {
  position: fixed;
  top: var(--topbar-height, 56px);
  bottom: 0;
  width: 400px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  animation: wehago-slide-in-right 0.3s var(--ease-out);
}

.wehago-panel--right {
  right: 0;
}

@keyframes wehago-slide-in-right {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.wehago-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.wehago-panel__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin: 0;
}

.wehago-panel__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.wehago-panel__close:hover {
  background: var(--color-surface-hover);
}

.wehago-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}


/* ==========================================================================
   AI Analyzer Panel
   ========================================================================== */

.wehago-tab-bar {
  display: flex;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.wehago-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-sans);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);
}

.wehago-tab.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.wehago-ai__textarea {
  resize: vertical;
  min-height: 200px;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.wehago-ai__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-secondary);
  text-align: center;
  transition:
    border-color var(--duration-fast) var(--ease-default),
    background-color var(--duration-fast) var(--ease-default);
}

.wehago-ai__dropzone--active {
  border-color: var(--rdx-blue);
  background: var(--color-info-light);
}

.wehago-ai__dropzone-icon {
  font-size: 48px;
  color: var(--color-text-muted);
}

.wehago-ai__dropzone-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.wehago-ai__dropzone-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.wehago-link {
  color: var(--rdx-blue);
  background: none;
  border: none;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.wehago-link:hover {
  color: var(--rdx-blue-dark);
}

.wehago-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: wehago-spin 0.8s linear infinite;
}

.wehago-spinner--sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--rdx-blue);
  border-radius: 50%;
  animation: wehago-spin 0.8s linear infinite;
}

/* AI Results */
.wehago-ai__results {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-success-light);
  border-radius: var(--radius-md);
}

.wehago-ai__results-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-success-dark);
  margin: 0;
}

.wehago-ai__results-summary {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  margin: 0;
}

.wehago-ai__results-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.wehago-ai__result-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}

.wehago-ai__result-num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.wehago-ai__result-desc {
  flex: 1;
  color: var(--color-text);
}

.wehago-ai__result-amount {
  font-weight: var(--font-weight-semibold);
  color: var(--rdx-blue);
  white-space: nowrap;
}

.wehago-ai__results-empty {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
}


/* ==========================================================================
   Alert
   ========================================================================== */

.wehago-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.wehago-alert--error {
  background: var(--color-danger-light);
  color: var(--color-danger-dark);
}

.wehago-alert .material-symbols-outlined {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}


/* ==========================================================================
   Guide Panel
   ========================================================================== */

.wehago-guide__ask {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.wehago-guide__ask-input-wrap {
  display: flex;
  gap: var(--space-2);
}

.wehago-guide__ask-input-wrap input {
  flex: 1;
}

.wehago-guide__answer {
  background: var(--color-info-light);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.wehago-guide__answer-header {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--rdx-blue);
  margin-bottom: var(--space-2);
}

.wehago-guide__answer-text {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  line-height: var(--line-height-relaxed);
  white-space: pre-wrap;
}

.wehago-divider {
  border: none;
  border-top: 1px solid var(--color-border-light);
  margin: 0;
}

.wehago-guide__categories {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wehago-guide__empty {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-4);
}

.wehago-guide__category-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg-secondary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.wehago-guide__category-header:hover {
  background: var(--color-bg-tertiary);
}

.wehago-guide__category-header.expanded {
  background: var(--color-info-light);
  color: var(--rdx-blue);
}

.wehago-guide__count {
  margin-left: auto;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

.wehago-guide__rules {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) 0 0 var(--space-3);
}

.wehago-guide__rule {
  padding: var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}

.wehago-guide__rule-header {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.wehago-guide__rule-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  margin: 0;
  line-height: var(--line-height-relaxed);
}

.wehago-guide__rule-detail {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-light);
  line-height: var(--line-height-relaxed);
}


/* ==========================================================================
   Utility: Screen Reader Only
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* ==========================================================================
   View Toggle (Grid / Card)
   ========================================================================== */

.wehago-view-toggle {
  display: flex;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.wehago-view-toggle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);
}

.wehago-view-toggle__btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.wehago-view-toggle__btn svg {
  width: 16px;
  height: 16px;
}


/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .wehago-panel {
    width: 360px;
  }
}

@media (max-width: 768px) {
  .wehago-page__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .wehago-type-selector {
    grid-template-columns: repeat(2, 1fr);
    padding: var(--space-3) var(--space-4);
  }

  .wehago-form {
    padding: var(--space-3) var(--space-4);
    padding-bottom: 140px;
  }

  .wehago-common-fields {
    grid-template-columns: 1fr;
  }

  .wehago-items--cards {
    grid-template-columns: 1fr;
  }

  .wehago-item {
    gap: var(--space-2);
    font-size: var(--font-size-sm);
  }

  .wehago-summary {
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .wehago-summary__info {
    width: 100%;
    justify-content: space-between;
  }

  .wehago-summary__actions {
    width: 100%;
  }

  .wehago-summary__actions .wehago-btn {
    flex: 1;
  }

  .wehago-panel {
    width: 100%;
    left: 0;
  }
}

@media (max-width: 480px) {
  .wehago-type-selector {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .wehago-type-card {
    flex-direction: row;
    text-align: left;
    padding: var(--space-3);
  }

  .wehago-type-card__icon {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
}
