:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #141628;
  background: #f5f6fb;
  font-synthesis: none;
  --muted: #555b70;
  --line: #e0e3ef;
  --surface: #fff;
  --accent: #5138dc;
  --accent-hover: #4228c8;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 290px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #6b54ec; outline-offset: 3px; }

.workspace { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); min-height: 100dvh; }
.sidebar { background: #17172a; color: #fff; padding: 2rem 1rem; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 0 .475rem; text-decoration: none; }
.brand-symbol {
  display: grid;
  place-items: center;
  width: 2.45rem;
  height: 2.45rem;
  flex: 0 0 auto;
  border-radius: .75rem;
  background: #a59aff;
  color: #201952;
  font-size: 1.53rem;
  font-weight: 850;
  line-height: 1;
}
.brand strong { display: block; font-size: 1.25rem; line-height: 1.15; letter-spacing: -.03em; }
.brand small { display: block; margin-top: .2rem; color: #c3c4d9; font-size: .8125rem; }
.navigation { display: grid; gap: .3rem; margin-top: 2.45rem; }
.navigation a {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 2.75rem;
  padding: .6rem .8rem;
  border-radius: .6rem;
  text-decoration: none;
  font-weight: 600;
  color: #d3d4e4;
}
.navigation a:hover { background: #23233e; }
.navigation a[aria-current] { color: #fff; background: #333064; box-shadow: inset 3px 0 #ad9fff; }
.logout { margin: 1.2rem .475rem 0; }
.logout .button { background: transparent; border-color: #56566d; color: #fff; }
.logout .button:hover { background: #333064; }
.icon { display: inline-block; flex: 0 0 auto; position: relative; width: 1rem; height: 1rem; }
.icon-board { border: 1.5px solid currentColor; border-radius: .2rem; }
.icon-board::after { content: ""; position: absolute; inset: .14rem .25rem; border-inline: 1px solid currentColor; }
.icon-script { border: 1.5px solid currentColor; border-radius: .18rem; width: .88rem; }
.icon-script::after { content: ""; position: absolute; inset: .23rem .12rem; border-block: 1px solid currentColor; }
.icon-search { border: 1.5px solid currentColor; border-radius: 50%; width: .8rem; height: .8rem; }
.icon-search::after { content: ""; width: .37rem; border-top: 1.5px solid currentColor; position: absolute; bottom: -.14rem; right: -.25rem; transform: rotate(45deg); }

main { min-width: 0; padding: clamp(1.25rem, 3.2vw, 3.25rem); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; }
h1 { font-size: clamp(2rem, 3.65vw, 3.2rem); font-weight: 760; letter-spacing: -.06em; line-height: 1.03; }
.page-header p { color: var(--muted); margin-top: .65rem; line-height: 1.45; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  min-height: 2.65rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: .55rem .88rem;
  background: var(--surface);
  color: #24263d;
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.25;
}
.button:hover { background: #f1f0fa; }
.button:disabled { opacity: .53; cursor: default; }
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.plus { font-size: 1.2rem; line-height: .8; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.75rem; }
.metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .44rem;
  padding: .94rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .9rem;
}
.metric h2 { font-size: .9rem; color: #4a5067; font-weight: 640; }
.metric p { font-size: clamp(1.42rem, 2.5vw, 2.1rem); line-height: 1.15; letter-spacing: -.045em; font-weight: 730; overflow-wrap: anywhere; }
.metric small { font-size: .8125rem; color: var(--muted); line-height: 1.4; }
.won-metric { background: #edf9f3; border-color: #d1e9dd; }
.won-metric p { color: #125841; }

.pipeline { min-width: 0; }
.toolbar, .toolbar-title, .filters { display: flex; align-items: center; gap: .6rem; }
.toolbar { justify-content: space-between; margin-bottom: .85rem; flex-wrap: wrap; }
.toolbar h2, .script-panel h2 { font-size: 1.25rem; letter-spacing: -.025em; }
.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  min-height: 1.55rem;
  padding: .1rem .42rem;
  border-radius: 5rem;
  background: #e9ebf5;
  color: #41475f;
  white-space: nowrap;
  font-size: .8125rem;
  font-weight: 680;
}
input:not([type="checkbox"]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.65rem;
  padding: .58rem .7rem;
  color: inherit;
  background-color: var(--surface);
  border: 1px solid #d5d9e8;
  border-radius: .55rem;
}
input::placeholder, textarea::placeholder { color: #62677b; }
select {
  appearance: none;
  padding-right: 1.85rem;
  background-image: linear-gradient(45deg, transparent 50%, #596079 50%), linear-gradient(135deg, #596079 50%, transparent 50%);
  background-position: right .875rem center, right .56rem center;
  background-size: .32rem .32rem;
  background-repeat: no-repeat;
}
.filters select, .search input { font-size: .9rem; }
.search { display: flex; align-items: center; position: relative; }
.search .icon { position: absolute; left: .72rem; color: #596079; pointer-events: none; }
.search input { width: clamp(10rem, 16vw, 15rem); padding-left: 2rem; }
.board-scroll { overflow-x: auto; padding: 3px 3px .7rem; margin-inline: -3px; scrollbar-color: #b7bbd5 transparent; }
.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(11.25rem, 1fr));
  align-items: stretch;
  gap: .7rem;
  min-width: min-content;
}
.stage {
  --stage-color: #77819e;
  min-width: 0;
  min-height: 21rem;
  background: #ebeef7;
  border: 1px solid transparent;
  border-radius: .8rem;
}
.stage[data-stage="contacted"] { --stage-color: #5876cb; }
.stage[data-stage="qualified"] { --stage-color: #8970d9; }
.stage[data-stage="offer"] { --stage-color: #ad6d1d; }
.stage[data-stage="won"] { --stage-color: #258164; }
.stage[data-stage="lost"] { --stage-color: #a25d72; }
.stage.drop-target { border-color: var(--accent); background: #e8e1ff; }
.stage-header { display: flex; gap: .45rem; align-items: center; min-height: 3.25rem; padding: .55rem .62rem; }
.stage-mark { width: .55rem; height: .55rem; background: var(--stage-color); border-radius: 50%; flex: 0 0 auto; }
.stage-header h3 { font-size: .875rem; line-height: 1.2; flex: 1; }
.stage-header .counter { background: #fff; }
.stage-cards { display: grid; gap: .45rem; padding: 0 .45rem .45rem; }
.empty-stage, .empty-add { min-height: 3.55rem; display: grid; place-items: center; border: 1px dashed #cbd0e2; border-radius: .55rem; font-size: .875rem; color: var(--muted); }
.empty-add { background: #f8f6ff; color: #4430b4; border-color: #b9b0ee; }
.deal-card {
  width: 100%;
  display: grid;
  gap: .5rem;
  text-align: left;
  color: inherit;
  background: var(--surface);
  border: 1px solid #dce0ed;
  border-radius: .62rem;
  padding: .68rem;
  box-shadow: 0 2px 3px #343b6210;
}
.deal-card:hover { border-color: #afa3ee; box-shadow: 0 3px 8px #343b6220; }
.card-top, .card-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .22rem .45rem; }
.card-bottom { margin-top: .18rem; padding-top: .55rem; border-top: 1px solid #edf0f7; }
.service-tag { display: inline-block; max-width: 100%; padding: .22rem .44rem; border-radius: .35rem; font-size: .8125rem; font-weight: 670; }
.prezload { background: #eae5ff; color: #4427b0; }
.voting { background: #dff3ea; color: #185f48; }
.card-amount { font-size: .8125rem; color: #3c435c; white-space: nowrap; }
.deal-title { font-size: .975rem; line-height: 1.24; overflow-wrap: anywhere; }
.deal-contact { color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.added-state, .card-bottom time { font-size: .875rem; color: var(--muted); }
.added-state.added { color: #16694d; }
.card-bottom .overdue { color: #ab344e; font-weight: 680; }
.load-warning { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }

.script-layout { display: grid; grid-template-columns: minmax(10.5rem, 14rem) minmax(0, 1fr); align-items: start; gap: 1rem; }
.service-list { display: grid; gap: .45rem; }
.service-list button {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 3.5rem;
  text-align: left;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: inherit;
  background: var(--surface);
  font-weight: 660;
}
.service-list button[aria-pressed="true"] { border-color: #a69bee; background: #f0edff; }
.service-icon { display: grid; place-items: center; flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: .48rem; }
.script-panel { padding: clamp(.9rem, 2.55vw, 2rem); background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; }
.script-steps { margin: 1rem 0 0; padding-left: 1.6rem; }
.script-steps li { padding: .85rem 0 .85rem .28rem; border-top: 1px solid var(--line); }
.script-steps li::marker { color: var(--accent); font-weight: 700; }
.script-steps h3 { font-size: 1rem; margin-bottom: .35rem; }
.script-steps p, .call-script p { color: #454b63; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.placeholder { color: var(--muted); padding: .7rem 0; }

.drawer {
  inset: 0 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  width: min(100%, 37rem);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--surface);
  color: inherit;
  box-shadow: -1rem 0 3rem #14162c29;
}
.drawer::backdrop { background: #17172a80; }
.drawer form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.drawer-header, .drawer-footer { display: flex; gap: .65rem; align-items: center; padding: .85rem clamp(.8rem, 3vw, 1.5rem); }
.drawer-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.drawer-header h2 { font-size: clamp(1.22rem, 4vw, 1.56rem); letter-spacing: -.03em; }
.drawer-footer { flex-wrap: wrap; justify-content: flex-end; border-top: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: 1rem clamp(.8rem, 3vw, 1.5rem) 1.5rem; }
.button.close { min-width: 2.65rem; font-size: 1.4rem; line-height: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.full { grid-column: 1 / -1; }
.drawer label { display: grid; align-content: start; gap: .32rem; font-size: .9rem; font-weight: 650; color: #30354b; }
.drawer input, .drawer select, .drawer textarea { font-weight: 400; font-size: 1rem; }
.drawer textarea { resize: vertical; }
.drawer .checkbox { display: flex; gap: .5rem; align-items: center; min-height: 2rem; }
.checkbox input { width: 1.12rem; height: 1.12rem; margin: 0; accent-color: var(--accent); }
.call-script { border: 1px solid #d9d3f5; background: #f8f6ff; border-radius: .65rem; }
.call-script > summary { padding: .7rem .8rem; font-weight: 680; color: #432db6; }
.call-script details { border-top: 1px solid #e4dff8; padding: .55rem .8rem; }
.call-script details summary { font-size: .9rem; font-weight: 640; }
.call-script p { margin-top: .35rem; }
.script-field { min-width: 0; display: grid; gap: .7rem; margin: 0 0 .85rem; padding: .8rem; border: 1px solid var(--line); border-radius: .65rem; }
.step-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.form-error { width: 100%; color: #a42e48; font-size: .9rem; }
.toast { position: fixed; inset: auto 1rem 1rem auto; max-width: calc(100vw - 2rem); padding: .8rem 1rem; z-index: 1; border-radius: .65rem; background: #272540; color: #fff; box-shadow: 0 4px 18px #241e4a40; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.login-layout { display: grid; min-height: 100dvh; place-items: center; }
.login-panel { display: grid; justify-items: start; gap: 1rem; width: min(100%, 28rem); padding: clamp(1.25rem, 5vw, 2.5rem); background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; }
.login-panel h1 { font-size: clamp(1.85rem, 5vw, 2.7rem); }
.login-panel p { color: var(--muted); line-height: 1.45; }
.login-panel .button { text-decoration: none; }

@media (min-width: 1150px) {
  .board { grid-template-columns: repeat(6, minmax(9.25rem, 1fr)); }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 11rem minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 730px) {
  .workspace { display: block; }
  .sidebar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; padding: .65rem .8rem; }
  .brand { padding: 0; gap: .45rem; }
  .brand small { display: none; }
  .brand-symbol { width: 2rem; height: 2rem; font-size: 1.12rem; border-radius: .52rem; }
  .navigation { display: flex; gap: .1rem; margin: 0; }
  .navigation a { font-size: .875rem; gap: .38rem; min-height: 2.5rem; padding: .45rem .52rem; }
  .navigation a[aria-current] { box-shadow: inset 0 -2px #ad9fff; }
  .navigation .icon { display: none; }
  .logout { margin: 0; }
  .logout .button { min-height: 2.4rem; padding-inline: .5rem; }
  main { padding: 1rem; }
  .page-header { align-items: flex-start; flex-wrap: wrap; margin-bottom: 1.1rem; }
  .metrics { gap: .55rem; margin-bottom: 1.2rem; }
  .metric { padding: .7rem; }
  .filters { flex-wrap: wrap; width: 100%; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .filters > label:not(.search) { flex: 1; }
  .script-layout { grid-template-columns: minmax(0, 1fr); }
  .service-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 370px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
