/* ============================================
   CLM Platform — Custom Styles
   ============================================ */

@font-face {
  font-family: 'Manrope';
  src: url('../fonts/Manrope/Manrope-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --sidebar-width: 240px;
  --topbar-height: 58px;
  --bg-body: #f0f4f8;
  --bg-surface: #ffffff;
  --bg-surface2: #f8fafc;
  --bg-surface3: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-glow: rgba(59,130,246,.1);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --purple: #7c3aed;
  --cyan: #0891b2;
  --orange: #ea580c;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
  --transition: .18s ease;
}

* { box-sizing: border-box; }

body.clm-body {
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-surface2); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══════════════ TOPBAR ══════════════ */
.clm-topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 220px; }

.sidebar-toggle {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; padding: .4rem; border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex; align-items: center;
}
.sidebar-toggle:hover { background: var(--bg-surface2); color: var(--text-primary); }

.topbar-brand {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; color: var(--text-primary);
  font-weight: 700; font-size: 1.1rem; white-space: nowrap;
}
.brand-icon { font-size: 1.3rem; }
.brand-text { color: var(--accent); }

.topbar-search {
  flex: 1; max-width: 460px; position: relative;
}
.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: .9rem;
}
.search-input {
  width: 100%; background: var(--bg-body);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .45rem 1rem .45rem 2.4rem;
  color: var(--text-primary); font-size: 13px;
  transition: var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-input::placeholder { color: var(--text-muted); }

.search-dropdown {
  position: absolute; top: 110%; left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto;
  display: none; z-index: 2000;
}
.search-dropdown.show { display: block; }
.search-result-item {
  padding: .65rem 1rem; display: flex; align-items: center; gap: .75rem;
  cursor: pointer; text-decoration: none; color: var(--text-primary);
  border-bottom: 1px solid var(--border-light); transition: var(--transition);
}
.search-result-item:hover { background: var(--bg-surface2); }
.search-result-item:last-child { border-bottom: none; }

.topbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

.topbar-icon-btn {
  position: relative; background: none; border: none;
  color: var(--text-secondary); cursor: pointer;
  padding: .45rem .55rem; border-radius: var(--radius-sm);
  transition: var(--transition); font-size: 1.1rem;
  display: flex; align-items: center;
}
.topbar-icon-btn:hover { background: var(--bg-surface2); color: var(--text-primary); }

.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-surface); box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.topbar-user-btn {
  display: flex; align-items: center; gap: .5rem;
  background: none; border: 1px solid var(--border);
  color: var(--text-primary); cursor: pointer;
  padding: .3rem .7rem; border-radius: 20px;
  transition: var(--transition); font-size: 13px;
}
.topbar-user-btn:hover { background: var(--bg-surface2); border-color: var(--accent); }
.user-name-topbar { font-weight: 500; }

/* ── Notification Dropdown ── */
.notif-dropdown {
  width: 340px; padding: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .85rem 1rem; border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--text-primary);
}
.mark-all-read { font-size: 12px; color: var(--accent); text-decoration: none; }
.notif-body { max-height: 300px; overflow-y: auto; }
.notif-empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem; text-decoration: none; color: var(--text-primary);
  border-bottom: 1px solid var(--border-light); transition: var(--transition);
}
.notif-item:hover { background: var(--bg-surface2); }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  margin-top: 5px; background: var(--accent);
}
.notif-info .notif-dot { background: var(--accent); }
.notif-success .notif-dot { background: var(--success); }
.notif-warning .notif-dot { background: var(--warning); }
.notif-danger .notif-dot { background: var(--danger); }
.notif-title { font-weight: 600; font-size: 13px; }
.notif-msg { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.notif-time { color: var(--text-muted); font-size: 11px; margin-top: 3px; }
.notif-footer { padding: .65rem 1rem; text-align: center; border-top: 1px solid var(--border); }
.notif-footer a { color: var(--accent); font-size: 12px; text-decoration: none; }

/* ── User Dropdown ── */
.user-menu {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 200px; padding: 0;
}
.user-menu-header { padding: .85rem 1rem; }
.user-menu-header > div { font-weight: 600; }
.user-menu-header small { color: var(--text-muted); }
.user-menu .dropdown-item {
  color: var(--text-primary); padding: .55rem 1rem; font-size: 13px;
  transition: var(--transition);
}
.user-menu .dropdown-item:hover { background: var(--bg-surface2); color: var(--text-primary); }
.user-menu .dropdown-item.text-danger:hover { background: rgba(239,68,68,.1); }
.user-menu .dropdown-divider { border-color: var(--border); margin: .25rem 0; }

/* ══════════════ LAYOUT ══════════════ */
.clm-layout {
  display: flex;
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}

/* ══════════════ SIDEBAR ══════════════ */
.clm-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed; top: var(--topbar-height); bottom: 0; left: 0;
  overflow-y: auto; overflow-x: hidden;
  transition: transform .25s ease, width .25s ease;
  z-index: 900;
  display: flex; flex-direction: column;
}
.clm-sidebar.collapsed { width: 60px; }
.clm-sidebar.mobile-hidden { transform: translateX(-100%); }

.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: .75rem 0; }

.sidebar-nav { flex: 1; padding: 0 .5rem; }

.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  color: var(--text-muted); padding: .5rem .75rem .25rem;
}

.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-secondary);
  transition: var(--transition); font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: var(--bg-surface2); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-glow); color: var(--accent);
  border-left: 3px solid var(--accent); padding-left: calc(.75rem - 3px);
}
.nav-icon { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }
.nav-label { white-space: nowrap; overflow: hidden; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: .1rem .4rem;
  border-radius: 10px; min-width: 20px; text-align: center;
}

.sidebar-footer {
  padding: .75rem .5rem; border-top: 1px solid var(--border); margin-top: auto;
}
.sidebar-user {
  display: flex; align-items: center;
  padding: .5rem .5rem; border-radius: var(--radius-sm);
}
.sidebar-user-name { font-size: 13px; font-weight: 600; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

/* ══════════════ MAIN CONTENT ══════════════ */
.clm-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 1.75rem 1.75rem 3.5rem;
  min-width: 0;
  transition: margin-left .25s ease;
}
.clm-main.expanded { margin-left: 60px; }

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem;
}
.page-title { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.page-subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* ── Cards ── */
.clm-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.clm-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: .95rem;
}
.clm-card-body { padding: 1.25rem; }

/* ── Stat Cards ── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative; overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before { background: var(--accent); }
.stat-card.green::before { background: var(--success); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.cyan::before { background: var(--cyan); }

.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: .75rem;
}
.stat-icon.blue { background: rgba(59,130,246,.15); color: var(--accent); }
.stat-icon.green { background: rgba(16,185,129,.15); color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,.15); color: var(--warning); }
.stat-icon.red { background: rgba(239,68,68,.15); color: var(--danger); }
.stat-icon.purple { background: rgba(139,92,246,.15); color: var(--purple); }
.stat-icon.cyan { background: rgba(6,182,212,.15); color: var(--cyan); }

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.stat-change { font-size: 12px; margin-top: .25rem; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ══════════════ BADGES ══════════════ */
.clm-badge {
  display: inline-flex; align-items: center;
  padding: .25rem .65rem; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-draft     { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-review    { background: #ecfeff; color: #0891b2; border: 1px solid #a5f3fc; }
.badge-legal     { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.badge-pending   { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-approved  { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-active    { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge-expired   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-terminated{ background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.badge-renewed   { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }

.clm-priority { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.clm-priority::before { content: '●'; font-size: 8px; }
.priority-low { color: var(--success); }
.priority-medium { color: var(--warning); }
.priority-high { color: var(--orange); }
.priority-critical { color: var(--danger); }

.avatar-initials {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; color: #fff;
  flex-shrink: 0; letter-spacing: -.02em;
}

.currency { font-weight: 600; color: var(--success); }

/* ══════════════ TABLES ══════════════ */
.table-dark-clm {
  --bs-table-bg: var(--bg-surface);
  --bs-table-border-color: var(--border);
  --bs-table-color: var(--text-primary);
  --bs-table-hover-bg: var(--bg-surface2);
  --bs-table-striped-bg: var(--bg-surface2);
}
.table-dark-clm th {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); background: var(--bg-surface3);
  border-color: var(--border); white-space: nowrap;
}
.table-dark-clm td { border-color: var(--border); vertical-align: middle; padding: .75rem .85rem; }
.table-dark-clm tbody tr { transition: var(--transition); }
.table-dark-clm tbody tr:hover td { background: var(--bg-surface2) !important; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .3rem .6rem; box-shadow: var(--shadow-sm);
}
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_info { color: var(--text-secondary); font-size: 12px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important; background: var(--bg-surface) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--accent) !important; color: #fff !important;
  border-color: var(--accent) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: var(--text-muted) !important; background: var(--bg-surface2) !important;
}

/* ══════════════ FORMS ══════════════ */
.form-control, .form-select {
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; transition: var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.form-control:focus, .form-select:focus {
  background: var(--bg-surface); color: var(--text-primary);
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: .4rem; }
.form-text { color: var(--text-muted); font-size: 11.5px; }
.form-select option { background: #fff; color: var(--text-primary); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* Select2 light theme */
.select2-container--bootstrap-5 .select2-selection {
  background: var(--bg-surface) !important; border-color: var(--border) !important;
  color: var(--text-primary) !important; box-shadow: 0 1px 2px rgba(0,0,0,.04) !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
  background: var(--bg-surface) !important; border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
}
.select2-container--bootstrap-5 .select2-results__option {
  color: var(--text-primary) !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background: var(--accent) !important; color: #fff !important;
}
.select2-container--bootstrap-5 .select2-search__field {
  background: var(--bg-surface2) !important; color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

/* Flatpickr light */
.flatpickr-calendar {
  background: var(--bg-surface) !important; border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
}
.flatpickr-day { color: var(--text-primary) !important; }
.flatpickr-day:hover { background: var(--bg-surface2) !important; border-color: var(--border) !important; }
.flatpickr-day.selected { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.flatpickr-day.today { border-color: var(--accent) !important; }
.flatpickr-months { background: var(--bg-surface3) !important; }
.flatpickr-current-month, .flatpickr-weekday { color: var(--text-primary) !important; fill: var(--text-primary) !important; }
.flatpickr-prev-month, .flatpickr-next-month { color: var(--text-secondary) !important; }
.flatpickr-prev-month svg, .flatpickr-next-month svg { fill: var(--text-secondary) !important; }

/* ══════════════ BUTTONS ══════════════ */
.btn-clm-primary {
  background: var(--accent); border: none; color: #fff;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  padding: .5rem 1.1rem; transition: var(--transition); cursor: pointer;
}
.btn-clm-primary:hover { background: var(--accent-dark); color: #fff; }

.btn-clm-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  padding: .45rem 1rem; transition: var(--transition); cursor: pointer;
}
.btn-clm-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.btn-icon {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: .3rem .4rem; border-radius: var(--radius-sm); transition: var(--transition);
  font-size: .95rem;
}
.btn-icon:hover { background: var(--bg-surface2); color: var(--text-primary); }
.btn-icon.danger:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ══════════════ CONTRACT PIPELINE ══════════════ */
.pipeline-container {
  display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem;
}
.pipeline-column {
  min-width: 220px; flex-shrink: 0;
  background: var(--bg-surface3); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.pipeline-col-header {
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.pipeline-col-body { padding: .5rem; min-height: 200px; }
.pipeline-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem; margin-bottom: .5rem;
  cursor: pointer; transition: var(--transition);
}
.pipeline-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow); }
.pipeline-card-title { font-size: 13px; font-weight: 600; margin-bottom: .35rem; }
.pipeline-card-sub { font-size: 11px; color: var(--text-muted); }

/* ══════════════ TABS ══════════════ */
.clm-tabs {
  display: flex; border-bottom: 1px solid var(--border); gap: .25rem; margin-bottom: 1.25rem;
}
.clm-tab {
  padding: .6rem 1.1rem; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: var(--transition); text-decoration: none; white-space: nowrap;
  background: none; border-top: none; border-left: none; border-right: none;
}
.clm-tab:hover { color: var(--text-primary); }
.clm-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ══════════════ TIMELINE ══════════════ */
.activity-timeline { padding: 0; }
.activity-item {
  display: flex; gap: .75rem; padding: .6rem 0;
  border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; margin-top: 2px;
}
.activity-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ══════════════ CHART CONTAINERS ══════════════ */
.chart-container { position: relative; }

/* ══════════════ LOGIN PAGE ══════════════ */
.login-page {
  min-height: 100vh; background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
  background-image: radial-gradient(circle at 20% 50%, rgba(59,130,246,.06) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(124,58,237,.05) 0%, transparent 40%);
}
.login-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 2.5rem; width: 420px; max-width: 95vw;
  box-shadow: 0 20px 48px rgba(0,0,0,.12);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .logo-icon { font-size: 3rem; display: block; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--accent); margin: 0; }
.login-logo p { color: var(--text-muted); font-size: 13px; margin: .25rem 0 0; }

/* ══════════════ SEARCH FILTERS ══════════════ */
.filter-bar {
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: center;
  padding: .85rem 1.1rem; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 1rem; box-shadow: var(--shadow-sm);
}
.filter-bar .form-control, .filter-bar .form-select {
  max-width: 180px; font-size: 13px;
}

/* ══════════════ STATUS PROGRESS ══════════════ */
.status-progress {
  display: flex; align-items: center; gap: 0; margin: 1.25rem 0;
}
.sp-step {
  flex: 1; text-align: center; position: relative;
}
.sp-step::before {
  content: ''; position: absolute; top: 14px; left: 50%; right: -50%;
  height: 2px; background: var(--border); z-index: 0;
}
.sp-step:last-child::before { display: none; }
.sp-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg-surface); display: inline-flex; align-items: center;
  justify-content: center; font-size: .75rem; color: var(--text-muted);
  position: relative; z-index: 1; margin-bottom: .35rem; transition: var(--transition);
}
.sp-step.done .sp-dot { background: var(--success); border-color: var(--success); color: #fff; }
.sp-step.active .sp-dot { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-glow); }
.sp-step.done::before { background: var(--success); }
.sp-label { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: block; }
.sp-step.active .sp-label { color: var(--accent); }
.sp-step.done .sp-label { color: var(--success); }

/* ══════════════ CLAUSE CARDS ══════════════ */
.clause-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem;
  transition: var(--transition); box-shadow: var(--shadow-sm);
}
.clause-card:hover { border-color: var(--accent); }
.clause-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .5rem; }
.clause-type-standard { border-left: 3px solid var(--success); }
.clause-type-preferred { border-left: 3px solid var(--accent); }
.clause-type-fallback { border-left: 3px solid var(--warning); }
.clause-type-non_standard { border-left: 3px solid var(--danger); }

/* ══════════════ MODAL ══════════════ */
.modal-content {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
}
.modal-header { border-bottom: 1px solid var(--border); padding: 1.1rem 1.25rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.25rem; }
.modal-title { font-weight: 700; font-size: 1rem; }
.btn-close { opacity: .6; }
.btn-close:hover { opacity: 1; }

/* ══════════════ RICH TEXT EDITOR ══════════════ */
.ql-toolbar { background: var(--bg-surface3) !important; border-color: var(--border) !important; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ql-container { background: var(--bg-surface) !important; border-color: var(--border) !important; border-radius: 0 0 var(--radius-sm) var(--radius-sm); min-height: 200px; color: var(--text-primary) !important; }
.ql-editor { color: var(--text-primary); }
.ql-stroke { stroke: var(--text-secondary) !important; }
.ql-fill { fill: var(--text-secondary) !important; }
.ql-picker-label { color: var(--text-secondary) !important; }
.ql-picker-options { background: var(--bg-surface) !important; border-color: var(--border) !important; box-shadow: var(--shadow) !important; }

/* ══════════════ MISC ══════════════ */
.bg-purple { background-color: var(--purple) !important; }
.text-purple { color: var(--purple); }
.text-cyan { color: var(--cyan); }
.text-muted { color: var(--text-muted) !important; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h5 { color: var(--text-secondary); }

.tooltip-inner { background: var(--bg-surface2); color: var(--text-primary); border: 1px solid var(--border); font-size: 12px; }

.divider { border-color: var(--border); }

.tag-pill {
  display: inline-flex; align-items: center; padding: .15rem .55rem;
  border-radius: 20px; font-size: 11px; font-weight: 600; cursor: default;
  margin: 0 2px; border: 1px solid rgba(255,255,255,.15);
}

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2.5rem; text-align: center; cursor: pointer;
  transition: var(--transition); color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent); background: var(--accent-glow); color: var(--text-primary);
}

/* ── Progress Bar ── */
.progress { background: var(--bg-surface3); height: 6px; border-radius: 10px; }
.progress-bar { border-radius: 10px; }

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 768px) {
  .clm-main { margin-left: 0; padding: 1rem; }
  .clm-sidebar { transform: translateX(-100%); }
  .clm-sidebar.open { transform: translateX(0); }
  .topbar-search { display: none; }
  .stat-card .stat-value { font-size: 1.5rem; }
}

/* ══════════════ ALERTS ══════════════ */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; }

/* ══════════════ ANIMATIONS ══════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp .3s ease; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.pulse { animation: pulse-dot 1.5s infinite; }
