@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --pm-purple: #4737ff;
  --pm-purple-hover: #3b2ee0;
  --pm-purple-light: #eeecff;
  --pm-purple-soft: #9088f7;
  --pm-bg: #f8f9fc;
  --pm-white: #ffffff;
  --pm-text: #101828;
  --pm-text-secondary: #667085;
  --pm-text-muted: #98a2b3;
  --pm-border: #d0d5dd;
  --pm-border-light: #eaecf0;
  --pm-link: #4737ff;
  --pm-disabled-bg: #f2f4f7;
  --pm-disabled-text: #98a2b3;
  --pm-success: #12b76a;
  --pm-danger: #f04438;
  --pm-danger-bg: #fef3f2;
  --pm-success-bg: #ecfdf3;
  --pm-radius-md: 8px;
  --pm-radius-lg: 12px;
  --pm-radius-xl: 16px;
  --pm-shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --pm-shadow-card: 0 1px 3px rgba(16, 24, 40, 0.06);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--pm-text);
  background: var(--pm-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button { font: inherit; }

.pm-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--pm-radius-md);
  background: transparent;
  color: var(--pm-purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.pm-icon-btn:hover { background: var(--pm-purple-light); }

.pm-btn-outline {
  height: 40px;
  padding: 0 14px;
  border: 2px solid var(--pm-purple-light);
  border-radius: var(--pm-radius-md);
  background: var(--pm-white);
  color: var(--pm-purple);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.pm-btn-outline:hover {
  background: var(--pm-purple-light);
}

.pm-btn-primary {
  height: 44px;
  padding: 0 20px;
  border: 2px solid var(--pm-purple);
  border-radius: var(--pm-radius-md);
  background: var(--pm-purple);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

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

.pm-btn-primary:disabled {
  background: var(--pm-disabled-bg);
  border-color: var(--pm-border-light);
  color: var(--pm-disabled-text);
  cursor: default;
  box-shadow: none;
}

.pm-btn-solid-sm {
  height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: var(--pm-radius-md);
  background: var(--pm-purple);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pm-btn-solid-sm:hover { background: var(--pm-purple-hover); }

.pm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pm-field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--pm-text);
}

.pm-input-wrap {
  display: flex;
  align-items: center;
  height: 40px;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-md);
  background: var(--pm-white);
  padding: 0 14px;
}

.pm-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--pm-text);
  background: transparent;
  min-width: 0;
}

.pm-input-wrap input::placeholder { color: var(--pm-text-muted); }

.pm-link {
  color: var(--pm-link);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

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

/* Login page */
.pm-login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--pm-bg);
}

.pm-login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  gap: 24px;
}

.pm-login-topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pm-login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.pm-login-card {
  width: 100%;
  max-width: 500px;
  background: var(--pm-white);
  border-radius: var(--pm-radius-xl);
  box-shadow: var(--pm-shadow-sm);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pm-login-card h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}

.pm-login-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pm-captcha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 300px;
  max-width: 100%;
  height: 65px;
  border: 1px solid var(--pm-border-light);
  border-radius: var(--pm-radius-md);
  background: #fafafa;
  padding: 0 12px;
}

.pm-captcha__success {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--pm-text);
}

.pm-captcha__check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pm-success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.pm-captcha__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 10px;
  color: var(--pm-text-muted);
}

.pm-captcha__brand strong {
  font-size: 11px;
  color: #f38020;
  letter-spacing: 0.02em;
}

.pm-login-help {
  text-align: center;
  font-size: 14px;
  color: var(--pm-text);
}

.pm-login-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 20px 24px;
  font-size: 12px;
  color: var(--pm-text-secondary);
}

.pm-login-footer a,
.pm-login-footer button {
  color: var(--pm-link);
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
}

/* Dashboard */
.pm-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pm-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px 12px 20px;
  background: var(--pm-white);
  border-bottom: 1px solid var(--pm-border-light);
}

.pm-app-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pm-app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.pm-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--pm-white);
  border-right: 1px solid var(--pm-border-light);
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin: 0 8px 12px;
  padding: 0 12px;
  border: 1px solid var(--pm-border-light);
  border-radius: var(--pm-radius-md);
  background: var(--pm-bg);
  color: var(--pm-text-muted);
  font-size: 14px;
}

.pm-search svg { flex-shrink: 0; color: var(--pm-text-muted); }

.pm-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pm-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--pm-radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--pm-text-secondary);
}

.pm-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
}

.pm-nav a:hover { background: var(--pm-bg); color: var(--pm-text); }

.pm-nav a.is-active {
  background: var(--pm-purple-light);
  color: var(--pm-purple);
  font-weight: 600;
}

.pm-main {
  flex: 1;
  overflow: auto;
  padding: 24px 32px 40px;
  background: var(--pm-bg);
}

.pm-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--pm-white);
  border: 1px solid var(--pm-border-light);
  border-radius: var(--pm-radius-lg);
  font-size: 14px;
  line-height: 1.5;
  color: var(--pm-text-secondary);
}

.pm-alert p { margin: 0; }

.pm-alert svg { flex-shrink: 0; margin-top: 2px; color: var(--pm-text-muted); }

.pm-alert--action {
  margin-bottom: 24px;
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.pm-alert--action svg { color: #ea580c; }

.pm-alert--action strong {
  color: #c2410c;
  font-weight: 700;
}

.pm-welcome h2 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pm-welcome p {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--pm-text-secondary);
}

.pm-portfolio-card {
  background: var(--pm-white);
  border: 1px solid var(--pm-border-light);
  border-radius: var(--pm-radius-xl);
  padding: 24px 28px 20px;
  margin-bottom: 24px;
  box-shadow: var(--pm-shadow-card);
}

.pm-portfolio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.pm-portfolio-label {
  font-size: 14px;
  color: var(--pm-text-secondary);
  margin-bottom: 4px;
}

.pm-portfolio-balances {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.pm-portfolio-value {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.pm-portfolio-held {
  font-size: 15px;
  font-weight: 500;
  color: var(--pm-text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
}

.pm-periods {
  display: flex;
  gap: 4px;
}

.pm-periods button {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pm-text-secondary);
  cursor: pointer;
}

.pm-periods button.is-active {
  background: var(--pm-purple-light);
  color: var(--pm-purple);
  font-weight: 600;
}

.pm-chart-wrap {
  position: relative;
  height: 220px;
  margin: 8px 0 16px;
}

.pm-chart-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pm-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.pm-action-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--pm-radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
}

.pm-action-btn--buy {
  background: var(--pm-purple);
  color: #fff;
}

.pm-action-btn--sell {
  background: #1d1d40;
  color: #fff;
}

.pm-action-btn--ghost {
  background: #eef0ff;
  color: var(--pm-purple);
}

.pm-action-btn:hover { opacity: 0.92; }

.pm-crypto-card {
  background: var(--pm-white);
  border: 1px solid var(--pm-border-light);
  border-radius: var(--pm-radius-xl);
  padding: 20px 24px 8px;
  box-shadow: var(--pm-shadow-card);
}

.pm-crypto-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
}

.pm-crypto-table {
  width: 100%;
  border-collapse: collapse;
}

.pm-crypto-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--pm-text-muted);
  padding: 0 8px 12px 0;
  border-bottom: 1px solid var(--pm-border-light);
}

.pm-crypto-table th:last-child { text-align: right; }

.pm-crypto-table td {
  padding: 16px 8px 16px 0;
  border-bottom: 1px solid var(--pm-border-light);
  font-size: 14px;
  vertical-align: middle;
}

.pm-crypto-table tr:last-child td { border-bottom: none; }

.pm-crypto-table td:last-child { text-align: right; }

.pm-coin {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.pm-coin-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.pm-coin-icon--btc { background: #f7931a; }
.pm-coin-icon--eth { background: #627eea; }
.pm-coin-icon--xrp { background: #23292f; color: #fff; }

.pm-change {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.pm-change--down {
  color: var(--pm-danger);
  background: var(--pm-danger-bg);
}

.pm-change--up {
  color: var(--pm-success);
  background: var(--pm-success-bg);
}

.pm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--pm-purple-light);
  color: var(--pm-purple);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 960px) {
  .pm-sidebar { display: none; }
  .pm-main { padding: 16px; }
  .pm-login-topbar { padding: 12px 16px; }
  .pm-login-card { padding: 24px 20px; }
}
