/* Shared list/detail primitives, ported from the Next.js app's globals.css so
   screens look identical while they move over module by module. */

h2 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.detail-card { margin-bottom: 16px; }
.detail-card h3 { font-size: 14px; font-weight: 600; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.detail-card h3.plain { border: 0; padding: 0; margin: 0; }
.detail-row { display: flex; justify-content: flex-start; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; gap: 16px; }
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
/* Labels form one column; each value starts right after it (HOMEBASE 6f92db7). */
.detail-row > span:first-child { color: var(--text-muted); font-size: 12px; font-weight: 500; flex: 0 0 var(--detail-label-w, 170px); min-width: 0; }
.detail-row > span:last-child { color: var(--text); text-align: left; }
.detail-row > span:only-child { flex: 1 1 auto; }
.detail-row .input { width: 60%; max-width: 420px; padding: 4px 8px; font-size: 13px; }
.detail-row textarea.input { min-height: 60px; }
.detail-row .input.narrow { width: 120px; }
.detail-row.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; font-weight: 700; }
.detail-row.total > span:first-child { color: var(--text); font-weight: 700; font-size: 13px; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; }
.badge-open { background: var(--info-dim); color: var(--info); }
.badge-in_progress { background: var(--warning-dim); color: var(--warning); }
.badge-on_hold { background: rgba(107, 112, 148, 0.15); color: var(--text-muted); }
.badge-closed { background: var(--success-dim); color: var(--success); }
.badge-emergency { background: var(--danger-dim); color: var(--danger); }
.badge-high { background: var(--warning-dim); color: var(--warning); }
.badge-medium { background: var(--info-dim); color: var(--info); }
.badge-low { background: rgba(107, 112, 148, 0.15); color: var(--text-muted); }
.badge-critical { background: var(--danger-dim); color: var(--danger); }
.badge-active { background: var(--success-dim); color: var(--success); }
select.badge { border: none; cursor: pointer; font: inherit; font-size: 11px; font-weight: 600; }

.table-wrapper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px 16px; color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
th.right, td.right { text-align: right; }
th.sortable { cursor: pointer; user-select: none; }
.detail-card table th, .detail-card table td { padding: 8px 10px; }
.detail-card table { margin-bottom: 12px; }
.detail-card table tfoot td { border-top: 1px solid var(--border); font-weight: 700; }
.empty-state { color: var(--text-muted); font-size: 13px; padding: 48px 0; text-align: center; letter-spacing: 0.3px; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--accent); letter-spacing: -1px; line-height: 1; overflow-wrap: anywhere; margin: 0; }
.stat-value.danger { color: var(--danger); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.plain { color: var(--text); }
.stat-hint { font-size: 11px; color: var(--accent); font-weight: 600; margin: 8px 0 0; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.3px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; background: var(--bg); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 9px 12px; color: var(--text); font: inherit; font-size: 13px; outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-group textarea { height: 90px; resize: vertical; }
.form-group input[type="checkbox"] { width: 16px; height: 16px; }
.form-group .check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); font-weight: 400; }
.form-group input:disabled, .form-group select:disabled, .form-group textarea:disabled { opacity: 0.7; }
.hint { font-size: 11px; color: var(--text-muted); display: block; margin-top: 4px; }
.preview-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.preview-box > div { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.preview-box > div.total { font-size: 15px; font-weight: 700; padding: 6px 0 3px; border-top: 1px solid var(--border); margin-top: 3px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: auto; padding: 5px 8px; font-size: 13px; }
.inline-form .w80 { width: 80px; } .inline-form .w100 { width: 100px; } .inline-form .w110 { width: 110px; } .inline-form .w120 { width: 120px; } .inline-form .w150 { width: 150px; } .inline-form .w180 { min-width: 180px; }
.inline-form .grow { flex: 1; min-width: 160px; }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-xs { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.btn-link { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font: inherit; font-size: 12px; padding: 4px 8px; }
.btn-link.accent { color: var(--accent); }
.btn-link.danger { color: var(--danger); }
.btn-danger-outline { border: 1px solid var(--border-2); color: var(--danger); background: transparent; }
.btn-muted { border: 1px solid var(--border-2); color: var(--text-muted); background: transparent; }
.chip-btn { background: transparent; border: 1px solid var(--border-2); color: var(--text-muted); border-radius: 6px; padding: 7px 12px; font-size: 12px; cursor: pointer; font: inherit; }
.chip-btn.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-panel { display: flex; gap: 12px; flex-wrap: wrap; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin: -4px 0 16px; }
.section-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin: 0 0 12px; }
.section-label small { font-weight: 400; text-transform: none; letter-spacing: 0; }
.section { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head .section-label { margin: 0; }
.row-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.row-card .main { min-width: 140px; flex: 1; font-size: 13px; font-weight: 600; }
.row-card .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 400; }
.row-card .side { display: flex; align-items: center; gap: 12px; }
.row-card.dim { opacity: 0.55; }
.row-list { display: grid; gap: 8px; margin-bottom: 12px; }
.money { font-variant-numeric: tabular-nums; }
.pos { color: var(--success); } .neg { color: var(--danger); }
.text-muted { color: var(--text-muted); } .text-subtle { color: var(--text-subtle); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.bold { font-weight: 600; } .bolder { font-weight: 700; }
.accent { color: var(--accent); }
.stage-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.stage-btn { flex: 1 1 120px; min-width: 110px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; text-align: center; border: 1px solid var(--border-2); background: transparent; color: var(--text-muted); }
.stage-btn.done { background: var(--accent-dim); color: var(--accent); }
.stage-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; cursor: default; }
.back-link { background: transparent; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0; margin-bottom: 6px; font: inherit; display: inline-block; }
.card-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: transparent; border: none; padding: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.note-item { border-left: 3px solid var(--accent); padding-left: 12px; }
.note-item .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.note-item .meta span:first-child { flex: 1; }
.note-item .body { font-size: 14px; white-space: pre-wrap; }
.note-list { display: flex; flex-direction: column; gap: 10px; }
.ai-box { background: rgba(14,92,99,0.06); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }

/* Column picker + multiselect dropdowns */
.dropdown-wrap { position: relative; display: inline-block; }
.dropdown-scrim { position: fixed; inset: 0; z-index: 40; }
.dropdown { position: absolute; top: 100%; right: 0; margin-top: 4px; z-index: 41; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; min-width: 200px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.dropdown.left { right: auto; left: 0; }
.dropdown label { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 4px; cursor: pointer; }
.dropdown label.locked { opacity: 0.6; cursor: default; }
.dropdown .dd-title { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 8px; }
.dropdown .dd-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.dropdown .dd-foot { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.dropdown .order-btns { display: inline-flex; gap: 2px; margin-left: auto; }
.dropdown .order-btns button { font: inherit; font-size: 10px; border: 1px solid var(--border); background: transparent; border-radius: 4px; cursor: pointer; padding: 0 5px; color: var(--text-muted); }
.table-tools { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }

/* Mobile row cards for DataTable */
.mcard-list { display: flex; flex-direction: column; gap: 10px; }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.mcard-head { display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; }
.mcard-head .primary { font-size: 15px; font-weight: 600; }
.mcard-head .secondary { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.mcard-body { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.mcard-body > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.mcard-body > div > span:first-child { color: var(--text-muted); flex-shrink: 0; }
.mcard-body > div > span:last-child { text-align: right; min-width: 0; word-break: break-word; }
.desktop-only { display: block; } .mobile-only { display: none; }
@media (max-width: 720px) {
  .desktop-only { display: none; } .mobile-only { display: block; }
  .detail-row { flex-wrap: wrap; } .detail-row > span:first-child { flex: none; } .detail-row .input { width: 100%; }
}

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.photo-tile { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.photo-tile img { width: 100%; height: 110px; object-fit: cover; display: block; cursor: zoom-in; }
.photo-tile .cap { font-size: 11px; color: var(--text-muted); padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-tile .del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.55); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 12px; line-height: 22px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: grid; place-items: center; z-index: 60; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 6px; }
.modal.wide { max-width: 640px; }
.modal-head h3 { margin: 0; border: 0; padding: 0; font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* A neutral note on a form — used when a View As sandbox closed itself. */
.form-note { background: var(--info-dim); color: var(--text); border-radius: var(--radius); padding: 8px 10px; font-size: 12.5px; margin: 10px 0 0; }
