/* ========================================
 * AFK Together - Professional finish
 * Loaded after v2.css on every page.
 * Only visual polish: calmer surfaces, one
 * type family, consistent radii, nav icons.
 * Uses the theme variables, so every theme
 * (purple, black, white, blue, green, red)
 * keeps working.
 * ======================================== */

:root {
  --font-display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --pro-surface: rgba(var(--surface-rgb), 0.78);
  --pro-surface-2: rgba(var(--ink-rgb), 0.025);
  --pro-well: rgba(var(--well-rgb), 0.55);
  --pro-line: rgba(var(--ink-rgb), 0.075);
  --pro-line-strong: rgba(var(--ink-rgb), 0.14);
  --pro-shadow: 0 1px 0 rgba(var(--ink-rgb), 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.18);
}

html[data-theme="white"] {
  --pro-surface: #ffffff;
  --pro-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 1px rgba(15, 23, 42, 0.03);
}

/* ---------- base ---------- */
body {
  font-family: var(--font-body);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body,
.dashboard-body {
  background:
    radial-gradient(900px 380px at 50% -160px, rgba(var(--accent-rgb), 0.07), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

body::before {
  display: none;
}

h1, h2, h3, h4,
.stat-value,
.plan-badge,
.plan-bots b,
.referral-stat-value,
.slot-breakdown strong,
.live-placeholder strong,
.inv-head strong,
.brand,
.sidebar-brand strong,
.empty-icon,
.hero-feature strong {
  font-family: var(--font-display) !important;
}

h1, h2, h3 {
  font-weight: 650;
  letter-spacing: -0.02em;
}

.stat-value,
.plan-bots b,
.referral-stat-value,
.slot-breakdown strong {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

/* ---------- sidebar ---------- */
.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 14px 18px;
  background: rgba(var(--surface-rgb), 0.55);
  backdrop-filter: none;
  border-right: 1px solid var(--pro-line);
}

.sidebar-brand {
  gap: 11px;
  padding: 0 8px 24px;
}

.sidebar-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.sidebar-brand strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.sidebar-brand span {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.sidebar-nav {
  gap: 2px;
}

.nav-item {
  position: relative;
  gap: 11px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  transform: none !important;
}

.nav-item::before {
  content: "";
  flex: none;
  width: 17px;
  height: 17px;
  background: currentColor;
  opacity: 0.75;
  -webkit-mask: var(--nav-icon) center / contain no-repeat;
  mask: var(--nav-icon) center / contain no-repeat;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(var(--ink-rgb), 0.045);
}

.nav-item.active {
  color: var(--text);
  border-color: var(--pro-line);
  background: rgba(var(--ink-rgb), 0.06);
}

.nav-item.active::before {
  opacity: 1;
  background: var(--primary);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: -15px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.nav-item[href="/dashboard"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E");
}

.nav-item[href="/bots"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 8V4H8'/%3E%3Crect x='4' y='8' width='16' height='12' rx='2'/%3E%3Cpath d='M2 14h2M20 14h2M15 13v2M9 13v2'/%3E%3C/svg%3E");
}

.nav-item[href="/settings"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 7h-9M14 17H5'/%3E%3Ccircle cx='17' cy='17' r='3'/%3E%3Ccircle cx='7' cy='7' r='3'/%3E%3C/svg%3E");
}

.nav-item[href="/download"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m7 10 5 5 5-5M12 15V3'/%3E%3C/svg%3E");
}

.nav-item[href^="/admin"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z'/%3E%3C/svg%3E");
}

.nav-item[href="/admin/proxies"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E");
}

.nav-item[href="/admin/auto-write"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}

/* sidebar footer */
.community-card {
  position: relative;
  margin-bottom: 8px;
  padding: 11px 34px 11px 12px;
  border: 1px solid var(--pro-line);
  border-radius: 10px;
  background: var(--pro-surface-2);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.community-card::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M7 7h10v10'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M7 7h10v10'/%3E%3C/svg%3E") center / contain no-repeat;
}

.community-card:hover {
  border-color: var(--pro-line-strong);
  background: rgba(var(--ink-rgb), 0.045);
}

.community-card:hover::after {
  background: var(--text);
}

.community-card strong {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.community-card span {
  font-size: 11.5px;
}

.community-card.shop-card {
  margin-top: 0;
}

.logout-btn {
  height: 38px;
  border-radius: 8px;
  border-color: var(--pro-line);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
}

/* ---------- top bar ---------- */
.dashboard-topbar {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--pro-line);
}

.topbar-label {
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.dashboard-topbar h1 {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.language-chip,
.language-btn {
  border-radius: 8px;
  border-color: var(--pro-line);
  transform: none !important;
}

.language-chip {
  width: 38px;
  height: 38px;
}

.user-badge {
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border-color: var(--pro-line);
  border-radius: 10px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}

.user-badge strong {
  font-weight: 600;
}

.user-badge span {
  font-size: 11px;
}

/* ---------- cards ---------- */
.dashboard-panel,
.stat-card,
.download-card,
.landing-platform,
.landing-card,
.auth-card {
  border: 1px solid var(--pro-line);
  background: var(--pro-surface);
  backdrop-filter: none;
  box-shadow: var(--pro-shadow);
}

.dashboard-panel {
  padding: 22px;
  border-radius: 14px;
}

.dashboard-panel:hover,
.stat-card:hover {
  border-color: var(--pro-line-strong);
}

.panel-head {
  margin-bottom: 18px;
}

.panel-eyebrow {
  margin-bottom: 6px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.panel-head h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.panel-description {
  color: var(--text-dim);
}

/* stats */
.stats-grid {
  gap: 14px;
}

.stat-card {
  min-height: 0;
  padding: 18px 20px;
  border-radius: 12px;
}

.stat-card.accent {
  border-color: rgba(var(--accent-rgb), 0.28);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.07), transparent 70%),
    var(--pro-surface);
}

.stat-card.accent::after {
  display: none;
}

.stat-label {
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
}

.stat-value {
  margin: 12px 0 6px;
  font-size: 30px;
  line-height: 1.1;
}

.stat-meta {
  font-size: 12px;
}

.tier-badge::before {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

/* ---------- buttons ---------- */
.btn,
.btn-primary,
.panel-button,
.primary-link-button,
.primary-action,
.landing-primary,
.landing-secondary,
.landing-login,
.landing-platform-button,
.download-button,
.plans-discord,
.live-btn,
.live-control-btn {
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
}

.btn,
.primary-action {
  font-size: 14px;
}

.primary-action,
.delete-bot-button {
  padding-left: 18px;
  padding-right: 18px;
  border-radius: 8px;
}

.panel-button,
.primary-link-button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-primary,
.panel-button,
.primary-link-button,
.primary-action,
.landing-primary,
a.download-button {
  background: var(--primary);
  color: var(--on-accent);
}

.btn:hover,
.btn-primary:hover,
.panel-button:hover,
.primary-link-button:hover,
.primary-action:hover,
.landing-primary:hover,
.landing-secondary:hover,
a.download-button:hover,
.btn-discord:hover {
  transform: none !important;
  box-shadow: none !important;
  filter: brightness(1.1);
}

.btn {
  height: 44px;
}

.plans-discord {
  padding: 7px 12px;
  border-color: var(--pro-line-strong);
  color: var(--text);
}

.plans-discord:hover {
  background: rgba(var(--ink-rgb), 0.05);
}

/* ---------- inputs ---------- */
.field input,
.license-form input,
.referral-link-row input,
.webhook-form input {
  border-radius: 8px;
  border-color: var(--pro-line-strong);
  background: var(--pro-well);
}

.field input {
  height: 44px;
}

.field label {
  font-weight: 500;
}

/* ---------- bot list ---------- */
.bot-list {
  gap: 8px;
}

.bot-card {
  min-height: 64px;
  border-color: var(--pro-line);
  border-radius: 10px;
  background: var(--pro-surface-2);
}

.bot-card:hover {
  transform: none;
  border-color: var(--pro-line-strong);
  background: rgba(var(--ink-rgb), 0.045);
}

.bot-card strong {
  font-size: 14px;
  font-weight: 600;
}

.bot-card span {
  font-size: 12px;
}

.bot-status-dot {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 4px rgba(var(--ink-rgb), 0.05);
}

.bot-status-dot.running {
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.14);
}

.bot-state {
  padding: 4px 8px;
  border: 1px solid var(--pro-line);
  border-radius: 999px;
  font-size: 10px !important;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.bot-arrow {
  color: var(--text-faint) !important;
  transition: color 0.15s ease, transform 0.15s ease;
}

.bot-card:hover .bot-arrow {
  color: var(--text) !important;
  transform: translateX(2px);
}

/* empty state */
.empty-dashboard-state {
  border-color: var(--pro-line-strong);
  border-radius: 12px;
}

.empty-icon {
  border-radius: 12px;
}

/* ---------- plans ---------- */
.plan-card {
  border-radius: 10px;
  border-color: var(--pro-line);
  background: var(--pro-surface-2);
}

.plan-card::before {
  height: 2px;
}

.plan-card:hover {
  transform: none;
}

.plan-card.current {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tier) 35%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tier) 9%, transparent), transparent 75%),
    var(--pro-surface-2);
}

.plan-current {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.plans-note {
  border-radius: 10px;
  border-color: var(--pro-line);
  background: var(--pro-surface-2);
  color: var(--text-dim);
}

.plans-note b,
.plans-note strong {
  color: var(--text);
}

/* slots / referrals */
.slot-breakdown div,
.referral-stats > div {
  border-radius: 10px;
  border-color: var(--pro-line);
  background: var(--pro-surface-2);
}

.progress-track {
  height: 6px;
}

.progress-fill {
  background: var(--primary);
}

/* ---------- alerts ---------- */
.dashboard-alert,
.alert {
  border-radius: 10px;
}

/* ---------- live view + inventory ---------- */
.live-stage {
  border-radius: 12px;
}

.inv-window {
  border-radius: 12px;
  border-color: var(--pro-line-strong);
}

/* ---------- public pages (landing, login) ---------- */
.landing-nav {
  padding-top: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--pro-line);
  max-width: none;
  padding-left: max(32px, calc((100% - 1180px) / 2 + 32px));
  padding-right: max(32px, calc((100% - 1180px) / 2 + 32px));
}

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

.brand-mark {
  border-radius: 9px;
}

.hero-kicker {
  padding: 6px 12px;
  border-color: var(--pro-line-strong);
  background: var(--pro-surface-2);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
}

.landing-copy h1,
.hero-copy h1 {
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.landing-copy p,
.hero-copy p {
  font-size: 16.5px;
  line-height: 1.65;
}

.landing-card {
  padding: 26px;
  border-radius: 14px;
}

.landing-primary,
.landing-secondary {
  min-height: 46px;
  font-size: 14.5px;
}

.landing-hint {
  border-radius: 8px;
}

.landing-section-head h2 {
  font-size: 20px;
}

.landing-platform,
.download-card {
  border-radius: 12px;
}

.landing-platform.is-current {
  border-color: rgba(var(--accent-rgb), 0.45);
}

.download-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
}

.download-icon svg {
  width: 20px;
  height: 20px;
}

.download-badge {
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.hero-feature {
  border-radius: 12px;
  backdrop-filter: none;
}

.auth-card {
  border-radius: 16px;
}

.auth-card h2 {
  font-size: 26px;
  font-weight: 650;
}

.landing-footer,
.hero-footer {
  font-size: 12.5px;
}

/* ---------- small screens ---------- */
@media (max-width: 850px) {
  .sidebar {
    padding: 14px var(--page-pad-x) 12px;
  }

  .sidebar-brand {
    padding: 0;
  }

  .nav-item {
    min-height: 36px;
    padding: 0 12px;
  }

  .nav-item.active::after {
    display: none;
  }

  .dashboard-topbar {
    padding-bottom: 18px;
  }
}

@media (max-width: 640px) {
  .landing-nav {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
