/* WorkRadar AI Mini App — собственный premium SaaS UI (не Telegram theme,
   STAGE 9.1, раздел 6). Mobile-first, safe-area aware. */

:root {
  --wr-bg: #f4f5fb;
  --wr-surface: #ffffff;
  --wr-surface-2: #f0f1f8;
  --wr-border: #e4e6f2;
  --wr-text: #14162b;
  --wr-text-muted: #6b6f8a;
  --wr-accent: #5b5bf0;
  --wr-accent-2: #8b6df0;
  --wr-accent-contrast: #ffffff;
  --wr-success: #1fae6b;
  --wr-warning: #e0972e;
  --wr-danger: #e0473e;
  --wr-radius-lg: 20px;
  --wr-radius-md: 14px;
  --wr-radius-sm: 10px;
  --wr-shadow: 0 10px 30px rgba(30, 30, 80, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --wr-bg: #0f1020;
    --wr-surface: #171933;
    --wr-surface-2: #1e2140;
    --wr-border: #2a2d54;
    --wr-text: #f2f2fb;
    --wr-text-muted: #9a9dc4;
    --wr-accent: #7b7bff;
    --wr-accent-2: #a685ff;
    --wr-accent-contrast: #ffffff;
    --wr-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--wr-bg);
  color: var(--wr-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(var(--safe-top) + 14px) 18px 12px;
  background: var(--wr-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--wr-accent), var(--wr-accent-2));
  color: var(--wr-accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }

.view {
  flex: 1;
  padding: 4px 18px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.loading-state, .error-state, .empty-state {
  margin-top: 40px;
  text-align: center;
  color: var(--wr-text-muted);
  font-size: 15px;
}

.error-state { color: var(--wr-danger); }

.screen-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 6px 0 0;
}

.screen-sub { color: var(--wr-text-muted); font-size: 14px; margin: -6px 0 4px; }

.back-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-btn {
  border: none;
  background: var(--wr-surface);
  box-shadow: var(--wr-shadow);
  color: var(--wr-text);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--wr-surface);
  border: 1px solid var(--wr-border);
  border-radius: var(--wr-radius-lg);
  box-shadow: var(--wr-shadow);
  padding: 16px;
}

.hero-card {
  background: linear-gradient(135deg, var(--wr-accent), var(--wr-accent-2));
  color: var(--wr-accent-contrast);
  border-radius: var(--wr-radius-lg);
  padding: 18px;
  box-shadow: var(--wr-shadow);
}

.hero-greeting { font-size: 15px; opacity: 0.9; margin: 0 0 4px; }
.hero-title { font-size: 20px; font-weight: 700; margin: 0; }

.stat-row { display: flex; gap: 10px; }

.stat-tile {
  flex: 1;
  background: var(--wr-surface);
  border: 1px solid var(--wr-border);
  border-radius: var(--wr-radius-md);
  padding: 12px 14px;
  box-shadow: var(--wr-shadow);
}

.stat-label { font-size: 12px; color: var(--wr-text-muted); margin: 0 0 4px; }
.stat-value { font-size: 18px; font-weight: 700; margin: 0; }
.stat-value.pro-active { color: var(--wr-success); }
.stat-value.pro-inactive { color: var(--wr-text-muted); }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 14px;
  border-radius: var(--wr-radius-md);
  border: 1px solid var(--wr-border);
  background: var(--wr-surface);
  box-shadow: var(--wr-shadow);
  text-align: left;
  font: inherit;
  color: var(--wr-text);
  cursor: pointer;
}

.action-btn:active { transform: scale(0.98); }

.action-icon { font-size: 22px; }
.action-label { font-size: 14px; font-weight: 600; }

.secondary-list { display: flex; flex-direction: column; gap: 8px; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--wr-radius-md);
  border: 1px solid var(--wr-border);
  background: var(--wr-surface);
  box-shadow: var(--wr-shadow);
  font: inherit;
  color: var(--wr-text);
  cursor: pointer;
  text-align: left;
}

.list-row-label { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.list-row-chevron { color: var(--wr-text-muted); }

.primary-btn {
  border: none;
  border-radius: var(--wr-radius-md);
  background: linear-gradient(135deg, var(--wr-accent), var(--wr-accent-2));
  color: var(--wr-accent-contrast);
  padding: 14px 16px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.primary-btn:disabled { opacity: 0.55; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-good { background: rgba(31, 174, 107, 0.14); color: var(--wr-success); }
.badge-possible { background: rgba(224, 151, 46, 0.14); color: var(--wr-warning); }

.match-card { display: flex; flex-direction: column; gap: 8px; }
.match-top { display: flex; justify-content: space-between; align-items: center; }
.match-category { font-size: 13px; color: var(--wr-text-muted); }
.match-snippet { font-size: 14px; line-height: 1.4; margin: 0; }
.match-budget { font-size: 13px; color: var(--wr-text-muted); }
.match-link { font-size: 13px; color: var(--wr-accent); text-decoration: none; }

.profile-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--wr-border); font-size: 14px; }
.profile-row:last-child { border-bottom: none; }
.profile-row-label { color: var(--wr-text-muted); }

.placeholder-note {
  font-size: 13px;
  color: var(--wr-text-muted);
  background: var(--wr-surface-2);
  border-radius: var(--wr-radius-sm);
  padding: 12px 14px;
}
