:root {
  --crm-navy: #17213c;
  --crm-navy-2: #21304f;
  --crm-gold: #f4b740;
  --crm-gold-soft: #fff7e6;
  --crm-canvas: #f5f7fb;
  --crm-ink: #17213c;
  --crm-muted: #6b7280;
  --crm-border: #e7eaf0;
  --crm-success: #16a36a;
  --crm-danger: #e5484d;
  --crm-sidebar: 264px;
}

* { box-sizing: border-box; }

body.crm-app {
  margin: 0;
  min-height: 100vh;
  background: var(--crm-canvas);
  color: var(--crm-ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.crm-shell { min-height: 100vh; }

.crm-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--crm-sidebar);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #17213c 0%, #11182d 100%);
  color: #fff;
  transition: width .24s ease, transform .24s ease;
  box-shadow: 12px 0 30px rgba(23, 33, 60, .08);
}

.crm-brand {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.crm-brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffd678, var(--crm-gold));
  color: #17213c;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: 0 8px 20px rgba(244,183,64,.24);
}

.crm-brand-copy { min-width: 0; }
.crm-brand-name { display: block; font-size: 15px; line-height: 1.2; font-weight: 750; letter-spacing: .03em; white-space: nowrap; }
.crm-brand-sub { display: block; margin-top: 3px; color: #94a3b8; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }

.crm-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.14) transparent;
}

.crm-nav-section { margin: 18px 10px 7px; color: #6f7d9b; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.crm-nav-section:first-child { margin-top: 5px; }

.crm-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin: 3px 0;
  padding: 0 12px;
  border-radius: 10px;
  color: #bbc5d9;
  text-decoration: none;
  font-size: 13px;
  font-weight: 550;
  transition: .18s ease;
}

.crm-nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.crm-nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(244,183,64,.20), rgba(244,183,64,.08)); }
.crm-nav-link.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--crm-gold); }
.crm-nav-link i { width: 20px; color: #8190ae; font-size: 18px; text-align: center; }
.crm-nav-link.active i { color: var(--crm-gold); }
.crm-nav-label { flex: 1; white-space: nowrap; }
.crm-nav-badge { padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.09); color: #b9c4d8; font-size: 9px; font-weight: 700; line-height: 17px; letter-spacing: .04em; }
.crm-nav-badge.sql { background: rgba(244,183,64,.16); color: #ffd36c; }

.crm-user-mini { display: flex; align-items: center; gap: 10px; margin: 8px 12px 14px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.055); }
.crm-avatar { width: 36px; height: 36px; object-fit: cover; border-radius: 10px; background: #edf0f5; }
.crm-user-mini-copy { flex: 1; min-width: 0; }
.crm-user-mini-copy strong { display: block; overflow: hidden; color: #fff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.crm-user-mini-copy span { display: block; margin-top: 2px; color: #8290ac; font-size: 10px; }
.crm-user-mini .crm-icon-btn { width: 28px; height: 28px; color: #9da9bf; border-color: transparent; background: transparent; }

.crm-main { min-height: 100vh; margin-left: var(--crm-sidebar); transition: margin .24s ease; }

.crm-header {
  position: sticky;
  top: 0;
  z-index: 35;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 30px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--crm-border);
  backdrop-filter: blur(14px);
}

.crm-mobile-toggle { display: none !important; }
.crm-header-title { min-width: 0; }
.crm-header-title h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.crm-breadcrumb { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #9aa3b2; font-size: 11px; }
.crm-breadcrumb i { font-size: 10px; }

.crm-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.crm-search-trigger { width: 245px; height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--crm-border); border-radius: 10px; background: #f8f9fb; color: #8b95a5; font-size: 12px; text-align: left; }
.crm-search-trigger span { flex: 1; }
.crm-key { padding: 2px 6px; border: 1px solid #dfe3ea; border-radius: 5px; background: #fff; color: #8b95a5; font-size: 9px; }

.crm-icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--crm-border); border-radius: 10px; background: #fff; color: #526075; cursor: pointer; transition: .18s ease; }
.crm-icon-btn:hover { border-color: #d5dae3; background: #f6f7fa; color: var(--crm-ink); }
.crm-icon-btn i { font-size: 18px; }
.crm-notification { position: relative; }
.crm-notification::after { content: ""; position: absolute; right: 8px; top: 8px; width: 6px; height: 6px; border: 2px solid #fff; border-radius: 50%; background: var(--crm-danger); }

.crm-content { width: min(1520px, 100%); margin: 0 auto; padding: 28px 30px 44px; }

.crm-page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.crm-page-head-copy { flex: 1; }
.crm-page-head h2 { margin: 0; font-size: 24px; font-weight: 750; letter-spacing: -.035em; }
.crm-page-head p { margin: 6px 0 0; color: var(--crm-muted); font-size: 13px; }
.crm-page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.crm-btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid #dde1e9; border-radius: 10px; background: #fff; color: #3d4a60; font-size: 12px; font-weight: 650; text-decoration: none; cursor: pointer; transition: .18s ease; }
.crm-btn:hover { border-color: #cfd5df; background: #f8f9fb; color: #19243d; }
.crm-btn i { font-size: 16px; }
.crm-btn-primary { border-color: #1d2945; background: var(--crm-navy); color: #fff; box-shadow: 0 6px 16px rgba(23,33,60,.16); }
.crm-btn-primary:hover { border-color: #263555; background: #263555; color: #fff; }
.crm-btn-gold { border-color: #e8a927; background: var(--crm-gold); color: #2a2419; box-shadow: 0 7px 18px rgba(244,183,64,.18); }
.crm-btn-gold:hover { border-color: #dea11e; background: #edaf33; color: #2a2419; }

.crm-grid { display: grid; gap: 18px; }
.crm-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.crm-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.crm-grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); }
.crm-grid-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.crm-card { min-width: 0; background: #fff; border: 1px solid var(--crm-border); border-radius: 14px; box-shadow: 0 3px 12px rgba(23,33,60,.025); }
.crm-card-head { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 18px; border-bottom: 1px solid #edf0f4; }
.crm-card-head h3 { margin: 0; color: #24304a; font-size: 14px; font-weight: 700; }
.crm-card-head p { margin: 3px 0 0; color: #8c96a6; font-size: 10px; }
.crm-card-head .crm-card-tools { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.crm-card-body { padding: 18px; }

.crm-kpi { position: relative; overflow: hidden; padding: 18px; }
.crm-kpi::after { content: ""; position: absolute; right: -25px; top: -28px; width: 92px; height: 92px; border-radius: 50%; background: var(--tone, #eff3ff); opacity: .65; }
.crm-kpi-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; }
.crm-kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--tone, #eff3ff); color: var(--tone-strong, #5078db); }
.crm-kpi-icon i { font-size: 18px; }
.crm-kpi-label { color: #7a8495; font-size: 11px; font-weight: 550; }
.crm-kpi-value { position: relative; z-index: 1; margin-top: 16px; font-size: 24px; font-weight: 750; letter-spacing: -.04em; }
.crm-kpi-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; margin-top: 7px; color: #8992a1; font-size: 10px; }
.crm-trend { display: inline-flex; align-items: center; gap: 2px; color: var(--crm-success); font-weight: 700; }
.crm-trend.down { color: var(--crm-danger); }

.crm-chart { height: 245px; display: flex; flex-direction: column; }
.crm-chart-legend { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; color: #7f8999; font-size: 10px; }
.crm-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.crm-chart-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.crm-bars { flex: 1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; align-items: end; padding-top: 5px; border-bottom: 1px solid #e9edf2; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), #edf0f4 25%); }
.crm-bar-group { height: 100%; display: flex; align-items: end; justify-content: center; gap: 3px; }
.crm-bar { width: min(9px, 40%); height: var(--h); border-radius: 5px 5px 1px 1px; background: var(--c); transition: height .4s ease; }
.crm-chart-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; margin-top: 9px; color: #a0a7b3; font-size: 9px; text-align: center; }

.crm-pipeline { display: grid; gap: 16px; }
.crm-pipeline-row { display: grid; grid-template-columns: 88px 1fr 65px; align-items: center; gap: 10px; }
.crm-pipeline-label { color: #667085; font-size: 10px; }
.crm-progress { height: 7px; overflow: hidden; border-radius: 99px; background: #eef1f5; }
.crm-progress > span { display: block; width: var(--w); height: 100%; border-radius: inherit; background: var(--c, var(--crm-gold)); }
.crm-pipeline-value { color: #38445a; font-size: 10px; font-weight: 700; text-align: right; }

.crm-activity { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef0f4; }
.crm-activity:last-child { border-bottom: 0; }
.crm-activity-icon { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 9px; background: var(--tone, #eef3ff); color: var(--tone-strong, #5078db); }
.crm-activity-copy { flex: 1; min-width: 0; }
.crm-activity-copy p { margin: 0; color: #3d485c; font-size: 11px; line-height: 1.45; }
.crm-activity-copy strong { color: #1f2b43; }
.crm-activity-copy time { display: block; margin-top: 3px; color: #9aa2af; font-size: 9px; }

.crm-table-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #edf0f4; }
.crm-field { position: relative; }
.crm-field > i { position: absolute; left: 12px; top: 50%; z-index: 1; transform: translateY(-50%); color: #929baa; font-size: 15px; }
.crm-input, .crm-select { height: 38px; border: 1px solid #e1e5eb; border-radius: 9px; outline: none; background: #fff; color: #344056; font-size: 11px; transition: .18s ease; }
.crm-input { width: 245px; padding: 0 12px 0 35px; }
.crm-select { min-width: 120px; padding: 0 30px 0 11px; }
.crm-input:focus, .crm-select:focus { border-color: #aebbd3; box-shadow: 0 0 0 3px rgba(59,91,156,.08); }
.crm-toolbar-spacer { flex: 1; }

.crm-table-wrap { overflow-x: auto; }
.crm-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.crm-table th { height: 43px; padding: 0 15px; background: #fafbfc; border-bottom: 1px solid #eaedf2; color: #8b95a4; font-size: 9px; font-weight: 700; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.crm-table td { height: 58px; padding: 0 15px; border-bottom: 1px solid #f0f2f5; color: #49556a; font-size: 11px; }
.crm-table tbody tr { transition: .16s ease; }
.crm-table tbody tr:hover { background: #fbfcfe; }
.crm-table tbody tr:last-child td { border-bottom: 0; }
.crm-table a { color: #263c68; font-weight: 700; text-decoration: none; }
.crm-table a:hover { color: #1d5bd2; }
.crm-table-customer { display: flex; align-items: center; gap: 10px; }
.crm-customer-logo { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--tone, #eef3ff); color: var(--tone-strong, #5078db); font-size: 10px; font-weight: 800; }
.crm-table-customer strong { display: block; color: #2b374e; font-size: 11px; }
.crm-table-customer span { display: block; margin-top: 2px; color: #9aa2af; font-size: 9px; }
.crm-amount { color: #27354e !important; font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.crm-balance-due { color: #c63f45 !important; }

.crm-status { display: inline-flex; align-items: center; gap: 6px; min-height: 23px; padding: 0 9px; border-radius: 99px; background: #eef8f4; color: #16835a; font-size: 9px; font-weight: 700; }
.crm-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.crm-status.pending { background: #fff7e5; color: #a96d00; }
.crm-status.overdue { background: #fff0f0; color: #c43e45; }
.crm-status.draft { background: #f0f2f5; color: #737e90; }
.crm-status.info { background: #edf5ff; color: #3272c6; }

.crm-table-foot { min-height: 55px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-top: 1px solid #edf0f4; color: #8b95a4; font-size: 10px; }
.crm-pagination { display: flex; gap: 5px; margin-left: auto; }
.crm-page-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #798394; font-size: 10px; cursor: pointer; }
.crm-page-btn.active { background: var(--crm-navy); color: #fff; }
.crm-page-btn:hover:not(.active) { background: #f0f2f5; }

.crm-sync-banner { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 15px 18px; border: 1px solid #f1d899; border-radius: 13px; background: linear-gradient(95deg, #fff9eb, #fffdf8); }
.crm-sync-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #f8df9f; color: #795514; }
.crm-sync-icon i { font-size: 20px; }
.crm-sync-copy { flex: 1; }
.crm-sync-copy strong { display: block; color: #57421c; font-size: 12px; }
.crm-sync-copy span { display: block; margin-top: 3px; color: #8d7441; font-size: 10px; }
.crm-live { display: inline-flex; align-items: center; gap: 6px; color: #16835a; font-size: 9px; font-weight: 700; }
.crm-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #1faf77; box-shadow: 0 0 0 4px rgba(31,175,119,.12); }

.crm-empty-filter { display: none; padding: 42px 20px; color: #8490a3; font-size: 12px; text-align: center; }

.crm-detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .72fr); gap: 18px; align-items: start; }
.crm-invoice-paper { padding: 30px; }
.crm-invoice-top { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid #e8ebf0; }
.crm-wordmark { display: flex; align-items: center; gap: 11px; }
.crm-wordmark .crm-brand-mark { width: 43px; height: 43px; flex-basis: 43px; }
.crm-wordmark strong { display: block; font-size: 15px; }
.crm-wordmark span { display: block; margin-top: 3px; color: #8b94a3; font-size: 9px; }
.crm-invoice-id { text-align: right; }
.crm-invoice-id h2 { margin: 0; color: #1c2944; font-size: 21px; letter-spacing: -.03em; }
.crm-invoice-id p { margin: 5px 0 0; color: #8b94a3; font-size: 10px; }
.crm-invoice-parties { display: grid; grid-template-columns: 1.25fr 1fr; gap: 30px; padding: 24px 0; }
.crm-label { margin-bottom: 8px; color: #9aa2af; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.crm-address strong { display: block; margin-bottom: 5px; color: #2a374f; font-size: 12px; }
.crm-address p { margin: 0; color: #677286; font-size: 10px; line-height: 1.65; }
.crm-invoice-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.crm-meta-row span { display: block; color: #98a1af; font-size: 9px; }
.crm-meta-row strong { display: block; margin-top: 3px; color: #344057; font-size: 10px; }
.crm-invoice-table th:last-child, .crm-invoice-table td:last-child { text-align: right; }
.crm-invoice-summary { width: min(350px, 100%); margin: 20px 0 0 auto; }
.crm-summary-row { display: flex; justify-content: space-between; gap: 20px; padding: 7px 0; color: #657085; font-size: 10px; }
.crm-summary-row strong { color: #26334b; font-variant-numeric: tabular-nums; }
.crm-summary-row.total { margin-top: 6px; padding-top: 13px; border-top: 1px solid #e4e8ed; color: #25324a; font-size: 12px; font-weight: 700; }
.crm-summary-row.total strong { font-size: 15px; }
.crm-invoice-note { margin-top: 26px; padding: 14px; border-radius: 10px; background: #f7f8fa; color: #687387; font-size: 9px; line-height: 1.6; }

.crm-side-stack { display: grid; gap: 18px; }
.crm-data-list { display: grid; gap: 0; }
.crm-data-row { display: flex; justify-content: space-between; gap: 15px; padding: 11px 0; border-bottom: 1px solid #eef0f3; }
.crm-data-row:last-child { border-bottom: 0; }
.crm-data-row span { color: #8c95a4; font-size: 9px; }
.crm-data-row strong { color: #374359; font-size: 10px; text-align: right; }
.crm-timeline { position: relative; display: grid; gap: 17px; }
.crm-timeline::before { content: ""; position: absolute; left: 6px; top: 7px; bottom: 7px; width: 1px; background: #e4e7ec; }
.crm-timeline-item { position: relative; padding-left: 26px; }
.crm-timeline-item::before { content: ""; position: absolute; left: 2px; top: 4px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--dot, #7685a0); box-shadow: 0 0 0 1px var(--dot, #7685a0); }
.crm-timeline-item strong { display: block; color: #3b465b; font-size: 10px; }
.crm-timeline-item span { display: block; margin-top: 3px; color: #929baa; font-size: 9px; line-height: 1.45; }

.crm-quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.crm-stat-box { padding: 14px; border: 1px solid #e8ebf0; border-radius: 11px; background: #fff; }
.crm-stat-box span { color: #9099a8; font-size: 9px; }
.crm-stat-box strong { display: block; margin-top: 6px; color: #26334a; font-size: 18px; }

.crm-modal-backdrop { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(9,15,30,.48); backdrop-filter: blur(4px); }
.crm-modal-backdrop.open { display: flex; }
.crm-modal { width: min(560px, 100%); overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 25px 70px rgba(12,19,37,.24); animation: crm-pop .18s ease; }
@keyframes crm-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.crm-modal-head { display: flex; align-items: center; gap: 12px; padding: 17px 19px; border-bottom: 1px solid #eaedf1; }
.crm-modal-head h3 { margin: 0; font-size: 14px; }
.crm-modal-head .crm-icon-btn { margin-left: auto; }
.crm-modal-body { padding: 18px 19px; }
.crm-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.crm-form-group.full { grid-column: 1 / -1; }
.crm-form-group label { display: block; margin-bottom: 6px; color: #677287; font-size: 10px; font-weight: 600; }
.crm-form-control { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #dfe3e9; border-radius: 9px; outline: none; background: #fff; color: #334057; font-size: 11px; }
.crm-form-control:focus { border-color: #9babc9; box-shadow: 0 0 0 3px rgba(61,91,153,.08); }
.crm-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 19px; border-top: 1px solid #eaedf1; background: #fafbfc; }

.crm-command { width: min(620px, 100%); align-self: flex-start; margin-top: 10vh; }
.crm-command-search { position: relative; padding: 14px; border-bottom: 1px solid #e8ebef; }
.crm-command-search i { position: absolute; left: 27px; top: 50%; transform: translateY(-50%); color: #8993a3; font-size: 18px; }
.crm-command-search input { width: 100%; height: 44px; padding: 0 45px; border: 0; outline: 0; color: #253149; font-size: 13px; }
.crm-command-results { max-height: 380px; overflow-y: auto; padding: 10px; }
.crm-command-section { padding: 7px 9px 4px; color: #9aa2af; font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.crm-command-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 9px; color: #3e4a60; text-decoration: none; }
.crm-command-item:hover { background: #f3f5f8; }
.crm-command-item i { width: 23px; color: #6c7d9b; font-size: 17px; text-align: center; }
.crm-command-item span { flex: 1; font-size: 11px; }
.crm-command-item small { color: #9aa2af; font-size: 9px; }

.crm-toast { position: fixed; right: 22px; bottom: 22px; z-index: 150; display: flex; align-items: center; gap: 11px; min-width: 300px; padding: 13px 15px; border: 1px solid #dfe9e4; border-radius: 12px; background: #fff; color: #3d4a60; box-shadow: 0 16px 45px rgba(23,33,60,.16); font-size: 11px; transform: translateY(24px); opacity: 0; pointer-events: none; transition: .25s ease; }
.crm-toast.show { transform: translateY(0); opacity: 1; }
.crm-toast i { color: var(--crm-success); font-size: 20px; }

.crm-overlay { position: fixed; inset: 0; z-index: 45; display: none; background: rgba(7,12,25,.44); }

body.crm-sidebar-collapsed { --crm-sidebar: 82px; }
body.crm-sidebar-collapsed .crm-brand-copy,
body.crm-sidebar-collapsed .crm-nav-section,
body.crm-sidebar-collapsed .crm-nav-label,
body.crm-sidebar-collapsed .crm-nav-badge,
body.crm-sidebar-collapsed .crm-user-mini-copy,
body.crm-sidebar-collapsed .crm-user-mini .crm-icon-btn { display: none; }
body.crm-sidebar-collapsed .crm-brand { justify-content: center; padding: 0; }
body.crm-sidebar-collapsed .crm-nav-link { justify-content: center; padding: 0; }
body.crm-sidebar-collapsed .crm-nav-link i { width: auto; }
body.crm-sidebar-collapsed .crm-user-mini { justify-content: center; padding: 9px; }

.dark body.crm-app, html.dark body.crm-app { --crm-canvas: #111827; --crm-ink: #e7eaf0; --crm-border: #283347; background: #111827; color: #e7eaf0; }
html.dark .crm-header, html.dark .crm-card, html.dark .crm-btn, html.dark .crm-icon-btn, html.dark .crm-input, html.dark .crm-select, html.dark .crm-modal, html.dark .crm-stat-box { background: #182236; color: #dbe1eb; border-color: #2a3549; }
html.dark .crm-header { background: rgba(24,34,54,.92); }
html.dark .crm-card-head, html.dark .crm-table-toolbar, html.dark .crm-table td, html.dark .crm-table th, html.dark .crm-table-foot, html.dark .crm-modal-head, html.dark .crm-modal-foot { border-color: #293448; }
html.dark .crm-table th, html.dark .crm-modal-foot { background: #151f32; }
html.dark .crm-table tbody tr:hover, html.dark .crm-search-trigger { background: #1c2840; }
html.dark .crm-page-head h2, html.dark .crm-header-title h1, html.dark .crm-card-head h3, html.dark .crm-kpi-value, html.dark .crm-table a, html.dark .crm-table-customer strong, html.dark .crm-amount, html.dark .crm-address strong, html.dark .crm-invoice-id h2, html.dark .crm-meta-row strong, html.dark .crm-data-row strong, html.dark .crm-stat-box strong { color: #eef2f8 !important; }
html.dark .crm-sync-banner { border-color: #5d4d2c; background: linear-gradient(95deg, #2b261a, #1f2330); }
html.dark .crm-sync-copy strong { color: #f2d48b; }
html.dark .crm-invoice-note { background: #151f32; }

@media (max-width: 1199px) {
  .crm-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-detail-grid { grid-template-columns: minmax(0, 1.6fr) minmax(260px, .75fr); }
}

@media (max-width: 991px) {
  .crm-sidebar { transform: translateX(-100%); width: min(284px, 86vw); }
  .crm-main { margin-left: 0; }
  .crm-mobile-toggle { display: inline-grid !important; }
  body.crm-mobile-open .crm-sidebar { transform: translateX(0); }
  body.crm-mobile-open .crm-overlay { display: block; }
  .crm-grid-2-1, .crm-detail-grid { grid-template-columns: 1fr; }
  .crm-search-trigger { width: 190px; }
}

@media (max-width: 767px) {
  .crm-header { min-height: 64px; padding: 0 16px; }
  .crm-header-title { display: none; }
  .crm-search-trigger { width: 38px; justify-content: center; padding: 0; }
  .crm-search-trigger span, .crm-key { display: none; }
  .crm-content { padding: 20px 15px 35px; }
  .crm-page-head { align-items: flex-start; flex-direction: column; }
  .crm-page-actions { width: 100%; }
  .crm-page-actions .crm-btn { flex: 1; }
  .crm-grid-4, .crm-grid-3, .crm-grid-1-1 { grid-template-columns: 1fr; }
  .crm-table-toolbar { align-items: stretch; flex-wrap: wrap; }
  .crm-field, .crm-input, .crm-select { width: 100%; }
  .crm-toolbar-spacer { display: none; }
  .crm-table-toolbar .crm-btn { flex: 1; }
  .crm-sync-banner { align-items: flex-start; flex-wrap: wrap; }
  .crm-sync-banner .crm-btn { width: 100%; }
  .crm-invoice-paper { padding: 20px; }
  .crm-invoice-top, .crm-invoice-parties { grid-template-columns: 1fr; flex-direction: column; }
  .crm-invoice-id { text-align: left; }
  .crm-invoice-parties { display: grid; gap: 20px; }
  .crm-quick-stats { grid-template-columns: 1fr; }
  .crm-form-grid { grid-template-columns: 1fr; }
  .crm-form-group.full { grid-column: auto; }
  .crm-toast { left: 15px; right: 15px; min-width: 0; }
}

@media print {
  .crm-sidebar, .crm-header, .crm-page-head, .crm-side-stack, .crm-overlay, .crm-toast { display: none !important; }
  .crm-main { margin: 0 !important; }
  .crm-content { width: 100%; padding: 0; }
  .crm-detail-grid { display: block; }
  .crm-invoice-paper { border: 0; box-shadow: none; }
}
