:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --surface: #f5f5f5;
  --primary: #6200ee;
  --primary-soft: #efe7ff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #0f9d58;
  --danger: #d32f2f;
  --shadow: 0 14px 28px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 440px);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.login-card,
.dashboard-screen {
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-card {
  padding: 30px 24px 26px;
}

.brand-block h1 {
  margin: 4px 0 28px;
  font-size: clamp(2rem, 4vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.eyebrow.muted {
  color: var(--muted);
}

.form-header {
  margin-bottom: 18px;
}

.form-header h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
}

.form-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.entry-option-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  font-weight: 700;
  padding: 10px;
}

.entry-option-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

#login-form, #register-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form.hidden, #register-form.hidden {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text);
}

.field span {
  font-weight: 600;
}

.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 14px 14px;
  font-size: 0.98rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  font-size: 0.95rem;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(98, 0, 238, 0.12);
}

.helper-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.text-button,
.icon-button,
.logout-button,
.tab-button,
.close-button {
  border: none;
  background: transparent;
}

.text-button {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0;
}

.error-message {
  min-height: 20px;
  color: var(--danger);
  font-size: 0.8rem;
  line-height: 1.4;
}

.captcha-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 6px;
}

.captcha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.1rem;
}

.captcha-prompt {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

.secondary-button,
.primary-button,
.tab-button {
  border-radius: 10px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.secondary-button:hover,
.primary-button:hover,
.tab-button:hover,
.logout-button:hover,
.close-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  width: 100%;
  border: none;
  background: var(--primary);
  color: white;
  padding: 12px 14px;
  font-weight: 600;
}

.primary-button {
  width: 100%;
  border: none;
  background: var(--primary);
  color: white;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  margin-top: 4px;
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.dashboard-screen {
  padding: 22px 18px 16px;
}

.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wallet-agent-panel {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.wallet-custody-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.8rem;
  line-height: 1.45;
}

.wallet-agent-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding: 4px;
}

.wallet-agent-message {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f4f6;
  font-size: 0.88rem;
  line-height: 1.45;
}

.wallet-agent-message.user {
  align-self: flex-end;
  max-width: 90%;
  background: var(--primary-soft);
}

.wallet-agent-message strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.76rem;
}

.wallet-agent-message p,
.wallet-agent-wallet p {
  margin: 0;
  overflow-wrap: anywhere;
}

.wallet-agent-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-agent-create-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-agent-create-form.hidden {
  display: none;
}

.wallet-agent-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.wallet-agent-form .field {
  flex: 1;
}

.wallet-agent-form .primary-button {
  width: auto;
  white-space: nowrap;
}

.wallet-agent-wallets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-agent-wallet {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.82rem;
}

.wallet-agent-wallet code {
  overflow-wrap: anywhere;
}

.wallet-agent-panel .camera-actions {
  align-items: center;
}

.wallet-agent-panel .camera-actions .primary-button {
  width: auto;
  margin: 0;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.dashboard-header h1 {
  margin: 4px 0 0;
  font-size: 1.9rem;
}

.logout-button {
  color: var(--primary);
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
}

.camera-panel,
.client-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
}

.camera-panel.hidden {
  display: none;
}

.camera-header,
.client-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.camera-header h3,
.client-panel-header h3 {
  margin: 0;
  font-size: 1rem;
}

.camera-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.secondary-button.tiny {
  width: auto;
  padding: 8px 12px;
  font-size: 0.8rem;
  margin-top: 0;
}

.secondary-button.tiny.alt {
  background: #eef2ff;
  color: var(--primary);
}

.secondary-button.tiny.active {
  background: var(--primary);
  color: #fff;
}

#remote-camera-frame {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 10px;
  background: linear-gradient(135deg, #dbeafe, #111827);
  display: block;
}

.camera-status {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  text-align: left;
}

.client-item h4 {
  margin: 0 0 2px;
  font-size: 0.96rem;
}

.client-item small {
  color: var(--muted);
}

.client-actions {
  display: flex;
  gap: 8px;
}

.inline-button {
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tab-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.tab-button {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 10px;
  font-weight: 700;
}

.tab-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.list-header h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.03);
}

.list-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.list-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.item-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.item-link {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.78rem;
}

.notification-item {
  padding: 14px;
}

.notification-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.buy-coins-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.buy-coins-subtitle {
  margin: 0 0 10px;
  font-size: 0.86rem;
  color: var(--muted);
}

.buy-form-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.buy-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}

.buy-field span {
  font-weight: 600;
}

.buy-field input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.amount-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
  margin-bottom: 10px;
}

.amount-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 8px 0 12px;
}

.terms-row input {
  margin-top: 2px;
}

.primary-button.compact {
  margin-top: 0;
  margin-bottom: 10px;
  padding: 11px;
  font-size: 0.9rem;
}

.inline-error {
  min-height: auto;
  margin-bottom: 8px;
}

.currency-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.currency-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.82rem;
}

.currency-button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.rate-note {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--text);
}

.qr-panel,
.receipt-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
}

.qr-panel h3,
.receipt-panel h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.qr-image {
  width: 220px;
  height: 220px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: block;
  margin: 8px 0;
}

.receipt-panel input[type="file"] {
  width: 100%;
  margin-bottom: 8px;
}

.receipt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.receipt-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rate-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.rate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.rate-table th,
.rate-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.rate-table th {
  background: #f8fafc;
  font-size: 0.8rem;
}

.rate-table tbody tr:last-child td {
  border-bottom: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.42);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(100%, 420px);
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.close-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f3f4f6;
  font-size: 1.4rem;
  color: var(--text);
}

.modal-body {
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fafafa;
  color: var(--muted);
  text-align: center;
  padding: 18px 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.secondary-link {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  padding: 10px 0 0;
}

.guest-qr-panel {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fbfbff;
}

.guest-qr-panel h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.guest-qr-panel > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.guest-amount {
  margin: 8px 0 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
}

.guest-qr-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.guest-qr-preview {
  margin-top: 12px;
}

.guest-qr-preview img {
  width: 220px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  display: block;
}

.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .login-card,
  .dashboard-screen {
    border-radius: 18px;
  }
}
