:root {
  --ee-ink: #0f172a;
  --ee-ink-soft: #64748b;
  --ee-paper: #f5f7fb;
  --ee-surface: #ffffff;
  --ee-line: #e2e8f0;
  --ee-line-strong: #cbd5e1;
  --ee-brass: #1d4ed8;
  --ee-brass-soft: #eff4ff;
  --ee-pine: #1d4ed8;
  --ee-danger: #b91c1c;
  --ee-danger-soft: #fef2f2;
  --ee-sidebar: #ffffff;
  --ee-radius: 10px;
  --ee-font: "Inter", system-ui, sans-serif;
  --ee-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --bs-body-font-family: var(--ee-font);
  --bs-body-color: var(--ee-ink);
  --bs-body-bg: var(--ee-paper);
  --bs-primary: var(--ee-ink);
  --bs-border-color: var(--ee-line);
  --bs-border-radius: 8px;
}

body {
  font-size: 14px;
  letter-spacing: -0.011em;
}

.btn {
  font-weight: 550;
  border-radius: 8px;
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  --bs-btn-bg: #1d4ed8;
  --bs-btn-border-color: #1d4ed8;
  --bs-btn-hover-bg: #1e40af;
  --bs-btn-hover-border-color: #1e40af;
  --bs-btn-color: #fff;
}

.btn-brass {
  background: var(--ee-brass);
  border: 1px solid var(--ee-brass);
  color: #fff;
}

.btn-brass:hover { background: #1e40af; color: #fff; }

.btn-ghost {
  background: #fff;
  border: 1px solid var(--ee-line-strong);
  color: var(--ee-ink);
}

.btn-lg { height: 42px; }

.form-control,
.form-select,
.ee-input {
  height: 40px;
  border: 1px solid var(--ee-line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: var(--ee-ink);
  box-shadow: none;
}

textarea.form-control,
textarea.ee-input { height: auto; min-height: 96px; padding-top: 10px; }

.form-control:focus,
.ee-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16);
}

.form-label,
.ee-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #3e4a61;
}

.field-error { color: var(--ee-danger); font-size: 12px; margin: 6px 0 0; }
.field-hint { color: var(--ee-ink-soft); font-size: 12px; margin: 6px 0 0; }
.is-invalid .ee-input,
.is-invalid .form-control { border-color: #e3b4b4; background: var(--ee-danger-soft); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.app-sidebar {
  background: #fff;
  color: var(--ee-ink);
  border-right: 1px solid var(--ee-line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { padding: 6px 10px 16px; }
.brand strong { display: block; color: var(--ee-ink); font-size: 15px; letter-spacing: -0.02em; }
.brand span { color: var(--ee-ink-soft); font-size: 12px; }

.nav-kicker {
  margin: 14px 10px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.app-nav a {
  display: flex;
  align-items: center;
  color: #334155;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 2px;
  font-size: 13.5px;
}

.app-nav a.active,
.app-nav a:hover { background: #eff4ff; color: #1d4ed8; }
.app-nav a.active { box-shadow: none; font-weight: 600; }

.side-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--ee-line); }
.side-foot button {
  background: none;
  border: 0;
  color: var(--ee-ink-soft);
  padding: 0;
  font-size: 13px;
}

.app-main { padding: 22px 28px 88px; min-width: 0; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h1 { font-size: 22px; margin: 0; font-weight: 620; letter-spacing: -0.03em; }
.section-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ee-brass);
  margin-bottom: 4px;
  font-weight: 650;
}

.surface {
  background: var(--ee-surface);
  border: 1px solid var(--ee-line);
  border-radius: 12px;
  box-shadow: var(--ee-shadow);
}

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--ee-line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 22px; font-weight: 640; letter-spacing: -0.03em; }
.stat span { color: var(--ee-ink-soft); font-size: 12px; }

.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.quick {
  display: block;
  background: #fff;
  border: 1px solid var(--ee-line);
  border-radius: 12px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
}
.quick:hover { border-color: #93c5fd; }
.quick small { display: block; color: var(--ee-brass); font-weight: 700; letter-spacing: 0.08em; font-size: 11px; }
.quick strong { display: block; margin-top: 6px; font-size: 14px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ee-ink-soft);
  font-weight: 650;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ee-line);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f0ebe4; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #f8fafc; }
.data-table a { color: inherit; font-weight: 600; text-decoration: none; }
.data-table a:hover { color: var(--ee-brass); }

.badge-status {
  background: var(--ee-brass-soft);
  color: #1e40af;
  font-weight: 650;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
}

.search {
  height: 40px;
  width: min(360px, 100%);
  border: 1px solid var(--ee-line-strong);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.workbench { display: grid; grid-template-columns: 180px 1fr; gap: 18px; align-items: start; }
.steps { position: sticky; top: 18px; }
.steps a {
  display: block;
  text-decoration: none;
  color: var(--ee-ink-soft);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.steps a:hover { background: #fff; color: var(--ee-ink); }

.block {
  background: #fff;
  border: 1px solid var(--ee-line);
  border-radius: 12px;
  padding: 16px 16px 8px;
  margin-bottom: 12px;
}
.block h2 { font-size: 15px; margin: 0 0 2px; font-weight: 640; }
.block .lead { color: var(--ee-ink-soft); font-size: 13px; margin: 0 0 14px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.span-2 { grid-column: span 2; }
.party {
  border: 1px solid var(--ee-line);
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}
.party h3 { font-size: 13px; margin: 0 0 10px; font-weight: 700; }

.suffix { position: relative; }
.suffix input { padding-right: 36px; }
.suffix i {
  position: absolute;
  right: 12px;
  top: 33px;
  font-style: normal;
  color: var(--ee-ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.savebar {
  position: sticky;
  bottom: 0;
  margin: 8px -28px -88px;
  padding: 12px 28px;
  background: rgba(245, 247, 251, 0.94);
  border-top: 1px solid var(--ee-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(8px);
}
.savebar p { margin: 0; color: var(--ee-ink-soft); font-size: 13px; }

.catalog-group { margin-bottom: 18px; }
.catalog-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #f0ebe4;
  text-decoration: none;
  color: inherit;
}
.catalog-row:hover { background: #f8fafc; }
.prefix {
  width: 36px;
  height: 28px;
  border-radius: 6px;
  background: #eff4ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.catalog-row strong { display: block; font-size: 14px; }
.catalog-row span { color: var(--ee-ink-soft); font-size: 12px; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ee-paper);
  padding: 24px;
}
.auth-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--ee-line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--ee-shadow);
}
.auth-card h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; margin: 8px 0 20px; }
.auth-logo { font-weight: 700; color: #1d4ed8; letter-spacing: -0.03em; }

.sheet {
  width: min(820px, 100%);
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--ee-line);
  padding: 36px 40px;
  color: #1c1c1c;
}
.sheet-top { display: flex; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e6e0d6; padding-bottom: 14px; margin-bottom: 18px; }
.sheet h2 { text-align: center; font-size: 20px; letter-spacing: 0.04em; margin: 8px 0 18px; }
.party-grid, .terms-grid, .sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.party-card, .term-card { border: 1px solid #ece6dc; padding: 12px; border-radius: 8px; }
.sign-box { min-height: 110px; border-top: 1px solid #cfc6b8; padding-top: 8px; }
.sign-box img { max-height: 72px; }
.draft-banner { background: #f8f1e4; color: #6d5224; border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-bottom: 12px; }
.pad-wrap { border: 1px solid var(--ee-line-strong); border-radius: 10px; background: #fff; }
.pad-wrap canvas { width: 100%; height: 180px; touch-action: none; }

.alert { border-radius: 10px; font-size: 13px; }

@media (max-width: 980px) {
  .auth-shell, .app-shell, .stat-row, .quick-row, .workbench, .grid, .party-grid, .terms-grid, .sign-row { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth-brand, .steps { display: none; }
  .app-sidebar { position: relative; height: auto; }
  .app-main { padding: 16px 16px 96px; }
  .savebar { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
}

@media print {
  .app-sidebar, .no-print, .page-head, .savebar { display: none !important; }
  .app-shell { display: block; }
  .app-main { padding: 0; }
  .sheet { border: 0; width: auto; }
}
