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

/* ============================================================
   ADVERTISING REPORT CARD DESIGN SYSTEM
   Shared across all /admin/* pages and client templates
   Brand: advertisingreportcard.com
   Primary #297498 (ARC blue)
   Accent  #DB6176 (coral)
   Warm    #D9A46D (tan)
   Soft    #8FB9CB (sky)
   Deep    #523429 (brown)
   ============================================================ */
:root, [data-theme="light"] {
  --color-primary: #297498;
  --color-primary-hover: #1F5B78;
  --color-primary-light: #CFE1EA;
  --color-primary-subtle: #EAF2F7;
  --color-accent: #DB6176;
  --color-accent-hover: #C24A60;
  --color-accent-subtle: #FBEBEE;
  --color-warm: #D9A46D;
  --color-warm-subtle: #F8EEDF;
  --color-sky: #8FB9CB;
  --color-brown: #523429;

  --color-bg: #F7FAFC;
  --color-surface: #FFFFFF;
  --color-border: #E3EAEF;
  --color-heading: #1C2A35;
  --color-body: #303030;
  --color-muted: #6B7A85;

  --color-success: #2EA66B;
  --color-warning: #D9A46D;
  --color-amber-deep: #B8862F;
  --color-danger: #DB6176;
  --color-info: #297498;
  --color-violet: #8B5CF6;

  --sidebar-bg: #FBFDFE;
  --sidebar-border: #E8EFF3;
  --sidebar-hover: #EEF4F8;

  --shadow-sm: 0 2px 8px rgba(28,42,53,.06);
  --shadow-md: 0 8px 24px rgba(28,42,53,.08);
  --shadow-lg: 0 16px 40px rgba(28,42,53,.12);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}
[data-theme="dark"] {
  --color-primary: #4FA3C9;
  --color-primary-hover: #6CB8DB;
  --color-primary-light: #1E3B4C;
  --color-primary-subtle: #0F2330;
  --color-accent: #E07A8D;
  --color-accent-hover: #ED93A4;
  --color-accent-subtle: #2A1418;
  --color-warm: #E3B683;
  --color-warm-subtle: #2B2116;
  --color-sky: #A9CCDA;
  --color-brown: #A87457;

  --color-bg: #0B141B;
  --color-surface: #12202A;
  --color-border: #1E3140;
  --color-heading: #E8F1F7;
  --color-body: #C5D3DC;
  --color-muted: #6F8593;

  --color-success: #4BC488;
  --color-warning: #E3B683;
  --color-amber-deep: #E8C487;
  --color-danger: #E07A8D;
  --color-info: #4FA3C9;
  --color-violet: #A78BFA;

  --sidebar-bg: #0D1A22;
  --sidebar-border: #1A2E3B;
  --sidebar-hover: #152633;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; overflow-x: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--color-body);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }
h1, h2, h3, h4, h5 { font-family: 'Inter', sans-serif; font-weight: 700; color: var(--color-heading); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
a { color: var(--color-primary); text-decoration: none; font-weight: 500; }
a:hover { color: var(--color-primary-hover); }
strong { font-weight: 600; color: var(--color-heading); }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .85em; background: var(--color-primary-subtle); padding: .1em .4em; border-radius: 4px; color: var(--color-primary); }

/* ---- LAYOUT ---- */
.admin-layout { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar { width: 240px; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; display: flex; flex-direction: column; transition: width .2s ease, transform .25s ease; overflow: hidden; }
.sidebar-header { padding: 1.25rem 19px .75rem; display: flex; align-items: center; gap: .65rem; white-space: nowrap; }
.sidebar-header img { height: 36px; width: 36px; padding: 4px; background: var(--color-primary-subtle); border: 1px solid rgba(41,116,152,.18); border-radius: 10px; }
.sidebar-header span { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--color-heading); letter-spacing: -0.01em; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: .25rem 0; }
.sidebar-nav a, .sidebar-nav button { display: flex; align-items: center; gap: .65rem; padding: .55rem 19px; font-size: .82rem; font-weight: 500; color: var(--color-body); text-decoration: none; transition: all .15s; border: none; background: none; cursor: pointer; width: 100%; text-align: left; font-family: inherit; border-left: 3px solid transparent; }
.sidebar-nav a:hover, .sidebar-nav button:hover { background: var(--sidebar-hover); color: var(--color-heading); }
.sidebar-nav a.active { background: var(--color-primary-subtle); color: var(--color-primary); font-weight: 600; border-left-color: var(--color-primary); }
.sidebar-nav .nav-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: .95rem; flex-shrink: 0; opacity: .65; }
.sidebar-nav a.active .nav-icon, .sidebar-nav a:hover .nav-icon { opacity: 1; }
.nav-section { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--color-muted); padding: .9rem .75rem .25rem 22px; opacity: .7; white-space: nowrap; }

/* ---- MAIN ---- */
.main { flex: 1; margin-left: 240px; min-width: 0; transition: margin-left .2s ease; }

/* ---- TOP BAR ---- */
.topbar { position: sticky; top: 0; z-index: 100; background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding: 0 2rem; height: 56px; display: flex; align-items: center; gap: 1rem; }
.search-box { flex: 1; max-width: 480px; position: relative; }
.search-box input { width: 100%; padding: .45rem .75rem .45rem 2.25rem; border: 1px solid var(--color-border); border-radius: 8px; font-size: .82rem; font-family: inherit; color: var(--color-body); background: var(--color-bg); transition: border-color .2s, box-shadow .2s; }
.search-box input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(41,116,152,.15); }
.search-box input::placeholder { color: var(--color-muted); }
.search-box .search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--color-muted); font-size: .85rem; pointer-events: none; }
.topbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

/* ---- CONTENT ---- */
.content { padding: 2rem; max-width: 1280px; }
@media (max-width: 1024px) { .content { padding: 1.5rem; } }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 10px; font-size: .85rem; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: all .2s; font-family: inherit; line-height: 1.2; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-accent { background: var(--color-accent); color: #fff; }
.btn-accent:hover { background: var(--color-accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-outline { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary-subtle); }
.btn-ghost { background: none; color: var(--color-muted); padding: .4rem .7rem; }
.btn-ghost:hover { color: var(--color-heading); background: var(--sidebar-hover); }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; border-radius: 8px; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1rem; border-radius: 12px; }

/* ---- CARDS ---- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.5rem; transition: border-color .2s, box-shadow .2s; }
.card:hover { border-color: var(--color-primary-light); box-shadow: var(--shadow-sm); }
.card-elevated { box-shadow: var(--shadow-md); border: none; }

/* ---- STAT CARDS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.25rem; transition: border-color .2s, box-shadow .2s; }
.stat-card:hover { border-color: var(--color-primary-light); box-shadow: var(--shadow-sm); }
.stat-card .stat-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--color-muted); margin-bottom: .4rem; }
.stat-card .stat-value { font-family: 'Inter', sans-serif; font-size: 2rem; font-weight: 800; color: var(--color-heading); line-height: 1; letter-spacing: -0.02em; }
.stat-card .stat-sub { font-size: .75rem; color: var(--color-muted); margin-top: .4rem; }
.stat-card .stat-trend-up { color: var(--color-success); font-weight: 600; }
.stat-card .stat-trend-down { color: var(--color-danger); font-weight: 600; }

/* ---- GRADE BADGES (report-card motif) ---- */
.grade { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 1.75rem; letter-spacing: -.02em; color: #fff; box-shadow: var(--shadow-sm); }
.grade-a { background: linear-gradient(135deg, #2EA66B, #27895A); }
.grade-b { background: linear-gradient(135deg, #297498, #1F5B78); }
.grade-c { background: linear-gradient(135deg, #D9A46D, #B8862F); }
.grade-d { background: linear-gradient(135deg, #DB6176, #B64759); }
.grade-f { background: linear-gradient(135deg, #523429, #3A241C); }
.grade-sm { width: 40px; height: 40px; font-size: 1.2rem; border-radius: 12px; }

/* ---- TAGS / PILLS ---- */
.tag { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.tag-active   { background: rgba(46,166,107,.12);  color: var(--color-success); }
.tag-onboarding { background: rgba(41,116,152,.12); color: var(--color-primary); }
.tag-prospect { background: rgba(217,164,109,.15); color: var(--color-amber-deep); }
.tag-lead     { background: rgba(107,122,133,.12); color: var(--color-muted); }
.tag-accent   { background: rgba(219,97,118,.12);  color: var(--color-accent); }
.tag-won      { background: linear-gradient(135deg, #297498, #1F5B78); color: #fff; }

/* ---- STATUS DOT ---- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green  { background: var(--color-success); box-shadow: 0 0 6px rgba(46,166,107,.5); }
.dot-blue   { background: var(--color-primary); box-shadow: 0 0 6px rgba(41,116,152,.5); }
.dot-yellow { background: var(--color-warm);    box-shadow: 0 0 6px rgba(217,164,109,.5); }
.dot-red    { background: var(--color-accent);  box-shadow: 0 0 6px rgba(219,97,118,.5); }
.dot-gray   { background: var(--color-muted); }

/* ---- FILTER TABS ---- */
.filter-bar { display: flex; align-items: center; gap: .25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--color-border); overflow-x: auto; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-tab { padding: .6rem 1rem; font-size: .82rem; font-weight: 500; color: var(--color-muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; transition: all .15s; white-space: nowrap; flex-shrink: 0; }
.filter-tab:hover { color: var(--color-heading); }
.filter-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.filter-tab .count { font-size: .7rem; padding: .08rem .45rem; border-radius: 4px; background: var(--color-bg); margin-left: .35rem; color: var(--color-muted); }
.filter-tab.active .count { background: var(--color-primary-subtle); color: var(--color-primary); }

/* ---- TABLES ---- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th { text-align: left; padding: .55rem .8rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--color-muted); border-bottom: 1px solid var(--color-border); background: var(--color-bg); }
.data-table td { padding: .7rem .8rem; border-bottom: 1px solid var(--color-border); font-size: .85rem; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .12s; }
.data-table tbody tr:hover { background: var(--sidebar-hover); }
.client-cell { display: flex; align-items: center; gap: .7rem; }
.client-avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--color-primary-subtle); color: var(--color-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .78rem; flex-shrink: 0; }
.client-name { font-weight: 600; color: var(--color-heading); }
.client-email { font-size: .75rem; color: var(--color-muted); }

/* ---- PROGRESS BAR ---- */
.progress-mini { display: flex; align-items: center; gap: .6rem; }
.progress-mini .bar { flex: 1; height: 6px; background: var(--color-border); border-radius: 3px; overflow: hidden; min-width: 60px; }
.progress-mini .bar-fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-sky)); border-radius: 3px; transition: width .3s; }
.progress-mini .bar-label { font-size: .75rem; color: var(--color-muted); white-space: nowrap; font-weight: 500; }

.progress-ring { --size: 80px; --track: 6px; width: var(--size); height: var(--size); position: relative; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring .track { stroke: var(--color-border); fill: none; stroke-width: var(--track); }
.progress-ring .fill  { stroke: var(--color-primary); fill: none; stroke-width: var(--track); stroke-linecap: round; transition: stroke-dashoffset .4s; }
.progress-ring .value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 1.1rem; color: var(--color-heading); }

/* ---- REPORT CARD CALLOUT (brand motif) ---- */
.report-callout { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover)); color: #fff; border-radius: var(--radius-lg); padding: 1.5rem 1.75rem; position: relative; overflow: hidden; }
.report-callout::before { content: ''; position: absolute; top: -40px; right: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.08); }
.report-callout h3 { color: #fff; margin-bottom: .4rem; }
.report-callout p { color: rgba(255,255,255,.85); font-size: .9rem; }

/* ---- FORM ---- */
.form-field { margin-bottom: 1.1rem; }
.form-field label { display: block; font-size: .8rem; font-weight: 600; color: var(--color-heading); margin-bottom: .35rem; }
.form-field input, .form-field select, .form-field textarea { width: 100%; padding: .6rem .8rem; border: 1px solid var(--color-border); border-radius: 10px; font-size: .9rem; font-family: inherit; color: var(--color-body); background: var(--color-surface); transition: border-color .2s, box-shadow .2s; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(41,116,152,.15); }
.form-field .hint { font-size: .75rem; color: var(--color-muted); margin-top: .3rem; }

/* ---- HERO / PAGE HEADER ---- */
.page-hero { background: linear-gradient(135deg, var(--color-primary-subtle), var(--color-surface)); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: 2rem 2.25rem; margin-bottom: 2rem; }
.page-hero .eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--color-primary); margin-bottom: .6rem; }
.page-hero h1 { margin-bottom: .5rem; }
.page-hero p { color: var(--color-muted); font-size: 1rem; max-width: 62ch; }

/* ---- TOAST ---- */
.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; padding: .7rem 1.1rem; border-radius: 10px; font-size: .82rem; font-weight: 500; z-index: 1000; transform: translateY(120%); transition: transform .3s; box-shadow: var(--shadow-md); }
.toast.show { transform: translateY(0); }
.toast.success { background: var(--color-success); color: #fff; }
.toast.error   { background: var(--color-danger);  color: #fff; }

/* ---- EMPTY / SPINNER ---- */
.empty-state { text-align: center; padding: 3rem; color: var(--color-muted); }
.empty-state p { font-size: .85rem; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- SECTION HEADER ---- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; gap: 1rem; }
.section-header h2 { font-size: 1.35rem; margin: 0; }
.section-desc { font-size: .85rem; color: var(--color-muted); margin-bottom: 1.5rem; }

/* ---- THEME TOGGLE ---- */
.theme-toggle { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 50%; width: 34px; height: 34px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .9rem; transition: all .2s; }
.theme-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ---- MOBILE ---- */
.mobile-toggle { display: none; background: none; border: none; color: var(--color-heading); font-size: 1.25rem; cursor: pointer; padding: .25rem; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 199; }
.sidebar.open ~ .sidebar-overlay { display: block; }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  .main { margin-left: 0; }
  .mobile-toggle { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: .78rem; }
  .data-table .hide-mobile { display: none; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  h1 { font-size: 1.85rem; }
}

/* M7: 44px touch-target floor on mobile */
@media (max-width: 768px) {
  .btn, button[type="submit"] { min-height: 44px; }
}
