/* Department overview. Builds on style.css (tokens) and admin.css (header, tables, section heads) and keeps their AAA
   rules: text >= 7:1, targets >= 44 px. The one visual statement is the stage bar: a funnel's amount split by stage,
   in the stage colours that the table's keys repeat in words. */

.overview-main {
  gap: 48px;
}

.ov-dept + .ov-dept {
  margin-top: 24px;
}

.ov-dept-name {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--slate);
}

.ov-funnel {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.ov-funnel .section-head {
  margin-bottom: 0;
}

.ov-funnel .section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.ov-heading {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.ov-lead {
  margin: 0 0 16px;
  max-width: 68ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--mist);
}

/* The funnel's amount, split by stage. Widths come from the server's amounts; the table says it in words. */
.stage-bar {
  display: flex;
  gap: 3px;
  height: 20px;
  margin: 8px 0 20px;
}

.stage-seg {
  flex-basis: 0;
  min-width: 6px;
  border-radius: 4px;
}

.stage-sent { background: var(--slate); }
.stage-negotiation { background: var(--cyan); }
.stage-won { background: var(--ok); }
.stage-lost { background: var(--danger); }

.stage-key {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 2px;
}

.stage-table {
  min-width: 32rem;
}

/* Three figures, each with how it was computed and the rows it comes from. */
.ov-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding-top: 28px;
  border-top: 1px solid var(--navy-line);
}

.ov-fact dt {
  font-size: 15px;
  font-weight: 500;
  color: var(--slate);
}

.ov-fact dd {
  margin: 0;
}

.ov-fact .ov-note {
  margin-top: 8px;
}

.ov-fact .ov-value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--mist);
}

.ov-note {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--slate);
}

.ov-skipped {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--mist);
}

@media (max-width: 860px) {
  .ov-facts {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* The model's reading of the figures: set apart from them by a cyan rule, since it is words about numbers, not numbers. */
.ov-explain {
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--cyan);
}

.ov-explain-text {
  margin: 0 0 10px;
  max-width: 68ch;
  font-size: 17px;
  line-height: 1.6;
  color: var(--mist);
}

.ov-explain-label {
  margin: 16px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--mist);
}

.ov-explain-list {
  margin: 0;
  padding-left: 20px;
  max-width: 68ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--mist);
}

.ov-explain-list li + li {
  margin-top: 6px;
}

.ov-explain .ov-note {
  margin: 14px 0 0;
  max-width: 68ch;
}

/* Active alarms, first in the department. A danger rule sets them apart, as the cyan rule does the model's words:
   the rule's colour says what kind of content it is. One line per alarm, divided by hairlines, no boxes. */
.ov-alarms {
  margin-bottom: 40px;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--danger);
}

.ov-alarms-head {
  margin: 0;
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  letter-spacing: -0.02em;
}

.ov-alarms > .ov-note {
  margin: 6px 0 0;
  max-width: 68ch;
}

.ov-alarm-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.ov-alarm {
  padding: 14px 0;
  border-top: 1px solid var(--navy-line);
}

.ov-alarm:last-child {
  padding-bottom: 0;
}

.ov-alarm p {
  margin: 0;
  max-width: 72ch;
}

.ov-alarm-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--danger);
}

.ov-alarm .ov-alarm-detail {
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  color: var(--mist);
}

.ov-alarm .ov-alarm-where {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--slate);
}

/* A tender's alarm links to the tender below, where the document is put right: the whole line is the target. */
.ov-alarm .ov-alarm-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 0;
  color: var(--mist);
  text-decoration: underline;
  text-decoration-color: var(--slate);
  text-underline-offset: 3px;
}

.ov-alarm .ov-alarm-link:hover {
  text-decoration-color: var(--mist);
}

/* ---------- Tenders (L2 step 3d) ----------
   A tender is read top to bottom as the department works it: the deadline, then the list to confirm, then the bid
   against it. The one loud thing is the deadline, set as a sentence ("Predaja za 6 dana"); gold once it is a week away.
   Colours keep their meaning from the rest of the page: danger is a problem in the bid, gold is waiting or soon,
   cyan is Atlas. Quotes from the documentation hang off a grey rule, so the documentation's words never look like ours. */

.ov-tenders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 48px;
}

.ov-tenders .section-head {
  margin-bottom: 0;
}

.ov-tenders .section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.tender {
  min-width: 0; /* a flex item: the bid table scrolls inside it instead of widening the page */
  padding: 28px 0 8px;
  border-top: 1px solid var(--navy-line);
}

.tender-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--slate);
}

.tender-lead {
  margin: 6px 0 0;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--mist);
}

.tender-lead.urgent {
  color: var(--gold);
}

.tender-lead.past {
  color: var(--slate);
}

.tender-when {
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--mist);
}

/* The documentation's own words, with where they stand. */
.tq {
  margin: 10px 0 0;
  padding-left: 14px;
  max-width: 68ch;
  border-left: 2px solid var(--field-line);
}

.tq-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--mist);
}

.tq-where {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate);
}

.tender-status {
  margin: 20px 0 0;
  max-width: 68ch;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--gold);
  font-size: 15px;
  line-height: 1.55;
  color: var(--mist);
}

.tender-status p {
  margin: 0 0 12px;
}

.tender-step {
  margin-top: 36px;
}

.tender-step:focus {
  outline: none;
}

.tender-step-head {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.tender-step > .status-msg {
  max-width: 68ch;
  margin: 0 0 16px;
}

.tender-step > .ov-note {
  margin: 0 0 16px;
}

/* The list to confirm: one document per row, divided by hairlines; the row being corrected becomes a form. */
.titem-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--navy-line);
}

.titem {
  padding: 16px 0;
  border-top: 1px solid var(--navy-line);
}

.titem p {
  margin: 0;
}

.titem-name {
  max-width: 68ch;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--mist);
}

.titem .titem-facts {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--slate);
}

.titem .ov-note {
  margin-top: 8px;
}

.titem-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.titem.editing {
  margin: 8px 0;
  padding: 20px;
  border: 1px solid var(--field-line);
  border-radius: 12px;
  background: var(--navy-2);
}

.titem.editing + .titem {
  border-top: none;
}

.titem.editing .field {
  margin-bottom: 14px;
}

.titem-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
}

.titem.editing input[aria-invalid="true"] {
  border-color: var(--danger);
}

.add-item {
  margin-top: 16px;
}

.tender-deadline-field {
  margin: 28px 0 0;
  max-width: 24rem;
}

.tender-deadline-field input {
  color-scheme: dark;
}

.tender-deadline-field .ov-note {
  margin-top: 10px;
}

.deadline-choices {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.5;
  color: var(--mist);
}

.deadline-choices li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 0;
}

.tender-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.tender-step > .status-msg.error {
  margin-top: 16px;
}

/* The bid against the confirmed list: the problems first, each with its word and its dot, never colour alone. */
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.check {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 4px 20px;
  padding: 14px 0;
  border-top: 1px solid var(--navy-line);
}

.check p {
  margin: 0;
}

.check-label {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.check-label::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate);
  transform: translateY(-1px);
}

.check-too_old .check-label,
.check-missing .check-label {
  color: var(--danger);
}

.check-too_old .check-label::before,
.check-missing .check-label::before {
  background: var(--danger);
}

.check-no_date .check-label,
.check-waiting .check-label {
  color: var(--gold);
}

.check-no_date .check-label::before,
.check-waiting .check-label::before {
  background: var(--gold);
}

.check-ok .check-label {
  color: var(--mist);
}

.check-ok .check-label::before {
  background: var(--ok);
}

.check-on_request .check-label {
  color: var(--slate);
}

.check-name {
  max-width: 68ch;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--mist);
}

.check .check-detail {
  margin-top: 2px;
  max-width: 68ch;
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
}

.bid-table {
  min-width: 40rem;
}

.bid-table td {
  vertical-align: top;
}

.bid-doc span,
.bid-issued span {
  display: block;
}

.bid-doc.pending,
.bid-doc.not_matched {
  color: var(--slate);
}

.bid-doc.unreadable {
  color: var(--gold);
}

.bid-table .bid-by,
.bid-table .bid-quote {
  margin-top: 4px;
  max-width: 34ch;
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate);
}

.bid-act {
  width: 1%;
  white-space: nowrap;
}

.bid-act .link-btn {
  margin: -8px 0;
}

.bid-form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
  max-width: 44rem;
}

.bid-form .field {
  margin-bottom: 0;
}

.bid-form input {
  color-scheme: dark;
}

.bid-edit .tender-actions {
  margin-top: 12px;
}

.bid-edit .status-msg {
  margin: 12px 0 0;
}

.tender-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 28px;
}

.tender-foot .ov-note {
  margin: 0;
}

@media (max-width: 860px) {
  .titem-row,
  .bid-form {
    grid-template-columns: 1fr;
  }

  .titem-row {
    gap: 0;
  }

  .check {
    grid-template-columns: 1fr;
  }
}

/* On a phone each bid file is a block of its own, the change button under it, instead of a table to scroll. */
@media (max-width: 600px) {
  .bid-table {
    min-width: 0;
  }

  .bid-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .bid-table,
  .bid-table tbody,
  .bid-table tr,
  .bid-table td {
    display: block;
  }

  .bid-table tr {
    padding: 14px 0;
    border-top: 1px solid var(--navy-line);
  }

  .bid-table td,
  .bid-table td:last-child {
    padding: 2px 0;
    border: none;
  }

  .bid-table .doc-name {
    font-weight: 600;
  }

  .bid-issued > .nowrap::before {
    content: "Datum izdavanja: ";
    color: var(--slate);
  }

  .bid-act {
    width: auto;
  }

  .bid-act .link-btn {
    margin: 8px 0 0;
  }
}
