@import './css/fonts.css';
@import './css/vela-design.css';

:root:not([data-theme='light']) {
  --acc: #e63900;
  --acc-2: #f5a800;
  --acc-soft: #e6390026;
  --warn: #f5a800;
  --warn-soft: #f5a80029;
}

:root[data-theme='light'] {
  --acc: #e63900;
  --acc-2: #f5a800;
  --acc-soft: #e639001f;
}

:root {
  font-family: var(--font-sans);
  color: var(--t0);
  background: var(--bg-0);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body { min-width: 320px; }
button, a, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; background: var(--bg-0); }
.workspace { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.sidebar { display: flex; position: sticky; top: 0; z-index: 30; width: 258px; height: 100vh; flex: 0 0 258px; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg-1); transition: transform .2s ease, width .2s ease; }
.sidebar-collapsed .sidebar { display: none; }
.brand-row { display: flex; min-height: 74px; align-items: center; justify-content: space-between; padding: 18px 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: linear-gradient(135deg, var(--acc), var(--acc-2)); color: white; font-size: 22px; }
.brand-dot { color: var(--acc); }
.navigation { flex: 1; overflow-y: auto; padding: 8px 14px; }
.nav-group { margin-bottom: 5px; }
.nav-toggle, .nav-link { display: flex; width: 100%; align-items: center; border: 0; border-radius: 11px; color: var(--t1); font-size: 13px; font-weight: 600; text-align: left; }
.nav-toggle { gap: 12px; padding: 11px 10px; background: transparent; }
.nav-toggle:hover, .nav-link:hover { background: var(--bg-3); color: var(--t0); }
.nav-icon { width: 18px; color: var(--t1); text-align: center; }
.nav-chevron { margin-left: auto; color: var(--t2); }
.nav-children { display: grid; gap: 3px; margin: 2px 0 8px 20px; padding-left: 14px; border-left: 1px solid var(--line); }
.nav-link { padding: 8px 10px; font-size: 12.5px; font-weight: 500; }
.nav-link.active { background: var(--acc-soft); color: var(--acc); font-weight: 700; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.sidebar-footer a { color: var(--acc); }
.sidebar-footer span { display: block; margin-top: 4px; color: var(--t2); font-size: 12px; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 74px; align-items: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-1) 88%, transparent); backdrop-filter: blur(14px); }
.icon-button { position: relative; display: inline-grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--t1); }
.icon-button:hover, .profile-button:hover { background: var(--bg-3); color: var(--t0); }
.search-button { display: flex; min-width: 0; max-width: 360px; flex: 1; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-inset); color: var(--t1); text-align: left; }
.search-button kbd { margin-left: auto; padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 5px; color: var(--t2); font-size: 10px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.notification-button i { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.profile-button { display: flex; align-items: center; gap: 8px; padding: 2px 5px; border: 0; border-radius: 10px; background: transparent; color: var(--t1); }
.profile-copy { display: grid; gap: 1px; text-align: left; }
.profile-copy strong { color: var(--t0); font-size: 12px; }
.profile-copy small { color: var(--t2); font-size: 10px; }
.avatar { display: inline-grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 50%; color: white; font-size: 10px; font-weight: 700; }
.mobile-only { display: none; }

main.main-content { display: block; width: auto; max-width: none; min-width: 0; flex: 1 1 auto; margin: 0; overflow-y: auto; padding: 40px 48px 64px; }
.main-content > * { width: 100%; max-width: none; }
.page-heading { display: flex; width: 100%; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 auto 32px; }
.breadcrumb { margin: 0 0 10px; color: var(--t1); font-size: 12px; }
.breadcrumb span { padding: 0 8px; color: var(--t2); }
.breadcrumb strong { color: var(--t0); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 800; letter-spacing: 0; }
.page-subtitle, .panel-heading p { margin-top: 5px; color: var(--t1); font-size: 13px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 13px; font-size: 13px; font-weight: 700; }
.button-primary { background: var(--acc); color: white; box-shadow: 0 10px 24px -10px var(--acc-soft); }
.button-primary:hover { background: var(--acc-2); }
.button-secondary { border-color: var(--line-2); background: var(--bg-3); color: var(--t0); }
.button-secondary:hover { border-color: var(--line-2); background: var(--bg-2); }
.button-small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.stats-grid { display: grid; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 auto; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); box-shadow: var(--shadow); }
.stat-card { padding: 20px; }
.stat-top, .panel-heading, .pipeline-meta, .deal-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 13px; font-size: 20px; }
.stat-label { margin-top: 18px; color: var(--t1); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stat-value { margin-top: 4px; font-size: 24px; font-weight: 800; }
.stat-detail { margin-top: 2px; color: var(--t2); font-size: 11px; }
.status { display: inline-flex; align-items: center; width: max-content; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-success { background: var(--ok-soft); color: var(--ok); }
.status-danger { background: var(--bad-soft); color: var(--bad); }
.status-info { background: var(--info-soft); color: var(--info); }
.content-grid { display: grid; width: 100%; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 16px; margin: 16px auto 0; }
.panel { padding: 24px; }
.panel-heading { align-items: flex-start; margin-bottom: 24px; }
.panel-heading h2 { font-size: 15px; font-weight: 700; }
.pipeline-list { display: grid; gap: 20px; }
.pipeline-meta { margin-bottom: 8px; font-size: 13px; }
.stage-label { display: flex; align-items: center; gap: 8px; color: var(--t1); font-weight: 600; }
.pipeline-meta small { margin-right: 12px; color: var(--t2); font-size: 11px; }
.pipeline-meta strong { font-family: var(--font-mono); font-size: 13px; }
.stage-dot { width: 10px; height: 10px; border-radius: 3px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--bg-3); }
.progress-track span { display: block; height: 100%; border-radius: inherit; }
.activity-list { display: grid; gap: 18px; }
.activity-row { display: flex; align-items: flex-start; gap: 10px; }
.activity-row p { color: var(--t1); font-size: 12px; line-height: 1.5; }
.activity-row p strong { color: var(--t0); }
.activity-row small { color: var(--t2); font-size: 11px; }
.text-button { margin-top: 24px; padding: 0; border: 0; background: transparent; color: var(--acc); font-size: 12px; font-weight: 700; }
.deals-panel { width: 100%; margin: 16px auto 0; }
.deal-table { overflow: auto; }
.deal-row { display: grid; grid-template-columns: 1.3fr 1fr .8fr .7fr; padding: 14px 0; border-top: 1px solid var(--line); color: var(--t1); font-size: 12px; }
.deal-row strong { color: var(--t0); }
.deal-header { border-top: 0; color: var(--t2); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tone-accent { background: color-mix(in srgb, var(--acc) 16%, transparent); color: var(--acc); }
.tone-info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.tone-success { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tone-warning { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.progress-track .tone-accent, .stage-dot.tone-accent { background: var(--acc); }
.progress-track .tone-info, .stage-dot.tone-info { background: var(--info); }
.progress-track .tone-success, .stage-dot.tone-success { background: var(--ok); }
.progress-track .tone-warning, .stage-dot.tone-warning { background: var(--warn); }

.auth-page { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1fr) minmax(420px, 560px); background: var(--bg-0); color: var(--t0); }
.auth-promo { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 40px 12%; color: #fff; }
.auth-promo::before, .auth-promo::after { position: absolute; width: 320px; height: 320px; border-radius: 50%; content: ''; filter: blur(4px); opacity: .25; pointer-events: none; }
.auth-promo::before { top: 12%; right: 10%; background: radial-gradient(circle, var(--acc), transparent 68%); }
.auth-promo::after { bottom: 12%; left: 8%; background: radial-gradient(circle, var(--warn), transparent 68%); }
.auth-promo-signin { background: linear-gradient(165deg, #2b1005, #0c0e15 70%); }
.auth-promo-signup { display: flex; align-items: center; justify-content: center; gap: 28px; background: linear-gradient(135deg, #1d1009, #371c08 50%, #0d1518); }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: #fff; font-size: 19px; font-weight: 800; }
.auth-promo-copy, .auth-quote, .auth-feature-grid { position: relative; z-index: 1; max-width: 440px; }
.auth-promo-copy h2 { max-width: 520px; font-size: clamp(28px, 4vw, 44px); font-weight: 800; line-height: 1.08; }
.auth-promo-copy p { max-width: 480px; margin-top: 18px; color: #fff9; font-size: 15px; line-height: 1.65; }
.auth-quote { margin: 0; padding: 20px; border: 1px solid #fff2; border-radius: 16px; background: #ffffff0d; backdrop-filter: blur(10px); }
.auth-quote p { color: #fffc; font-size: 14px; line-height: 1.6; }
.auth-quote footer { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.auth-quote footer span:last-child { display: grid; gap: 2px; }
.auth-quote strong { font-size: 13px; }
.auth-quote small { color: #fff8; font-size: 11px; }
.auth-feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.auth-feature-grid article { display: grid; gap: 5px; padding: 18px; border: 1px solid #fff2; border-radius: 16px; background: #ffffff0d; }
.auth-feature-grid strong { color: var(--warn); font-size: 22px; }
.auth-feature-grid b { font-size: 13px; }
.auth-feature-grid small { color: #fff8; font-size: 11px; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 48px 64px; background: var(--bg-1); }
.auth-form { width: 100%; max-width: 400px; }
.auth-brand-mobile { display: none; color: var(--t0); }
.auth-form h1 { font-size: 30px; }
.auth-intro { margin-top: 8px; margin-bottom: 28px; color: var(--t1); font-size: 15px; }
.auth-social { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.auth-social button { height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); color: var(--t0); font-weight: 600; }
.auth-divider { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; color: var(--t2); font-size: 11px; font-weight: 700; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; background: var(--line); content: ''; }
.auth-form form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 7px; color: var(--t1); font-size: 12px; font-weight: 700; }
.auth-form label > span { display: flex; justify-content: space-between; }
.auth-form label a, .auth-switch a { color: var(--acc); }
.auth-form input:not([type='checkbox']) { width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: var(--bg-inset); color: var(--t0); }
.auth-form input:not([type='checkbox']):focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.auth-name-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.auth-check { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 500 !important; line-height: 1.5; }
.auth-check input { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; accent-color: var(--acc); }
.auth-check span { display: block !important; }
.auth-submit { width: 100%; min-height: 46px; border: 0; }
.auth-feedback { margin-top: 14px; color: var(--warn); font-size: 12px; text-align: center; }
.auth-switch { margin-top: 22px; color: var(--t1); font-size: 13px; text-align: center; }
.auth-switch a { font-weight: 700; }
.auth-back { display: block; margin-top: 18px; color: var(--t2); font-size: 12px; text-align: center; }

@media (max-width: 1100px) {
  .main-content { padding: 32px 24px 48px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .auth-page { display: block; }
  .auth-promo { display: none; }
  .auth-form-wrap { min-height: 100vh; padding: 32px 20px; }
  .auth-brand-mobile { display: flex; margin-bottom: 40px; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow); }
  .mobile-scrim { position: fixed; inset: 0; z-index: 25; background: #0008; }
  .mobile-only { display: inline-grid; }
  .desktop-only { display: none; }
  .topbar { padding: 12px 16px; }
  .profile-copy, .profile-button > span:last-child { display: none; }
  .main-content { padding: 28px 16px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .content-grid { grid-template-columns: 1fr; }
  .deal-row { grid-template-columns: 1.2fr .9fr .8fr; }
  .deal-row > :last-child { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .search-button span:nth-child(2), .search-button kbd { display: none; }
  .deal-row { min-width: 440px; }
  .deal-table { margin-right: -24px; padding-right: 24px; }
}