/* CSS Design System Tokens */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.12);
  --primary-gradient: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #38bdf8 100%);
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  /* Dark Theme Default */
  --bg-page: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-subtle: #19243d;
  --bg-input: #0f172a;
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
  --border-card: rgba(255, 255, 255, 0.08);
  --border-input: #334155;
  --border-focus: #38bdf8;
  --header-bg: rgba(11, 15, 25, 0.85);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-btn: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

[data-theme="light"] {
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: rgba(26, 115, 232, 0.08);
  --primary-gradient: linear-gradient(135deg, #1a73e8 0%, #2563eb 100%);
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --text-main: #0f172a;
  --text-sub: #334155;
  --text-muted: #64748b;
  --border-card: #e2e8f0;
  --border-input: #cbd5e1;
  --border-focus: #1a73e8;
  --header-bg: rgba(255, 255, 255, 0.92);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  --shadow-btn: 0 4px 14px 0 rgba(26, 115, 232, 0.25);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Offline Notice */
.offline-banner {
  background: #dc2626;
  color: #ffffff;
  padding: 8px 16px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

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

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 68px;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-outline:hover {
  background: var(--bg-card-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-install {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  padding: 8px 14px;
  font-size: 13.5px;
  border-radius: 20px;
  animation: pulseInstall 2.5s infinite;
}

@keyframes pulseInstall {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Main Container */
.main-container {
  flex: 1;
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 20px 48px;
}

/* Hero */
.hero-section {
  text-align: center;
  margin-bottom: 36px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--accent-green);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 36px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.5;
}

.hero-subtitle strong {
  color: var(--text-main);
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  .content-grid {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.25);
}

.card-header {
  margin-bottom: 22px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-title-group h2, .card-title-group h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.card-title-group p {
  font-size: 13px;
  color: var(--text-muted);
}

.icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-circle-accent {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-gold);
}

.icon-circle-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

/* Form Styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-sub);
}

.text-link {
  font-size: 12.5px;
  color: var(--primary);
  text-decoration: none;
}

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

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

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  height: 46px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 10px;
  padding: 0 46px 0 42px;
  color: var(--text-main);
  font-size: 14.5px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.pill-btn {
  position: absolute;
  right: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.icon-toggle-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.icon-toggle-btn:hover {
  color: var(--text-main);
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-container input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-card);
}

.divider span {
  padding: 0 12px;
}

/* Direct Launch Box */
.direct-launch-box {
  background: var(--bg-card-subtle);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-card);
}

.direct-caption {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* Recent Accounts */
.recent-accounts {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-card);
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.text-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.recent-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Right Column */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* PWA Guide Card */
.install-steps-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-card-subtle);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
}

.tab-btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-pane.active {
  display: flex;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-sub);
  line-height: 1.45;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Config Table */
.config-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.config-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-card);
}

@media (min-width: 500px) {
  .config-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

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

.config-val-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  background: var(--bg-card-subtle);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  color: var(--primary);
  word-break: break-all;
}

.copy-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.subtle-text {
  font-size: 13px;
  color: var(--text-sub);
}

.config-footer {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  background: var(--bg-card-subtle);
  padding: 10px 14px;
  border-radius: 8px;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-card);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--header-bg);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.footer-links a:hover {
  color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 10000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .hero-title {
    font-size: 28px;
  }
  .app-header {
    padding: 0 16px;
  }
  .card {
    padding: 20px 16px;
  }
}
