/* ADB Pre-Sales Pipeline — built to the Altron Digital Business design standard.
   Palette, typography and the card / block / chip system are taken from the
   brand spec; nothing decorative has been added on top of it.               */

:root {
  --dark-teal:   #08252B;
  --blue-dianne: #1F4550;
  --teal-blue:   #55B8DF;
  --cyan:        #55DADF;
  --navy:        #28468E;
  --mint:        #C3F1D7;
  --mindaro:     #EBF980;
  --coral:       #EC8759;
  --grey:        #E6E6E6;
  --white:       #FFFFFF;

  --ink:      var(--dark-teal);
  --ink-soft: var(--blue-dianne);
  --muted:    #6B8189;
  --hairline: #DFE6E8;

  --r-card:  10px;
  --r-block: 6px;
  --r-chip:  999px;

  --pad: 20px;
  --shadow: 0 1px 2px rgba(8, 37, 43, .06), 0 8px 24px rgba(8, 37, 43, .05);

  --stage-new:         var(--cyan);
  --stage-in-progress: var(--blue-dianne);
  --stage-submitted:   var(--teal-blue);
  --stage-on-hold:     var(--grey);
  --stage-won:         var(--navy);
  --stage-lost:        var(--coral);
  --stage-no-bid:      #9FB2B8;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: Ubuntu, "Ubuntu Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.mono {
  font-family: "Ubuntu Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ chrome */

.masthead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; padding: 22px var(--pad) 0;
  max-width: 1440px; margin: 0 auto;
}
.masthead h1 {
  margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; color: var(--ink);
}
.masthead .sub { margin: 2px 0 0; font-size: 14px; color: var(--teal-blue); font-weight: 400; }
.wordmark {
  font-weight: 700; font-size: 15px; letter-spacing: .22em; color: var(--ink);
  white-space: nowrap; padding-bottom: 4px;
}
.wordmark small {
  display: block; letter-spacing: .06em; font-size: 10px; font-weight: 400;
  color: var(--muted); text-align: right; margin-top: 3px;
}

.tabs {
  display: flex; gap: 4px; padding: 16px var(--pad) 0;
  max-width: 1440px; margin: 0 auto; border-bottom: 1px solid var(--hairline);
}
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 500; color: var(--muted);
  padding: 9px 14px; border-radius: var(--r-block) var(--r-block) 0 0;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); background: #F4F8F9; }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--teal-blue); }

main { max-width: 1440px; margin: 0 auto; padding: 0 var(--pad) 64px; }
.view[hidden] { display: none; }

/* ------------------------------------------------- signature: the filter rail */

.rail {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 12px 0; min-height: 52px; border-bottom: 1px solid var(--hairline);
}
.rail .lead {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-right: 4px;
}
.rail select {
  font: inherit; font-size: 13px; color: var(--ink-soft);
  border: 1px solid var(--hairline); background: var(--white);
  border-radius: var(--r-chip); padding: 6px 12px; cursor: pointer;
}
.rail select:focus-visible { outline: 2px solid var(--teal-blue); outline-offset: 1px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--dark-teal); color: var(--white);
  border: 0; border-radius: var(--r-chip); padding: 6px 8px 6px 13px;
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  animation: chipIn .18s ease-out;
}
.chip b { font-weight: 400; opacity: .62; text-transform: uppercase; font-size: 10px; letter-spacing: .07em; }
.chip .x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255, 255, 255, .18); font-size: 12px; line-height: 1;
}
.chip:hover .x { background: var(--coral); }
.chip-clear {
  background: transparent; color: var(--muted); border: 1px dashed var(--hairline);
  padding: 6px 13px;
}
.chip-clear:hover { color: var(--coral); border-color: var(--coral); }
@keyframes chipIn { from { opacity: 0; transform: translateY(-3px); } }

/* ------------------------------------------------------------------ sections */

.sec-head {
  display: flex; align-items: center; gap: 9px; margin: 30px 0 13px;
}
.sec-head::before {
  content: ""; width: 4px; align-self: stretch; min-height: 15px;
  background: var(--dark-teal); border-radius: 2px;
}
.sec-head h2 {
  margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--ink);
}
.sec-head .hint { font-size: 11px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ------------------------------------------------------------------ KPI tiles */

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tile {
  background: var(--white); border: 1px solid var(--hairline);
  border-radius: var(--r-card); padding: 15px 16px; position: relative; overflow: hidden;
}
.tile::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--teal-blue);
}
.tile.won::before  { background: var(--navy); }
.tile.lost::before { background: var(--coral); }
.tile.rate::before { background: var(--dark-teal); }
.tile .k {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); margin-bottom: 6px;
}
.tile .v { font-size: 27px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.tile .n { font-size: 11px; color: var(--muted); margin-top: 4px; }
.tile .n.warn { color: var(--coral); font-weight: 500; }

/* ------------------------------------------------------------------ panels */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel {
  border: 1px solid var(--hairline); border-radius: var(--r-card);
  padding: 16px; background: var(--white);
}

/* bars — clickable, keyboard reachable */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar {
  display: grid; grid-template-columns: 108px 1fr auto; align-items: center; gap: 10px;
  background: transparent; border: 0; padding: 4px 6px; margin: 0 -6px;
  font: inherit; text-align: left; cursor: pointer; border-radius: var(--r-block);
}
.bar:hover { background: #F4F8F9; }
.bar:focus-visible { outline: 2px solid var(--teal-blue); outline-offset: 1px; }
.bar[aria-pressed="true"] { background: #EDF7FB; }
.bar[aria-pressed="true"] .bar-label { font-weight: 700; }
.bar-label {
  font-size: 12px; color: var(--ink-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { height: 22px; background: #F1F5F6; border-radius: 3px; overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%; border-radius: 3px; background: var(--teal-blue);
  transform-origin: left;
  animation: grow .34s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-val { font-size: 12px; font-weight: 700; color: var(--ink); min-width: 74px; text-align: right; }
.bar-val small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); }

/* solution-line blocks — the brand's dark component block */
.blocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.block {
  border: 0; border-radius: var(--r-block); padding: 14px; cursor: pointer;
  color: var(--white); text-align: left; font: inherit;
  background: var(--blue-dianne); transition: transform .12s ease;
}
.block:hover { transform: translateY(-2px); }
.block:focus-visible { outline: 2px solid var(--dark-teal); outline-offset: 2px; }
.block[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--mindaro); }
.block.ce { background: var(--teal-blue); }
.block.fo { background: var(--navy); }
.block.both { background: var(--blue-dianne); }
.block.unspec { background: var(--grey); color: var(--ink-soft); }
.block .bk { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; opacity: .82; }
.block .bv { font-size: 22px; font-weight: 700; margin-top: 5px; letter-spacing: -.02em; }
.block .bn { font-size: 11px; opacity: .82; margin-top: 2px; }

/* won/lost by quarter */
.quarters { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 8px; }
.q { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; min-width: 0; }
.q-pair { display: flex; align-items: flex-end; gap: 3px; height: 150px; }
.q-bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; animation: rise .4s cubic-bezier(.2, .7, .3, 1) both; transform-origin: bottom; }
.q-bar.won { background: var(--navy); }
.q-bar.lost { background: var(--coral); }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.q-lab {
  font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.legend { display: flex; gap: 14px; margin-top: 12px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

/* the brand's mint outcome bar, doing real work: data integrity at a glance */
.mintbar {
  background: var(--mint); border-radius: var(--r-card); padding: 12px 18px;
  margin-top: 22px; color: var(--dark-teal); font-size: 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.mintbar b { font-weight: 700; }
.mintbar .sep { opacity: .45; }
.mintbar .flag { color: #A9482A; font-weight: 500; }

/* ------------------------------------------------------------------ tables */

.tablewrap { border: 1px solid var(--hairline); border-radius: var(--r-card); overflow: auto; max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.wide { width: max-content; min-width: 100%; }
table.wide th, table.wide td { white-space: nowrap; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--dark-teal); color: var(--white);
  text-align: left; padding: 10px 12px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid #EEF3F4; color: var(--ink-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F7FAFB; }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); white-space: nowrap; }
td.cust { font-weight: 500; color: var(--ink); }
.linkbtn {
  background: 0; border: 0; padding: 0; font: inherit; color: var(--teal-blue);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--navy); }

.pill {
  display: inline-block; border-radius: var(--r-chip); padding: 3px 10px;
  font-size: 10.5px; font-weight: 700; color: var(--white); white-space: nowrap;
}
.pill.s-new         { background: var(--stage-new); color: var(--dark-teal); }
.pill.s-in-progress { background: var(--stage-in-progress); }
.pill.s-submitted   { background: var(--stage-submitted); }
.pill.s-on-hold     { background: var(--stage-on-hold); color: var(--ink-soft); }
.pill.s-won         { background: var(--stage-won); }
.pill.s-lost        { background: var(--stage-lost); }
.pill.s-no-bid      { background: var(--stage-no-bid); }

.aged { color: var(--coral); font-weight: 700; }

/* ------------------------------------------------------------------ forms */

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 18px 0 0; }
.toolbar .spacer { flex: 1; }
.search {
  font: inherit; font-size: 13px; padding: 8px 14px; min-width: 240px;
  border: 1px solid var(--hairline); border-radius: var(--r-chip); color: var(--ink);
}
.search:focus-visible { outline: 2px solid var(--teal-blue); outline-offset: 1px; }

/* multi-select status chips (Pipeline tab) */
.statusbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  padding: 12px 0 4px;
}
.statusbar .lead {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-right: 4px;
}
.statuschip {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  border-radius: var(--r-chip); padding: 6px 13px;
  border: 1px solid var(--hairline); background: var(--white); color: var(--ink-soft);
}
.statuschip:hover { border-color: var(--teal-blue); color: var(--ink); }
.statuschip.on { background: var(--dark-teal); border-color: var(--dark-teal); color: var(--white); }
.statuschip.on::before {
  content: "✓"; font-size: 11px; opacity: .9;
}
.statuschip.preset {
  background: #EDF7FB; border-color: var(--teal-blue); color: var(--blue-dianne); font-weight: 700;
}
.statuschip.preset:hover { background: #E0F1F9; }
.statuschip.clear { border-style: dashed; color: var(--muted); }
.statuschip.clear:hover { color: var(--coral); border-color: var(--coral); }

/* column picker (Pipeline tab) */
.colpicker {
  border: 1px solid var(--hairline); border-radius: var(--r-card);
  padding: 14px 16px; margin: 6px 0 4px; background: #FAFCFC;
}
.colpicker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.colpicker-head b { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink); }
.colpicker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px;
}
.colpicker-grid label {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer;
}
.colpicker-grid input { cursor: pointer; }
.colpicker-grid label.locked { color: var(--muted); cursor: default; }

.dupe-banner {
  display: flex; align-items: center; gap: 10px;
  background: #FDF3EE; border: 1px solid #F5D8C8; border-left: 4px solid var(--coral);
  border-radius: var(--r-block); padding: 11px 15px; margin: 14px 0 0;
  font-size: 12.5px; color: var(--ink-soft);
}
.dupe-banner b { color: #A9482A; }
.dupe-banner .linkbtn { margin-left: auto; }

.btn {
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  border-radius: var(--r-chip); padding: 8px 16px;
  border: 1px solid var(--hairline); background: var(--white); color: var(--ink-soft);
}
.btn:hover { border-color: var(--teal-blue); color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--teal-blue); outline-offset: 1px; }
.btn.primary { background: var(--dark-teal); border-color: var(--dark-teal); color: var(--white); font-weight: 700; }
.btn.primary:hover { background: var(--blue-dianne); border-color: var(--blue-dianne); color: var(--white); }
.btn.danger { color: var(--coral); border-color: #F3D3C6; }
.btn.danger:hover { background: var(--coral); border-color: var(--coral); color: var(--white); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

dialog {
  border: 0; border-radius: var(--r-card); padding: 0; width: min(760px, calc(100vw - 32px));
  box-shadow: var(--shadow); color: var(--ink);
}
dialog::backdrop { background: rgba(8, 37, 43, .42); }
.dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--dark-teal); color: var(--white); padding: 14px 20px;
}
.dlg-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.dlg-head .x { background: 0; border: 0; color: var(--white); font-size: 22px; cursor: pointer; line-height: 1; opacity: .8; }
.dlg-head .x:hover { opacity: 1; }
.dlg-body { padding: 20px; max-height: 68vh; overflow: auto; }
.dlg-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--hairline); background: #FAFCFC;
}

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.wide { grid-column: 1 / -1; }
.field label {
  display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 5px;
}
.field label .req { color: var(--coral); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 13px; color: var(--ink);
  padding: 8px 11px; border: 1px solid var(--hairline); border-radius: var(--r-block);
  background: var(--white);
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--teal-blue); outline-offset: 0;
}
.field .help { font-size: 11px; color: var(--muted); margin-top: 4px; }
.derived {
  background: var(--mint); border-radius: var(--r-block); padding: 10px 13px;
  font-size: 12px; color: var(--dark-teal); grid-column: 1 / -1;
}
.derived b { font-weight: 700; }

/* ------------------------------------------------------------------ import */

.drop {
  border: 2px dashed var(--hairline); border-radius: var(--r-card);
  padding: 44px 20px; text-align: center; background: #FAFCFC; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--teal-blue); background: #F1F9FC; }
.drop h3 { margin: 0 0 5px; font-size: 15px; color: var(--ink); }
.drop p { margin: 0; font-size: 12.5px; color: var(--muted); }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.stat { border: 1px solid var(--hairline); border-radius: var(--r-block); padding: 12px 14px; }
.stat .sk { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.stat .sv { font-size: 21px; font-weight: 700; color: var(--ink); margin-top: 3px; }
.stat.flag { background: #FDF3EE; border-color: #F5D8C8; }
.stat.flag .sv { color: var(--coral); }

.notice {
  border-left: 4px solid var(--mindaro); background: #FCFDEE;
  padding: 12px 15px; border-radius: var(--r-block); font-size: 12.5px; color: var(--ink-soft); margin: 14px 0;
}
.notice.bad { border-left-color: var(--coral); background: #FDF3EE; }
.notice.good { border-left-color: var(--teal-blue); background: #F1F9FC; }
.notice b { color: var(--ink); }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 5px; font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--dark-teal); color: var(--white); padding: 11px 20px;
  border-radius: var(--r-chip); font-size: 13px; box-shadow: var(--shadow); z-index: 50;
  animation: chipIn .2s ease-out;
}
.toast.bad { background: var(--coral); }

.rolechip {
  display: inline-block; border-radius: var(--r-chip); padding: 2px 9px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--grey); color: var(--ink-soft);
}
.rolechip.admin  { background: var(--dark-teal); color: var(--white); }
.rolechip.editor { background: var(--teal-blue); color: var(--white); }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr; }
  .blocks { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 10px; }
  .tabs { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .tabs, .rail, .toolbar, .wordmark small { display: none; }
  .panel, .tile, .tablewrap { break-inside: avoid; }
}
