:root {
  --cd-primary: #4f46e5;
  --cd-primary-dark: #4338ca;
  --cd-secondary: #0ea5e9;
  --cd-bg: #f6f7fb;
  --cd-surface: #ffffff;
  --cd-border: #e5e7eb;
  --cd-text: #111827;
  --cd-text-muted: #6b7280;
  --cd-radius: 14px;
  --cd-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

body {
  background-color: var(--cd-bg);
  color: var(--cd-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

a { text-decoration: none; }

/* ---------- Shell layout ---------- */
.cd-shell { display: flex; min-height: 100vh; }

.cd-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #111827;
  color: #e5e7eb;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.cd-sidebar .brand {
  display: flex; align-items: center;
  padding: .5rem .5rem 1.25rem;
}
.cd-sidebar .brand img {
  max-width: 100%; height: auto;
}
.cd-sidebar .nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; margin: 1rem .5rem .35rem; }
.cd-sidebar .nav-link {
  color: #cbd5e1; border-radius: 10px; padding: .55rem .65rem;
  display: flex; align-items: center; gap: .6rem; font-size: .9rem; font-weight: 500;
}
.cd-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.cd-sidebar .nav-link.active { background: var(--cd-primary); color: #fff; }
.cd-sidebar .nav-link .icon { width: 18px; text-align: center; opacity: .85; }

.cd-main { flex: 1; min-width: 0; }
.cd-topbar {
  background: var(--cd-surface); border-bottom: 1px solid var(--cd-border);
  padding: .85rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.cd-content { padding: 1.5rem; max-width: 1320px; }

/* ---------- Cards / stats ---------- */
.cd-card {
  background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: var(--cd-radius);
  box-shadow: var(--cd-shadow);
}
.cd-card-body { padding: 1.25rem 1.4rem; }
.cd-stat { padding: 1.25rem 1.4rem; }
.cd-stat .label { font-size: .78rem; color: var(--cd-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.cd-stat .value { font-size: 1.9rem; font-weight: 700; margin-top: .15rem; }
.cd-stat .icon-wrap {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: rgba(79,70,229,.1); color: var(--cd-primary); font-size: 1.1rem;
}

.cd-empty { text-align: center; padding: 3rem 1rem; color: var(--cd-text-muted); }
.cd-empty .icon { font-size: 2.4rem; margin-bottom: .5rem; opacity: .6; }

.btn-primary { background-color: var(--cd-primary); border-color: var(--cd-primary); }
.btn-primary:hover { background-color: var(--cd-primary-dark); border-color: var(--cd-primary-dark); }
.text-primary-cd { color: var(--cd-primary) !important; }

.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--cd-text-muted); border-bottom-width: 1px; }
.table td, .table th { vertical-align: middle; }

.cd-skeleton { background: linear-gradient(90deg,#eef0f4 25%,#e5e7eb 37%,#eef0f4 63%); background-size: 400% 100%; animation: cd-shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes cd-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Auth ---------- */
.cd-auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top, #eef1ff, var(--cd-bg)); padding: 1.5rem; }
.cd-auth-card { width: 100%; max-width: 400px; }

/* ---------- Public consent flow ---------- */
.cd-public-wrap { max-width: 640px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.cd-public-header { text-align: center; padding: 1.5rem 0 1rem; }
.cd-public-header img { max-height: 64px; margin-bottom: .5rem; }
.cd-term-text { max-height: 46vh; overflow-y: auto; border: 1px solid var(--cd-border); border-radius: var(--cd-radius); padding: 1.1rem 1.25rem; background: var(--cd-surface); }
.cd-term-text h2 { font-size: 1.1rem; }
.cd-signature-pad-wrap { border: 2px dashed #cbd5e1; border-radius: var(--cd-radius); background: #fff; position: relative; touch-action: none; }
#signature-pad { width: 100%; height: 220px; touch-action: none; }
.cd-step-indicator { display: flex; justify-content: center; gap: .4rem; margin-bottom: 1.25rem; }
.cd-step-indicator .dot { width: 28px; height: 4px; border-radius: 2px; background: var(--cd-border); }
.cd-step-indicator .dot.active { background: var(--cd-primary); }
.cd-success-badge { width: 78px; height: 78px; border-radius: 50%; background: #dcfce7; color: #16a34a; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; margin: 0 auto 1rem; }

@media (max-width: 576px) {
  .cd-sidebar { position: fixed; left: -280px; z-index: 40; transition: left .2s ease; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
  .cd-sidebar.open { left: 0; }
  .cd-content { padding: 1rem; }
}
