.page-body {
  background: #f4f6f8;
}

.page-body.has-sidebar {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  min-height: 100vh;
}

.page-body.has-sidebar .page-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 26px 28px 48px;
}

.app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: #132536;
  color: #d8e2ea;
}

.app-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar .brand span {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #16a36a;
  color: #fff;
  font-weight: 800;
}

.app-sidebar .brand strong,
.app-sidebar .brand small {
  display: block;
}

.app-sidebar .brand small {
  color: #9db0bf;
  font-size: 11px;
  margin-top: 2px;
}

.app-sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 8px 8px 18px;
  gap: 2px;
}

.app-sidebar nav a,
.app-sidebar nav .sidebar-link {
  border-radius: 6px;
  color: #b9c8d4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  padding: 11px 10px;
  text-decoration: none;
}

.app-sidebar nav button.sidebar-link {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.app-sidebar nav a:hover,
.app-sidebar nav a.active,
.app-sidebar nav .sidebar-link:hover,
.app-sidebar nav .sidebar-link.active {
  background: #071c28;
  color: #fff;
}

.sidebar-collapsible {
  position: relative;
}

.sidebar-chevron {
  color: #8ea6b8;
  font-size: 11px;
  transition: transform .15s ease;
}

.sidebar-collapsible.open .sidebar-chevron {
  transform: rotate(90deg);
}

.sidebar-flyout-menu {
  background: #fff;
  border: 1px solid #dbe4ea;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 24px);
  min-width: 320px;
  overflow-y: auto;
  padding: 18px 0;
  position: fixed;
  width: 320px;
  z-index: 1000;
}

.sidebar-flyout-menu[hidden] {
  display: none !important;
}

.sidebar-flyout-title {
  color: #0f172a;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  padding: 0 22px 14px;
}

.sidebar-flyout-menu a {
  align-items: center;
  background: transparent;
  border-radius: 0;
  color: #0f172a;
  display: flex;
  font-size: 14px;
  font-weight: 500;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 22px;
  text-decoration: none;
}

.sidebar-flyout-menu a:hover,
.sidebar-flyout-menu a.active {
  background: #f3f4f6;
  color: #0f172a;
}

.sidebar-flyout-menu a.active {
  box-shadow: inset -3px 0 0 #173346;
  font-weight: 700;
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 28px 48px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-head p {
  color: var(--muted);
  margin-top: 4px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.module-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.module-menu a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  padding: 9px 11px;
  text-decoration: none;
}

.module-menu a:hover,
.module-menu a.active {
  border-color: var(--green);
  background: #e9f8f0;
  color: #126c49;
}

.finance-chip-filters {
  display: grid;
  gap: 12px;
}

.chip-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  border: 1px solid #d7e0e8;
  border-radius: 999px;
  background: #fff;
  color: #1d4ed8;
  font-weight: 800;
  padding: 7px 15px;
  text-decoration: none;
}

.filter-chip.active {
  border-color: #7059e8;
  background: #7059e8;
  color: #fff;
}

.filter-chip.warning {
  border-color: #f8b84e;
  color: #b66b00;
}

.filter-chip.warning.active {
  background: #f8b84e;
  color: #111827;
}

.dds-chip-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 13px;
  text-decoration: none;
}

.entity-link,
.document-link,
.badge-link,
.muted-link {
  color: #126c49;
  font-weight: 700;
  text-decoration: none;
}

.document-link {
  color: #1d4ed8;
}

.muted-link {
  color: #475569;
  font-weight: 600;
}

.badge-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  padding: 4px 8px;
}

.btn.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.padded {
  padding: 16px;
  margin-bottom: 16px;
}

.padded h2 {
  margin-bottom: 12px;
}

.deal-card-layout {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.deal-main-column {
  min-width: 0;
}

.deal-context-panel {
  min-width: 0;
}

.deal-sticky-panel {
  position: sticky;
  top: 18px;
}

.deal-context-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deal-context-summary div,
.deal-context-total {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.deal-context-summary span,
.deal-context-total span,
.deal-context-total small {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.deal-context-summary strong,
.deal-context-total strong {
  display: block;
  margin-top: 4px;
}

.deal-context-total {
  margin-top: 12px;
}

.deal-context-total strong {
  font-size: 24px;
}

.deal-context-links {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.deal-quick-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.deal-quick-form h3 {
  font-size: 15px;
  margin: 0 0 2px;
}

.deal-quick-form input,
.deal-quick-form select,
.deal-quick-form textarea {
  width: 100%;
}

.deal-quick-form .btn {
  width: 100%;
}

.deal-sticky-panel hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0 4px;
}

.module-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-links code {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}

.compact-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.stock-actions-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stock-action-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.stock-action-form h3 {
  font-size: 16px;
  margin: 0;
}

.stock-action-form input,
.stock-action-form select {
  min-width: 0;
  width: 100%;
}

.form-message {
  color: #15803d;
  font-weight: 700;
  margin-top: 12px;
  min-height: 20px;
}

.form-message.error {
  color: #b91c1c;
}

.compact-action-form {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 72px 92px minmax(140px, 1fr) auto;
  min-width: 390px;
}

.compact-action-form input,
.compact-action-form select {
  min-width: 0;
  width: 100%;
}

.compact-action-form button {
  white-space: nowrap;
}

.checkline {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  white-space: nowrap;
}

.checkline input {
  width: auto;
}

.status-pill.danger {
  background: #ef4444;
}

.status-pill.ok {
  background: #16a34a;
}

.hidden {
  display: none;
}

.click-table tbody tr {
  cursor: pointer;
}

.click-table tbody tr:hover {
  background: #f8fafc;
}

@media (max-width: 1180px) {
  .deal-card-layout {
    grid-template-columns: 1fr;
  }

  .deal-sticky-panel {
    position: static;
  }
}

.stocrm-shell {
  background: #f3f6f8;
  color: #0f172a;
  display: grid;
  font-family: Inter, Arial, sans-serif;
  grid-template-columns: 132px minmax(0, 1fr);
  margin: 0;
  min-height: 100vh;
}

.stocrm-side {
  background: #173346;
  color: #dbe7ef;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.stocrm-logo {
  align-items: center;
  background: #102838;
  display: flex;
  font-weight: 800;
  height: 66px;
  justify-content: center;
  letter-spacing: .03em;
}

.stocrm-nav {
  color: #c9d5dd;
  display: block;
  font-size: 15px;
  font-weight: 700;
  padding: 16px 14px;
  text-decoration: none;
}

.stocrm-nav.sidebar-link {
  align-items: center;
  display: flex;
  justify-content: space-between;
  width: 100%;
}

button.stocrm-nav {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.stocrm-nav.active,
.stocrm-nav:hover {
  background: #0f2534;
  color: #fff;
}

.stocrm-side .sidebar-flyout-menu {
  border-radius: 0;
  min-height: 360px;
  width: 350px;
}

.stocrm-side .sidebar-flyout-title {
  font-size: 21px;
  padding: 0 30px 18px;
}

.stocrm-side .sidebar-flyout-menu a {
  font-size: 16px;
  min-height: 46px;
  padding: 11px 30px;
}

.stocrm-side .sidebar-flyout-menu a.active {
  box-shadow: inset -4px 0 0 #173346;
}

.stocrm-main {
  min-width: 0;
}

.stocrm-topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: grid;
  gap: 10px;
  grid-template-columns: 190px minmax(0, 1fr) auto auto;
  min-height: 54px;
  padding: 8px 14px;
}

.pipeline-select {
  display: grid;
  font-size: 19px;
  gap: 2px;
}

.pipeline-select small {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.stocrm-search {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) 220px 88px;
}

.dashboard-topbar {
  grid-template-columns: 190px minmax(0, 1fr);
}

.dashboard-search {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-hero {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 22px 26px;
}

.dashboard-hero h1 {
  font-size: 30px;
  margin: 0 0 6px;
}

.dashboard-hero p {
  color: #64748b;
  margin: 0;
}

.dashboard-metrics {
  padding: 12px 18px;
}

.dashboard-alert {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #9a3412;
  font-weight: 700;
  padding: 10px 12px;
}

.dashboard-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding: 10px 14px;
}

.dashboard-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(18, 29, 45, 0.06);
  overflow: hidden;
}

.dashboard-finance-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 16px;
}

.dashboard-finance-metric {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
}

.dashboard-finance-metric span {
  color: #64748b;
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}

.dashboard-finance-metric b {
  color: #0f172a;
  font-size: 20px;
}

.dashboard-finance-detail {
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 0 16px 16px;
}

.dashboard-finance-detail strong {
  color: #0f172a;
}

.dashboard-panel .table-wrap,
.dashboard-list {
  max-height: 320px;
  overflow: auto;
}

.stock-bulk-bar {
  align-items: center;
  background: #e8f1fb;
  border: 1px solid #cbdceb;
  border-radius: 8px;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.stock-bulk-bar.active {
  display: flex;
}

.stock-bulk-bar strong {
  color: #173346;
  margin-right: 8px;
}

.stock-bulk-bar button {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #173346;
  cursor: pointer;
  font-weight: 700;
  padding: 6px 9px;
}

.stock-bulk-bar button:hover {
  background: #fff;
}

.stock-bulk-panel {
  background: #fff;
  border: 1px solid #cbdceb;
  border-radius: 10px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, .12);
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 14px;
}

.stock-bulk-panel[hidden] {
  display: none;
}

.stock-bulk-panel h3 {
  margin: 0 0 4px;
}

.stock-bulk-items {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: grid;
  max-height: 260px;
  overflow: auto;
}

.stock-bulk-item {
  align-items: center;
  border-bottom: 1px solid #edf2f7;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) 94px 110px 110px;
  padding: 9px 10px;
}

.stock-bulk-item:last-child {
  border-bottom: 0;
}

.stock-bulk-item strong,
.stock-bulk-item small {
  display: block;
}

.stock-bulk-item small {
  color: #64748b;
  margin-top: 3px;
}

.stock-bulk-item input {
  max-width: 92px;
}

.stock-bulk-controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) 180px;
}

.stock-bulk-controls label,
.stock-bulk-controls span {
  display: grid;
  gap: 5px;
}

.column-tools {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 8px;
  position: relative;
}

.column-tools button {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #173346;
  cursor: pointer;
  font-weight: 700;
  padding: 6px 10px;
}

.column-panel {
  background: #fff;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: 36px;
  z-index: 20;
}

.column-panel[hidden] {
  display: none;
}

.column-panel label {
  align-items: center;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

th[data-col-drag] {
  cursor: grab;
  user-select: none;
}

th[data-col-drag].dragging {
  opacity: .55;
}

.entity-card-layout {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: 320px minmax(0, 1fr);
}

.entity-profile-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.entity-profile-list div {
  border-bottom: 1px solid #edf1f4;
  display: grid;
  gap: 3px;
  padding-bottom: 9px;
}

.entity-profile-list dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.entity-profile-list dd {
  margin: 0;
}

.entity-tabbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #edf1f4;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 8px;
}

.entity-tabbar button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: #334155;
  cursor: pointer;
  flex: 0 0 auto;
  font-weight: 800;
  padding: 14px 10px 11px;
}

.entity-tabbar button.active {
  border-bottom-color: #173346;
  color: #0f172a;
}

.entity-tab-panel {
  padding: 14px;
}

.entity-tab-panel[hidden] {
  display: none;
}

.entity-empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  padding: 18px;
}

.dashboard-panel.wide {
  grid-column: 1 / -1;
}

.dashboard-list {
  display: grid;
  gap: 0;
  padding: 8px 14px 14px;
}

.dashboard-list a {
  border-bottom: 1px solid #edf1f4;
  color: #173346;
  display: grid;
  gap: 4px;
  padding: 10px 0;
  text-decoration: none;
}

.dashboard-list a:last-child {
  border-bottom: 0;
}

.dashboard-list span {
  color: #64748b;
}

.compact-table {
  min-width: 0;
}

.stocrm-table.compact-table {
  min-width: 0;
  table-layout: auto;
}

.dashboard-panel .stocrm-table.compact-table th,
.dashboard-panel .stocrm-table.compact-table td {
  padding: 8px 10px;
}

.stocrm-search input,
.stocrm-search select,
.deal-filters input,
.deal-filters select,
.deal-modal input,
.deal-modal select {
  border: 1px solid #d9dee5;
  border-radius: 4px;
  font: inherit;
  min-height: 36px;
  padding: 8px 10px;
}

.deal-filterbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: grid;
  gap: 8px;
  padding: 10px 14px 12px;
}

.deal-filters {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 180px 190px 170px 150px 150px 96px 84px;
}

.deal-filters label {
  color: #64748b;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 4px;
  text-transform: uppercase;
}

.deal-filters button,
.deal-filters a {
  align-items: center;
  border: 1px solid #d9dee5;
  border-radius: 4px;
  color: #173346;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 36px;
  padding: 8px 10px;
  text-decoration: none;
}

.deal-filters button {
  background: #173346;
  border-color: #173346;
  color: #fff;
  cursor: pointer;
}

.deal-summary-strip {
  color: #475569;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.deal-summary-strip span {
  background: #f8fafc;
  border: 1px solid #edf1f4;
  border-radius: 6px;
  padding: 6px 10px;
}

.deal-workbar {
  align-items: start;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.deal-bulk-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.deal-bulk-actions select {
  border: 1px solid #d9dee5;
  border-radius: 4px;
  min-height: 34px;
  padding: 7px 10px;
}

.deal-bulk-actions button,
.deal-column-tools button {
  background: #eef4f7;
  border: 1px solid #d7e1e8;
  border-radius: 4px;
  color: #173346;
  cursor: pointer;
  font-weight: 800;
  min-height: 34px;
  padding: 7px 12px;
}

.inline-status {
  color: #15803d;
  font-weight: 800;
  min-height: 20px;
}

.inline-status.error {
  color: #b91c1c;
}

.stock-tabs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.stock-tabs a {
  background: #f8fafc;
  border: 1px solid #d9dee5;
  border-radius: 4px;
  color: #173346;
  font-weight: 800;
  padding: 8px 12px;
  text-decoration: none;
}

.stock-tabs a.active {
  background: #173346;
  border-color: #173346;
  color: #fff;
}

.stocrm-dense-table {
  font-size: 13px;
  min-width: 1360px;
}

.stocrm-dense-table th,
.stocrm-dense-table td {
  padding: 8px 10px;
}

.deal-column-tools {
  position: relative;
}

.deal-column-panel {
  background: #fff;
  border: 1px solid #d9dee5;
  border-radius: 6px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, .16);
  display: grid;
  gap: 6px;
  min-width: 220px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 5;
}

.deal-column-panel label {
  align-items: center;
  color: #173346;
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.stocrm-table input[type="checkbox"] {
  height: 16px;
  margin: 0;
  width: 16px;
}

.dark-btn,
.icon-btn {
  background: #173346;
  border: 0;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 9px 14px;
  text-decoration: none;
}

.icon-btn {
  background: #eef4f7;
  color: #173346;
}

.deal-grid-panel {
  background: #fff;
  min-height: calc(100vh - 54px);
}

.x-scroll {
  overflow: auto;
}

.stocrm-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 1760px;
  width: 100%;
}

.stocrm-table th,
.stocrm-table td {
  border-bottom: 1px solid #edf1f4;
  border-right: 1px solid #edf1f4;
  padding: 10px 12px;
  white-space: nowrap;
}

.stocrm-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.stocrm-table tbody tr:nth-child(even) {
  background: #f6f9fb;
}

.stocrm-table tbody tr:hover {
  background: #eaf3ff;
}

.mini-badge {
  align-items: center;
  background: #f1f5f9;
  border-radius: 999px;
  display: inline-flex;
  gap: 5px;
  padding: 4px 8px;
}

.mini-badge::before {
  background: var(--dot, #94a3b8);
  border-radius: 50%;
  content: "";
  height: 8px;
  width: 8px;
}

.mini-badge.ok::before {
  background: #22c55e;
}

.mini-badge.warn::before {
  background: #f59e0b;
}

.plate {
  border: 1px solid #111827;
  border-radius: 3px;
  font-weight: 800;
  padding: 2px 6px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(0, 0, 0, .38);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 20;
}

.modal-backdrop[hidden],
.deal-column-panel[hidden],
.deal-car-picker[hidden] {
  display: none !important;
}

.deal-modal {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .25);
  min-height: 620px;
  padding: 34px 40px;
  position: relative;
  width: min(1120px, calc(100vw - 80px));
}

.modal-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 30px;
  position: absolute;
  right: 24px;
  top: 22px;
}

.deal-create-row {
  align-items: center;
  display: grid;
  gap: 28px;
  grid-template-columns: 360px 1fr;
  margin: 24px 0;
}

.deal-create-row.compact {
  margin-top: -8px;
}

.deal-client-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  margin-bottom: 24px;
}

.deal-client-search button {
  background: #f7d867;
  border: 0;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-weight: 700;
}

.deal-client-results {
  color: #111827;
  margin: 18px auto;
  max-width: 760px;
  min-height: 84px;
}

.client-result-row {
  background: transparent;
  border: 0;
  cursor: pointer;
  display: grid;
  font-size: 18px;
  grid-template-columns: 1fr;
  padding: 12px 8px;
  text-align: left;
  width: 100%;
}

.client-result-row.selected {
  background: #eef6ff;
}

.deal-car-picker {
  background: #f8fafc;
  border: 1px solid #edf1f4;
  border-radius: 6px;
  margin: 0 auto 14px;
  max-width: 760px;
  padding: 12px;
}

.deal-inline-grid {
  border: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  margin: 8px 0;
  padding: 0;
}

.deal-inline-grid button {
  background: #173346;
  border: 0;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 8px 12px;
}

.floating-plus {
  background: #f7d867;
  border: 0;
  border-radius: 50%;
  bottom: 54px;
  box-shadow: 0 12px 28px rgba(0,0,0,.14);
  cursor: pointer;
  font-size: 42px;
  height: 76px;
  position: absolute;
  right: 54px;
  width: 76px;
}

.page-shell .panel-head {
  gap: 16px;
}

.page-shell .panel-head input {
  max-width: 360px;
}

.page-shell .metric-grid {
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .page-body.has-sidebar {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    height: auto;
    position: static;
  }

  .app-sidebar nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .app-sidebar nav a,
  .app-sidebar nav .sidebar-link,
  .app-sidebar nav .sidebar-collapsible {
    flex: 0 0 auto;
  }

  .sidebar-flyout-menu {
    max-width: calc(100vw - 24px);
    min-width: 280px;
    width: calc(100vw - 24px);
  }

  .page-shell {
    padding: 18px 14px 36px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .two-column,
  .workspace-grid,
  .stock-actions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .stocrm-shell {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .stocrm-side .sidebar-flyout-menu {
    width: min(320px, calc(100vw - 24px));
  }

  .stocrm-topbar,
  .deal-filters,
  .dashboard-grid,
  .dashboard-finance-strip {
    grid-template-columns: 1fr;
  }

  .dashboard-panel.wide {
    grid-column: auto;
  }
}

/* ─── Kanban view ─────────────────────────────────────────────────────────── */
.kanban-board {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  min-height: 60vh;
  overflow-x: auto;
  padding: 12px 14px 28px;
}

.kanban-col {
  display: flex;
  flex: 0 0 220px;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.kanban-col-head {
  align-items: center;
  background: #173346;
  border-radius: 8px;
  color: #dbe7ef;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  padding: 7px 10px;
}

.kanban-count {
  background: rgba(255, 255, 255, .18);
  border-radius: 10px;
  font-size: 11px;
  margin-left: auto;
  padding: 1px 7px;
}

.kanban-status-dot {
  border-radius: 50%;
  flex-shrink: 0;
  height: 9px;
  width: 9px;
}

.kanban-cards {
  border: 2px dashed transparent;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
  padding: 4px;
  transition: border-color .15s, background .15s;
}

.kanban-cards.drag-over {
  background: rgba(22, 163, 106, .07);
  border-color: #16a36a;
}

.kanban-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: grab;
  font-size: 13px;
  padding: 8px 10px;
  transition: box-shadow .15s;
}

.kanban-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}

.kanban-card:active,
.kanban-card.kanban-dragging {
  cursor: grabbing;
  opacity: .5;
}

.kanban-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.kanban-card-num {
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.kanban-card-num:hover {
  text-decoration: underline;
}

.kanban-amount {
  color: #16a36a;
  font-size: 12px;
  font-weight: 700;
}

.kanban-card-client {
  color: #374151;
  font-size: 13px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-car {
  color: #64748b;
  font-size: 11px;
  margin-bottom: 2px;
}

.kanban-card-date {
  color: #94a3b8;
  font-size: 11px;
  margin-top: 4px;
}

.kanban-col-total {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 4px;
  text-align: right;
}

/* ─── View toggle (list / board) ─────────────────────────────────────────── */
.view-toggle {
  display: flex;
  gap: 3px;
}

.view-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 10px;
}

.view-btn.active {
  background: #173346;
  border-color: #173346;
  color: #fff;
}

/* ─── Sidebar task badge ──────────────────────────────────────────────────── */
.nav-badge {
  background: #e53e3e;
  border-radius: 9px;
  color: #fff;
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  margin-left: 5px;
  min-width: 16px;
  padding: 2px 5px;
  text-align: center;
  vertical-align: middle;
}

.stocrm-sidebar nav a:has(.nav-badge),
.stocrm-sidebar nav .sidebar-link:has(.nav-badge) {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-hint {
  color: #64748b;
  font-size: 12px;
  margin: -4px 0 0;
}

.mini-panel {
  background: #fbfdff;
  border: 1px solid #d7e0e8;
  border-radius: 8px;
  padding: 12px;
}

.mini-panel .panel-head {
  margin-bottom: 10px;
}

.notification-row.unread {
  background: #eef6ff;
}

.notification-kind {
  border: 1px solid #d7e0e8;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
}

/* ─── Global search in sidebar ───────────────────────────────────────────── */
.sidebar-search-wrap {
  margin: 8px 10px 4px;
  position: relative;
}

.sidebar-search-input {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 7px;
  color: #e8f0f5;
  font-size: 13px;
  outline: none;
  padding: 7px 10px;
  width: 100%;
}

.sidebar-search-input::placeholder {
  color: rgba(255,255,255,.45);
}

.sidebar-search-input:focus {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.3);
}

.sidebar-search-dropdown {
  background: #fff;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  box-shadow: 0 10px 36px rgba(15,23,42,.2);
  left: 0;
  max-height: 400px;
  min-width: 240px;
  overflow-y: auto;
  position: absolute;
  top: calc(100% + 4px);
  width: max-content;
  z-index: 200;
}

.gs-section-head {
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  padding: 8px 12px 3px;
  text-transform: uppercase;
}

.gs-item {
  align-items: baseline;
  color: #0f172a;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  padding: 7px 12px;
  text-decoration: none;
}

.gs-item:hover {
  background: #f0f6ff;
}

.gs-label {
  font-size: 13px;
  font-weight: 600;
}

.gs-sub {
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

.gs-empty {
  color: #94a3b8;
  font-size: 13px;
  padding: 12px;
  text-align: center;
}

/* ─── Order status timeline ────────────────────────────────────────────── */
.order-timeline { padding: 4px 0; }

.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-item {
  align-items: flex-start;
  border-left: 2px solid #dbe3ea;
  display: flex;
  gap: 10px;
  margin-left: 8px;
  padding: 6px 0 6px 14px;
  position: relative;
}

.timeline-item:last-child { border-color: transparent; }

.tl-icon {
  font-size: 14px;
  left: -11px;
  position: absolute;
  top: 6px;
}

.tl-time {
  color: #64748b;
  font-size: 11px;
  min-width: 110px;
  white-space: nowrap;
}

.tl-body { flex: 1; font-size: 13px; }

.tl-msg {
  color: #475569;
  font-size: 12px;
  margin-top: 2px;
}

/* ─── Dashboard today row ──────────────────────────────────────────────── */
.dashboard-panel .dashboard-list a {
  border-bottom: 1px solid #f1f5f9;
  color: inherit;
  display: block;
  padding: 7px 0;
  text-decoration: none;
}

.dashboard-panel .dashboard-list a:hover { background: #f8fafc; margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem; }
.dashboard-panel .dashboard-list a b { display: block; font-size: 13px; }
.dashboard-panel .dashboard-list a span { color: #64748b; font-size: 11px; }

/* ─── Wave 8: Photo Gallery ───────────────────────────────────────────── */
.photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 0;
}

.photo-thumb {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  width: 140px;
}

.photo-thumb img {
  display: block;
  height: 100px;
  object-fit: cover;
  width: 100%;
}

.photo-thumb .file-link {
  align-items: center;
  color: #3b82f6;
  display: flex;
  font-size: 12px;
  height: 80px;
  justify-content: center;
  padding: 8px;
  text-align: center;
  word-break: break-all;
}

.photo-meta {
  color: #94a3b8;
  font-size: 10px;
  padding: 3px 6px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-delete-photo {
  background: rgba(0,0,0,0.45);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  height: 20px;
  line-height: 20px;
  padding: 0;
  position: absolute;
  right: 5px;
  text-align: center;
  top: 5px;
  width: 20px;
}

.btn-delete-photo:hover { background: #ef4444; }

.inline-edit-link,
.inline-edit-chip {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  margin: 0;
  padding: 0;
  text-align: left;
}

.inline-edit-chip {
  border-radius: 999px;
  padding: 4px 10px;
}

.inline-edit-link:hover,
.inline-edit-chip:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.inline-editing {
  min-width: 150px;
}

.inline-edit-control {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  min-height: 34px;
  padding: 6px 10px;
  width: 100%;
}

.inline-date-wrap {
  align-items: center;
  display: flex;
  gap: 6px;
}

.inline-clear-btn {
  background: #e2e8f0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  height: 34px;
  width: 34px;
}

.inline-clear-btn:hover {
  background: #cbd5e1;
}

.code-block {
  background: #0f172a;
  border-radius: 6px;
  color: #e5e7eb;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
}
