/* ==========================================================================
   Client Portal — design system
   Colours are driven per-client from the workspace's branding settings.
   ========================================================================== */

:root {
  --primary: #0d0f10;
  --accent: #1490af;
  --bg: #f2f4f5;

  --surface: #ffffff;
  --surface-2: #fafbfc;
  --text: #10151c;
  --text-2: #5b6672;
  --text-3: #8b96a3;
  --border: #e6e9ed;
  --border-2: #eef1f4;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, .06);
  --shadow: 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .14);

  --sidebar-w: 264px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 650; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
img { max-width: 100%; }
.muted { color: var(--text-2); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
svg { flex-shrink: 0; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar::before {
  content: '';
  position: absolute; inset: 0 auto 0 0; width: 100%; height: 220px;
  background: radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 70%);
  pointer-events: none;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.4rem 1.25rem 1.1rem;
  position: relative; z-index: 1;
}
.sidebar-brand img {
  width: 40px; height: 40px; border-radius: 11px; object-fit: cover;
  background: #fff; padding: 3px; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.sidebar-brand .name { font-weight: 650; font-size: .98rem; line-height: 1.15; }
.sidebar-brand .sub { font-size: .72rem; opacity: .6; }

.nav-group { padding: .5rem .75rem; position: relative; z-index: 1; }
.nav-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .1em;
  opacity: .45; padding: .9rem .5rem .4rem; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .65rem; border-radius: 10px;
  color: rgba(255,255,255,.72); font-size: .89rem; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent); }
.nav-item .count {
  margin-left: auto; font-size: .72rem; opacity: .75;
  background: rgba(255,255,255,.13); padding: .05rem .45rem; border-radius: 999px;
}
.nav-item.active .count { background: rgba(255,255,255,.22); opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 1rem .75rem 1.25rem; position: relative; z-index: 1; }

.client-switch {
  position: relative; z-index: 1; margin: .25rem .75rem .5rem;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: .55rem .7rem;
}
.client-switch label { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; opacity: .5; font-weight: 600; }
.client-switch select {
  width: 100%; margin-top: .3rem; background: transparent; color: #fff;
  border: 0; font-size: .88rem; font-weight: 600; padding: 0; cursor: pointer;
}
.client-switch select option { background: #1a1f24; color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .85rem 1.75rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.content { padding: 1.75rem; flex: 1; max-width: 1400px; width: 100%; }

.user-chip { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--primary)));
  color: #fff; display: grid; place-items: center;
  font-size: .8rem; font-weight: 650; letter-spacing: .02em;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 2.1rem 2.2rem;
  margin-bottom: 1.5rem;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%),
    linear-gradient(120deg, var(--primary), color-mix(in srgb, var(--primary) 78%, var(--accent)));
  color: #fff;
  box-shadow: var(--shadow);
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%);
  pointer-events: none;
}
.hero h1 { font-size: 2rem; margin-bottom: .35rem; }
.hero .wave { display: inline-block; animation: wave 2.4s ease-in-out 1; transform-origin: 70% 70%; }
@keyframes wave { 0%,60%,100%{transform:rotate(0)} 15%{transform:rotate(16deg)} 30%{transform:rotate(-8deg)} 45%{transform:rotate(12deg)} }
.hero p { opacity: .82; max-width: 52ch; }
.hero-stats { display: flex; gap: 2rem; margin-top: 1.5rem; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stat .n { font-size: 1.6rem; font-weight: 680; line-height: 1; }
.hero-stat .l { font-size: .78rem; opacity: .72; margin-top: .2rem; }

/* ---------- Section cards ---------- */
.section-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.section-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem;
  box-shadow: var(--shadow-xs);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
  display: block;
}
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.section-card .ico {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); margin-bottom: .9rem;
}
.section-card h3 { margin-bottom: .2rem; }
.section-card .blurb { color: var(--text-2); font-size: .85rem; }
.section-card .foot { display: flex; align-items: baseline; gap: .45rem; margin-top: 1rem; }
.section-card .foot .n { font-size: 1.5rem; font-weight: 680; letter-spacing: -.03em; }
.section-card .foot .l { color: var(--text-3); font-size: .8rem; }
.section-card .go {
  position: absolute; right: 1.15rem; bottom: 1.15rem; color: var(--text-3);
  transition: transform .18s var(--ease), color .18s var(--ease);
}
.section-card:hover .go { color: var(--accent); transform: translateX(3px); }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem; box-shadow: var(--shadow-xs);
  margin-bottom: 1.5rem;
}
.panel-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.panel-head h2 { flex: 1; }
.section-title { display: flex; align-items: center; gap: .75rem; margin: 0 0 1rem; }
.section-title h2 { flex: 1; }

/* ---------- Media grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; display: block;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
  box-shadow: var(--shadow-xs);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-thumb {
  position: relative; aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #171c22, #0b0e12);
  display: grid; place-items: center; overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card:hover .card-thumb img { transform: scale(1.045); }
.thumb-icon { color: rgba(255,255,255,.5); }
.card-badge {
  position: absolute; top: .6rem; left: .6rem;
  background: rgba(8,10,13,.72); backdrop-filter: blur(6px);
  color: #fff; font-size: .68rem; font-weight: 600;
  padding: .2rem .55rem; border-radius: 999px;
  display: flex; align-items: center; gap: .3rem;
}
.card-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.15); opacity: 0; transition: opacity .2s var(--ease);
}
.card:hover .card-play { opacity: 1; }
.card-play span {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: var(--primary);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.card-body { padding: .8rem .9rem 1rem; }
.card-title {
  font-weight: 600; font-size: .92rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { color: var(--text-3); font-size: .76rem; margin-top: .3rem; }
.card-tags { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .6rem; }
.mini-tag {
  font-size: .68rem; padding: .12rem .45rem; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2);
}

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.search-form { display: flex; gap: .5rem; align-items: center; margin-left: auto; }
.search-input {
  position: relative; display: flex; align-items: center;
}
.search-input svg { position: absolute; left: .7rem; color: var(--text-3); pointer-events: none; }
.search-input input {
  width: 230px; max-width: 46vw; padding: .5rem .9rem .5rem 2.1rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: .88rem; font-family: inherit; color: var(--text);
}
.search-input input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; border-color: var(--accent); }
.chip-row { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .32rem .8rem; border-radius: 999px; font-size: .82rem; line-height: 1.25;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  white-space: nowrap; transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: .55rem 1rem; font-size: .88rem; font-weight: 550;
  font-family: inherit; cursor: pointer; transition: all .15s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--text-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.07); border-color: var(--accent); }
.btn-dark { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: #fff; border-color: #f3c9c9; color: #b42318; }
.btn-danger:hover { background: #fef3f2; border-color: #f0a9a4; }
.btn-sm { padding: .32rem .65rem; font-size: .78rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; }

/* ---------- Forms ---------- */
label { display: block; font-size: .82rem; font-weight: 550; color: var(--text-2); margin-bottom: .9rem; }
input, select, textarea {
  width: 100%; margin-top: .3rem; padding: .58rem .8rem; font-size: .9rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 1px; border-color: var(--accent);
}
input[type="color"] { padding: .2rem; height: 42px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0; }
.inline-form input, .inline-form select { width: auto; margin: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; }
.checkline { display: inline-flex; align-items: center; gap: .45rem; color: var(--text); font-weight: 450; margin: 0 1rem .5rem 0; font-size: .87rem; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; margin: 0 0 .9rem; }
legend { font-size: .78rem; color: var(--text-2); font-weight: 600; padding: 0 .35rem; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  text-align: left; padding: .55rem .7rem; color: var(--text-3);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 650;
  border-bottom: 1px solid var(--border);
}
.table td { padding: .7rem; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- Badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; font-weight: 600; padding: .16rem .5rem; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-2);
}
.badge-ok { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.badge-warn { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.badge-err { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.badge-accent { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }

.flash {
  padding: .8rem 1.1rem; border-radius: 12px; font-size: .88rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .6rem;
}
.flash-success { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.flash-error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }

.empty {
  text-align: center; padding: 3.5rem 1.5rem; color: var(--text-2);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty .ico { color: var(--text-3); margin-bottom: .8rem; }
.empty h3 { margin-bottom: .3rem; color: var(--text); }

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background:
    radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--bg);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.4rem; width: 100%; max-width: 410px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.auth-card .logo { width: 60px; height: 60px; border-radius: 16px; object-fit: cover; margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: .3rem; }
.auth-card form { text-align: left; margin-top: 1.5rem; }
.auth-foot { margin-top: 1.5rem; color: var(--text-3); font-size: .78rem; }

/* ---------- File detail ---------- */
.file-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.player, .player-embed, .photo-full {
  width: 100%; border-radius: var(--radius); overflow: hidden;
  background: #0b0e12; box-shadow: var(--shadow-sm); display: block;
}
.player-embed { position: relative; aspect-ratio: 16/9; }
.player-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.doc-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 3.5rem; text-align: center; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }

.comment { padding: .8rem 0; border-bottom: 1px solid var(--border-2); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .82rem; margin-bottom: .3rem; }
.comment p { font-size: .89rem; white-space: pre-wrap; }
.comment-admin { background: color-mix(in srgb, var(--accent) 5%, transparent); border-radius: 10px; padding: .8rem; }
.comments { max-height: 420px; overflow-y: auto; }
.timecode {
  background: var(--primary); color: #fff; border: 0; border-radius: 999px;
  font-size: .68rem; padding: .1rem .5rem; cursor: pointer; font-family: inherit;
}

/* ---------- Client hub (agency) ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.hub-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-xs);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
  display: flex; flex-direction: column;
}
.hub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.hub-card-top { padding: 1.15rem 1.25rem; display: flex; align-items: center; gap: .8rem; border-bottom: 1px solid var(--border-2); }
.hub-avatar {
  width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 650; font-size: .95rem;
}
.hub-stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.hub-stats div { padding: .8rem .5rem; text-align: center; border-right: 1px solid var(--border-2); }
.hub-stats div:last-child { border-right: 0; }
.hub-stats .n { font-weight: 660; font-size: 1.05rem; }
.hub-stats .l { color: var(--text-3); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.hub-actions { padding: .8rem 1.25rem; display: flex; gap: .5rem; margin-top: auto; border-top: 1px solid var(--border-2); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow-xs);
}
.stat .n { font-size: 1.7rem; font-weight: 680; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { color: var(--text-3); font-size: .78rem; margin-top: .15rem; }

.upload-box {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.4rem;
  background: var(--surface-2); display: flex; gap: .9rem; align-items: center; flex-wrap: wrap;
}
.upload-box input[type="file"] { width: auto; flex: 1; min-width: 200px; margin: 0; border: 0; background: transparent; padding: 0; }
.upload-box select { width: auto; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .file-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row;
    align-items: center; overflow-x: auto; padding-right: .5rem;
  }
  .sidebar-brand { padding: .8rem 1rem; }
  .sidebar-brand .sub { display: none; }
  .nav-group { display: flex; gap: .3rem; padding: .5rem; }
  .nav-label, .sidebar-foot, .client-switch label { display: none; }
  .nav-item .count { display: none; }
  .client-switch { margin: 0 .5rem; padding: .35rem .5rem; }
  .sidebar-foot { display: block; margin: 0; padding: .5rem; }
  .content, .topbar { padding: 1rem; }
  .hero { padding: 1.5rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero-stats { gap: 1.25rem; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
  .search-form { margin-left: 0; width: 100%; }
  .search-input { flex: 1; }
  .search-input input { width: 100%; max-width: none; }
  .hub-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Initials mark used when a client has no logo uploaded yet */
.sidebar-mark {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
  background: var(--accent); color: #fff; letter-spacing: .02em;
}
.auth-mark {
  width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 1rem;
  display: grid; place-items: center; font-weight: 700; font-size: 1.3rem;
  background: var(--accent); color: #fff;
}

/* ---------- Connected accounts ---------- */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .7rem; }
.conn-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2);
}
.conn-item.is-on { background: var(--surface); border-color: color-mix(in srgb, #12b76a 35%, var(--border)); }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.conn-item.is-on .conn-dot { background: #12b76a; box-shadow: 0 0 0 3px rgba(18,183,106,.15); }

/* ---------- Analytics ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.05rem 1.2rem; box-shadow: var(--shadow-xs);
}
.kpi-top { display: flex; align-items: center; gap: .45rem; color: var(--text-2); font-size: .78rem; font-weight: 550; }
.kpi-ico { color: var(--accent); display: grid; place-items: center; }
.kpi-n { font-size: 1.75rem; font-weight: 680; letter-spacing: -.03em; line-height: 1.15; margin-top: .35rem; }
.kpi-delta { font-size: .76rem; font-weight: 600; margin-top: .2rem; display: flex; align-items: center; gap: .3rem; }
.kpi-delta.up { color: #067647; }
.kpi-delta.down { color: #b42318; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border-2); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 20px; font-family: inherit; }
.chart-legend { display: flex; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--text-2); }
.chart-legend .lg i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-empty { padding: 2.5rem 1rem; text-align: center; color: var(--text-3); font-size: .88rem; }

.barlist { display: flex; flex-direction: column; gap: .6rem; }
.barlist-row { display: grid; grid-template-columns: 130px 1fr 62px; align-items: center; gap: .7rem; }
.barlist-label { display: flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 550; }
.barlist-label i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.barlist-track { background: var(--surface-2); border-radius: 999px; height: 9px; overflow: hidden; }
.barlist-fill { height: 100%; border-radius: 999px; transition: width .5s var(--ease); }
.barlist-value { text-align: right; font-weight: 620; font-size: .84rem; }

.analytics-split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .analytics-split { grid-template-columns: 1fr; } }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: .45rem; }
@media (max-width: 560px) { .barlist-row { grid-template-columns: 96px 1fr 52px; } }

/* Logo picker preview */
.logo-preview { display: flex; align-items: center; gap: .7rem; margin: -.3rem 0 .9rem; }
.logo-preview img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 13px;
  border: 1px solid var(--border); background: var(--surface-2); padding: 3px;
}
