/* src/client/index.css */
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --bg: #fafafa;
  --surface: #fff;
  --border: #e5e7eb;
  --border-focus: #3b82f6;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: #eff6ff;
  --danger: #dc2626;
  --danger-subtle: #fef2f2;
  --success: #16a34a;
  --success-subtle: #f0fdf4;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px #0000000d;
  --shadow: 0 1px 3px #00000014, 0 1px 2px #0000000a;
  --shadow-lg: 0 4px 12px #00000014;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, "Courier New", monospace;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  background: #f3f4f6;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: .88em;
}

.page-centered {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  min-height: 100vh;
  padding: 24px 16px;
}

.page-top {
  display: flex;
  flex-direction: column;
  align-items:  center;
  min-height: 100vh;
  padding: 48px 16px 24px;
}

.page-top .container {
  margin-top: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 600px;
  padding: 32px;
}

.panel-wide {
  max-width: 720px;
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-title {
  color: var(--text);
  margin-bottom: 4px;
  font-size: 1.25rem;
  font-weight: 600;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: .875rem;
}

.section-title {
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-size: .8rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  font-family: var(--font);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid #0000;
  justify-content: center;
  align-items:  center;
  gap: 6px;
  padding: 9px 16px;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1;
}

.btn:hover {
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-subtle);
  border-color: #fca5a5;
}

.btn-ghost {
  color: var(--text-secondary);
  background: none;
  border-color: #0000;
  padding: 6px 10px;
}

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

.btn-sm {
  padding: 5px 10px;
  font-size: .8rem;
}

.btn-full {
  width: 100%;
}

.btn:not([class*="btn-"]):not(.btn-sm):not(.btn-full) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn:not([class*="btn-"]):not(.btn-sm):not(.btn-full):hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  padding: 0;
  font-size: .8rem;
}

.link:disabled {
  color: var(--text-tertiary);
  cursor: default;
  text-decoration: none;
}

.alert {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .85rem;
  line-height: 1.5;
}

.alert-info {
  background: var(--accent-subtle);
  color: #1e40af;
}

.alert-success {
  background: var(--success-subtle);
  color: #15803d;
}

.alert-error {
  background: var(--danger-subtle);
  color: var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #92400e;
}

.spinner {
  display: inline-block;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  border: 2px solid;
  border-top-color: #0000;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  margin-right: 6px;
}

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

.status {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .85rem;
}

.status-loading {
  background: var(--accent-subtle);
  color: #1e40af;
}

.status-success {
  background: var(--success-subtle);
  color: #15803d;
}

.status-error {
  background: var(--danger-subtle);
  color: var(--danger);
}

.status-info {
  background: var(--warning-bg);
  color: #92400e;
}

.warning-box {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  color: #92400e;
  padding: 8px 12px;
  font-size: .82rem;
  line-height: 1.5;
}

.conn-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.conn-card {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  align-items:  flex-start;
  gap: 12px;
  padding: 12px 14px;
  transition: background .1s, border-color .1s;
}

.conn-card:hover {
  background: #fafbfc;
}

.conn-card.selected {
  background: var(--accent-subtle);
  border-color: #93c5fd;
}

.conn-card input[type="checkbox"] {
  accent-color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.conn-body {
  flex: 1;
  min-width: 0;
}

.conn-name {
  color: var(--text);
  font-size: .93rem;
  font-weight: 600;
  line-height: 1.3;
}

.conn-dob {
  color: var(--text-secondary);
  margin-left: 6px;
  font-size: .8rem;
  font-weight: 400;
}

.conn-meta {
  color: var(--text-tertiary);
  margin-top: 1px;
  font-size: .78rem;
}

.conn-progress {
  color: var(--accent);
  margin-top: 2px;
  font-size: .78rem;
}

.conn-error {
  color: var(--danger);
  margin-top: 2px;
  font-size: .78rem;
}

.conn-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.status-dot {
  display: inline-block;
  vertical-align: middle;
  border-radius: 50%;
  width: 7px;
  height: 7px;
  margin-right: 5px;
}

.status-dot-active {
  background: var(--success);
}

.status-dot-expired {
  background: #f59e0b;
}

.status-dot-error {
  background: var(--danger);
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  align-items:  center;
  gap: 4px;
  margin-bottom: 6px;
  font-size: .78rem;
}

.toolbar .sep {
  color: var(--text-tertiary);
}

.action-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

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

.provider-search {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 auto 20px;
}

.provider-search-input {
  font-size: .95rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface);
  width: 100%;
  padding: 10px 40px 10px 14px;
  transition: border-color .15s;
}

.provider-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px #3b82f61a;
}

.provider-search-clear {
  position: absolute;
  color: var(--text-tertiary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  font-size: 18px;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.provider-search-clear:hover {
  color: var(--text-secondary);
}

.provider-results {
  width: 100%;
}

.results-count {
  color: var(--text-tertiary);
  margin-bottom: 10px;
  font-size: .8rem;
}

.no-results {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 0;
  font-size: .9rem;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.provider-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  justify-content: space-between;
  align-items:  center;
  padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}

.provider-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px #3b82f614;
}

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

.provider-card-name {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 1px;
  font-size: .9rem;
  font-weight: 600;
}

.provider-card-brand {
  color: var(--accent);
  margin: 0;
  font-size: .78rem;
}

.provider-card-location, .provider-card-collapsed {
  color: var(--text-tertiary);
  margin: 0;
  font-size: .75rem;
}

.provider-card-arrow {
  color: var(--text-tertiary);
  margin-left: 8px;
  font-size: 18px;
}

.provider-card:hover .provider-card-arrow {
  color: var(--accent);
}

.load-more-btn {
  display: block;
  margin: 16px auto 0;
}

.provider-select-container {
  background: var(--bg);
  min-height: 100vh;
  padding: 16px;
}

.provider-select-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 16px;
}

.provider-select-header h1 {
  color: var(--text);
  margin-bottom: 2px;
  font-size: 1.1rem;
  font-weight: 600;
}

.provider-select-header p {
  color: var(--text-secondary);
  margin: 0;
  font-size: .85rem;
}

.back-button {
  position: absolute;
  color: var(--accent);
  cursor: pointer;
  border-radius: var(--radius);
  background: none;
  border: none;
  padding: 6px 10px;
  font-size: .85rem;
  top: 16px;
  left: 16px;
}

.back-button:hover {
  background: var(--accent-subtle);
}

.modal-backdrop {
  position: fixed;
  display: flex;
  z-index: 1000;
  background: #0006;
  justify-content: center;
  align-items:  center;
  padding: 20px;
  inset: 0;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 28px;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal p {
  color: var(--text-secondary);
  margin: 0 0 8px;
  font-size: .88rem;
  line-height: 1.5;
}

.modal-brand {
  color: var(--accent);
  font-size: .82rem;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.progress-bar-container {
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 2px;
  width: 100%;
  height: 4px;
  margin: 12px 0;
}

.progress-bar {
  background: var(--accent);
  border-radius: 2px;
  height: 100%;
  transition: width .3s;
}

.home-header {
  text-align: center;
  padding: 48px 16px 24px;
}

.home-header h1 {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 1.5rem;
  font-weight: 700;
}

.home-header p {
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
  font-size: .95rem;
}

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

.home-section h2 {
  margin-bottom: 8px;
  font-size: .95rem;
  font-weight: 600;
}

.home-steps {
  color: var(--text-secondary);
  padding-left: 1.1rem;
  font-size: .88rem;
  line-height: 1.8;
}

.home-steps strong {
  color: var(--text);
}

.copy-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  position: relative;
  background: #f3f4f6;
  padding: 12px 14px;
  transition: border-color .15s;
  font-size: .88rem;
  line-height: 1.5;
}

.copy-box:hover {
  border-color: var(--accent);
}

.copy-box-hint {
  color: var(--text-tertiary);
  margin-top: 6px;
  font-size: .75rem;
}

.step-badge {
  display: inline-flex;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
  justify-content: center;
  align-items:  center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  font-size: .72rem;
  font-weight: 700;
}

.step-row {
  display: flex;
  align-items:  flex-start;
  margin-bottom: 12px;
}

.step-row:last-child {
  margin-bottom: 0;
}

.step-text {
  color: var(--text-secondary);
  font-size: .88rem;
  line-height: 1.5;
}

.step-text strong {
  color: var(--text);
  font-weight: 600;
}

.help-toggle {
  color: var(--text-tertiary);
  cursor: pointer;
  display: inline-flex;
  background: none;
  border: none;
  align-items:  center;
  gap: 4px;
  padding: 0;
  font-family: inherit;
  font-size: .82rem;
}

.help-toggle:hover {
  color: var(--accent);
}

.help-detail {
  color: var(--text-secondary);
  background: var(--accent-subtle);
  border-radius: var(--radius);
  margin-top: 10px;
  padding: 12px 14px;
  font-size: .82rem;
  line-height: 1.7;
}

.help-detail h4 {
  color: var(--text);
  margin: 10px 0 4px;
  font-size: .82rem;
  font-weight: 600;
}

.help-detail h4:first-child {
  margin-top: 0;
}

.help-detail code {
  font-size: .8rem;
}

.site-footer {
  width: 100%;
  margin-top: auto;
  padding: 32px 0 24px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items:  center;
  gap: 6px;
  font-size: .82rem;
}

.footer-links a {
  color: var(--text-tertiary);
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.footer-sep {
  color: var(--border);
}

.footer-note {
  text-align: center;
  color: var(--text-tertiary);
  margin-top: 8px;
  font-size: .78rem;
}

.footer-note a {
  color: var(--text-secondary);
}

.security-info {
  color: var(--text-tertiary);
  margin-top: 16px;
  font-size: .82rem;
}

.hero {
  display: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  padding: 24px;
}

.card h2 {
  color: var(--text);
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 600;
}

.card h3 {
  color: var(--text);
  margin-bottom: 6px;
  font-size: .9rem;
  font-weight: 600;
}

.btn-link {
  color: var(--text-secondary);
  background: none;
  border-color: #0000;
  padding: 5px 10px;
  font-size: .82rem;
}

.btn-link:hover:not(:disabled) {
  color: var(--text);
  background: #f3f4f6;
}

@media (width <= 600px) {
  .panel {
    padding: 20px 16px;
  }

  .provider-grid {
    grid-template-columns: 1fr;
  }
}
