.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .94);
}

.ghost-button { white-space: nowrap; }

.stage-column {
  border-top: 3px solid var(--stage-color, #dfe5e2);
}

.stage-column > header {
  min-height: 42px;
  align-items: start;
  padding-top: 1px;
}

.stage-heading {
  display: grid;
  gap: 4px;
}

.stage-heading small {
  color: #879396;
  font-size: 9px;
  font-weight: 600;
}

.order-card h3 { font-size: 14px; }
.order-card p { font-size: 12px; }
.card-bottom .amount-missing {
  color: #98a2a4;
  font-size: 9px;
  font-weight: 600;
}

.deadline-last {
  display: block;
  margin-top: 8px;
  color: #7f9296;
  font-size: 10px;
}

.lead-status-row { margin-bottom: 10px; }
.telegram-delivery {
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
}
.telegram-delivery.sent { background: #edf8dd; color: #4e7f3d; }
.telegram-delivery.pending { background: #fff4df; color: #966b19; }
.telegram-delivery.scheduled { background: #eaf2fb; color: #486f98; }
.notification-list button > span.soon { background: #eaf2fb; color: #486f98; }

.deal-progress {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--stage-count, 7), minmax(58px, 1fr));
  gap: 0;
  padding: 8px 26px 14px;
  overflow-x: auto;
}

.deal-progress::before {
  content: "";
  position: absolute;
  top: 15px;
  right: 34px;
  left: 34px;
  height: 2px;
  background: #e2e8e5;
}

.deal-progress button {
  position: relative;
  z-index: 1;
  min-width: 58px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: #9aa4a5;
  font-size: 8px;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.deal-progress button i {
  width: 15px;
  height: 15px;
  display: block;
  margin: 0 auto 6px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #dfe6e3;
  box-shadow: 0 0 0 1px #d3dcda;
}

.deal-progress button.done i,
.deal-progress button.current i { background: var(--step-color); }
.deal-progress button.done,
.deal-progress button.current { color: #4d5c5f; font-weight: 800; }
.deal-progress button.current i { box-shadow: 0 0 0 3px rgba(153, 200, 75, .27); }

.deal-completeness {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8e5;
  border-radius: 12px;
  background: #fff;
}
.deal-completeness > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #68777a;
  font-size: 11px;
}
.deal-completeness > div b { color: var(--ink); }
.deal-completeness > i {
  display: block;
  height: 5px;
  margin: 8px 0;
  overflow: hidden;
  border-radius: 5px;
  background: #e5eae8;
}
.deal-completeness > i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--acid-dark);
}
.deal-completeness p { margin: 0; color: #909b9d; font-size: 10px; }

.telegram-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}
.telegram-test {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--acid);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.telegram-test:disabled { color: #748589; cursor: default; }

.empty-results button,
.empty-big button { margin-top: 10px; display: inline-flex; }

.drawer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.drawer-section-head h3 { margin: 0 0 4px; }
.drawer-section-head span { color: #899597; font-size: 12px; }
.drawer-section-head > b {
  min-width: 42px;
  padding: 6px 9px;
  border-radius: 9px;
  background: #edf6de;
  color: #547a2e;
  font-size: 12px;
  text-align: center;
}
.checklist-progress {
  height: 5px;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: #e6ebe9;
}
.checklist-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--acid-dark);
  transition: width .2s ease;
}
.checklist-items { display: grid; }
.checklist-item {
  min-height: 40px;
  display: grid;
  grid-template-columns: 25px 1fr 24px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #edf1ef;
  color: #4d5c5f;
  font-size: 13px;
}
.checklist-item > button:first-child {
  width: 23px;
  height: 23px;
  border: 1px solid #cfd9d5;
  border-radius: 7px;
  background: #fff;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.checklist-item.done > button:first-child { border-color: var(--acid-dark); background: var(--acid-dark); }
.checklist-item.done > span { color: #93a09d; text-decoration: line-through; }
.remove-row {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #a3adab;
  cursor: pointer;
}
.remove-row:hover { background: #fff0ed; color: var(--danger); }
.inline-add {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 7px;
  margin-top: 11px;
}
.inline-add input {
  min-width: 0;
  height: 36px;
  padding: 0 11px;
  border: 1px solid #dce3e1;
  border-radius: 9px;
  background: #f8faf9;
  outline: 0;
}
.inline-add button {
  border: 0;
  border-radius: 9px;
  background: var(--acid);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.stage-deadlines { display: grid; gap: 7px; }
.stage-deadline-row {
  display: grid;
  grid-template-columns: 120px minmax(145px, 1fr) 136px;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid #e7ecea;
  border-radius: 10px;
  background: #fbfcfc;
}
.stage-deadline-row.current { border-color: #bcd994; background: #f7fceD; }
.stage-deadline-row.done { opacity: .62; }
.deadline-step { display: flex; align-items: center; gap: 7px; min-width: 0; }
.deadline-step i { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; }
.deadline-step b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.stage-deadline-row input,
.stage-deadline-row select {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #dce3e1;
  border-radius: 8px;
  background: #fff;
  color: #536164;
  font-size: 12px;
  outline: 0;
}
.stage-deadline-row input:focus,
.stage-deadline-row select:focus { border-color: #94bd52; box-shadow: 0 0 0 3px rgba(185, 231, 105, .18); }
.attach-button {
  position: relative;
  padding: 7px 10px;
  border: 1px solid #dce3e1;
  border-radius: 9px;
  color: #567c2d;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.attach-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attachment-list { display: grid; gap: 7px; }
.attachment-list article {
  display: grid;
  grid-template-columns: 34px 1fr 24px;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid #e7ecea;
  border-radius: 10px;
  background: #fbfcfc;
}
.attachment-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eaf1ee;
  color: #5d7376;
  font-size: 16px;
}
.attachment-list a { min-width: 0; color: inherit; text-decoration: none; }
.attachment-list a b,
.attachment-list a small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-list a b { font-size: 13px; }
.attachment-list a small { margin-top: 4px; color: #8b9799; font-size: 11px; }
.workflow-empty { margin: 8px 0; color: #929d9f; font-size: 12px; }

@media (max-width: 680px) {
  .deal-progress { padding-inline: 18px; }
  .telegram-actions { grid-column: 1 / -1; justify-items: stretch; }
  .telegram-test { text-align: left; }
  .stage-deadline-row { grid-template-columns: 1fr 1fr; }
  .deadline-step { grid-column: 1 / -1; }
}

[hidden] { display: none !important; }
body.auth-visible { overflow: auto; background: #f3f5f4; }
.auth-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, .92fr) minmax(440px, 1.08fr);
  background: #f3f5f4;
  color: var(--ink);
}
.auth-visual {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #18252a;
  color: #fff;
}
.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 23% 18%, rgba(185, 231, 105, .14), transparent 31%), linear-gradient(145deg, rgba(255,255,255,.035), transparent 44%);
}
.auth-stone { position: absolute; display: block; border: 1px solid rgba(255,255,255,.08); background: #26363c; box-shadow: 0 34px 80px rgba(0,0,0,.28); transform: rotate(-13deg); }
.auth-stone::after { content: ""; position: absolute; inset: 11%; border: 1px solid rgba(185,231,105,.16); border-radius: inherit; }
.auth-stone-one { width: 42vw; height: 48vw; max-width: 640px; max-height: 720px; right: -19vw; top: -8vw; border-radius: 46% 54% 61% 39% / 41% 38% 62% 59%; }
.auth-stone-two { width: 28vw; height: 31vw; max-width: 430px; max-height: 470px; left: -12vw; bottom: -10vw; border-radius: 58% 42% 37% 63% / 48% 61% 39% 52%; background: #213138; }
.auth-visual-copy { position: absolute; z-index: 1; right: 12%; bottom: 10%; left: 12%; }
.auth-visual-copy > span { color: var(--acid); font-size: 11px; font-weight: 900; letter-spacing: .2em; }
.auth-visual-copy strong { display: block; margin-top: 18px; font-size: clamp(38px, 4.2vw, 67px); line-height: .98; letter-spacing: -.055em; }
.auth-visual-copy p { max-width: 440px; margin: 22px 0 0; color: #aebabc; font-size: 13px; line-height: 1.65; }
.auth-entry { min-height: 100dvh; display: grid; place-items: center; padding: 42px; }
.auth-card { width: min(430px, 100%); padding: 42px; border: 1px solid #dfe5e2; border-radius: 22px; background: #fff; box-shadow: 0 22px 70px rgba(24,37,42,.09); }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 45px; }
.auth-brand > span:last-child { display: grid; }
.auth-brand strong { font-size: 15px; letter-spacing: .13em; }
.auth-brand small { margin-top: 2px; color: #8a9698; font-size: 9px; letter-spacing: .12em; }
.auth-kicker { margin: 0 0 12px; color: #799f3e; font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.auth-card h1 { margin: 0; font-size: 34px; line-height: 1; letter-spacing: -.045em; }
.auth-subtitle { margin: 13px 0 28px; color: #7d898c; font-size: 13px; line-height: 1.5; }
.auth-field { display: grid; gap: 8px; margin-top: 15px; }
.auth-field > span { color: #526064; font-size: 11px; font-weight: 800; }
.auth-field input { width: 100%; height: 49px; padding: 0 14px; border: 1px solid #d7dfdc; border-radius: 12px; background: #f8faf9; color: var(--ink); font: inherit; outline: 0; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.auth-field input:focus { border-color: #93bc51; background: #fff; box-shadow: 0 0 0 4px rgba(185,231,105,.22); }
.auth-error { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: #fff0ed; color: #a74439; font-size: 11px; line-height: 1.45; }
.auth-submit { width: 100%; height: 50px; display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding: 0 13px 0 18px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 900; cursor: pointer; }
.auth-submit i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--acid); color: var(--ink); font-size: 17px; font-style: normal; }
.auth-submit:hover { background: #24353b; }
.auth-submit:disabled { opacity: .62; cursor: wait; }
.auth-security { display: block; margin-top: 17px; color: #a0aaac; font-size: 9px; text-align: center; }
.account-summary { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8faf9; }
.account-summary h3, .account-summary p { margin: 0; }
.account-summary h3 { font-size: 15px; }
.account-summary p { margin-top: 4px; color: #6f7d80; font-size: 12px; }
.account-summary small { display: block; margin-top: 3px; color: #98a2a4; }
.telegram-id-form { grid-column: 1 / -1; display: grid; gap: 9px; margin-top: 2px; padding-top: 13px; border-top: 1px solid #eef1ef; }
.telegram-id-form label { display: grid; gap: 6px; }
.telegram-id-form label > span { color: #7f8c8f; font-size: 10px; font-weight: 800; }
.telegram-id-form input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #d9e1de; border-radius: 9px; background: #f8faf9; color: var(--ink); outline: 0; }
.telegram-id-form input:focus { border-color: #94bd52; box-shadow: 0 0 0 3px rgba(185,231,105,.2); }
.telegram-id-form > div { display: flex; flex-wrap: wrap; gap: 7px; }
.telegram-id-form button { height: 31px; padding: 0 10px; border: 1px solid #dbe2df; border-radius: 8px; background: #fff; color: #5f6d70; font-size: 10px; font-weight: 800; cursor: pointer; }
.telegram-id-form .telegram-save { border-color: #9dbf66; background: #eff8df; color: #52742e; }
.telegram-id-form .telegram-clear { margin-left: auto; border-color: transparent; color: #a64a40; }
.telegram-id-form button:disabled { opacity: .42; cursor: default; }
.telegram-state.assigned { background: #fff4df; color: #8b651d; }
.team-card > div { min-width: 0; }
.team-card > div small { overflow-wrap: anywhere; }
.telegram-panel a { color: inherit; font-weight: 800; }

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-entry { padding: 24px; }
}
@media (max-width: 520px) {
  .auth-entry { align-items: start; padding: 18px; }
  .auth-card { margin-top: 6vh; padding: 28px 22px; border-radius: 18px; }
  .auth-brand { margin-bottom: 36px; }
  .auth-card h1 { font-size: 30px; }
  .telegram-id-form input,
  .stage-deadline-row input,
  .stage-deadline-row select { min-height: 44px; font-size: 16px; }
  .telegram-id-form button { min-height: 44px; }
}
