
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --secondary-color: #0f172a;
  --secondary-hover: #1e293b;
  --success-color: #16a34a;
  --warning-color: #d97706;
  --error-color: #dc2626;
  --bg-color: #f3f7ff;
  --bg-accent: #e7efff;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: #dbe3f3;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.1);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--text-primary);
  line-height: 1.45;
}

/* Login */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(96, 165, 250, 0.35), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(129, 140, 248, 0.35), transparent 40%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 460px;
}

.login-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(4px);
  padding: 32px;
}

.login-header {
  margin-bottom: 24px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  margin-bottom: 12px;
}

.snowflake-icon {
  width: 30px;
  height: 30px;
  color: var(--primary-color);
}

.login-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

.login-form {
  display: grid;
  gap: 16px;
}

/* Dashboard */
.dashboard-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 5%, rgba(96, 165, 250, 0.14), transparent 30%),
    radial-gradient(circle at 15% 95%, rgba(129, 140, 248, 0.16), transparent 35%),
    var(--bg-color);
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}

.header-content {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

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

.logo .snowflake-icon {
  width: 26px;
  height: 26px;
  margin: 0;
}

.logo h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 13px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.main {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 22px 20px 80px;
  display: grid;
  gap: 20px;
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.utc-note {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: -8px;
  margin-bottom: 12px;
}

.overview-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.overview-label {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
}

.overview-card strong {
  font-size: 25px;
  letter-spacing: -0.03em;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-content .toolbar {
  flex: 1;
  max-width: none;
}

.header-content .search-field {
  max-width: none;
}

.search-field {
  flex: 1;
  max-width: 460px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.search-field svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.search-field input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
}

.search-field input:focus {
  outline: none;
}

.search-meta {
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.loading-panel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid transparent;
}

.alert-error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.accounts-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.account-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  padding: 14px;
}

.account-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.account-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.account-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-action {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-action:hover:not(:disabled) {
  background: #f8fafc;
  color: var(--text-primary);
}

.icon-delete {
  color: #991b1b;
  border-color: #fecaca;
}

.icon-delete:hover:not(:disabled) {
  background: #fef2f2;
}

.icon-relogin {
  font-size: 13px;
}

.account-body {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.account-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.account-username {
  font-size: 17px;
  margin-bottom: 4px;
  line-height: 1.25;
}

.account-id {
  color: var(--text-secondary);
  font-size: 12px;
}

.account-balance {
  text-align: left;
}

.balance-label {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.balance-value {
  font-size: 22px;
  font-weight: 750;
  color: var(--primary-color);
}

.account-meta {
  display: grid;
  gap: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.status-warn {
  color: #92400e;
  background: #fef3c7;
}

.status-muted {
  color: #334155;
  background: #e2e8f0;
}

.status-expired {
  color: #991b1b;
  background: #fee2e2;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.meta-item span {
  color: var(--text-secondary);
  font-size: 11px;
}

.meta-item strong {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.btn-checkin-card {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
}

.empty-state {
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  padding: 40px 24px;
  text-align: center;
  display: grid;
  place-items: center;
  gap: 10px;
}

.empty-icon {
  width: 52px;
  height: 52px;
  color: var(--text-secondary);
}

.empty-state h2 {
  font-size: 20px;
}

.empty-state p {
  color: var(--text-secondary);
  max-width: 420px;
}

.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary-color), #1e40af);
  color: #fff;
  box-shadow: var(--shadow-md);
  transition: transform 0.18s ease;
}

.fab:hover {
  transform: scale(1.06);
}

.fab svg {
  width: 24px;
  height: 24px;
}

/* Forms */
.form-group {
  display: grid;
  gap: 8px;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

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

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 44px;
}

.icon-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #e2e8f0;
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

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

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

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

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

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

.btn-outline {
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  background: #fff;
}

.btn-outline:hover:not(:disabled) {
  background: #f8fafc;
}

.btn-delete {
  color: #991b1b;
  border-color: #fecaca;
  background: #fff;
}

.btn-delete:hover:not(:disabled) {
  background: #fef2f2;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
}

.btn-google:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
}

.google-login-section {
  padding: 16px 20px 0;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.login-form .btn-primary {
  width: 100%;
}

.login-form .cf-turnstile {
  justify-self: center;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  z-index: 120;
}

.modal-content {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  font-size: 19px;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-open {
  overflow: hidden;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
}

.modal-tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}

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

.modal-tab:hover:not(.active) {
  color: var(--text-primary);
}

.login-fields {
  display: grid;
  gap: 14px;
}

.input-icon-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.input-with-icon {
  padding-left: 36px !important;
}

.captcha-section {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border-color);
}

.captcha-layout {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.captcha-image {
  height: 80px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  object-fit: contain;
  background: var(--bg-accent);
}

.captcha-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  width: 110px;
  flex-shrink: 0;
}

.captcha-controls input {
  width: 100%;
  text-align: center;
}

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

/* Toasts */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 150;
}

.toast {
  min-width: 240px;
  max-width: 90vw;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  background: #0f172a;
  font-size: 14px;
}

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

.toast-success {
  background: var(--success-color);
}

.toast-warning {
  background: var(--warning-color);
}

.toast-error {
  background: var(--error-color);
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.65s linear infinite;
}

.spinner-dark {
  border-color: rgba(37, 99, 235, 0.25);
  border-top-color: var(--primary-color);
}

.error-message {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

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

@media (max-width: 740px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }

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

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field {
    max-width: 100%;
  }

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

  .account-header {
    align-items: flex-start;
  }

  .account-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .account-meta .meta-item {
    flex-direction: column;
    gap: 2px;
  }

  .btn-checkin-card {
    width: 100%;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .fab {
    right: 16px;
    bottom: 16px;
  }
}
