/* Divergências (worklist e detalhe).
   Page-scoped rules only; shared components live in ../app.css. Every rule
   hangs off .dv-list-page / .dv-detail-page (or a .dv-* class) because all
   page sheets load on every page. */

.dv-list-page .panel-head h2,
.dv-detail-page .panel-head h2{margin:0}
.dv-list-page .panel-head,
.dv-detail-page .panel-head{flex-wrap:wrap;row-gap:4px}
.dv-list-page .panel-head .sub,
.dv-detail-page .panel-head .sub{color:var(--sec);font-size:13px;font-weight:500}

/* ---------------------------------------------------------------- filters */
.dv-filters{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px 16px;align-items:end;margin:0 0 14px}
.dv-filters .dv-f-q{grid-column:span 2}
.dv-filters .field>label{font-size:13px}
.dv-f-actions{display:flex;align-items:flex-end}
.dv-f-actions .btn{min-width:112px}
@media (max-width:1100px){
  .dv-filters{grid-template-columns:repeat(3,minmax(0,1fr))}
  .dv-filters .dv-f-q{grid-column:1 / -1}
}
@media (max-width:720px){
  .dv-filters{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .dv-f-actions{grid-column:1 / -1}
  .dv-f-actions .btn{width:100%}
}

.dv-chips{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;margin:0 0 10px}
.dv-chips-label{font-size:13px;font-weight:600;color:var(--sec)}
.dv-chips ul{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
.dv-chips .chip{min-height:32px;padding:0 12px;text-decoration:none}
.dv-chips .chip:hover{background:var(--accent-soft-2)}
.dv-chips .chip .x{font-size:15px;line-height:1}
.dv-chips .linkbtn{margin:0}

.dv-scope{margin:0 0 18px;font-size:13px;line-height:1.6;color:var(--sec)}
.dv-scope a{color:var(--accent-strong);font-weight:600;text-decoration:underline;text-underline-offset:3px;white-space:nowrap}

/* ---------------------------------------------------------------- results */
.dv-table thead th{white-space:nowrap}
.dv-table td{vertical-align:top}
.dv-table .dv-c-sev{width:118px}
.dv-table .dv-c-cli{width:210px}
.dv-table .dv-c-cli .fname{overflow-wrap:anywhere}
.dv-table .dv-c-msg{min-width:280px;line-height:1.5}
.dv-table .dv-c-msg>a{color:var(--ink)}
.dv-table .dv-c-fam{width:170px;font-size:13.5px}
.dv-table .dv-c-imp{width:150px}
.dv-table .dv-c-status{width:120px;font-size:13.5px}
.dv-table .dv-c-comp{width:104px;font-variant-numeric:tabular-nums}
.dv-area,.dv-run,.dv-shadow{display:block;margin-top:3px;font-size:12.5px;color:var(--sec);font-weight:500}
.dv-shadow{color:var(--ter);white-space:nowrap}
.dv-footnote{margin:0;padding:12px 20px;border-top:1px solid var(--line-2);font-size:13px;color:var(--sec)}

/* Cadastral group: one line per customer that opens into its items. */
.dv-group>summary{display:list-item;cursor:pointer;min-height:24px;border-radius:4px}
.dv-group>summary:hover strong{text-decoration:underline;text-underline-offset:3px}
.dv-sys{color:var(--sec);font-weight:500}
.dv-group-items{margin:10px 0 0;padding:0;list-style:none}
.dv-group-items>li{padding:10px 0;border-top:1px solid var(--line-2)}
.dv-gi-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.dv-gi-vals{display:flex;flex-wrap:wrap;gap:2px 16px;margin:6px 0 4px;font-size:13px}
.dv-gi-vals>div{display:flex;gap:5px;min-width:0}
.dv-gi-vals dt{color:var(--sec);font-weight:500}
.dv-gi-vals dt::after{content:":"}
.dv-gi-vals dd{margin:0;color:var(--ink);overflow-wrap:anywhere}
.dv-gi-link{display:inline-flex;align-items:center;gap:4px;min-height:24px;font-size:13.5px;font-weight:600;color:var(--accent-strong);text-decoration:underline;text-decoration-color:transparent;text-underline-offset:3px}
.dv-gi-link:hover{text-decoration-color:currentColor}

.dv-empty{padding:36px 24px 40px;text-align:center}
.dv-empty h3{margin:0 0 6px}
.dv-empty p{margin:0 auto;max-width:520px;color:var(--sec)}
.dv-empty .dv-empty-actions{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:12px 20px;margin-top:18px}

/* Phone: each row becomes a card (severity and impact on top, then the
   customer, the message and one line of context). The thead stays for
   screen readers, and the rows keep role="row"/"cell" in the markup. */
@media (max-width:720px){
  .dv-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .dv-table,.dv-table tbody{display:block}
  .dv-table tr{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;padding:14px 16px;border-bottom:1px solid var(--line-2)}
  .dv-table tbody tr:last-child{border-bottom:0}
  .dv-table td,.dv-table td[class]{display:block;width:auto;min-width:0;padding:0;border:0}
  .dv-table tr[data-href]:hover,.dv-table tr[data-href]:focus-within{background:var(--row-hover)}
  .dv-table tr[data-href]:hover>td,.dv-table tr[data-href]:focus-within>td{background:transparent}
  .dv-table .dv-c-sev{flex:1 1 auto;order:0}
  .dv-table .dv-c-imp{flex:0 0 auto;order:1;text-align:right}
  .dv-table .dv-c-cli{order:2}
  .dv-table .dv-c-msg{order:3}
  .dv-table .dv-c-fam{order:4}
  .dv-table .dv-c-status{order:5}
  .dv-table .dv-c-comp{order:6}
  .dv-table .dv-c-imp .dv-shadow{display:inline;margin-left:6px}
  .dv-table .dv-c-cli,.dv-table .dv-c-msg{flex:1 1 100%;min-width:0}
  .dv-table .dv-c-msg{font-size:14px}
  .dv-table .dv-c-fam,.dv-table .dv-c-status,.dv-table .dv-c-comp{flex:0 1 auto;font-size:13px;color:var(--sec)}
  .dv-table .dv-c-fam .dv-area{display:inline;margin:0;font-size:inherit;font-weight:inherit}
  .dv-table .dv-c-fam .dv-area::before{content:" · "}
  .dv-table .dv-c-status::before,.dv-table .dv-c-comp::before{content:"·";content:"·" / "";margin-right:8px;color:var(--ter)}
  .dv-table .dv-c-msg+.dv-c-status::before{content:none}
  .dv-table .dv-run{display:inline;margin-left:6px}
  .dv-footnote{padding:12px 16px}
}

/* ----------------------------------------------------------------- detail */
.dv-crumbs{margin:0 0 10px;font-size:13.5px}
.dv-crumbs ol{display:flex;flex-wrap:wrap;align-items:center;margin:0;padding:0;list-style:none}
.dv-crumbs li{display:inline-flex;align-items:center;min-height:24px;color:var(--ink);font-weight:600;min-width:0;overflow-wrap:anywhere}
.dv-crumbs li+li::before{content:"›";content:"›" / "";margin:0 8px;color:var(--ter);font-weight:500}
.dv-crumbs a{color:var(--sec);text-decoration:underline;text-decoration-color:transparent;text-underline-offset:3px}
.dv-crumbs a:hover{color:var(--accent-strong);text-decoration-color:currentColor}

.dv-head{flex-direction:column;align-items:flex-start;gap:10px;margin-bottom:24px}
.dv-head h1{overflow-wrap:anywhere}
.dv-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px 16px;margin:0;font-size:14px;color:var(--sec)}
.dv-meta strong{color:var(--ink)}

.dv-detail{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:22px;align-items:start}
@media (max-width:1100px){.dv-detail{grid-template-columns:minmax(0,1fr)}}
@media (max-width:720px){.dv-detail-page .panel-body{padding:18px 16px}}

.dv-message{margin:0 0 18px;font-size:16px;line-height:1.55;color:var(--ink);max-width:72ch;overflow-wrap:anywhere}

.dv-compare{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
@media (max-width:560px){.dv-compare{grid-template-columns:minmax(0,1fr)}}
.dv-val{padding:12px 14px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);min-width:0}
.dv-val h3{margin:0 0 6px;font-size:13px;font-weight:600;color:var(--sec)}
.dv-val p{margin:0;font-size:14.5px;font-weight:600;color:var(--ink);overflow-wrap:anywhere}
.dv-kv{margin:0}
.dv-kv>div{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:3px 0}
.dv-kv>div+div{border-top:1px solid var(--line-2)}
.dv-kv dt{color:var(--sec);font-size:13.5px}
.dv-kv dd{margin:0;font-weight:600;color:var(--ink);text-align:right;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;min-width:0}

.dv-raw{margin:10px 0 20px;font-size:13px}
.dv-raw>summary{display:inline-flex;align-items:center;min-height:24px;cursor:pointer;color:var(--accent-strong);font-weight:600}
.dv-raw>summary:hover{text-decoration:underline;text-underline-offset:3px}
.dv-raw pre{margin:8px 0 0;padding:12px 14px;border-radius:var(--r-sm);background:var(--neu-bg);color:var(--ink);font-size:12.5px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;max-height:320px;overflow:auto}
.dv-raw-k{color:var(--sec);font-weight:600}

.dv-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 24px;margin:0;padding-top:18px;border-top:1px solid var(--line-2)}
.dv-facts>div{min-width:0}
.dv-facts>.wide{grid-column:1 / -1}
.dv-facts dt{font-size:12.5px;font-weight:600;color:var(--sec)}
.dv-facts dd{margin:3px 0 0;font-size:14px;color:var(--ink);overflow-wrap:anywhere}
.dv-facts dd a{color:var(--accent-strong);text-decoration:underline;text-decoration-color:transparent;text-underline-offset:3px}
.dv-facts dd a:hover{text-decoration-color:currentColor}
.dv-facts code,.dv-ref code{font-size:12.5px;padding:1px 5px;border-radius:4px;background:var(--neu-bg);overflow-wrap:anywhere}
.dv-ref{display:block;margin-top:3px;font-size:12.5px;color:var(--sec)}
.dv-facts-compact{padding-top:0;border-top:0;gap:10px 20px}
@media (max-width:480px){.dv-facts{grid-template-columns:minmax(0,1fr)}}

/* Treatment: the ruling in force, the decision form, revocation, history. */
.dv-decide .err[hidden],.dv-decide .field[hidden]{display:none}
.dv-ruling{margin:0 0 4px}
.dv-ruling-type{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 14px;font-size:13.5px}
.dv-note{margin:12px 0 0;font-size:13px;line-height:1.5;color:var(--sec)}

.dv-decide .notice{margin-bottom:18px}
.dv-decide>.field{margin-top:18px}
.dv-decide>.dv-types{margin-top:0}
.dv-types{border:0;padding:0;margin:0;gap:8px}
.dv-types>legend{padding:0;margin:0 0 8px;font-size:13.5px;font-weight:600;color:var(--ink)}
.dv-type{display:flex;align-items:flex-start;gap:12px;min-height:44px;padding:11px 14px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);cursor:pointer;transition:border-color .15s ease,background-color .15s ease}
.dv-type:hover{border-color:var(--field-line)}
.dv-type:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
.dv-type input{flex:none;margin-top:2px}
.dv-types input[aria-invalid="true"]{box-shadow:none}
.dv-types:has(input[aria-invalid="true"]) .dv-type{border-color:var(--bad)}
.dv-type-text{display:flex;flex-direction:column;gap:2px;min-width:0}
.dv-type-text strong{font-size:14px;color:var(--ink)}
.dv-type-help{font-size:13px;line-height:1.45;color:var(--sec)}
.dv-decide .check{align-items:flex-start;line-height:1.45}
.dv-decide .check input{margin-top:1px}
.dv-decide .form-actions{margin-top:20px}

.dv-disclosure{margin-top:18px}
.dv-disclosure>summary{list-style:none;width:max-content;max-width:100%}
.dv-disclosure>summary::-webkit-details-marker{display:none}
.dv-disclosure[open]>summary{margin-bottom:14px}
.dv-when-open{display:none}
.dv-disclosure[open] .dv-when-open{display:inline}
.dv-disclosure[open] .dv-when-closed{display:none}
.dv-revoke-confirm{padding:14px 16px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--bad-bg);color:var(--bad-ink)}
.dv-revoke-confirm p{margin:0 0 12px;font-size:14px;line-height:1.5}

.dv-history{margin-top:24px;padding-top:18px;border-top:1px solid var(--line-2)}
.dv-history h3{margin:0 0 6px}
.dv-history ol{margin:0;padding:0;list-style:none}
.dv-history li{display:flex;flex-direction:column;gap:2px;padding:10px 0;border-bottom:1px solid var(--line-2);font-size:13.5px;overflow-wrap:anywhere}
.dv-history li:last-child{border-bottom:0}
.dv-h-top{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px}
.dv-h-state{font-size:12.5px;font-weight:600;color:var(--sec)}
.dv-history li.is-live .dv-h-state{color:var(--ok)}

.dv-related{margin-top:22px}
.dv-related .panel-head .dv-related-all{margin-left:auto;display:inline-flex;align-items:center;min-height:24px;color:var(--accent-strong);font-weight:600;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:3px}
.dv-related .panel-head .dv-related-all:hover{text-decoration-color:currentColor}
.dv-table-related .dv-c-msg{min-width:0}
