/* Owner app. Sheets of paper on a steel bench; the job's own ticket stub is
   the only loud thing on screen. */

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

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  padding: 10px var(--gutter) 0;
  background: var(--paper);
  border-bottom: 1.5px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-stretch: 75%;
  font-weight: 800;
  font-size: 20px;
}

.tabs {
  display: flex;
  gap: 4px;
}

.tabs a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 12px;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.notice {
  margin: 0;
  padding: 10px var(--gutter);
  background: var(--amber-wash);
  color: var(--amber);
  font-size: 14px;
  border-bottom: 1.5px solid #ecd49a;
}

.notice strong {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .top {
    padding-top: 6px;
  }

  .tabs {
    width: calc(100% + 2 * var(--gutter));
    margin: 0 calc(-1 * var(--gutter));
  }

  .tabs a {
    flex: 1;
    justify-content: center;
    padding: 0 4px;
  }
}

/* ------------------------------------------------------------ pages */

.view {
  outline: none;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
}

.page.narrow {
  max-width: 680px;
}

.page h1 {
  font-size: clamp(34px, 7vw, 46px);
}

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

.page-lead {
  margin: 0 0 16px;
  color: var(--ink-2);
  max-width: 62ch;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: 8px;
  font-weight: 600;
  text-decoration: none;
}

.back::before {
  content: '';
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.section-title {
  margin: 32px 0 12px;
  font-size: 24px;
}

.muted {
  color: var(--ink-3);
}

.help {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-3);
}

.form-error {
  color: var(--red);
  font-weight: 600;
}

.form-error:empty {
  display: none;
}

.empty {
  padding: 32px 20px;
  background: var(--paper);
  border-top: 4px solid var(--ink);
}

.empty h1,
.empty h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.empty p + p {
  margin-top: 16px;
}

.switch {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}

.switch a {
  padding: 8px 16px;
  border: 1.5px solid var(--rule);
  background: var(--paper);
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

.switch a:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.switch a:last-child {
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.switch a.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ------------------------------------------------------------ job list */

.job-list,
.sub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border-top: 4px solid var(--ink);
}

.job-list li + li,
.sub-list li + li {
  border-top: 1.5px solid var(--rule);
}

.job-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 2px 16px;
  padding: 16px;
  color: var(--ink);
  text-decoration: none;
}

.job-row:hover {
  background: #f5f7f8;
}

.job-no {
  grid-row: span 3;
  padding-top: 4px;
  color: var(--serial);
  font-stretch: 80%;
  font-weight: 800;
}

.job-who {
  font-stretch: 72%;
  font-weight: 800;
  font-size: 24px;
  line-height: 1.1;
}

.job-what {
  color: var(--ink-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 14px;
  border: 1px solid transparent;
}

.chip b {
  font-weight: 700;
}

.chip-awarded { background: var(--green-wash); color: var(--green); }
.chip-picked { background: var(--blue-wash); color: var(--blue-deep); }
.chip-priced { background: var(--paper); color: var(--ink); border-color: var(--rule); }
.chip-waiting { background: var(--amber-wash); color: var(--amber); }
.chip-unsent { background: var(--steel); color: var(--ink-2); }

@media (max-width: 560px) {
  .job-row {
    grid-template-columns: 1fr;
  }

  .job-no {
    grid-row: auto;
    padding-top: 0;
  }
}

/* ------------------------------------------------------------ one job */

.job-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}

@media (min-width: 980px) {
  .job-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .estimate {
    position: sticky;
    top: 16px;
  }
}

/* The job's carbon copy: same canary paper subs see, with the red serial. */
.stub {
  position: relative;
  padding: 18px 20px 28px;
  background: var(--ticket);
  color: var(--ticket-ink);
}

.stub::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 14px;
  background: radial-gradient(circle at 7px 7px, var(--steel) 4.5px, transparent 5px) repeat-x;
  background-size: 14px 14px;
}

.stub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stub-no {
  color: var(--serial);
  font-stretch: 80%;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.stub-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stub .button.text,
.stub button.text {
  color: var(--ticket-ink);
}

/* On a wide screen the estimate sits beside the job; no jump needed. */
@media (min-width: 980px) {
  .to-estimate {
    display: none;
  }
}

.stub h1 {
  margin-top: 6px;
  font-size: clamp(38px, 9vw, 56px);
  font-stretch: 66%;
  font-weight: 850;
  line-height: 0.95;
}

.stub-summary {
  margin-top: 8px;
  font-weight: 600;
  font-size: 18px;
}

.stub-address {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1.5px dashed rgba(43, 36, 0, 0.35);
}

.stub-area {
  font-size: 14px;
  opacity: 0.8;
}

.stub-closed {
  margin-top: 10px;
  font-weight: 700;
}

.scope {
  margin-top: 28px;
  padding: 18px 18px 20px;
  background: var(--paper);
  border-top: 4px solid var(--ink);
}

.scope-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.scope-head h2 {
  font-size: 32px;
}

.scope-meta {
  flex: 1;
  color: var(--ink-2);
  font-weight: 600;
}

.scope-text {
  margin-top: 10px;
  max-width: 68ch;
  white-space: pre-line;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 112px));
  gap: 8px;
  margin-top: 14px;
}

.thumb img,
.add-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 2px;
}

.thumb img {
  object-fit: cover;
  background: var(--steel-deep);
}

@media (max-width: 560px) {
  .thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.add-photo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 8px;
  border: 1.5px dashed var(--rule);
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
}

.add-photo:hover,
.add-photo:focus-within {
  border-color: var(--blue);
  background: var(--blue-wash);
}

.add-photo input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.add-photo.is-busy {
  color: var(--ink-3);
  pointer-events: none;
}

/* Answers from subs, one row each */

.answers {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  border-top: 1.5px solid var(--ink);
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  padding: 14px 0;
  border-bottom: 1.5px solid var(--rule);
}

.answer-row > .note,
.answer-row > .picked-mark,
.answer-row > .row-actions {
  grid-column: 1 / -1;
}

.answer-row.is-picked {
  margin: 0 -18px;
  padding: 14px 18px 14px 13px;
  border-left: 5px solid var(--blue);
  background: var(--blue-wash);
}

.answer-row.status-awarded.is-picked {
  border-left-color: var(--green);
  background: var(--green-wash);
}

.answer-row.status-declined,
.answer-row.status-not_selected {
  color: var(--ink-3);
}

.who-name {
  font-weight: 700;
  font-size: 17px;
}

.who-co {
  color: var(--ink-2);
  font-size: 15px;
}

.what {
  text-align: right;
}

.price {
  font-stretch: 72%;
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
}

.state {
  font-size: 14px;
  color: var(--ink-2);
}

.state-strong {
  font-weight: 700;
}

.state-warn {
  color: var(--amber);
  font-weight: 700;
}

.note {
  padding-left: 10px;
  border-left: 3px solid var(--rule);
  color: var(--ink-2);
  font-size: 15px;
}

.note-reply {
  border-left-color: var(--amber);
}

.picked-mark {
  font-weight: 700;
  font-size: 14px;
  color: var(--blue-deep);
}

.status-awarded .picked-mark {
  color: var(--green);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 6px;
}

.row-actions button:not(.text),
.row-actions .button:not(.text) {
  min-height: 38px;
  padding: 0 14px;
}

.flag {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
}

.flag-expired { color: var(--red); }
.flag-missing,
.flag-soon { color: var(--amber); }

.scope-actions,
.award-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 18px;
}

.award-bar {
  padding: 10px 12px;
  background: var(--green-wash);
  color: var(--green);
}

.add-scope {
  width: 100%;
  min-height: 60px;
  margin-top: 28px;
  border: 2px dashed var(--rule);
  background: transparent;
  color: var(--blue);
  font-size: 17px;
}

.add-scope:hover {
  border-color: var(--blue);
  background: var(--blue-wash);
}

.job-foot {
  margin-top: 32px;
}

/* ------------------------------------------------------------ estimate */

.estimate {
  scroll-margin-top: 12px;
  padding: 18px 18px 20px;
  background: var(--paper);
  border-top: 4px solid var(--blue);
}

.est-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.est-head h2 {
  font-size: 26px;
}

.est-head button {
  min-height: 36px;
  padding: 0 12px;
}

.est-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.est-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-bottom: 1.5px solid var(--rule);
}

.est-desc {
  font-weight: 600;
}

.est-price {
  font-stretch: 72%;
  font-weight: 800;
  font-size: 24px;
  line-height: 1.1;
}

.est-math,
.est-line .flag,
.est-copy {
  grid-column: 1 / -1;
}

.est-math {
  font-size: 14px;
  color: var(--ink-3);
}

.est-copy {
  display: flex;
  gap: 12px;
}

.est-copy button {
  min-height: 32px;
  font-size: 14px;
}

.est-waiting {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--amber-wash);
  color: var(--amber);
  font-size: 15px;
}

.est-waiting h3 {
  font-stretch: 100%;
  font-weight: 700;
  font-size: 15px;
}

.est-waiting ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.est-totals {
  margin: 14px 0 0;
}

.est-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.est-totals dt {
  color: var(--ink-2);
}

.est-totals dd {
  margin: 0;
  font-weight: 700;
}

.est-totals .margin {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1.5px solid var(--ink);
}

.est-totals .margin dt {
  color: var(--ink);
  font-weight: 700;
}

.est-totals .margin dd span {
  color: var(--ink-3);
  font-weight: 600;
  margin-left: 6px;
}

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

.stack > * + * {
  margin-top: 18px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 520px) {
  .two {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.label-like {
  padding: 0;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 15px;
}

.small-label {
  margin-top: 12px;
}

.trade-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trade-pick {
  margin: 0;
  font-weight: 500;
}

.trade-pick input {
  position: absolute;
  opacity: 0;
}

.trade-pick span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
}

.trade-pick input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.trade-pick input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-weight: 500;
}

.check input {
  width: 20px;
  height: 20px;
}

.photo-edits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.photo-edit img {
  width: 96px;
  height: 72px;
  object-fit: cover;
}

/* ------------------------------------------------------------ dialog */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-top: 4px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(27, 38, 50, 0.35);
}

dialog::backdrop {
  background: rgba(27, 38, 50, 0.45);
}

#dialog-body {
  padding: 16px 20px 22px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.dialog-head h2 {
  font-size: 28px;
  padding-top: 4px;
}

.dialog-lead {
  margin-bottom: 14px;
  color: var(--ink-2);
}

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

@media (max-width: 560px) {
  dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 92dvh;
    margin: auto 0 0;
  }
}

.pick-group {
  margin: 16px 0 6px;
  font-stretch: 100%;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-2);
}

.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1.5px solid var(--rule);
}

.pick {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 12px 4px;
  border-bottom: 1.5px solid var(--rule);
  font-weight: 400;
  cursor: pointer;
}

.pick input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  flex: none;
}

.pick-body {
  display: flex;
  flex-direction: column;
}

.pick-name {
  font-weight: 700;
}

.pick-name span {
  font-weight: 400;
  color: var(--ink-2);
}

.pick-note {
  font-size: 13px;
  color: var(--ink-3);
}

.pick.is-done {
  color: var(--ink-3);
  cursor: default;
}

.award-price {
  font-stretch: 72%;
  font-weight: 800;
  font-size: 34px;
}

.award-warning {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--red-wash);
  font-size: 15px;
}

.award-warning .flag {
  font-size: 15px;
}

/* ------------------------------------------------------------ texts */

.text-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.text-card {
  padding: 14px 0;
  border-top: 1.5px solid var(--rule);
}

.text-card:last-child {
  border-bottom: 1.5px solid var(--rule);
}

.page .text-card {
  padding: 14px 16px;
  background: var(--paper);
}

.text-to {
  font-weight: 700;
}

.text-to span {
  margin-left: 6px;
  font-weight: 400;
  color: var(--ink-2);
}

.text-meta {
  font-size: 14px;
  color: var(--ink-3);
}

.text-body {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--steel);
  border-radius: 14px 14px 14px 4px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.text-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 10px;
}

.sent-mark {
  margin-top: 8px;
  font-weight: 700;
  color: var(--green);
}

.text-card.is-failed .text-body {
  background: var(--red-wash);
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
}

.history li {
  padding: 12px 16px;
  border-bottom: 1.5px solid var(--rule);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.history li.is-in {
  border-left: 4px solid var(--amber);
}

.history-head span {
  color: var(--ink-3);
  font-size: 13px;
  margin-left: 6px;
}

/* ------------------------------------------------------------ subs */

.sub-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  padding: 14px 16px;
  color: var(--ink);
  text-decoration: none;
}

.sub-row:hover {
  background: #f5f7f8;
}

.sub-name {
  font-weight: 700;
  font-size: 18px;
}

.sub-name span {
  font-weight: 400;
  color: var(--ink-2);
  font-size: 16px;
}

.sub-phone {
  color: var(--ink-2);
  text-align: right;
}

.sub-trades,
.sub-docs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.trade {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.trade + .trade::before {
  content: '/';
  margin-right: 14px;
  color: var(--rule);
  font-weight: 400;
}

.doc {
  font-size: 14px;
  color: var(--ink-3);
}

.doc-expired { color: var(--red); font-weight: 700; }
.doc-soon,
.doc-missing { color: var(--amber); font-weight: 700; }

@media (max-width: 520px) {
  .sub-phone {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ------------------------------------------------------------ login, toast */

.login {
  max-width: 360px;
  margin: 12vh auto 0;
  padding: 0 var(--gutter);
}

.login h1 {
  margin: 14px 0 24px;
  font-size: 40px;
}

.login button {
  width: 100%;
  margin-top: 16px;
}

.login .form-error {
  margin-top: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-kind='error'] {
  background: var(--red);
}

.page.narrow > h1 {
  margin-bottom: 20px;
}

.stack > .section-title {
  margin-top: 36px;
}

.stack > .section-title:first-child {
  margin-top: 0;
}

.setup {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-left: 5px solid var(--ticket-shade);
  background: var(--paper);
  font-weight: 600;
}
