/* Worxphere AI Tracker — Dashboard Common Styles */

:root {
  --purple: #7C3AED; --purple-light: #EDE9FE; --purple-dark: #5B21B6;
  --gray-50: #F9FAFB; --gray-100: #F3F4F6; --gray-200: #E5E7EB;
  --gray-400: #9CA3AF; --gray-500: #6B7280; --gray-700: #374151; --gray-900: #111827;
  --green: #10B981; --yellow: #F59E0B; --red: #EF4444; --cyan: #06B6D4;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--gray-900); background: var(--gray-50); line-height: 1.6; }
.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* Nav */
nav { padding: 16px 0; background: white; border-bottom: 1px solid var(--gray-200); }
nav .container { display: flex; align-items: center; justify-content: space-between; }
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--gray-900); }
.nav-logo svg { width: 32px; height: 32px; }
.nav-logo span { font-size: 18px; font-weight: 700; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-email { font-size: 13px; color: var(--gray-500); }
.nav-icon-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: none; background: none; color: var(--gray-400); cursor: pointer; transition: all .15s; text-decoration: none; }
.nav-icon-btn:hover { color: var(--gray-900); background: var(--gray-100); }

/* Demo banner */
.demo-banner { background: linear-gradient(135deg, var(--purple), #9333EA); color: white; text-align: center; padding: 10px 24px; font-size: 14px; font-weight: 500; }
.demo-banner a { color: white; text-decoration: underline; font-weight: 700; margin-left: 8px; }

/* Login */
.login-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - 65px); text-align: center; padding: 40px 24px; }
.login-screen h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.login-screen p { font-size: 16px; color: var(--gray-500); margin-bottom: 32px; }

/* Dashboard */
.dashboard { padding: 32px 0 60px; display: none; }
.dashboard.active { display: block; }
.dash-header { margin-bottom: 28px; }
.dash-header h1 { font-size: 24px; font-weight: 700; }
.dash-header p { font-size: 14px; color: var(--gray-500); }

/* Info grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.info-card { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; }
.info-card .label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.info-card .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.info-card .unit { font-size: 14px; color: var(--gray-400); font-weight: 400; }
.info-card .sub-text { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.info-card .countdown { font-size: 13px; color: var(--purple); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* Gauge */
.gauge-wrap { position: relative; width: 100%; height: 20px; background: var(--gray-100); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.gauge-fill { height: 100%; border-radius: 10px; transition: width .5s ease; }
.gauge-label-inside { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 600; color: white; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.gauge-mark { position: absolute; top: 0; height: 100%; width: 2px; background: rgba(0,0,0,.3); }

/* Status badge */
.status-badge { display: inline-block; padding: 3px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.st-ok { background: #dcfce7; color: #166534; }
.st-warn { background: #fef9c3; color: #854d0e; }
.st-danger { background: #fee2e2; color: #991b1b; }

/* Plan badge */
.plan-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.pb-pro { background: #dbeafe; color: #1e40af; }
.pb-max5 { background: #fef3c7; color: #92400e; }
.pb-max20 { background: #fce7f3; color: #9d174d; }
.pb-team { background: #e0e7ff; color: #3730a3; }
.pb-team-prem { background: #c7d2fe; color: #312e81; }
.pb-enterprise { background: #dcfce7; color: #166534; }
.pb-free { background: #F3F4F6; color: #6B7280; }
.pb-unk { background: var(--gray-100); color: var(--gray-500); }

/* Recommendation card */
.rec-card { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; margin-bottom: 24px; border-left: 4px solid; }
.rec-card.rc-ok { border-color: var(--green); }
.rec-card.rc-warn { border-color: var(--yellow); }
.rec-card.rc-danger { border-color: var(--red); }
.rec-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.rec-body { font-size: 14px; color: var(--gray-700); line-height: 1.6; }
.rec-detail { font-size: 12px; color: var(--gray-500); margin-top: 6px; }
.rec-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rec-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.rec-icon.ri-upgrade { background: #fef2f2; color: #dc2626; }
.rec-icon.ri-upgrade-mod { background: #fffbeb; color: #d97706; }
.rec-icon.ri-downgrade { background: #ecfdf5; color: #059669; }
.rec-icon.ri-good { background: #ecfdf5; color: #059669; }
.rec-icon.ri-warn { background: #fffbeb; color: #d97706; }
.rec-icon.ri-info { background: #f3f4f6; color: #6b7280; }
.rec-plan-change { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.rec-cost { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.rec-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.rec-btn { display: inline-block; padding: 8px 20px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; color: white; cursor: pointer; text-decoration: none; }
.rec-btn.rb-upgrade { background: #d97706; }
.rec-btn.rb-upgrade-urgent { background: #dc2626; }
.rec-btn.rb-downgrade { background: #059669; }
.rec-dismiss { padding: 8px 16px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 13px; background: white; color: var(--gray-500); cursor: pointer; }
.view-as-banner { background: #fffbeb; border: 1px solid #f59e0b; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: #92400e; }
.view-as-banner a { color: #7C3AED; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* Fitness Matrix */
.fm-card { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; margin-bottom: 24px; }
.fm-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.fm-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.fm-table th { font-size: 12px; color: var(--gray-500); font-weight: 500; padding: 8px 12px; text-align: center; border-bottom: 1px solid var(--gray-200); }
.fm-table th:first-child { text-align: left; }
.fm-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--gray-100); }
.fm-plan-cell { text-align: left !important; font-weight: 600; font-size: 13px; white-space: nowrap; }
.fm-icon-cell { cursor: default; }
.fm-cost-cell { font-size: 13px; color: var(--gray-500); font-variant-numeric: tabular-nums; }
.fm-reasoning { border-top: 1px solid var(--gray-200); padding-top: 12px; margin-top: 4px; }
.fm-reasoning ul { list-style: none; padding: 0; margin: 0; }
.fm-reasoning li { font-size: 13px; color: var(--gray-600); line-height: 1.7; padding-left: 16px; position: relative; }
.fm-reasoning li::before { content: '\00b7'; position: absolute; left: 4px; font-weight: bold; }
.fm-legend { font-size: 11px; color: var(--gray-400); margin-top: 12px; text-align: center; }
.fm-row-current { border-left: 3px solid #007aff; }
.fm-row-rec { background: #f0fdf4; }
.fm-row-current.fm-row-rec { border-left: 3px solid #007aff; background: #f0fdf4; }
.fm-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.fm-badge-current { background: #e8f2ff; color: #007aff; }
.fm-badge-rec { background: #16a34a; color: #fff; }
.fm-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; font-size: 14px; font-weight: 700; }
.fm-icon-exceeded { background: #fee2e2; color: #dc2626; }
.fm-icon-tight { background: #fef3c7; color: #d97706; }
.fm-icon-fit { background: #dcfce7; color: #16a34a; }
.fm-icon-overspend { background: #e0e7ff; color: #6366f1; }
.fm-icon-unknown { background: #f3f4f6; color: #9ca3af; }
.fm-icon.fm-partial { opacity: 0.75; border: 1.5px dashed currentColor; }
.fm-group-sep td { padding: 0 !important; height: 8px; border-bottom: 2px solid var(--gray-200); }
.fm-row-ref { opacity: 0.45; }
.fm-msg { padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; margin-top: 16px; }
.fm-msg-upgrade { background: #eff6ff; border-left: 3px solid #3b82f6; color: #1e40af; }
.fm-msg-downgrade { background: #f0fdf4; border-left: 3px solid #16a34a; color: #166534; }
@media (max-width: 640px) { .fm-table th, .fm-table td { padding: 8px 6px; font-size: 12px; } .fm-icon { width: 24px; height: 24px; font-size: 12px; } }
@media (max-width: 480px) { .fm-table th, .fm-table td { padding: 6px 4px; font-size: 11px; } .fm-icon { width: 22px; height: 22px; font-size: 11px; } }

.util-nav { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.util-nav-btn { padding: 5px 12px; border: 1px solid #e5e7eb; background: white; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; color: #6b7280; }
.util-nav-btn:hover:not(:disabled) { background: #f9fafb; }
.util-nav-btn:disabled { opacity: 0.35; cursor: default; }
.util-range-label { font-size: 13px; font-weight: 600; color: #111827; min-width: 140px; text-align: center; }
.util-scale-toggle { margin-left: auto; display: flex; border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; }
.util-scale-btn { padding: 4px 14px; border: none; background: white; font-size: 12px; font-weight: 500; cursor: pointer; color: #6b7280; }
.util-scale-btn.active { background: #7c3aed; color: white; }
.util-scale-btn:not(.active):hover { background: #f5f3ff; }

/* Tab bar */
.tab-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn { padding: 8px 20px; border: 1px solid var(--gray-200); border-radius: 20px; font-size: 13px; font-weight: 500; cursor: pointer; background: white; color: var(--gray-700); transition: all .15s; }
.tab-btn:hover { border-color: var(--purple); color: var(--purple); }
.tab-btn.active { background: var(--purple); color: white; border-color: var(--purple); }

/* Chart card */
.chart-card { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; margin-bottom: 24px; }
.chart-card h3 { font-size: 15px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.chart-sub { font-size: 11px; color: var(--gray-400); margin-bottom: 12px; }

/* Account info */
.account-card { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 24px; margin-bottom: 28px; }
.account-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.account-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.account-row:last-child { border-bottom: none; }
.account-label { font-size: 14px; color: var(--gray-500); }
.account-value { font-size: 14px; font-weight: 600; }

/* Nav tabs */
.nav-tabs { display: flex; gap: 4px; margin-left: 20px; }
.nav-tab { padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--gray-500); transition: all .15s; }
.nav-tab:hover { color: var(--gray-900); background: var(--gray-100); }
.nav-tab.active { background: var(--purple); color: white; }
.nav-tab.admin-tab { display: none; }

/* Empty / Loading */
.empty-state { text-align: center; padding: 60px 24px; background: white; border: 1px solid var(--gray-200); border-radius: 14px; }
.empty-state h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--gray-500); margin-bottom: 20px; line-height: 1.7; }
.empty-state a { display: inline-block; background: var(--purple); color: white; padding: 10px 24px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 600; }
.empty-state a:hover { background: var(--purple-dark); }
.loading { text-align: center; padding: 80px 24px; color: var(--gray-400); font-size: 16px; }

/* Status Banner */
.status-banner { margin-bottom: 20px; padding: 16px 20px; border-radius: 14px; display: flex; align-items: center; gap: 12px; }
.sb-icon { font-size: 24px; flex-shrink: 0; line-height: 1; }
.sb-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.sb-sub { font-size: 12px; margin-top: 2px; opacity: 0.8; }
.sb-at-limit, .sb-danger { background: #fef2f2; border: 1px solid #fecaca; }
.sb-at-limit .sb-title, .sb-danger .sb-title { color: #991b1b; }
.sb-at-limit .sb-sub, .sb-danger .sb-sub { color: #b91c1c; }
.sb-warning { background: #fffbeb; border: 1px solid #fde68a; }
.sb-warning .sb-title { color: #92400e; }
.sb-warning .sb-sub { color: #a16207; }
.sb-caution { background: #f5f3ff; border: 1px solid #e9d5ff; }
.sb-caution .sb-title { color: #5b21b6; }
.sb-caution .sb-sub { color: #6d28d9; }
.sb-safe { background: #f0fdf4; border: 1px solid #bbf7d0; }
.sb-safe .sb-title { color: #166534; }
.sb-safe .sb-sub { color: #15803d; }
.sb-nodata { background: #f9fafb; border: 1px solid #e5e7eb; }
.sb-nodata .sb-title { color: #6b7280; }
.sb-nodata .sb-sub { color: #9ca3af; }

/* Weekday/Weekend stats */
.wd-we-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; padding: 16px; background: var(--gray-50); border-radius: 10px; border: 1px solid var(--gray-200); margin-top: 16px; }
.wd-we-card { text-align: center; padding: 8px; }
.wd-we-label { font-size: 11px; color: var(--gray-500); margin-bottom: 4px; }
.wd-we-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .container { padding: 0 12px; }
  .nav-tabs { display: none; }
  .nav-logo span { font-size: 15px; }
  .user-email { display: none; }
  .dash-header h1 { font-size: 18px; }
  .dash-header p { font-size: 12px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .info-card { padding: 14px; }
  .info-card .value { font-size: 22px; }
  .info-card .label { font-size: 11px; }
  .shared-user-gauges { flex-direction: column; gap: 8px; }
  .wd-we-stats { grid-template-columns: 1fr; }
  .util-range-label { min-width: auto; font-size: 12px; }
  .util-scale-toggle { margin-left: 0; }
  .util-nav { gap: 4px; }
  .util-nav-btn { padding: 4px 8px; font-size: 12px; }
  .rec-card { padding: 14px; }
  .rec-title { font-size: 14px; }
  .rec-body { font-size: 13px; }
  .fm-card { padding: 14px; }
  .login-screen h1 { font-size: 22px; }
  .login-screen p { font-size: 14px; }
}
@media (max-width: 420px) {
  .info-grid { grid-template-columns: 1fr; }
}
