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

:root {
  --ink: #17231f;
  --ink-2: #263b34;
  --green: #3f7f68;
  --green-bright: #92d7b5;
  --mint: #dff2e9;
  --cream: #f5f3eb;
  --paper: #fdfcf8;
  --orange: #e88953;
  --red: #c7665b;
  --blue: #6f8db5;
  --muted: #78827e;
  --line: #e3e5df;
  --shadow: 0 12px 35px rgba(27, 46, 39, .07);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--cream); font: 14px/1.5 'Manrope', system-ui, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.eyebrow.light { color: var(--green-bright); }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1.12fr .88fr; background: var(--paper); }
.login-art { position: relative; min-height: 100vh; overflow: hidden; display: flex; align-items: flex-end; padding: 9vw; color: white; background: var(--ink); }
.login-copy { z-index: 3; max-width: 580px; }
.login-copy h1 { margin: 20px 0; font-size: clamp(54px, 7vw, 104px); line-height: .9; letter-spacing: -.07em; }
.login-copy p { max-width: 500px; color: #b9c9c2; font-size: 17px; }
.art-grid { position: absolute; inset: 0; opacity: .12; background-image: linear-gradient(#a9d7c5 1px, transparent 1px), linear-gradient(90deg, #a9d7c5 1px, transparent 1px); background-size: 56px 56px; mask-image: linear-gradient(to bottom, black, transparent); }
.art-orbit { position: absolute; border: 1px solid rgba(146,215,181,.35); border-radius: 50%; }
.orbit-one { width: 48vw; height: 48vw; right: -16vw; top: -14vw; box-shadow: 0 0 100px rgba(146,215,181,.08); }
.orbit-two { width: 26vw; height: 26vw; right: -3vw; top: -3vw; }
.brand-mark { width: 34px; height: 34px; display: flex; align-items: flex-end; gap: 3px; padding: 6px; border-radius: 9px; background: var(--green-bright); }
.brand-mark span { display: block; flex: 1; background: var(--ink); border-radius: 5px; }
.brand-mark span:nth-child(1) { height: 40%; }.brand-mark span:nth-child(2) { height: 72%; }.brand-mark span:nth-child(3) { height: 100%; }
.brand-mark.large { position: absolute; z-index: 3; left: 9vw; top: 8vh; width: 50px; height: 50px; border-radius: 13px; padding: 9px; }
.login-panel { display: grid; place-items: center; padding: 6vw; }
.login-card { width: min(390px, 100%); }
.login-card h2 { margin: 12px 0 6px; font-size: 34px; line-height: 1.15; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 35px; }
label { display: block; color: var(--ink-2); font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: 0 13px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 10px; outline: none; transition: .2s; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63,127,104,.1); }
.login-card label { margin: 18px 0; }
.login-card label > input, .password-wrap { margin-top: 8px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 45px; }
.password-wrap button { position: absolute; right: 3px; top: 3px; width: 38px; height: 38px; border: 0; color: var(--muted); background: transparent; }
.form-error { min-height: 20px; color: var(--red); font-size: 12px; }
.btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; transition: transform .15s, background .2s; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: white; background: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.outline { border-color: var(--line); background: var(--paper); color: var(--ink); }
.login-btn { width: 100%; justify-content: space-between; margin-top: 8px; padding: 0 20px; min-height: 50px; }
.login-card small { display: block; margin-top: 24px; color: #9da5a2; text-align: center; }
.mobile-logo { display: none; align-items: center; gap: 10px; margin-bottom: 45px; font-weight: 800; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 220px; display: flex; flex-direction: column; padding: 31px 20px 21px; color: white; background: var(--ink); }
.logo { display: flex; align-items: center; gap: 11px; padding: 0 9px; font-size: 16px; line-height: 1.05; letter-spacing: -.02em; }
.sidebar nav { margin-top: 65px; }
.nav-item { width: 100%; min-height: 45px; display: flex; align-items: center; gap: 12px; margin-bottom: 6px; padding: 0 12px; color: #aebcb7; text-align: left; background: transparent; border: 0; border-radius: 10px; font-weight: 600; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: var(--ink); background: var(--green-bright); }
.nav-icon { width: 20px; text-align: center; font-size: 19px; }
.sidebar-bottom { margin-top: auto; }
.week-reminder { display: flex; align-items: center; gap: 10px; margin: 0 8px 22px; color: #bdcac5; }
.week-reminder small, .week-reminder b { display: block; }
.week-reminder b { color: white; font-size: 12px; }
.pulse-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 5px rgba(146,215,181,.12); }
main { min-height: 100vh; margin-left: 220px; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; padding: 20px 38px; background: rgba(245,243,235,.92); border-bottom: 1px solid rgba(217,219,212,.8); backdrop-filter: blur(12px); }
.topbar h1 { margin: 3px 0 0; font-size: 27px; line-height: 1.1; letter-spacing: -.04em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.week-select-wrap { position: relative; min-width: 210px; }
.week-select-wrap span { position: absolute; z-index: 1; left: 12px; top: 5px; font-size: 9px; color: var(--muted); text-transform: uppercase; }
.week-select-wrap select { height: 48px; padding-top: 10px; font-weight: 700; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 24px; }
.default-warning { margin: 18px 38px 0; padding: 10px 14px; color: #6e3c1e; background: #f7dfc8; border-radius: 10px; font-size: 12px; }
.page { display: none; padding: 26px 38px 50px; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } }
.period-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; color: var(--muted); font-size: 12px; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-weight: 700; }
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.metric-card { position: relative; overflow: hidden; min-height: 150px; padding: 19px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.metric-card.featured { color: white; background: var(--ink); border-color: var(--ink); }
.metric-card.featured::after { content: ''; position: absolute; width: 140px; height: 140px; right: -70px; top: -70px; border: 1px solid rgba(146,215,181,.3); border-radius: 50%; box-shadow: 0 0 0 30px rgba(146,215,181,.04); }
.metric-title { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.featured .metric-title { color: #b3c6bd; }
.metric-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--green); background: var(--mint); font-size: 13px; }
.metric-value { margin-top: 22px; font-size: 33px; font-weight: 800; letter-spacing: -.055em; line-height: 1; }
.metric-foot { margin-top: 9px; color: var(--muted); font-size: 11px; }
.featured .metric-foot { color: #aabdb4; }
.metric-foot b { color: var(--green); }.featured .metric-foot b { color: var(--green-bright); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .75fr); gap: 13px; margin-top: 13px; }
.panel { padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel h3 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.035em; }
.legend { display: flex; gap: 15px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; }.legend .green { background: var(--green); }.legend .orange { background: var(--orange); }.legend .red { background: var(--red); }
.chart { min-height: 230px; }
.chart svg { width: 100%; height: 230px; overflow: visible; }
.chart-grid { stroke: #e7e9e4; stroke-width: 1; stroke-dasharray: 3 4; }
.chart-label { fill: #89918e; font: 9px 'Manrope'; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { opacity: .09; }
.chart-dot { stroke: white; stroke-width: 2; }
.empty-chart { min-height: 230px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.mini-badge { padding: 5px 8px; color: var(--green); background: var(--mint); border-radius: 7px; font-size: 10px; font-weight: 800; }
.funnel-total { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.funnel-total strong { display: block; font-size: 28px; line-height: 1; letter-spacing: -.05em; }.funnel-total small { color: var(--muted); }
.funnel-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 14px 0; }
.funnel-row span, .funnel-row b { font-size: 11px; }.funnel-row span { color: var(--muted); }.funnel-row b { font-size: 12px; }
.bar-track { grid-column: 1 / -1; height: 7px; overflow: hidden; background: #edf0ec; border-radius: 9px; }
.bar-fill { height: 100%; min-width: 2px; border-radius: 9px; background: var(--green); }
.affiliate-direction-row { margin: 16px 0; }
.affiliate-direction-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.affiliate-direction-head > span { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; }
.affiliate-direction-head > span i { width: 7px; height: 7px; border-radius: 50%; }
.affiliate-direction-head > b { font-size: 12px; }
.affiliate-direction-head > b small { color: var(--muted); font-size: 8px; font-weight: 600; }
.affiliate-direction-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 8px; }
.affiliate-direction-stats div { min-width: 0; padding: 6px 4px; border-radius: 7px; background: #f4f5f1; text-align: center; }
.affiliate-direction-stats small, .affiliate-direction-stats b { display: block; }
.affiliate-direction-stats small { overflow: hidden; color: var(--muted); font-size: 7px; letter-spacing: .02em; text-overflow: ellipsis; }
.affiliate-direction-stats b { margin-top: 1px; font-size: 11px; }
.funnel-divider { height: 1px; margin: 18px 0; background: var(--line); }
.conversion-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.conversion-row div { padding: 10px; border-radius: 10px; background: #f4f5f1; }.conversion-row small,.conversion-row b { display: block; }.conversion-row small { color: var(--muted); font-size: 9px; }.conversion-row b { margin-top: 3px; }
.partner-chart-panel, .directions-panel, .site-table-panel { margin-top: 13px; }
.partner-chart-head { align-items: center; }
.partner-legend { flex-wrap: wrap; justify-content: flex-end; max-width: 510px; }
.partner-chart { position: relative; min-height: 285px; }
.partner-chart svg { width: 100%; height: 285px; overflow: visible; }
.partner-chart .percent-line { stroke-dasharray: 6 5; }
.percent-axis-label { fill: #8b6fb0; }
.chart-hit-area { fill: transparent; pointer-events: all; }
.partner-hover-line { visibility: hidden; stroke: #65706b; stroke-width: 1; stroke-dasharray: 3 4; opacity: .7; }
.partner-hover-line.visible { visibility: visible; }
.partner-hover-dot { visibility: hidden; stroke: white; stroke-width: 2.5; pointer-events: none; }
.partner-hover-dot.visible { visibility: visible; }
.chart-tooltip { position: absolute; z-index: 4; width: 200px; padding: 11px 12px; color: white; background: rgba(23,35,31,.96); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .12s, transform .12s; }
.chart-tooltip.visible { opacity: 1; transform: translateY(0); }
.chart-tooltip > strong { display: block; margin-bottom: 7px; font-size: 10px; }
.chart-tooltip > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; font-size: 9px; }
.chart-tooltip > div span { display: flex; align-items: center; gap: 6px; color: #c5d0cb; }
.chart-tooltip > div i { width: 7px; height: 7px; border-radius: 2px; }
.chart-tooltip > div b { font-size: 10px; }
.direction-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
.direction-card { padding: 15px; background: #f4f5f1; border-radius: 12px; }
.direction-name { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.direction-name i { width: 8px; height: 8px; border-radius: 50%; }
.direction-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 17px; }
.direction-stats small,.direction-stats b { display: block; }.direction-stats small { color: var(--muted); font-size: 9px; }.direction-stats b { margin-top: 2px; font-size: 16px; }
.direction-ctr { margin-top: 12px; padding-top: 10px; border-top: 1px solid #dfe2dc; color: var(--muted); font-size: 10px; }.direction-ctr b { float: right; color: var(--ink); }
.table-controls { display: flex; gap: 7px; }.table-controls select { width: 165px; }.table-controls input { width: 180px; }
.selected-period-note { margin-top: 4px; color: var(--muted); font-size: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; color: #8a928f; border-bottom: 1px solid var(--line); text-align: left; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid #eceee9; font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8f8f4; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.domain-cell { font-weight: 700; }.domain-cell a { color: var(--ink); text-decoration: none; }.domain-cell a:hover { color: var(--green); }
.direction-pill { display: inline-block; padding: 4px 7px; border-radius: 6px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.direction-pill.brand { color: #27614f; background: #def1e8; }.direction-pill.cross { color: #865229; background: #f6e6d5; }.direction-pill.broadcast { color: #506b91; background: #e2eafa; }.direction-pill.slots { color: #7d4e78; background: #f1e1ef; }
.warning-value { color: var(--red); font-weight: 800; }

.entry-intro { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 19px; }.entry-intro h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.04em; }.entry-intro p { margin: 0; color: var(--muted); }.date-range { display: flex; align-items: flex-end; gap: 8px; }.date-range label { width: 145px; }.date-range input { margin-top: 5px; }
.entry-panel { margin-bottom: 13px; }.autosave-note { color: var(--muted); font-size: 10px; }
.entry-table-wrap { max-height: 520px; }.entry-table thead { position: sticky; z-index: 2; top: 0; background: var(--paper); }.entry-table th:first-child { min-width: 210px; }.entry-table input { width: 88px; min-height: 34px; padding: 0 8px; text-align: right; font-size: 11px; }
.entry-group td { padding: 8px 12px; color: var(--green); background: #f0f5f1; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.affiliate-input-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.affiliate-input-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; }.affiliate-input-card h4 { margin: 0 0 12px; }.affiliate-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }.affiliate-fields label { color: var(--muted); font-size: 9px; }.affiliate-fields input { min-height: 38px; margin-top: 4px; }
.save-bar { position: sticky; z-index: 5; bottom: 13px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 15px; padding: 14px 18px; background: rgba(23,35,31,.96); border-radius: 14px; box-shadow: 0 10px 30px rgba(23,35,31,.2); }.save-bar label { flex: 1; max-width: 470px; color: #c9d3cf; }.save-bar input { height: 40px; min-height: 40px; margin-top: 4px; color: white; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }.save-bar .btn { color: var(--ink); background: var(--green-bright); }.save-status { margin-right: 12px; color: #b8c7c0; font-size: 11px; }.wide { min-width: 160px; }
.sites-layout { display: grid; grid-template-columns: 1.7fr .7fr; gap: 13px; align-items: start; }.site-group { margin-top: 20px; }.site-group-title { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11px; font-weight: 800; }.site-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 11px; border-top: 1px solid var(--line); }.site-row a { color: var(--ink); text-decoration: none; font-size: 12px; font-weight: 700; }.site-row small { color: var(--muted); }.site-row.inactive { opacity: .45; }.site-toggle { padding: 5px 8px; border: 0; border-radius: 7px; color: var(--green); background: var(--mint); font-size: 9px; font-weight: 800; }.site-toggle.off { color: #8a514b; background: #f6dedb; }.add-site-panel { position: sticky; top: 20px; }.add-site-panel > p { font-size: 11px; }.add-site-panel form { margin-top: 24px; }.add-site-panel label { margin: 14px 0; }.add-site-panel input,.add-site-panel select { margin-top: 5px; }
footer { padding: 0 38px 28px; color: #999f9c; font-size: 10px; }footer span { margin: 0 6px; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 18px; color: white; background: var(--ink); border-radius: 11px; box-shadow: 0 15px 40px rgba(0,0,0,.2); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s; }.toast.show { opacity: 1; transform: translateY(0); }.toast.error { background: #9c4c44; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }.direction-grid { grid-template-columns: repeat(2, 1fr); }.dashboard-grid { grid-template-columns: 1fr; }.affiliate-input-grid { grid-template-columns: 1fr; }.sites-layout { grid-template-columns: 1fr; }.add-site-panel { position: static; }
}
@media (max-width: 760px) {
  .login-screen { grid-template-columns: 1fr; }.login-art { display: none; }.login-panel { min-height: 100vh; padding: 28px; }.mobile-logo { display: flex; }
  .sidebar { width: 220px; transform: translateX(-100%); transition: .25s; box-shadow: 10px 0 30px rgba(0,0,0,.18); }.sidebar.open { transform: translateX(0); }
  main { margin-left: 0; }.mobile-menu { display: block; }.topbar { min-height: 82px; padding: 15px 18px; }.topbar > div:first-of-type { flex: 1; margin-left: 8px; }.topbar h1 { font-size: 21px; }.top-actions .week-select-wrap,.top-actions .btn.outline { display: none; }.top-actions .btn.primary { width: 42px; padding: 0; font-size: 0; }.top-actions .btn.primary::after { content: '+'; font-size: 20px; }
  .page { padding: 19px 14px 40px; }.default-warning { margin: 12px 14px 0; }.metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }.metric-card { min-height: 125px; padding: 15px; }.metric-value { margin-top: 17px; font-size: 27px; }.metric-title { font-size: 9px; }.panel { padding: 16px; }.direction-grid { grid-template-columns: 1fr; }.legend:not(.partner-legend) { display: none; }.partner-chart-head { display: block; }.partner-legend { display: flex; justify-content: flex-start; margin-top: 12px; }.partner-chart { overflow-x: auto; }.partner-chart svg { min-width: 680px; }.affiliate-direction-stats { grid-template-columns: repeat(2, 1fr); }
  .entry-intro { display: block; }.date-range { margin-top: 15px; }.date-range label { width: 100%; }.save-bar { align-items: stretch; flex-direction: column; }.save-bar label { width: 100%; }.save-bar > div { display: flex; justify-content: flex-end; align-items: center; }.table-controls { display: none; }
}
