/* MotionCoach Design System — v2 */
/* Fonts loaded via <link> in HTML <head> for non-blocking rendering */

/* ─── tokens ─── */
:root {
  color-scheme: dark;

  --mc-bg:         #0b0f15;
  --mc-surface-1:  #141921;
  --mc-surface-2:  #1c222d;
  --mc-surface-3:  #252c3a;
  --mc-border:     #2e3647;
  --mc-border-soft:#232a38;

  --mc-text:       #e4e8ef;
  --mc-text-2:     #a0a8b8;
  --mc-text-3:     #6b7385;
  --mc-text-inv:   #0b0f15;

  --mc-accent:     #22c997;
  --mc-accent-h:   #19e6aa;
  --mc-accent-soft:rgba(34,201,151,0.10);
  --mc-accent-mute:rgba(34,201,151,0.22);

  --mc-blue:       #539bf5;
  --mc-blue-soft:  rgba(83,155,245,0.10);
  --mc-amber:      #e5a742;
  --mc-amber-soft: rgba(229,167,66,0.10);
  --mc-red:        #e5534b;
  --mc-red-soft:   rgba(229,83,75,0.10);

  --mc-font:       'DM Sans', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  --mc-font-head:  'Outfit', 'PingFang SC', system-ui, sans-serif;
  --mc-font-mono:  'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  --mc-radius-s:   6px;
  --mc-radius:     10px;
  --mc-radius-l:   16px;
  --mc-radius-xl:  24px;

  --mc-shadow:     0 2px 8px rgba(0,0,0,0.25);
  --mc-shadow-lg:  0 8px 32px rgba(0,0,0,0.35);
}

/* ─── reset ─── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--mc-bg);
  color: var(--mc-text);
  font-family: var(--mc-font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--mc-font-head);
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
}
h1 { font-size: 26px; letter-spacing: -0.02em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
a { color: var(--mc-accent); text-decoration: none; }
a:hover { color: var(--mc-accent-h); }
code, pre { font-family: var(--mc-font-mono); font-size: 13px; }

/* ─── layout shell ─── */
.mc-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}
.mc-shell-full {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── sidebar nav ─── */
.mc-sidebar {
  grid-row: 1 / -1;
  background: var(--mc-surface-1);
  border-right: 1px solid var(--mc-border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.mc-sidebar-brand {
  padding: 0 20px 20px;
  font-family: var(--mc-font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--mc-accent);
  letter-spacing: -0.02em;
}
.mc-sidebar-brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--mc-text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}
.mc-sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
.mc-sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--mc-text-2);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mc-sidebar-nav li a:hover {
  background: var(--mc-accent-soft);
  color: var(--mc-text);
}
.mc-sidebar-nav li a[aria-current="page"] {
  background: var(--mc-accent-soft);
  color: var(--mc-accent);
  border-left-color: var(--mc-accent);
  font-weight: 600;
}
.mc-sidebar-nav li a .nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* ─── top header (inside content area) ─── */
.mc-header {
  padding: 24px 32px 0;
}
.mc-header h1 { margin-bottom: 6px; }
.mc-header p { color: var(--mc-text-2); margin: 0; }

/* ─── main content ─── */
.mc-main {
  padding: 24px 32px 40px;
  min-width: 0;
}

/* ─── panels / cards ─── */
.mc-panel {
  background: var(--mc-surface-1);
  border: 1px solid var(--mc-border);
  border-radius: var(--mc-radius-l);
  padding: 20px;
}
.mc-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.mc-panel-head h2 { font-size: 16px; }
.mc-panel-head .mc-muted { color: var(--mc-text-3); font-size: 13px; margin-top: 2px; }

.mc-card {
  background: var(--mc-surface-2);
  border: 1px solid var(--mc-border-soft);
  border-radius: var(--mc-radius);
  padding: 16px;
}
.mc-card + .mc-card { margin-top: 8px; }

/* ─── buttons ─── */
.mc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--mc-radius-s);
  font-family: var(--mc-font-head);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.mc-btn:active { transform: scale(0.97); }
.mc-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.mc-btn-primary {
  background: var(--mc-accent);
  color: var(--mc-text-inv);
}
.mc-btn-primary:hover:not(:disabled) {
  background: var(--mc-accent-h);
}
.mc-btn-secondary {
  background: var(--mc-surface-3);
  color: var(--mc-text);
  border: 1px solid var(--mc-border);
}
.mc-btn-secondary:hover:not(:disabled) {
  background: var(--mc-surface-2);
  border-color: var(--mc-text-3);
}
.mc-btn-ghost {
  background: transparent;
  color: var(--mc-text-2);
}
.mc-btn-ghost:hover:not(:disabled) {
  background: var(--mc-surface-3);
  color: var(--mc-text);
}
.mc-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.mc-btn-danger {
  background: var(--mc-red);
  color: #fff;
}
.mc-btn-danger:hover:not(:disabled) { background: #cf3e37; }

/* ─── forms ─── */
.mc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mc-field + .mc-field { margin-top: 12px; }
.mc-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--mc-text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mc-input, .mc-select {
  padding: 8px 12px;
  background: var(--mc-surface-2);
  border: 1px solid var(--mc-border);
  border-radius: var(--mc-radius-s);
  color: var(--mc-text);
  font-family: var(--mc-font);
  font-size: 14px;
  transition: border-color 0.15s;
}
.mc-input:focus, .mc-select:focus {
  outline: none;
  border-color: var(--mc-accent);
  box-shadow: 0 0 0 2px var(--mc-accent-soft);
}
.mc-input::placeholder { color: var(--mc-text-3); }
.mc-input[type="file"] {
  padding: 10px 12px;
  cursor: pointer;
}
.mc-input[type="file"]::file-selector-button {
  background: var(--mc-accent);
  color: var(--mc-text-inv);
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-family: var(--mc-font-head);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 10px;
}
.mc-check-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.mc-check-field input[type="checkbox"] {
  accent-color: var(--mc-accent);
  margin-top: 3px;
  flex-shrink: 0;
}
textarea.mc-input {
  resize: vertical;
  min-height: 80px;
}

/* ─── badges / tags ─── */
.mc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mc-badge-green  { background: rgba(34,201,151,0.14); color: #22c997; }
.mc-badge-blue   { background: var(--mc-blue-soft);    color: var(--mc-blue); }
.mc-badge-amber  { background: var(--mc-amber-soft);   color: var(--mc-amber); }
.mc-badge-red    { background: var(--mc-red-soft);     color: var(--mc-red); }
.mc-badge-muted  { background: var(--mc-surface-3);    color: var(--mc-text-3); }

/* ─── status dot ─── */
.mc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.mc-dot-green  { background: var(--mc-accent); }
.mc-dot-amber  { background: var(--mc-amber); }
.mc-dot-red    { background: var(--mc-red); }
.mc-dot-blue   { background: var(--mc-blue); }
.mc-dot-muted  { background: var(--mc-text-3); }
.mc-dot-pulse  { animation: mc-pulse 1.5s ease-in-out infinite; }
@keyframes mc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ─── progress bar ─── */
.mc-progress {
  height: 4px;
  background: var(--mc-surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.mc-progress-fill {
  height: 100%;
  background: var(--mc-accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── empty state ─── */
.mc-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--mc-text-3);
  font-size: 14px;
}
.mc-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ─── divider ─── */
.mc-divider {
  border: none;
  border-top: 1px solid var(--mc-border);
  margin: 16px 0;
}

/* ─── tabs ─── */
.mc-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--mc-border);
  margin-bottom: 20px;
}
.mc-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mc-text-3);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.mc-tab:hover { color: var(--mc-text); }
.mc-tab.active, .mc-tab[aria-selected="true"] {
  color: var(--mc-accent);
  border-bottom-color: var(--mc-accent);
}

/* ─── toast / banner ─── */
.mc-banner {
  padding: 10px 16px;
  border-radius: var(--mc-radius-s);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-banner-info   { background: var(--mc-blue-soft);  color: var(--mc-blue); }
.mc-banner-warn   { background: var(--mc-amber-soft); color: var(--mc-amber); }
.mc-banner-error  { background: var(--mc-red-soft);   color: var(--mc-red); }
.mc-banner-ok     { background: var(--mc-accent-soft);color: var(--mc-accent); }

/* ─── table-like list ─── */
.mc-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--mc-radius-s);
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
}
.mc-list-item:hover { background: var(--mc-surface-2); }
.mc-list-item.active {
  background: var(--mc-accent-soft);
  border-color: var(--mc-accent-mute);
}
.mc-list-item-body { flex: 1; min-width: 0; }
.mc-list-item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-list-item-sub {
  font-size: 12px;
  color: var(--mc-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── detail sections ─── */
.mc-section { margin-bottom: 20px; }
.mc-section-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--mc-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--mc-border-soft);
}

/* ─── video ─── */
.mc-video {
  width: 100%;
  border-radius: var(--mc-radius);
  background: #000;
}

/* ─── modal overlay ─── */
.mc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc-overlay[hidden] { display: none; }
.mc-modal {
  background: var(--mc-surface-1);
  border: 1px solid var(--mc-border);
  border-radius: var(--mc-radius-l);
  padding: 24px;
  max-width: 640px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--mc-shadow-lg);
}

/* ─── score ring ─── */
.mc-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-family: var(--mc-font-head);
  font-size: 16px;
  font-weight: 700;
  border: 3px solid;
  flex-shrink: 0;
}
.mc-score-high  { border-color: var(--mc-accent); color: var(--mc-accent); }
.mc-score-mid   { border-color: var(--mc-amber);  color: var(--mc-amber); }
.mc-score-low   { border-color: var(--mc-red);    color: var(--mc-red); }

/* ─── tooltip ─── */
.mc-tip {
  position: relative;
}
.mc-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--mc-surface-3);
  color: var(--mc-text);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.mc-tip:hover::after { opacity: 1; }

/* ─── responsive: collapse sidebar on small screens ─── */
@media (max-width: 768px) {
  .mc-shell {
    grid-template-columns: 1fr;
  }
  .mc-sidebar {
    position: fixed;
    left: -240px;
    z-index: 900;
    transition: left 0.25s ease;
    width: 220px;
    box-shadow: var(--mc-shadow-lg);
  }
  .mc-sidebar.open { left: 0; }
  .mc-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 899;
    display: none;
  }
  .mc-sidebar-backdrop.open { display: block; }
  .mc-mobile-toggle {
    display: flex !important;
  }
  .mc-main { padding: 16px; }
  .mc-header { padding: 16px 16px 0; }
}
@media (min-width: 769px) {
  .mc-mobile-toggle { display: none !important; }
  .mc-sidebar-backdrop { display: none !important; }
}

/* ─── utilities ─── */
.mc-muted   { color: var(--mc-text-2); }
.mc-faint   { color: var(--mc-text-3); }
.mc-accent  { color: var(--mc-accent); }
.mc-mono    { font-family: var(--mc-font-mono); }
.mc-nowrap  { white-space: nowrap; }
.mc-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mc-flex     { display: flex; }
.mc-flex-col { display: flex; flex-direction: column; }
.mc-gap-4    { gap: 4px; }
.mc-gap-8    { gap: 8px; }
.mc-gap-12   { gap: 12px; }
.mc-gap-16   { gap: 16px; }
.mc-gap-20   { gap: 20px; }
.mc-items-center { align-items: center; }
.mc-justify-between { justify-content: space-between; }
.mc-flex-1   { flex: 1; min-width: 0; }
.mc-mt-0     { margin-top: 0; }
.mc-mt-8     { margin-top: 8px; }
.mc-mt-12    { margin-top: 12px; }
.mc-mt-16    { margin-top: 16px; }
.mc-mt-24    { margin-top: 24px; }
.mc-mb-8     { margin-bottom: 8px; }
.mc-mb-16    { margin-bottom: 16px; }
.mc-hidden   { display: none !important; }
