:root {
  --bg: #eef3f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --sidebar: #0f172a;
  --text: #0f172a;
  --text-soft: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --success: #16a34a;
  --danger-text: #b91c1c;
  --warning-soft: #fff7ed;
  --warning-text: #c2410c;
  --danger-soft: #fee2e2;
  --success-soft: #dcfce7;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  --radius-lg: 16px;
  --content-width: 1480px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { background: linear-gradient(180deg, #0f172a 0%, #111827 100%); color: #fff; padding: 20px 16px; display: grid; align-content: start; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, #2563eb, #22c55e); font-size: 13px; }
.brand__title { font-weight: 700; font-size: 16px; }
.brand__subtitle { color: rgba(255,255,255,.68); font-size: 12px; margin-top: 3px; }
.nav { display: grid; gap: 6px; }
.nav__item { text-align: left; border: 1px solid rgba(255,255,255,.08); background: transparent; color: rgba(255,255,255,.78); padding: 11px 12px; border-radius: 12px; font-size: 14px; }
.nav__item--active, .nav__item:hover:not(:disabled) { background: rgba(37, 99, 235, 0.18); color: #fff; border-color: rgba(59, 130, 246, .5); }
.nav__item:disabled { opacity: .72; cursor: not-allowed; }
.sidebar-card { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.sidebar-card__title { font-weight: 700; }
.sidebar-card__text { color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.5; }
.sidebar-card__link { color: #93c5fd; text-decoration: none; font-weight: 600; }
.main { padding: 16px 18px 24px; }
.main__inner { width: min(100%, var(--content-width)); margin: 0 auto; display: grid; align-content: start; gap: 14px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 28px; line-height: 1.05; letter-spacing: -0.02em; }
.page-subtitle { margin: 6px 0 0; color: var(--text-soft); max-width: 760px; line-height: 1.45; font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--warning-soft); color: var(--warning-text); font-weight: 700; font-size: 13px; }
.status-pill--ok { background: var(--success-soft); color: #166534; }
.status-pill--error { background: var(--danger-soft); color: var(--danger-text); }
.primary-btn { border: none; background: linear-gradient(135deg, var(--accent), #1d4ed8); color: #fff; padding: 10px 14px; border-radius: 12px; font-weight: 700; box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18); }
.ghost-btn { border: 1px solid var(--line-strong); background: white; color: var(--text); padding: 9px 12px; border-radius: 12px; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 10px; }
.stat-card, .panel { background: rgba(255,255,255,.85); backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.stat-card { padding: 12px 14px; }
.stat-card__label { color: var(--text-soft); font-size: 12px; margin-bottom: 6px; }
.stat-card__value { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card__hint { margin-top: 4px; color: var(--text-soft); font-size: 12px; line-height: 1.35; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr); gap: 14px; }
.content-stack { display: grid; gap: 14px; }
.content-stack--forms { align-content: start; }
.content-stack--wide { width: 100%; }
.panel { padding: 14px; }
.panel__header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.panel__header h2 { margin: 0; font-size: 18px; }
.panel__header p { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; line-height: 1.45; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.crm-table { width: 100%; border-collapse: collapse; background: white; }
.crm-table th, .crm-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.crm-table th { color: var(--text-soft); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #f8fafc; }
.crm-table tbody tr:hover { background: #f8fbff; cursor: pointer; }
.crm-table tbody tr.is-active { background: #eff6ff; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge--type { background: #eff6ff; color: #1d4ed8; }
.badge--status { background: #f1f5f9; color: #334155; }
.badge--money { background: #ecfccb; color: #3f6212; }
.badge--selected { background: #dcfce7; color: #166534; }
.badge--income { background: #dcfce7; color: #166534; }
.badge--outgoing { background: #fee2e2; color: #991b1b; }
.crm-form { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-field { display: grid; gap: 6px; }
.form-field span { color: var(--text-soft); font-size: 12px; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid var(--line-strong); background: #fff; color: var(--text); padding: 10px 12px; border-radius: 12px; outline: none; }
.form-field textarea { min-height: 84px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #93c5fd; box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.22); }
.form-message { min-height: 20px; font-size: 13px; color: var(--text-soft); }
.form-message.is-success { color: #166534; }
.form-message.is-error { color: #b91c1c; }
.empty-state { border: 1px dashed var(--line-strong); border-radius: 14px; padding: 18px; background: #fbfdff; }
.empty-state__title { font-weight: 700; margin-bottom: 8px; }
.empty-state__text { color: var(--text-soft); line-height: 1.6; }
.deal-card { display: grid; gap: 12px; }
.deal-card__hero { display: grid; gap: 10px; }
.deal-card__hero-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr); gap: 12px; align-items: start; }
.deal-card__hero-main-col, .deal-card__hero-side { display: grid; gap: 10px; }
.deal-card__hero-surface { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.deal-card__hero-surface--main { display: grid; gap: 12px; }
.deal-card__hero-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
.deal-card__hero-main { display: grid; gap: 8px; min-width: 0; }
.deal-card__eyebrow { color: var(--text-soft); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.deal-card__title { margin: 0; font-size: 24px; line-height: 1.12; letter-spacing: -0.02em; }
.deal-card__meta { display: flex; gap: 8px; flex-wrap: wrap; }
.deal-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.deal-metric { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; display: grid; gap: 4px; }
.deal-metric__label { color: var(--text-soft); font-size: 12px; }
.deal-metric__value { font-size: 16px; line-height: 1.3; }
.deal-metric__value--ok { color: #166534; }
.deal-metric__value--danger { color: #b91c1c; }
.deal-focus-bar { display: grid; gap: 4px; padding: 11px 12px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); }
.deal-focus-bar__label { color: var(--text-soft); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.deal-focus-bar__text { font-size: 14px; line-height: 1.5; }
.deal-hero-summary { display: grid; gap: 8px; }
.deal-hero-summary__label { color: var(--text-soft); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.deal-hero-summary__row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.deal-hero-summary__row:last-child { border-bottom: none; padding-bottom: 0; }
.deal-hero-summary__row span { color: var(--text-soft); font-size: 13px; }
.deal-hero-summary__row strong { font-size: 14px; line-height: 1.35; text-align: right; }
.hero-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-summary__item { min-width: 126px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.hero-summary__item span { display: block; color: var(--text-soft); font-size: 12px; margin-bottom: 4px; }
.hero-summary__item strong { font-size: 16px; }
.deal-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.deal-tab { border: 1px solid var(--line-strong); background: #fff; color: var(--text-soft); border-radius: 999px; padding: 8px 12px; font-weight: 700; font-size: 13px; }
.deal-tab.is-active { background: var(--accent-soft); color: #1d4ed8; border-color: #93c5fd; }
.deal-card__section { display: grid; gap: 12px; }
.deal-card__section-title { font-size: 12px; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: .08em; }
.deal-card__section-hint { margin-top: -6px; color: var(--text-soft); font-size: 12px; }
.tab-shell { display: grid; gap: 10px; }
.tab-shell__header { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #f8fafc; }
.tab-shell__main { display: grid; gap: 4px; }
.tab-shell__title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.tab-shell__subtitle { color: var(--text-soft); font-size: 13px; line-height: 1.5; max-width: 860px; }
.tab-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tab-stat { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; gap: 4px; }
.tab-stat--warning { background: #fffaf3; }
.tab-stat--success { background: #f5fcf7; }
.tab-stat__label { color: var(--text-soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.tab-stat__value { font-size: 18px; font-weight: 800; line-height: 1.2; }
.tab-stat__value--warning { color: var(--warning-text); }
.tab-stat__value--success { color: #166534; }
.tab-stat__hint { color: var(--text-soft); font-size: 12px; line-height: 1.4; }
.operation-layout { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(320px, .82fr); gap: 12px; align-items: start; }
.operation-layout__main, .operation-layout__side { display: grid; gap: 10px; }
.section-panel { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px; display: grid; gap: 12px; }
.section-panel--side { position: sticky; top: 14px; }
.section-panel__header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.section-panel__title { color: var(--text-soft); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.section-panel__hint { margin-top: 5px; color: var(--text-soft); font-size: 13px; line-height: 1.45; }
.stack-list--dense { gap: 10px; }
.inline-helper--compact { margin-top: 0; padding: 10px 12px; align-items: flex-start; justify-content: flex-start; background: #f8fbff; }
.subcard--dense { padding: 12px; gap: 8px; }
.subcard--dense .subcard__meta { margin-top: 4px; font-size: 12px; }
.subcard--dense .detail-item { padding: 10px 12px; }
.subcard--dense .subcard__body { font-size: 14px; line-height: 1.55; }
.subcard__note { padding: 10px 12px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); color: var(--text); font-size: 13px; line-height: 1.5; }
.overview-shell { display: grid; grid-template-columns: minmax(0, 1.2fr) 300px; gap: 12px; align-items: start; }
.overview-shell__main, .overview-shell__side { display: grid; gap: 12px; }
.deal-side-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.deal-side-card__title { font-size: 12px; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: .08em; }
.deal-side-list { display: grid; gap: 2px; }
.deal-side-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.deal-side-row:last-child { border-bottom: none; padding-bottom: 0; }
.deal-side-row__label { color: var(--text-soft); font-size: 12px; }
.deal-side-row__value { font-weight: 700; text-align: right; line-height: 1.4; }
.deal-side-row__value--muted { color: var(--text-soft); font-weight: 500; }
.deal-side-note { margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--line); line-height: 1.5; font-size: 13px; }
.deal-side-note--muted { color: var(--text-soft); }
.deal-tab:hover, .workflow-card--interactive:hover { border-color: #93c5fd; }
.workflow-card--interactive { cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.workflow-card--interactive:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-grid--compact, .flag-grid.three-up { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.detail-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.detail-item__label { color: var(--text-soft); font-size: 12px; margin-bottom: 6px; }
.detail-item__value { font-weight: 700; line-height: 1.5; }
.detail-item__value--muted { font-weight: 500; color: var(--text-soft); }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.summary-card { border-radius: 14px; padding: 14px; background: var(--panel-soft); border: 1px solid var(--line); }
.summary-card__label { color: var(--text-soft); font-size: 12px; margin-bottom: 8px; }
.summary-card__value { font-size: 18px; font-weight: 800; }
.summary-card__value--positive { color: var(--success); }
.summary-card__value--neutral { color: #1d4ed8; }
.split-section { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(290px, .88fr); gap: 10px; align-items: start; }
.split-section__content, .split-section__side, .stack-list { display: grid; gap: 12px; }
.subcard { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; display: grid; gap: 10px; }
.subcard--selected { border-color: #86efac; box-shadow: inset 0 0 0 1px #86efac; }
.subcard__header { display: flex; justify-content: space-between; gap: 12px; align-items: start; flex-wrap: wrap; }
.subcard__title { font-weight: 800; }
.subcard__meta { color: var(--text-soft); font-size: 13px; margin-top: 6px; }
.subcard__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.subcard__body { color: var(--text); line-height: 1.6; }
.product-card__flags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: #f1f5f9; color: #334155; font-size: 12px; font-weight: 700; }
.tag--ok { background: #dcfce7; color: #166534; }
.tag--danger { background: #fee2e2; color: #991b1b; }
.check-grid, .flag-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.checkbox-pill { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: white; border-radius: 12px; padding: 11px 12px; }
.checkbox-pill input { margin: 0; }
.embedded-form-actions { display: grid; gap: 8px; }
.muted { color: var(--text-soft); }
.mono { font-variant-numeric: tabular-nums; }
@media (max-width: 1260px) { .content-grid, .split-section, .overview-shell, .operation-layout { grid-template-columns: 1fr; } .section-panel--side { position: static; } }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deal-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .main { padding: 18px; }
  .stats-grid, .form-row, .detail-grid, .summary-grid, .flag-grid, .check-grid, .detail-grid--compact, .deal-metrics, .tab-stats { grid-template-columns: 1fr; }
  .page-title { font-size: 28px; }
}

.subcard__actions a.ghost-btn { text-decoration: none; display: inline-flex; align-items: center; }

.editRecordBtn { white-space: nowrap; }
.hero-summary__item--action { display: flex; flex-direction: column; justify-content: center; }

.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.editor-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
}

.editor-modal__dialog {
  position: relative;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
  padding: 22px;
}

.editor-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

.editor-modal__title {
  font-size: 22px;
  font-weight: 800;
}

.editor-modal__subtitle {
  margin-top: 6px;
  color: var(--text-soft);
  line-height: 1.55;
}

.editor-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.editor-field--wide {
  grid-column: 1 / -1;
}

.editor-field__hint {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.editor-checkbox {
  min-height: 48px;
}

.editor-modal__footer {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.editor-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .editor-modal {
    padding: 12px;
  }

  .editor-modal__dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 16px;
  }

  .editor-form-grid {
    grid-template-columns: 1fr;
  }
}

.summary-card__value--negative { color: #b91c1c; }
.hero-summary__item--wide { min-width: 240px; flex: 1 1 280px; }
.hero-summary__text { font-size: 15px; line-height: 1.45; }
.workflow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.workflow-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; display: grid; gap: 6px; }
.workflow-card__label { color: var(--text-soft); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.workflow-card__value { font-size: 18px; font-weight: 800; }
.workflow-card__hint { color: var(--text-soft); line-height: 1.5; }
.workflow-card--done { border-color: #86efac; background: #f0fdf4; }
.workflow-card--progress { border-color: #fdba74; background: #fff7ed; }
.workflow-card--empty { border-style: dashed; background: #fbfdff; }
.alert-list { display: grid; gap: 10px; }
.alert-strip { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); background: #fff; line-height: 1.5; }
.alert-strip--warn { border-color: #fdba74; background: #fff7ed; color: #9a3412; }
.alert-strip--ok { border-color: #86efac; background: #f0fdf4; color: #166534; }
@media (max-width: 980px) { .workflow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .workflow-grid { grid-template-columns: 1fr; } .hero-summary__item--wide { min-width: 100%; } }

.section-shell[hidden] { display: none; }
.nav__item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nav__item--planned { color: rgba(255,255,255,.6); }
.nav__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.82);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.panel__header--stacked { align-items: stretch; }
.panel-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
  gap: 10px;
  width: 100%;
}
.panel-toolbar--deals {
  grid-template-columns: minmax(280px, 1.4fr) repeat(2, minmax(150px, 1fr));
  align-items: end;
}
.panel-toolbar__field { margin: 0; }
.empty-state--compact { gap: 12px; }
.workflow-grid--deals { margin-bottom: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.deal-list-focus { margin-top: 6px; color: #1d4ed8; line-height: 1.45; font-size: 13px; }
.deal-list-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.deal-list-stage-meta { font-weight: 600; color: var(--text); }
.deal-list-money--positive { color: #166534; font-weight: 700; }
.deal-list-money--negative { color: #b91c1c; font-weight: 700; }
.counterparty-card {
  display: grid;
  gap: 14px;
}
.counterparty-card__hero {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.counterparty-card__title { margin: 0; font-size: 22px; }
.related-deals { display: grid; gap: 12px; }
.related-deal-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  display: grid;
  gap: 10px;
}
.related-deal-card__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  flex-wrap: wrap;
}
.related-deal-card__title { font-weight: 800; }
.related-deal-card__meta { color: var(--text-soft); line-height: 1.5; }
.related-deal-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1200px) {
  .panel-toolbar--deals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workflow-grid--deals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .panel-toolbar { grid-template-columns: 1fr; }
  .panel-toolbar--deals { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .workflow-grid--deals { grid-template-columns: 1fr; }
}

.content-grid--single-sidebar {
  grid-template-columns: minmax(0, 1.22fr) minmax(300px, 0.78fr);
}

.ops-card {
  display: grid;
  gap: 18px;
}

.ops-card__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.ops-card__title {
  margin: 0;
  font-size: 24px;
}

@media (max-width: 1260px) {
  .content-grid--single-sidebar {
    grid-template-columns: 1fr;
  }
}


.panel--create {
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,250,252,.98) 100%);
}
.panel--deals-list,
.panel--detail {
  background: rgba(255,255,255,.92);
}
.panel--deals-list .panel__header {
  display: grid;
  grid-template-columns: minmax(220px, 0.86fr) minmax(0, 1.14fr);
  align-items: end;
  gap: 12px;
}
.summary-grid--overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel__header--compact {
  align-items: center;
}
.crm-form--compact {
  gap: 10px;
}
.form-row--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.form-field--wide-2 {
  grid-column: span 2;
}
.form-actions-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.inline-helper {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: #fbfdff;
}
.inline-helper__title {
  font-weight: 700;
  margin-bottom: 4px;
}
.inline-helper__text {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}
.table-wrap--dense {
  border-radius: 12px;
}
.crm-table--deals tbody tr:hover {
  background: #f8fbff;
}
.empty-state--detail {
  min-height: 120px;
}
.deal-list-focus {
  margin-top: 4px;
  color: #1d4ed8;
  line-height: 1.4;
  font-size: 12px;
}
.deal-list-stage-meta {
  font-weight: 600;
  color: var(--text-main);
  font-size: 13px;
}
.hero-summary__item--wide {
  min-width: 220px;
  flex: 1 1 240px;
}
.hero-summary__text {
  font-size: 14px;
  line-height: 1.4;
}
@media (max-width: 1260px) {
  .panel-toolbar--deals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .panel-toolbar__field--search,
  .form-field--wide-2 {
    grid-column: 1 / -1;
  }
  .form-row--triple {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 980px) {
  .inline-helper,
  .form-actions-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .workflow-grid--deals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .form-row--triple,
  .panel-toolbar--deals,
  .workflow-grid--deals {
    grid-template-columns: 1fr;
  }
  .form-field--wide-2 {
    grid-column: auto;
  }
}

@media (max-width: 1380px) {
  .deal-card__hero-grid,
  .panel--deals-list .panel__header { grid-template-columns: 1fr; }
  .summary-grid--overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .deal-card__hero-grid,
  .overview-shell,
  .split-section,
  .content-grid--single-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .main__inner { width: 100%; }
}

/* ===== Stage 12 holistic redesign ===== */
:root {
  --bg: #eff3f8;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --sidebar: #0f172a;
  --text: #101828;
  --text-soft: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #2f5bea;
  --accent-soft: #eef3ff;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 10px 24px rgba(16,24,40,.04);
  --radius-lg: 16px;
  --content-width: 1368px;
}

body {
  background:
    radial-gradient(circle at top left, rgba(47,91,234,.05), transparent 360px),
    linear-gradient(180deg, #f4f7fb 0%, #eef2f7 100%);
  color: var(--text);
}

.app-shell {
  grid-template-columns: 208px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  gap: 14px;
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.04);
}

.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 12px;
}

.brand__title { font-size: 15px; }
.brand__subtitle { font-size: 11px; }

.nav { gap: 4px; }
.nav__item {
  padding: 10px 11px;
  border-radius: 10px;
  font-size: 13px;
}

.sidebar-card {
  margin-top: 2px;
  padding: 12px;
  border-radius: 12px;
  gap: 8px;
  background: rgba(255,255,255,.045);
}

.sidebar-card__title { font-size: 13px; }
.sidebar-card__text { font-size: 12px; line-height: 1.45; }

.main {
  padding: 18px 20px 28px;
}

.main__inner {
  gap: 12px;
}

.topbar {
  align-items: flex-start;
  padding: 2px 2px 0;
}

.page-title {
  font-size: 34px;
  line-height: 1;
}

.page-subtitle {
  margin-top: 5px;
  max-width: 700px;
  font-size: 13px;
  line-height: 1.5;
}

.topbar-actions { gap: 8px; }

.status-pill,
.primary-btn,
.ghost-btn {
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
}

.primary-btn {
  padding: 10px 13px;
  box-shadow: none;
}

.ghost-btn {
  padding: 9px 12px;
}

.stats-grid {
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.stat-card {
  padding: 12px 14px;
  border-radius: 14px;
}

.stat-card__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-card__value {
  font-size: 24px;
  line-height: 1.05;
}

.stat-card__hint {
  font-size: 12px;
  line-height: 1.4;
}

.panel {
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
}

.panel__header {
  margin: 0;
  padding: 16px 18px 14px;
}

.panel__header h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.panel__header p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 620px;
}

.panel__header--compact {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}

.panel--create {
  padding: 18px;
  border-color: rgba(47,91,234,.16);
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
}

.panel--deals-list,
.panel--detail {
  background: rgba(255,255,255,.98);
}

.panel--deals-list .panel__header {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.panel-toolbar--deals {
  grid-template-columns: minmax(260px, 1.55fr) repeat(3, minmax(145px, 1fr));
  gap: 10px;
  align-items: end;
}

.panel-toolbar__field span,
.form-field span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-field input,
.form-field select,
.form-field textarea {
  border-radius: 10px;
  border-color: var(--line-strong);
  padding: 10px 12px;
  background: #fff;
}

.form-field textarea {
  min-height: 96px;
}

.inline-helper {
  background: #f8fafc;
  border-style: solid;
  border-color: var(--line);
}

.form-actions-inline {
  justify-content: flex-start;
}

.workflow-grid--deals {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 18px 12px;
  margin: 0;
}

.workflow-card {
  padding: 12px 12px 11px;
  border-radius: 12px;
  gap: 4px;
  box-shadow: none;
  background: #f8fafc;
}

.workflow-card__label {
  font-size: 10px;
  letter-spacing: .08em;
}

.workflow-card__value {
  font-size: 22px;
  line-height: 1.05;
}

.workflow-card__hint {
  font-size: 12px;
  line-height: 1.4;
}

.workflow-card--neutral {
  border-color: #dbe4f0;
  background: #f8fbff;
}

.workflow-card--done {
  border-color: #b7e0c0;
  background: #f3fcf6;
}

.workflow-card--progress {
  border-color: #f2c58b;
  background: #fff9f2;
}

.workflow-card--empty {
  border-style: solid;
  background: #fbfcfd;
}

.table-wrap {
  margin: 0 18px 18px;
  border-radius: 12px;
}

.crm-table {
  background: #fff;
}

.crm-table th,
.crm-table td {
  padding: 12px 12px;
}

.crm-table th {
  font-size: 10px;
  letter-spacing: .08em;
  background: #f8fafc;
}

.crm-table--deals td {
  font-size: 13px;
}

.crm-table--deals td:nth-child(1) { width: 88px; }
.crm-table--deals td:nth-child(2) { width: 360px; }
.crm-table--deals td:nth-child(3),
.crm-table--deals td:nth-child(4) { width: 150px; }
.crm-table--deals td:nth-child(5) { width: 170px; }
.crm-table--deals td:nth-child(6),
.crm-table--deals td:nth-child(7) { width: 130px; }
.crm-table--deals td:nth-child(8) { width: 150px; }

.crm-table--deals td strong {
  font-size: 14px;
  line-height: 1.35;
}

.crm-table--deals td .muted {
  font-size: 12px;
  line-height: 1.4;
}

.crm-table--deals td:nth-child(2) .muted {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.crm-table tbody tr.is-active {
  background: #eef4ff;
  box-shadow: inset 2px 0 0 var(--accent);
}

.deal-list-badges {
  gap: 6px;
}

.badge {
  padding: 5px 8px;
  font-size: 10px;
  letter-spacing: .02em;
}

.deal-list-focus {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #315be8;
}

.deal-list-stage-meta,
.deal-list-money--positive,
.deal-list-money--negative {
  font-size: 13px;
}

.panel--detail > .panel__header {
  padding-bottom: 12px;
}

.detail-host {
  padding: 18px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f7f9fc 100%);
}

.detail-host > .empty-state {
  min-height: 160px;
}

.empty-state {
  border: 1px dashed #d6dde8;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
}

.empty-state--detail {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
}

.deal-card {
  gap: 14px;
}

.deal-card__hero-grid {
  grid-template-columns: minmax(0, 1.26fr) 340px;
  gap: 14px;
}

.deal-card__hero-surface {
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px;
}

.deal-card__eyebrow {
  font-size: 11px;
  letter-spacing: .08em;
}

.deal-card__title {
  font-size: 32px;
}

.deal-card__meta {
  gap: 6px;
}

.deal-focus-bar {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f7f9fc;
}

.deal-focus-bar__text {
  font-size: 15px;
}

.deal-metric {
  border-radius: 14px;
  padding: 12px 14px;
  background: #f8fafc;
}

.deal-metric__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.deal-metric__value {
  font-size: 18px;
}

.deal-hero-summary__label,
.deal-card__section-title,
.deal-side-card__title,
.section-panel__title,
.tab-stat__label,
.summary-card__label {
  font-size: 11px;
  letter-spacing: .08em;
}

.deal-hero-summary__row {
  padding: 10px 0;
}

.deal-tabs {
  gap: 6px;
  padding: 0 2px;
}

.deal-tab {
  padding: 8px 12px;
  border-radius: 999px;
  border-color: var(--line);
  color: #475467;
  background: transparent;
}

.deal-tab.is-active {
  background: #fff;
  color: var(--accent);
  border-color: #bfd1ff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.overview-shell {
  grid-template-columns: minmax(0, 1.3fr) 320px;
  gap: 14px;
}

.deal-card__section,
.deal-side-card,
.section-panel,
.subcard,
.summary-card,
.tab-shell__header {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.deal-card__section {
  padding: 16px;
}

.summary-grid--overview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card {
  padding: 14px;
}

.summary-card__value {
  font-size: 20px;
}

.workflow-grid--clickable {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.alert-list {
  gap: 8px;
}

.alert-strip {
  padding: 11px 13px;
  border-radius: 12px;
}

.tab-shell {
  gap: 12px;
}

.tab-shell__header {
  padding: 14px 16px;
  gap: 14px;
}

.tab-stats {
  gap: 10px;
}

.tab-stat {
  background: #f8fafc;
  border-radius: 14px;
  padding: 12px 13px;
}

.tab-stat__value {
  font-size: 20px;
}

.operation-layout {
  grid-template-columns: minmax(0, 1.24fr) 340px;
  gap: 14px;
}

.section-panel {
  padding: 14px;
}

.section-panel--side {
  top: 18px;
}

.subcard,
.related-deal-card {
  padding: 14px;
  border-radius: 14px;
}

.subcard__title,
.related-deal-card__title {
  font-size: 15px;
}

.detail-grid,
.summary-grid,
.check-grid,
.flag-grid,
.tab-stats,
.deal-metrics {
  gap: 10px;
}

.detail-item {
  border-radius: 12px;
  padding: 12px;
}

.counterparty-card__hero,
.ops-card__header,
.tab-shell__header,
.section-panel__header {
  border-bottom: 1px solid var(--line);
}

.editor-modal__dialog {
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(15,23,42,.18);
}

@media (max-width: 1380px) {
  .panel--deals-list .panel__header,
  .deal-card__hero-grid,
  .overview-shell,
  .operation-layout {
    grid-template-columns: 1fr;
  }

  .workflow-grid--deals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-toolbar--deals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workflow-grid--deals,
  .workflow-grid--clickable {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main {
    padding: 14px;
  }

  .stats-grid,
  .panel-toolbar--deals,
  .workflow-grid--deals,
  .workflow-grid--clickable,
  .form-row,
  .form-row--triple,
  .detail-grid,
  .summary-grid,
  .tab-stats,
  .deal-metrics,
  .check-grid,
  .flag-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 28px;
  }

  .panel__header,
  .detail-host,
  .table-wrap {
    margin-left: 0;
    margin-right: 0;
  }

  .table-wrap {
    margin: 0 14px 14px;
  }
}

/* --- Stage 13 systemic enterprise redesign overrides --- */
:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --sidebar: #0f172a;
  --text: #101828;
  --text-soft: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #2458e7;
  --accent-soft: #e8efff;
  --success: #157347;
  --success-soft: #e9f8ef;
  --danger-text: #b42318;
  --danger-soft: #fef3f2;
  --warning-soft: #fff7ed;
  --warning-text: #c2410c;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.04);
  --radius-lg: 14px;
  --content-width: 1360px;
}

body {
  background:
    linear-gradient(180deg, #f6f8fb 0%, #f1f4f8 100%);
}

.app-shell {
  grid-template-columns: 208px minmax(0, 1fr);
}

.sidebar {
  padding: 18px 12px;
  gap: 16px;
  border-right: 1px solid rgba(255,255,255,.06);
}

.brand {
  padding: 2px 2px 6px;
}

.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 12px;
}

.brand__title {
  font-size: 15px;
  line-height: 1.1;
}

.brand__subtitle {
  font-size: 11px;
}

.nav {
  gap: 4px;
}

.nav__item {
  padding: 10px 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

.nav__item--active,
.nav__item:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(96, 165, 250, .46);
}

.sidebar-card {
  padding: 12px;
  border-radius: 12px;
  gap: 8px;
  background: rgba(255,255,255,.035);
}

.sidebar-card__title {
  font-size: 13px;
}

.sidebar-card__text {
  font-size: 12px;
  line-height: 1.55;
}

.main {
  padding: 18px 20px 28px;
}

.main__inner {
  gap: 12px;
}

.topbar {
  align-items: flex-start;
  padding-top: 2px;
}

.page-title {
  font-size: 26px;
  line-height: 1.05;
}

.page-subtitle {
  max-width: 760px;
  font-size: 13px;
  line-height: 1.45;
}

.topbar-actions {
  gap: 8px;
}

.status-pill,
.primary-btn,
.ghost-btn {
  min-height: 38px;
}

.primary-btn,
.ghost-btn {
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
}

.primary-btn {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.status-pill {
  padding: 7px 11px;
  font-size: 12px;
}

.stats-grid {
  gap: 8px;
}

.stat-card,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.stat-card {
  padding: 11px 13px;
}

.stat-card__label {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-card__value {
  font-size: 18px;
}

.stat-card__hint {
  margin-top: 3px;
  font-size: 12px;
}

.content-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .95fr);
  gap: 12px;
}

.panel {
  padding: 12px;
}

.panel__header {
  margin-bottom: 10px;
}

.panel__header h2 {
  font-size: 17px;
  line-height: 1.15;
}

.panel__header p {
  font-size: 12px;
  line-height: 1.45;
  max-width: 760px;
}

.panel__header--section-bar {
  gap: 10px;
}

.panel-toolbar {
  gap: 8px;
  align-items: end;
}

.panel-toolbar--deals {
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(140px, 1fr));
}

.panel-toolbar--counterparties {
  grid-template-columns: minmax(280px, 1.6fr) minmax(180px, 220px) auto;
}

.panel-toolbar__field {
  gap: 5px;
}

.panel-toolbar__actions {
  display: flex;
  justify-content: flex-end;
  align-items: end;
}

.form-field span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 9px 11px;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

.form-field textarea {
  min-height: 88px;
}

.form-row--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field--wide-2 {
  grid-column: span 2;
}

.panel--create {
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.panel--create.is-open {
  animation: slidePanelIn .18s ease-out;
}

@keyframes slidePanelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel--table {
  overflow: hidden;
}

.table-wrap {
  border-radius: 12px;
  overflow: hidden;
}

.table-wrap--flush {
  border-color: var(--line);
}

.crm-table th,
.crm-table td {
  padding: 9px 10px;
}

.crm-table th {
  font-size: 10px;
  letter-spacing: .08em;
  background: #f8fafc;
}

.crm-table tbody tr {
  transition: background .14s ease, box-shadow .14s ease;
}

.crm-table tbody tr:hover {
  background: #f8fbff;
}

.crm-table tbody tr.is-active {
  background: #eef4ff;
  box-shadow: inset 2px 0 0 #2458e7;
}

.badge {
  padding: 4px 8px;
  font-size: 10px;
  letter-spacing: .02em;
}

.empty-state {
  border: 1px dashed #d0d5dd;
  background: #fafbfc;
}

.detail-host {
  padding: 0;
  background: transparent;
}

.detail-host > .empty-state {
  min-height: 150px;
}

.detail-host--deal,
.detail-host--counterparty {
  padding: 0;
}

.counterparty-card,
.deal-card {
  gap: 12px;
}

.counterparty-card {
  padding: 4px 2px 2px;
}

.counterparty-card__hero {
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
}

.counterparty-card__title {
  font-size: 24px;
  line-height: 1.08;
}

.hero-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  width: 100%;
}

.hero-summary__item {
  min-width: 0;
  padding: 10px 11px;
  border-radius: 12px;
  background: #f8fafc;
}

.hero-summary__item span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.hero-summary__item strong {
  font-size: 15px;
  line-height: 1.25;
}

.hero-summary__item--action {
  background: #fff;
}

.detail-grid--compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-item {
  padding: 11px 12px;
  border-radius: 12px;
  background: #fff;
}

.detail-item__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
}

.detail-item__value {
  font-size: 14px;
  line-height: 1.45;
}

.related-deals {
  gap: 8px;
}

.related-deal-card {
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
}

.related-deal-card__title {
  font-size: 14px;
}

.related-deal-card__meta {
  font-size: 12px;
}

.panel--detail > .panel__header {
  padding-bottom: 0;
  border-bottom: none;
}

.deal-card__hero-grid {
  grid-template-columns: minmax(0, 1.42fr) minmax(300px, .88fr);
}

.deal-card__hero-surface,
.deal-side-card,
.section-panel,
.subcard,
.summary-card {
  border-radius: 12px;
}

.deal-card__hero-surface {
  padding: 12px;
}

.deal-card__title {
  font-size: 28px;
}

.deal-card__eyebrow,
.deal-card__section-title,
.tab-stat__label,
.section-panel__title,
.deal-side-card__title,
.deal-hero-summary__label,
.deal-focus-bar__label,
.tab-shell__title {
  letter-spacing: .05em;
}

.deal-metric,
.tab-stat,
.summary-card,
.section-panel,
.subcard,
.related-deal-card {
  box-shadow: none;
}

.deal-metric,
.tab-stat {
  padding: 10px 11px;
}

.deal-focus-bar {
  background: #f7f9fc;
  padding: 10px 11px;
}

.deal-tabs {
  gap: 6px;
}

.deal-tab {
  padding: 7px 11px;
  font-size: 12px;
}

.tab-shell__header {
  padding: 10px 12px;
}

.tab-shell__subtitle,
.section-panel__hint,
.deal-side-note,
.subcard__meta,
.subcard__body {
  font-size: 13px;
}

.content-grid--single-sidebar {
  grid-template-columns: minmax(0, 1.34fr) minmax(300px, .82fr);
}

.inline-helper {
  border-radius: 12px;
}

.editor-modal__dialog {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15,23,42,.18);
}

@media (max-width: 1260px) {
  .app-shell {
    grid-template-columns: 196px minmax(0, 1fr);
  }

  .panel-toolbar--deals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-toolbar--counterparties {
    grid-template-columns: 1fr 220px auto;
  }

  .hero-summary,
  .detail-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }

  .content-grid,
  .content-grid--single-sidebar,
  .deal-card__hero-grid,
  .operation-layout,
  .overview-shell,
  .split-section {
    grid-template-columns: 1fr;
  }

  .panel-toolbar,
  .panel-toolbar--deals,
  .panel-toolbar--counterparties,
  .form-row,
  .form-row--triple,
  .hero-summary,
  .detail-grid--compact {
    grid-template-columns: 1fr;
  }

  .form-field--wide-2 {
    grid-column: auto;
  }

  .panel-toolbar__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .stats-grid,
  .detail-grid,
  .summary-grid,
  .flag-grid,
  .check-grid,
  .deal-metrics,
  .tab-stats {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 24px;
  }

  .counterparty-card__title,
  .deal-card__title {
    font-size: 22px;
  }
}

/* stage14 master-detail pass */
.panel--table .panel__header p,
.panel--detail .panel__header p {
  max-width: 620px;
}

.crm-table {
  table-layout: fixed;
}

.crm-table td,
.crm-table th {
  vertical-align: top;
}

.crm-table tbody tr.is-active {
  background: #eef3ff;
  box-shadow: inset 3px 0 0 #2458e7;
}

.crm-table tbody tr td:first-child strong,
.crm-table tbody tr td strong {
  color: #0f172a;
}

.crm-table--deals td:nth-child(1) { width: 90px; }
.crm-table--deals td:nth-child(2) { width: 34%; }
.crm-table--deals td:nth-child(3) { width: 22%; }
.crm-table--deals td:nth-child(4) { width: 24%; }
.crm-table--deals td:nth-child(5) { width: 20%; }

#counterpartiesSection .crm-table td:nth-child(1) { width: 38%; }
#counterpartiesSection .crm-table td:nth-child(2) { width: 18%; }
#counterpartiesSection .crm-table td:nth-child(3) { width: 30%; }
#counterpartiesSection .crm-table td:nth-child(4) { width: 14%; }

#productsSection .crm-table td:nth-child(1) { width: 32%; }
#productsSection .crm-table td:nth-child(2) { width: 28%; }
#productsSection .crm-table td:nth-child(3) { width: 16%; }
#productsSection .crm-table td:nth-child(4) { width: 14%; }
#productsSection .crm-table td:nth-child(5) { width: 10%; }

#shipmentsSection .crm-table td:nth-child(1) { width: 30%; }
#shipmentsSection .crm-table td:nth-child(2) { width: 28%; }
#shipmentsSection .crm-table td:nth-child(3) { width: 16%; }
#shipmentsSection .crm-table td:nth-child(4) { width: 16%; }
#shipmentsSection .crm-table td:nth-child(5) { width: 10%; }

#paymentsSection .crm-table td:nth-child(1) { width: 16%; }
#paymentsSection .crm-table td:nth-child(2) { width: 26%; }
#paymentsSection .crm-table td:nth-child(3) { width: 30%; }
#paymentsSection .crm-table td:nth-child(4) { width: 14%; }
#paymentsSection .crm-table td:nth-child(5) { width: 14%; }

.overview-shell {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.overview-shell__main {
  gap: 10px;
}

.deal-side-card {
  gap: 8px;
}

.deal-side-row {
  padding: 8px 0;
}

.deal-card__section-hint {
  margin-bottom: 10px;
}

.deal-card__section-title {
  margin-bottom: 6px;
}

.summary-grid--overview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .crm-table {
    table-layout: auto;
  }

  .summary-grid--overview {
    grid-template-columns: 1fr;
  }
}
