/* ============================================================================
   Assured Services LLC — dashboard additions.
   Loaded after css/asl-pm.css. Everything here supports the editable dashboard:
   record forms, detail panels, photo galleries, toolbars.
   ========================================================================== */

/* ---- Wider dialogs for record forms and detail panels ------------------ */
#recordDialog, #detailPanel { width: min(760px, calc(100vw - 2rem)); }
#detailPanel:has(.dialog-wide) { width: min(1000px, calc(100vw - 2rem)); }
.confirm-dialog { width: min(480px, calc(100vw - 2rem)); }

/* ---- Two-up form grid --------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid > .field, .form-grid > .check { grid-column: 1 / -1; }
.form-grid > .field-half { grid-column: span 1; }
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > .field-half { grid-column: 1 / -1; }
}
.field .req { color: var(--rose); font-weight: 700; }
.field > span > small.muted,
.field small.muted { display: block; font-weight: 400; letter-spacing: 0; text-transform: none; font-size: .76rem; margin-top: .3rem; }
.check.field-half { margin-bottom: .9rem; align-self: start; }

/* ---- Destructive button ------------------------------------------------- */
.btn-danger { background: var(--rose); color: #fff; border-color: var(--rose); }
.btn-danger:hover { filter: brightness(.93); }

/* ---- Pane toolbar: title, search, filters, primary action -------------- */
.pane-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem;
}
.pane-head h2 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar .input { height: 38px; padding: .35rem .7rem; font-size: .85rem; margin: 0; width: auto; min-width: 150px; }
.toolbar-search { min-width: 210px; }
.count-note { font-size: .78rem; color: var(--ink-3); }

/* ---- Row actions inside data tables ------------------------------------ */
table.data td.actions { white-space: nowrap; text-align: right; width: 1%; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: .55rem;
  padding: .25rem .55rem; font-size: .78rem; cursor: pointer; color: var(--ink-2);
  line-height: 1.6;
}
.icon-btn + .icon-btn { margin-left: .3rem; }
.icon-btn:hover { background: #f4f4f5; color: var(--ink); border-color: var(--ink-4); }
.icon-btn.danger:hover { background: #fff1f3; color: var(--rose); border-color: var(--rose); }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: #fafafa; }

/* ---- Photo gallery ------------------------------------------------------ */
.photo-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 720px) { .photo-columns { grid-template-columns: 1fr; } }

.photo-col h4 {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 .6rem;
}
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: .7rem; overflow: hidden; border: 1px solid var(--line); background: #f4f4f5; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo-cell .rm {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 999px;
  border: none; background: rgba(16,16,20,.62); color: #fff; font-size: .8rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
}
.photo-cell .rm:hover { background: var(--rose); }
.photo-drop {
  border: 1.5px dashed var(--line); border-radius: .7rem; padding: 1rem; text-align: center;
  color: var(--ink-3); font-size: .82rem; cursor: pointer; background: #fcfcfd;
}
.photo-drop:hover, .photo-drop.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.photo-drop input { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(16,16,20,.9);
  display: grid; place-items: center; padding: 2rem; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: .5rem; }

/* ---- Detail panel internals -------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.detail-cell { border: 1px solid var(--line); border-radius: .75rem; padding: .7rem .85rem; background: #fcfcfd; }
.detail-cell .k { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.detail-cell .v { font-weight: 700; font-size: .95rem; margin-top: .15rem; }

.section-rule { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0 1.1rem; }
.subhead { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 .6rem; }

/* ---- Quote / line item totals ------------------------------------------ */
.totals { margin-left: auto; max-width: 320px; }
.totals .quote-line { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; font-size: .86rem; }
.totals .grand { border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .5rem; font-size: 1.05rem; font-weight: 800; }

/* ---- Mail pane ---------------------------------------------------------- */
.mail-layout { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .mail-layout { grid-template-columns: 1fr; } }
.mail-list { border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; background: var(--paper); max-height: 68vh; overflow-y: auto; }
.mail-item { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid #f1f1f4; background: none; padding: .7rem .85rem; cursor: pointer; }
.mail-item:hover { background: #fafafa; }
.mail-item.active { background: var(--accent-soft); }
.mail-item.unread b { font-weight: 800; }
.mail-item b { display: block; font-size: .84rem; font-weight: 500; }
.mail-item small { color: var(--ink-3); font-size: .76rem; }
.mail-body { border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); padding: 1.25rem; min-height: 320px; }
.mail-body pre { white-space: pre-wrap; word-wrap: break-word; font: inherit; margin: 0; color: var(--ink-2); }

/* ---- Misc --------------------------------------------------------------- */
.badge-teal { background: rgba(6,182,212,.12); color: #0e7490; }
.hint-row { font-size: .8rem; color: var(--ink-3); margin-top: .75rem; }
.stack-sm > * + * { margin-top: .5rem; }
.nowrap { white-space: nowrap; }

/* ---- Brand logo ---------------------------------------------------------
   Replaces the old "AS" monogram tile with the real mark. Height-driven so it
   sits on the same baseline as the wordmark at every breakpoint. */
.brand-logo { height: 38px; width: auto; flex: none; display: block; }
.footer .brand-logo { height: 34px; }
@media (max-width: 520px) { .brand-logo { height: 32px; } }

/* Details/summary groups in the public estimator */
#jobPicker details > summary { list-style: none; }
#jobPicker details > summary::-webkit-details-marker { display: none; }
#jobPicker details > summary::before { content: '▸ '; color: var(--ink-3); }
#jobPicker details[open] > summary::before { content: '▾ '; }
#heroPicks .check { padding: .5rem .65rem; }
#heroPicks .check b { font-size: .82rem; }
