/* ==========================================================================
   sidebar.css — standard fixed left nav. Plain list items, one active state.
   ========================================================================== */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 60;
}

/* ---------------------------------------------------------- wordmark -- */
.sidebar-brand {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
}

.sidebar-brand .logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
}
.sidebar-brand .logo svg { width: 16px; height: 16px; }

.sidebar-brand .brand-text { display: flex; flex-direction: column; min-width: 0; }

.sidebar-brand .brand-name {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand .brand-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ------------------------------------------------------------- label -- */
.sidebar-label {
  flex: none;
  padding: 6px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* --------------------------------------------------------- nav list -- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 2px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.client-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  text-align: left;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.client-link:hover { background: var(--surface-alt); color: var(--text); }

.client-link.active {
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}

.client-link .client-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-link .client-pct {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.client-link.active .client-pct { color: var(--accent); opacity: .8; }

.client-link .away-mark { flex: none; color: var(--caution); }
.client-link .away-mark svg { width: 13px; height: 13px; }

.sidebar-note {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ------------------------------------ circular usage indicator (SVG) -- */
.usage-ring { flex: none; }

.usage-ring circle {
  transition: stroke-dashoffset 500ms var(--ease), stroke 200ms var(--ease);
}

.usage-ring .ring-track { stroke: var(--border); }
.usage-ring .ring-fill  { stroke: var(--text-3); }

.client-link.active .usage-ring .ring-fill { stroke: var(--accent); }
.usage-ring.warn .ring-fill { stroke: var(--caution); }
.usage-ring.over .ring-fill { stroke: var(--critical); }
.client-link.active .usage-ring.warn .ring-fill { stroke: var(--caution); }
.client-link.active .usage-ring.over .ring-fill { stroke: var(--critical); }

/* ------------------------------------------------------------ footer -- */
.sidebar-footer {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.sidebar-btn svg { width: 15px; height: 15px; color: var(--text-3); }
.sidebar-btn:hover,
.sidebar-btn.active { color: var(--text); background: var(--surface-alt); }
.sidebar-btn:hover svg,
.sidebar-btn.active svg { color: var(--text); }

/* ================================================ mobile: tab strip == */
@media (max-width: 900px) {
  .sidebar {
    position: sticky;
    inset: 0 0 auto 0;
    width: 100%;
    flex: none;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-brand { padding: 14px 16px 10px; }
  .sidebar-label { display: none; }

  .sidebar-nav {
    flex: none;
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 12px;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }

  .client-link { width: auto; flex: none; padding: 7px 12px; }
  .client-link .client-name { max-width: 140px; }
  .client-link .client-pct { display: none; }

  .sidebar-footer {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar-footer::-webkit-scrollbar { display: none; }
  .sidebar-btn { white-space: nowrap; }
}
