/* Stone Surgeons CRM — the Estimates page (estimates.js, Nov 21 2026): Client | Job description | Booked by | Estimate date |
   Appt. date | Notes | ⋮, a card per estimate on phones. Flat look: colour tokens from glass.css / glass-dark.css. */

#main:has(.est-tbl) { width: 100%; min-width: 0; }   /* the page keeps its width whatever the tab */
.est-tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.est-tbl th { padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-weight: 500; text-align: left; white-space: nowrap; }
.est-tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.est-tbl tbody tr:last-child td { border-bottom: 0; }
.est-tbl tr.est-row { cursor: pointer; }
.tbl-wrap .est-tbl tbody tr { height: auto; }                          /* glass.css fixes table rows at 44 px / --row-h */
.tbl-wrap .est-tbl tbody tr:has(.est-menu[open]) { z-index: 5; }      /* glass.css makes each row its own layer (z-index 0) */
.est-tbl tr.est-row:hover td { background: var(--surface-2); }
.est-tbl tr.est-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.est-tbl td.empty { padding: 28px 10px; color: var(--text-3); text-align: center; }
.est-client { min-width: 160px; max-width: 240px; }
.est-client a, .est-client strong { font-weight: 600; color: var(--text); text-decoration: none; }
.est-client a:hover { color: var(--primary); text-decoration: underline; }
.est-client .small { overflow-wrap: anywhere; }
.est-job { min-width: 180px; max-width: 320px; }
.est-notes { max-width: 220px; }
.est-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.est-state { margin-top: 3px; color: var(--text-2); }
.est-progress .est-state, .est-pending .est-state, .est-late .est-state { color: var(--warning); }
.est-late .est-state { font-weight: 600; }
.est-success .est-state { color: var(--success); }
.est-refused .est-state, .est-cancelled .est-state { color: var(--danger); }
.est-d { white-space: nowrap; }
.est-act { width: 44px; text-align: right; }

/* the ⋮ menu: a small list that floats over the page */
.est-menu { display: inline-block; }
.est-menu > summary { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid transparent;
  border-radius: var(--radius); color: var(--text-2); font-size: 18px; line-height: 1; list-style: none; cursor: pointer; user-select: none; }
.est-menu > summary::-webkit-details-marker { display: none; }
.est-menu > summary:hover, .est-menu[open] > summary { border-color: var(--border); background: var(--surface); color: var(--text); }
.est-menu > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.est-menu-list { position: fixed; z-index: 60; display: grid; min-width: 200px; padding: 4px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(15, 23, 42, .14); text-align: left; }
.est-menu-list .est-mi { display: block; height: auto; min-height: 0; margin: 0; padding: 8px 12px; border: 0; border-radius: calc(var(--radius) - 2px);
  background: none; color: var(--text); font: inherit; font-size: 14px; line-height: 1.35; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.est-menu-list .est-mi:hover, .est-menu-list .est-mi:focus-visible { background: var(--surface-2); outline: none; }
.est-menu-list .est-mi.danger { color: var(--danger); }
.est-book { margin-bottom: 14px; }

/* phones: each estimate is a card */
@media (max-width: 760px) {
  .est-wrap { border: 0; background: none; overflow: visible; }
  .est-tbl thead { display: none; }
  .est-tbl, .est-tbl tbody { display: block; }
  .est-tbl tr.est-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin-bottom: 10px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .est-tbl tr.est-row td { display: block; min-width: 0; max-width: none; padding: 0; border: 0; background: none; }
  .est-tbl tr.est-row:hover td { background: none; }
  .est-tbl td.est-client { grid-column: 1; grid-row: 1; }
  .est-tbl td.est-act { grid-column: 2; grid-row: 1; width: auto; }
  .est-tbl td.est-job, .est-tbl td.est-by, .est-tbl td.est-d, .est-tbl td.est-notes { grid-column: 1 / -1; }
  .est-tbl td.est-by::before, .est-tbl td.est-d::before, .est-tbl td.est-notes::before { content: attr(data-l) ': '; color: var(--text-2); font-size: 13px; }
  .est-tbl td.est-notes .est-clamp { display: inline; }
  .est-tbl tr.more-row, .est-tbl tr.more-row td { display: block; border: 0; }
  .est-tbl tr:not(.est-row):not(.more-row) td { display: block; }
  .est-menu > summary { width: 40px; height: 40px; }
  .est-menu-list .est-mi { padding: 11px 14px; }
}
.est-job .jy-line { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.est-job .jy-line[hidden] { display: none; }
@media (max-width: 760px) { .est-job .jy-line { max-width: none; white-space: normal; } }
