/* SH2X Dashboard Styles - Orman Clark Inspired */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #eef1f5;
  --color-card: #ffffff;
  --color-border: #dde1e6;
  --color-border-light: #e8ecf0;
  --color-text: #2c3e50;
  --color-text-muted: #7b8a99;
  --color-text-light: #9ba8b5;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

html {
  overflow-y: scroll; /* Always show scrollbar to prevent layout shift */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Layout */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #1d1d1f 0%, #2d2d2f 100%);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.app-subtitle {
  font-size: 14px;
  color: var(--color-text-light);
}

/* Tab Navigation */
.tab-nav {
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  padding: 0 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 0;
  z-index: 50;
}

.tab-btn {
  padding: 16px 24px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Tab Content */
.tab-content {
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Section Headers for all tabs */
.panel-content h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-light);
}

/* Search Section */
.search-section {
  margin-bottom: 20px;
}

.search-section form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.search-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.search-input-group input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-group input:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.search-input-group button {
  padding: 12px 16px;
  background: #0071e3;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-input-group button:hover {
  background: #0077ed;
}

.search-input-group button svg {
  width: 20px;
  height: 20px;
}

.search-input-group button.loading {
  opacity: 0.7;
  pointer-events: none;
}

.search-input-group button.loading svg {
  animation: spin 1s linear infinite;
}

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

.nav-controls {
  display: flex;
  gap: 8px;
}

.nav-btn {
  padding: 8px 16px;
  font-size: 13px;
  background: var(--color-card);
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  cursor: pointer;
  color: #1d1d1f;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: #f5f5f7;
  border-color: var(--color-text-light);
}

/* Status Area */
.status-area {
  text-align: center;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.status-area.error {
  background: #fef2f2;
  color: #dc2626;
}

/* Cards */
.card {
  background: var(--color-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Field Row */
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.secondary-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f2;
}

.field {
  flex: 1;
  min-width: 120px;
}

.field.contact-field {
  flex: 2;
  min-width: 200px;
}

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.field-value {
  font-size: 14px;
  color: #1d1d1f;
}

/* Copyable */
.copyable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.copyable:hover {
  background: #f5f5f7;
}

.copyable .val {
  font-size: 14px;
  color: #1d1d1f;
}

.copy-btn {
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.copyable:hover .copy-btn {
  opacity: 0.5;
}

.copy-btn:hover {
  opacity: 1 !important;
}

.copy-btn svg {
  width: 14px;
  height: 14px;
  stroke: var(--color-text-light);
}

.copy-btn.copied svg {
  stroke: #34c759;
}

/* Currency badge */
.currency-badge {
  font-size: 11px;
  background: #e5f2ff;
  color: #0071e3;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Warning */
.warning {
  background: #fff8e6;
  color: #b45309;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Line Items Table */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.line-items-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--color-border);
}

.line-items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f2;
  vertical-align: middle;
}

.line-items-table th.r,
.line-items-table td.r {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.line-items-table td .copyable {
  padding: 2px 6px;
}

.line-items-table td.r .copyable {
  justify-content: flex-end;
}

.line-items-table tbody tr:hover {
  background: #fafafa;
}

.line-items-table tr.fee-row {
  color: #dc2626;
  background: #fef2f2;
}

.line-items-table tr.shipping-row {
  color: var(--color-text-muted);
}

.line-items-table tr.tax-row {
  color: #0071e3;
  background: #e5f2ff;
}

.line-items-table tr.rounding-row {
  color: var(--color-text-muted);
  font-style: italic;
}

.line-items-table tfoot td {
  font-weight: 500;
}

.line-items-table tfoot .label {
  text-align: right;
  color: var(--color-text-muted);
  padding-right: 16px;
}

.line-items-table tfoot .amount {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 100px;
}

.line-items-table .total-row td {
  font-weight: 700;
  font-size: 14px;
  border-top: 2px solid var(--color-border);
}

.line-items-table .total-row .amount {
  font-variant-numeric: tabular-nums;
}

/* Conversion note */
.conversion-note {
  font-size: 10px;
  color: var(--color-text-light);
  margin-top: 2px;
  font-style: italic;
}

/* Discount cell */
.discount-cell .copyable {
  color: #7c3aed;
  font-weight: 500;
}

/* Payment Card */
.payment-card {
  background: #fafafa;
}

.payment-header {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.payment-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.payment-label {
  font-size: 11px;
  color: var(--color-text-light);
  text-transform: uppercase;
}

.payment-value {
  font-size: 14px;
  font-weight: 500;
}

.payment-value.fee {
  color: #dc2626;
}

.payment-value.net {
  color: #34c759;
}

.payment-row-border {
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  margin-top: 12px;
}

/* Xero Actions */
.xero-actions {
  text-align: center;
  padding: 16px;
}

.send-to-xero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #13B5EA;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.send-to-xero-btn:hover {
  background: #0ea5d9;
}

.send-to-xero-btn svg {
  width: 18px;
  height: 18px;
}

/* Extra Info */
.extra-info {
  margin-top: 16px;
}

.extra-info summary {
  padding: 12px 16px;
  background: var(--color-card);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  color: var(--color-text-muted);
}

.extra-info[open] summary {
  border-radius: 10px 10px 0 0;
}

.extra-fields {
  background: var(--color-card);
  padding: 16px;
  border-radius: 0 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Results loading state */
.results.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ============ BATCH ACTIONS ============ */
.batch-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.batch-description {
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.batch-input-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.batch-input-area textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  font-size: 14px;
  font-family: 'SF Mono', Monaco, monospace;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  resize: vertical;
  outline: none;
}

.batch-input-area textarea:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.batch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.batch-btn.primary {
  background: #0071e3;
  color: white;
}

.batch-btn.primary:hover:not(:disabled) {
  background: #0077ed;
}

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

.batch-btn svg {
  width: 18px;
  height: 18px;
}

.batch-results {
  margin-top: 24px;
}

.batch-summary {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.batch-summary span {
  font-weight: 600;
}

#batch-valid-count { color: #34c759; }
#batch-invalid-count { color: #dc2626; }
#batch-exists-count { color: #f59e0b; }

.batch-orders-list {
  background: var(--color-card);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.batch-order-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f2;
  gap: 12px;
}

.batch-order-item:last-child {
  border-bottom: none;
}

.batch-order-number {
  font-weight: 600;
  min-width: 80px;
}

.batch-order-contact {
  flex: 1;
  color: var(--color-text-muted);
}

.batch-order-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.batch-order-status.valid {
  background: #dcfce7;
  color: #166534;
}

.batch-order-status.invalid {
  background: #fef2f2;
  color: #dc2626;
}

.batch-order-status.exists {
  background: #fef3c7;
  color: #b45309;
}

.batch-order-status.sent {
  background: #10b981;
  color: #fff;
}

.batch-actions {
  display: flex;
  gap: 12px;
}

.batch-progress {
  margin-top: 20px;
}

.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #0071e3;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
}

/* ============ INTEGRATIONS ============ */
.integration-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
}

.integration-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.integration-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.integration-logo svg {
  width: 28px;
  height: 28px;
}

.xero-logo {
  background: #13B5EA;
  color: white;
}

.shopify-logo {
  background: #96bf48;
  color: white;
}

.integration-info {
  flex: 1;
}

.integration-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.integration-info p {
  font-size: 13px;
  color: var(--color-text-muted);
}

.integration-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 16px;
  font-weight: 500;
}

.status-badge.connected {
  background: #dcfce7;
  color: #166534;
}

.status-badge.disconnected {
  background: #fef2f2;
  color: #dc2626;
}

.connect-btn, .disconnect-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.connect-btn {
  background: #13B5EA;
  color: white;
  border: none;
}

.connect-btn:hover {
  background: #0ea5d9;
}

.disconnect-btn {
  background: var(--color-card);
  color: #dc2626;
  border: 1px solid #fecaca;
}

.disconnect-btn:hover {
  background: #fef2f2;
}

.text-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.text-btn:hover {
  opacity: 0.8;
}

.integration-details {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f2;
}

.integration-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.detail-label {
  color: var(--color-text-muted);
  font-size: 13px;
}

.detail-value {
  font-weight: 500;
  font-size: 13px;
}

/* Integration Store List (Shopify) */
.integration-stores-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.integration-store-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f5f5f7;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.integration-store-item.active {
  background: #e8f5e9;
  border-color: #95bf47;
}

.store-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.store-item-name {
  font-weight: 500;
  font-size: 14px;
  color: #1d1d1f;
}

.store-item-domain {
  font-size: 12px;
  color: var(--color-text-muted);
}

.store-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.store-active-badge {
  font-size: 11px;
  font-weight: 600;
  color: #2e7d32;
  background: rgba(46, 125, 50, 0.15);
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.store-select-btn {
  font-size: 12px;
  font-weight: 500;
  color: #0071e3;
  background: transparent;
  border: 1px solid #0071e3;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.store-select-btn:hover {
  background: #0071e3;
  color: white;
}

.store-disconnect-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 400;
  color: var(--color-text-light);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.store-disconnect-btn:hover {
  color: #e53935;
  background: rgba(229, 57, 53, 0.1);
}

.store-env-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 14px;
  color: var(--color-text-light);
  cursor: help;
}

.shopify-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #95bf47;
  border-color: #95bf47;
}

.shopify-connect-btn:hover {
  background: #7aa93c;
  border-color: #7aa93c;
}

.shopify-connect-btn svg {
  width: 14px;
  height: 14px;
}

/* ============ SETTINGS ============ */
.settings-section {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
}

.settings-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-light);
}

/* Account Section */
.account-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.account-avatar svg {
  width: 28px;
  height: 28px;
  color: var(--color-text-muted);
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-email {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text);
}

.account-id {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-family: monospace;
}

.account-actions {
  display: flex;
  gap: 12px;
}

.secondary-btn {
  padding: 10px 18px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-btn:hover {
  background: var(--color-border);
}

.danger-btn {
  padding: 10px 18px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #dc2626;
  cursor: pointer;
  transition: all 0.2s;
}

.danger-btn:hover {
  background: #fee2e2;
}

.settings-description {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.setting-row {
  margin-bottom: 16px;
}

.setting-row label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.setting-row input[type="number"] {
  width: 100px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  outline: none;
}

.setting-row input:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.setting-help {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 4px;
}

.gl-mapping-table {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}

.gl-row {
  display: grid;
  grid-template-columns: 150px 100px 1fr;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid #f0f0f2;
}

.gl-row:last-child {
  border-bottom: none;
}

.gl-row.header {
  background: #f5f5f7;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.gl-row span {
  font-size: 14px;
}

.gl-code-input, .gl-name-input {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  outline: none;
}

.gl-code-input {
  width: 80px;
  font-family: 'SF Mono', Monaco, monospace;
}

.gl-name-input {
  width: 100%;
}

.gl-code-input:focus, .gl-name-input:focus {
  border-color: #0071e3;
}

.save-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 24px;
  background: #34c759;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.save-btn:hover {
  background: #2db94d;
}

.save-btn svg {
  width: 18px;
  height: 18px;
}

/* ============ MODAL ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: var(--color-card);
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f7;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-muted);
}

.modal-close:hover {
  background: var(--color-border);
}

.modal-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.modal-value {
  font-size: 15px;
  color: #1d1d1f;
}

.modal-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* Xero line items table in modal */
.xero-line-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.xero-line-items th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  border-bottom: 2px solid var(--color-border);
}

.xero-line-items td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f2;
}

.xero-line-items .r {
  text-align: right;
}

.xero-line-items .account-name {
  font-weight: 500;
  color: #1d1d1f;
}

.xero-line-items .account-code {
  font-size: 10px;
  color: var(--color-text-light);
  margin-left: 4px;
}

.xero-line-items .tax-type {
  font-size: 11px;
  color: var(--color-text-muted);
}

.xero-line-items tfoot td {
  border-bottom: none;
  padding-top: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  background: #fafafa;
}

.modal-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn.secondary {
  background: var(--color-card);
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
}

.modal-btn.secondary:hover {
  background: #f5f5f7;
}

.modal-btn.primary {
  background: #13B5EA;
  color: white;
  border: none;
}

.modal-btn.primary:hover {
  background: #0ea5d9;
}

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

/* Modal messages */
.modal-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  flex: 1;
}

.modal-message svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.modal-message-success {
  background: #dcfce7;
  color: #166534;
}

.modal-message-exists {
  background: #fef3c7;
  color: #b45309;
}

.modal-message-error {
  background: #fef2f2;
  color: #dc2626;
}

.modal-message-link {
  margin-left: auto;
  color: inherit;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.modal-message-link:hover {
  text-decoration: underline;
}

/* ============ ACTIVITY LOG ============ */
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.log-header h2 {
  margin: 0;
}

.log-description {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.activity-log {
  background: var(--color-card);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.activity-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 14px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg {
  width: 16px;
  height: 16px;
}

.activity-icon.success {
  background: #dcfce7;
  color: #166534;
}

.activity-icon.error {
  background: #fef2f2;
  color: #dc2626;
}

.activity-icon.skipped {
  background: #fef3c7;
  color: #b45309;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
}

.activity-message {
  font-size: 13px;
  color: var(--color-text-muted);
}

.activity-time {
  font-size: 12px;
  color: var(--color-text-light);
  white-space: nowrap;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--color-card);
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  color: #1d1d1f;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: #f5f5f7;
  border-color: #c5c5c7;
}

.btn-secondary svg {
  width: 16px;
  height: 16px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .tab-nav {
    padding: 0 8px;
  }

  .tab-btn {
    padding: 12px 14px;
    font-size: 13px;
  }

  .panel-content {
    padding: 16px;
  }

  .field-row {
    flex-direction: column;
    gap: 12px;
  }

  .field.contact-field {
    min-width: auto;
  }

  .modal-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .gl-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .gl-row.header {
    display: none;
  }

  .gl-row span:first-child {
    font-weight: 600;
  }

  .gl-code-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 12px 16px;
  }

  .app-logo {
    font-size: 20px;
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 12px;
  }

  .modal-row {
    grid-template-columns: 1fr;
  }

  .batch-order-item {
    flex-wrap: wrap;
  }

  .batch-order-contact {
    width: 100%;
    order: 3;
    margin-top: 4px;
  }
}

/* ============ SESSION BANNER ============ */
.session-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 1px solid #f59e0b;
  padding: 10px 20px;
}

.session-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-banner svg {
  width: 20px;
  height: 20px;
  color: #b45309;
  flex-shrink: 0;
}

.session-banner-content span {
  flex: 1;
  color: #92400e;
  font-size: 14px;
  font-weight: 500;
}

.session-banner-btn {
  padding: 6px 14px;
  background: #f59e0b;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.session-banner-btn:hover {
  background: #d97706;
}

.session-banner-close {
  padding: 4px 8px;
  background: none;
  border: none;
  font-size: 20px;
  color: #b45309;
  cursor: pointer;
  opacity: 0.6;
}

.session-banner-close:hover {
  opacity: 1;
}

/* ============ STORE SWITCHER (Shopify) ============ */
.store-switcher {
  position: relative;
  margin-left: auto;
}

.store-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(150, 191, 72, 0.2);
  border: 1px solid rgba(150, 191, 72, 0.4);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.store-switcher-btn:hover {
  background: rgba(150, 191, 72, 0.3);
  border-color: rgba(150, 191, 72, 0.6);
}

.store-switcher-btn .store-icon {
  width: 18px;
  height: 18px;
  color: #96bf48;
  flex-shrink: 0;
}

.org-switcher-btn .xero-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.store-switcher-arrow {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.store-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--color-card);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 100;
}

.store-menu-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #f0f0f2;
}

.store-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  color: #1d1d1f;
  cursor: pointer;
  transition: background 0.15s;
}

.store-menu-item:hover {
  background: #f5f5f7;
}

.store-menu-item.active {
  background: #f0fdf4;
  color: #166534;
}

.store-menu-item svg {
  width: 16px;
  height: 16px;
  color: #166534;
}

.store-legacy-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  margin-left: 8px;
}

.store-menu-footer {
  padding: 8px;
  border-top: 1px solid #f0f0f2;
  background: #fafafa;
}

.store-menu-footer button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  color: #166534;
  cursor: pointer;
  transition: background 0.15s;
}

.store-menu-footer button:hover {
  background: var(--color-border);
}

.store-menu-footer svg {
  width: 16px;
  height: 16px;
}

/* ============ ORG SWITCHER (Xero) ============ */
.org-switcher {
  position: relative;
  margin-left: 12px;
}

.org-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(19, 181, 234, 0.15);
  border: 1px solid rgba(19, 181, 234, 0.3);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.org-switcher-btn:hover {
  background: rgba(19, 181, 234, 0.25);
  border-color: rgba(19, 181, 234, 0.5);
}

.org-switcher-btn.session-expired {
  background: rgba(229, 57, 53, 0.2);
  border-color: rgba(229, 57, 53, 0.4);
  animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.org-switcher-arrow {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.org-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--color-card);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 100;
}

.org-menu-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #f0f0f2;
}

.org-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  color: #1d1d1f;
  cursor: pointer;
  transition: background 0.15s;
}

.org-menu-item:hover {
  background: #f5f5f7;
}

.org-menu-item.active {
  background: #e5f2ff;
  color: #0071e3;
}

.org-menu-item svg {
  width: 16px;
  height: 16px;
  color: #0071e3;
}

.org-menu-divider,
.store-menu-divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

.org-menu-item.reconnect-item {
  color: #e53935;
  gap: 10px;
  justify-content: flex-start;
}

.org-menu-item.reconnect-item svg {
  width: 16px;
  height: 16px;
  color: #e53935;
}

.org-menu-item.reconnect-item:hover {
  background: #fef2f2;
}

/* Disconnect item styling */
.org-menu-item.disconnect-item,
.store-menu-item.disconnect-item {
  color: #dc2626;
  gap: 10px;
  justify-content: flex-start;
}

.org-menu-item.disconnect-item svg,
.store-menu-item.disconnect-item svg {
  width: 16px;
  height: 16px;
  color: #dc2626;
}

.org-menu-item.disconnect-item:hover,
.store-menu-item.disconnect-item:hover {
  background: #fef2f2;
}

/* Connect item styling */
.org-menu-item.connect-item,
.store-menu-item.connect-item {
  color: var(--color-primary);
  gap: 10px;
  justify-content: flex-start;
}

.org-menu-item.connect-item svg,
.store-menu-item.connect-item svg {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

/* Not configured state for switcher buttons */
.store-switcher-btn.not-configured,
.org-switcher-btn.not-configured {
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.store-switcher-btn.not-configured:hover,
.org-switcher-btn.not-configured:hover {
  opacity: 0.7;
}

/* Info message in dropdown */
.menu-info-message {
  padding: 16px;
  color: var(--color-text-muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}

.menu-info-message a {
  color: var(--color-primary);
  text-decoration: underline;
}

.menu-info-message a:hover {
  text-decoration: none;
}

.org-menu-footer {
  padding: 8px;
  border-top: 1px solid #f0f0f2;
  background: #fafafa;
}

.org-menu-footer button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  color: #0071e3;
  cursor: pointer;
  transition: background 0.15s;
}

.org-menu-footer button:hover {
  background: var(--color-border);
}

.org-menu-footer svg {
  width: 16px;
  height: 16px;
}

/* ============ TOKEN HEALTH ============ */
.token-health {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  margin-left: 12px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.health-dot.health-healthy {
  background: #34c759;
  box-shadow: 0 0 6px rgba(52, 199, 89, 0.5);
}

.health-dot.health-warning {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.health-dot.health-expired {
  background: #dc2626;
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.5);
}

.health-dot.health-unknown {
  background: var(--color-text-light);
}

#token-health-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: #1d1d1f;
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ AUTH OVERLAYS ============ */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-overlay-content {
  text-align: center;
  color: var(--color-text);
}

.auth-overlay-content p {
  margin-top: 16px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.auth-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

.auth-error-content h2 {
  margin: 16px 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
}

.auth-error-icon {
  width: 48px;
  height: 48px;
  color: #dc2626;
}

.auth-retry-btn {
  margin-top: 20px;
  padding: 10px 24px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-retry-btn:hover {
  background: #0077ed;
}

/* ============ USER MENU ============ */
.user-menu {
  position: relative;
  margin-left: auto;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

.user-menu-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.user-avatar svg {
  width: 18px;
  height: 18px;
  color: white;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-menu-arrow {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--color-card);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 100;
}

.user-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-muted);
  word-break: break-all;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  color: #1d1d1f;
  cursor: pointer;
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: #f5f5f7;
}

.user-dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
}

/* Utility */
.hidden {
  display: none !important;
}

.muted {
  color: var(--color-text-light);
}
