/* Charcoal Grey Theme Variables */
:root {
  --bg-main: #1e1e1e;
  --bg-elevated: #2d2d2d;
  --bg-elevated-soft: #252525;
  --accent: #4dd0e1;
  --accent-soft: rgba(77, 208, 225, 0.15);
  --accent-strong: #26c6da;
  --text-main: #e4e4e4;
  --text-muted: #9e9e9e;
  --border-subtle: #3e3e3e;
  --danger: #ef5350;
  --success: #66bb6a;
  --warning: #ffb74d;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #1e1e1e;
  color: var(--text-main);
  min-height: 100vh;
}

/* Main container */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  padding: 24px clamp(16px, 3vw, 40px);
  max-width: 1200px;
  margin: 0 auto;
}

/* Auth pages */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 56px);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.auth-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

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

.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

/* Forms */
.field {
  margin-bottom: 16px;
}

.label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-main);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  font-family: 'SF Mono', Monaco, monospace;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: var(--bg-main);
}

.input::placeholder {
  color: #6e6e6e;
}

.input[readonly] {
  background: var(--bg-elevated-soft);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: system-ui, -apple-system, sans-serif;
}

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

.btn-primary {
  background: var(--accent);
  color: #1e1e1e;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(77, 208, 225, 0.3);
}

.btn-secondary {
  background: #3a3a3a;
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background: #454545;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

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

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Alerts */
.alert {
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  border-left: 3px solid;
}

.alert-danger {
  background: rgba(239, 83, 80, 0.1);
  border-left-color: var(--danger);
  color: #e57373;
}

.alert-success {
  background: rgba(102, 187, 106, 0.1);
  border-left-color: var(--success);
  color: #81c784;
}

.alert-warning {
  background: rgba(255, 183, 77, 0.1);
  border-left-color: var(--warning);
  color: var(--warning);
}

.alert-info {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Cards */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.section-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 18px;
  margin-top: 16px;
}

.card-header, .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title, .section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.card-subtitle, .section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.card-tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #3a3a3a;
  color: var(--text-muted);
  border: 1px solid #4e4e4e;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.card-body {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Badges */
.badge, .status-pill, .badge-exchange {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success, .status-pill.ok {
  background: rgba(102, 187, 106, 0.15);
  color: #81c784;
  border: 1px solid rgba(102, 187, 106, 0.3);
}

.badge-danger, .status-pill.bad {
  background: rgba(239, 83, 80, 0.15);
  color: #e57373;
  border: 1px solid rgba(239, 83, 80, 0.3);
}

.badge-warning, .status-pill.warn {
  background: rgba(255, 183, 77, 0.15);
  color: var(--warning);
  border: 1px solid rgba(255, 183, 77, 0.3);
}

.badge-info {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(77, 208, 225, 0.3);
}

.badge-exchange {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(77, 208, 225, 0.3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead {
  background: var(--bg-elevated-soft);
  border-bottom: 2px solid var(--border-subtle);
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #3a3a3a;
}

.table th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  color: var(--text-main);
}

.table tr:hover td {
  background: #2a2a2a;
}

/* Exchange selection cards */
.exchange-card {
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.exchange-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(77, 208, 225, 0.2);
}

.exchange-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.exchange-card h3 {
  font-size: 20px;
  margin: 12px 0 8px;
  color: var(--text-main);
}

.exchange-card p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

.exchange-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  background: var(--bg-main);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

/* Status checklist */
.status-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.status-checklist li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-elevated-soft);
  border-radius: 6px;
  border-left: 3px solid transparent;
}

.status-checklist li.success {
  border-left-color: var(--success);
}

.status-checklist li.error {
  border-left-color: var(--danger);
}

.status-checklist li.pending {
  border-left-color: var(--warning);
}

.status-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.status-icon.success {
  background: rgba(102, 187, 106, 0.2);
  color: var(--success);
}

.status-icon.error {
  background: rgba(239, 83, 80, 0.2);
  color: var(--danger);
}

.status-icon.pending {
  background: rgba(255, 183, 77, 0.2);
  color: var(--warning);
}

/* Code/monospace */
code, .code, pre {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  background: var(--bg-main);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}

pre {
  padding: 12px;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
}

/* QR code */
.qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-main);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.qr-wrapper img {
  border-radius: var(--radius-lg);
  border: 2px solid var(--accent);
  padding: 8px;
  background: white;
}

/* Utilities */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

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

.text-center {
  text-align: center;
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

/* Spinner */
.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .card, .section-card {
    padding: 16px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-elevated-soft);
}

::-webkit-scrollbar-thumb {
  background: #4e4e4e;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}