/* NexusDesk 3.10 — ticket workspace and mileage assignment */
.nd-ticket-organized { padding: 0 0 28px; }
.nd-ticket-hero { padding: 22px 26px 12px; background: linear-gradient(115deg,rgba(109,96,236,.12),transparent 75%); }
.nd-ticket-hero .detail-title { margin-bottom: 11px; }
.nd-ticket-hero .detail-meta { margin-bottom: 4px; }
.nd-ticket-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 12px 23px 0; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.nd-ticket-tab { padding: 11px 13px; border: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); white-space: nowrap; font-weight: 700; font-size: 12px; }
.nd-ticket-tab:hover { color: var(--text); background: rgba(128,136,178,.09); }
.nd-ticket-tab.active { color: var(--text); border-bottom-color: var(--primary); background: rgba(128,114,240,.12); }
.nd-ticket-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nd-ticket-tab-panel { padding: 19px 23px 8px; }
.nd-ticket-card { background: var(--surface2); border: 1px solid var(--line); border-radius: 13px; padding: 18px; margin-bottom: 17px; min-width: 0; }
.nd-ticket-card-title { font-size: 14px; font-weight: 750; letter-spacing: .01em; margin: 0 0 16px; }
.nd-ticket-card .detail-desc { margin: 0 0 15px; }
.nd-ticket-card .detail-split { margin-top: 12px; }
.nd-ticket-card .detail-cell { min-width: 0; overflow-wrap: anywhere; }
.nd-ticket-card .form-grid { margin-top: 6px; }
.nd-ticket-card .section-title { margin-top: 0; }
.nd-ticket-card .ops-ticket-extra { margin: 18px 0 0; }
.nd-ticket-card .ops-ticket-extra .section-title { margin: 0 0 12px; }
.nd-ticket-card .ops-subpanel { padding: 14px; }
.nd-ticket-card .nd-task-create { margin-bottom: 0; }
.nd-ticket-card .detail-actions { margin: 0 0 8px; }
.nd-ticket-tab-panel #nd-ticket-workflow { margin: 0; }
.nd-ticket-tab-panel #nd-ticket-workflow .nd-ticket-workflow-head { margin-top: 0; }
.nd-mile-search { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.nd-mile-search .field { margin: 0; flex: 1 1 235px; }
.nd-mile-search .muted { font-size: 12px; }
.nd-mile-ticket-list { display: grid; gap: 8px; max-height: 460px; overflow-y: auto; }
.nd-mile-ticket-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: var(--surface2); }
.nd-mile-ticket-info { min-width: 0; overflow-wrap: anywhere; }
.nd-mile-ticket-info strong { display: block; font-size: 13px; font-weight: 650; }
.nd-mile-ticket-info small { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; color: var(--muted); margin-top: 6px; }
.nd-mile-ticket-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; flex-shrink: 0; }
.nd-mile-ticket-link { color: var(--blue); background: transparent; border: 0; padding: 3px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.nd-mileage-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 16px; }
.nd-mileage-header h3 { margin: 0 0 4px; }
.nd-mileage-header p { margin: 0; font-size: 12px; }
.nd-ticket-mile-kpis { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-bottom: 18px; }
.nd-ticket-mile-kpis>div { background: var(--surface3); border-radius: 10px; padding: 12px; min-width: 0; }
.nd-ticket-mile-kpis strong,.nd-ticket-mile-kpis small { display: block; overflow-wrap: anywhere; }
.nd-ticket-mile-kpis strong { font-size: 19px; }
.nd-ticket-mile-kpis small { font-size: 11px; color: var(--muted); }
.nd-ticket-mile-table { overflow-x: auto; }
.nd-ticket-mile-table table { min-width: 540px; }
.nd-ticket-mile-table td small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
@media (max-width: 650px) {
  .nd-ticket-tabs { padding-left: 13px; padding-right: 13px; }
  .nd-ticket-tab-panel { padding: 13px; }
  .nd-ticket-hero { padding: 17px; }
  .nd-ticket-card { padding: 13px; }
  .nd-mile-ticket-row { flex-direction: column; align-items: stretch; }
  .nd-mile-ticket-actions { justify-content: stretch; }
  .nd-mile-ticket-actions .btn { flex: 1; }
  .nd-ticket-mile-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.nd-edit-wide { grid-column: 1 / -1; }

/* 3.10.8: ticket customer identity (desktop + mobile). */
.nd-ticket-customer { margin:16px 0 5px; padding:15px 17px; border:1px solid var(--line); border-radius:13px; background:var(--surface2); min-width:0; }
.nd-ticket-customer-line { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:8px; }
.nd-customer-label { font-size:10px; font-weight:800; letter-spacing:.12em; color:var(--muted); }
.nd-customer-type { font-size:11px; font-weight:750; padding:5px 9px; border-radius:100px; color:var(--text); background:var(--surface3); border:1px solid var(--line); }
.nd-customer-type.contract { background:rgba(41,150,105,.12); color:var(--text); border-color:rgba(41,150,105,.35); }
.nd-customer-type.residential { background:rgba(76,122,220,.13); border-color:rgba(76,122,220,.3); }
.nd-customer-main { display:flex; flex-wrap:wrap; align-items:baseline; column-gap:12px; row-gap:3px; margin-bottom:5px; overflow-wrap:anywhere; }
.nd-customer-main strong { font-size:16px; }
.nd-customer-main span,.nd-ticket-customer small { font-size:12px; color:var(--muted); }
.nd-ticket-customer small { display:block; margin:3px 0; }
.nd-ticket-customer #nd-customer-edit-toggle { margin-top:10px; }
.nd-customer-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:14px; border-top:1px solid var(--line); padding-top:13px; }
.nd-customer-form label { display:grid; gap:6px; min-width:0; font-size:12px; font-weight:650; }
.nd-customer-form select { width:100%; min-width:0; padding:10px; background:var(--surface3); color:var(--text); border:1px solid var(--line); border-radius:9px; }
.nd-customer-actions { display:flex; gap:8px; align-items:center; grid-column:1/-1; flex-wrap:wrap; }
@media(max-width:650px) { .nd-ticket-customer {padding:13px; margin-top:13px;} .nd-customer-form {grid-template-columns:1fr;} .nd-customer-main {flex-direction:column; align-items:flex-start;} }

/* 3.10.9: structural parsing markers are never presented as headings. */
#dialog-content .nd-ticket-structural { display: none !important; }
.nd-ticket-customer > strong { display:block; margin-top:7px; }

/* 3.10.12: desktop legacy ticket header cleanup. Keep contents and tabs. */
@media (min-width: 651px) {
  #dialog-content > .nd-ticket-structural,
  #dialog-content > [data-legacy-ticket-heading],
  #dialog-content > .nd-ticket-boundary { display: none !important; }
}
