/* ==========================================================================
   Entwine · Clients & sites — on top of the dashboard tokens and the
   Asset Manager shell (portfolio.css). No colours of its own.
   ========================================================================== */
.cr-btn { font: inherit; font-size: 13.5px; font-weight: 600; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.cr-btn:hover { background: var(--surface-3); }
.cr-btn.primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.cr-btn.primary:hover { filter: brightness(1.08); }
.cr-btn.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.cr-btn.danger:hover { border-color: var(--st-critical); color: var(--st-critical); background: var(--wash-critical); }
.cr-btn:disabled { opacity: .55; cursor: default; }

.cr-menu { position: relative; }
.cr-drop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; padding: 6px; display: flex; flex-direction: column; background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); }
.cr-drop[hidden] { display: none; }
.cr-drop button { font: inherit; font-size: 13.5px; text-align: left; padding: 9px 11px; border: 0; border-radius: 8px; background: none; color: var(--text-primary); cursor: pointer; }
.cr-drop button:hover { background: var(--surface-3); }

.cr-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cr-kpis .pf-kpi { padding: 16px 18px; border-radius: 16px; }
.cr-kpis .pf-kpi .v { font-size: 28px; }

.cr-split { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 18px; align-items: start; }
.cr-listcard { padding: 14px; gap: 10px; position: sticky; top: 16px; max-height: calc(100vh - 32px); }
.cr-search { width: 100%; }
.cr-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cr-filters .field { padding: 8px 9px; font-size: 13px; min-width: 0; }
.cr-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 60px; }
.cr-item { text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-1); display: flex; flex-direction: column; gap: 5px; }
.cr-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.cr-item[aria-current="true"] { border-color: var(--series-1); background: color-mix(in srgb, var(--series-1) 9%, var(--surface-1)); }
.cr-item .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cr-item .nm { font-weight: 600; font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.cr-item .meta { font-size: 12.5px; color: var(--text-muted); }

.cr-idtag, .cr-mono { font-family: var(--mono); font-size: 12px; color: var(--text-secondary); }
.cr-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--border-strong); color: var(--text-primary); background: var(--surface-2); }
.cr-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex: none; }
.cr-pill.ok::before { background: var(--st-ok); }
.cr-pill.info::before { background: var(--st-info); }
.cr-pill.warning::before { background: var(--st-warning); }
.cr-pill.critical::before { background: var(--st-critical); }
.cr-pill.warning { background: var(--wash-warning); }
.cr-pill.critical { background: var(--wash-critical); }

.cr-detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cr-hero { background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; border-radius: 20px; padding: 22px 24px; display: flex; flex-wrap: wrap; gap: 14px 20px; justify-content: space-between; align-items: flex-start; }
.cr-hero h2 { margin: 6px 0 4px; font-family: var(--font); font-size: 26px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cr-hero .cr-idtag { color: #b9d3ea; }
.cr-hero .sub { color: #cfe1f3; font-size: 14px; }
.cr-hero .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.cr-hero .cr-btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); color: #fff; }
.cr-hero .cr-btn:hover { background: rgba(255,255,255,.2); }
.cr-hero .cr-pill { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }

.cr-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 22px; }
.cr-fact .k { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin-bottom: 3px; }
.cr-fact .v { font-size: 14px; overflow-wrap: anywhere; white-space: pre-line; }
.cr-fact .v a { color: var(--series-1); text-decoration: none; }
.cr-fact .v a:hover { text-decoration: underline; }
.cr-fact .v.none { color: var(--text-muted); }

.cr-sitehead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cr-sitehead h3 { margin: 0; font-family: var(--font); font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.cr-sitehead .grow { flex: 1; }
.cr-toggle { font: inherit; border: 0; background: none; cursor: pointer; color: var(--text-secondary); font-size: 17px; line-height: 1; width: 30px; height: 30px; border-radius: 8px; }
.cr-toggle:hover { background: var(--surface-3); color: var(--text-primary); }
.cr-counts { font-size: 13px; color: var(--text-secondary); }

.cr-live { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.cr-live.unlinked { border-style: dashed; color: var(--text-muted); font-size: 13.5px; }
.cr-live .lv b { display: block; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.cr-live .lv span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.cr-live .grow { flex: 1; }

.cr-nodes { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-node { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; }
.cr-node small { font-family: var(--font); color: var(--text-muted); font-size: 11.5px; }
.cr-node button { font: inherit; font-family: var(--font); font-size: 11.5px; border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-secondary); border-radius: 7px; padding: 2px 8px; cursor: pointer; }
.cr-node button:hover { color: var(--text-primary); background: var(--surface-3); }

.cr-sec { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin: 4px 0 -4px; }
.cr-tablewrap { overflow-x: auto; }
.cr-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cr-table th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; text-align: left; padding: 6px 10px; white-space: nowrap; }
.cr-table td { padding: 8px 10px; border-top: 1px solid var(--grid); vertical-align: top; }
.cr-table td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cr-table td.notes { color: var(--text-secondary); }

.cr-empty { padding: 34px 24px; text-align: center; color: var(--text-muted); font-size: 14.5px; }
.cr-empty b { display: block; color: var(--text-primary); font-size: 17px; margin-bottom: 6px; }

/* ---- forms ---- */
.cr-modal { max-width: 860px; }
.cr-modalfoot { display: flex; align-items: center; gap: 10px; padding: 14px 19px; border-top: 1px solid var(--border); }
.cr-err { flex: 1; color: var(--st-critical); font-size: 13px; }
.cr-form h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); margin: 22px 0 10px; }
.cr-form h4:first-child { margin-top: 0; }
.cr-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.cr-f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-secondary); font-weight: 500; grid-column: span 3; min-width: 0; }
.cr-f.w2 { grid-column: span 2; } .cr-f.w4 { grid-column: span 4; } .cr-f.w6 { grid-column: span 6; }
.cr-f .field { width: 100%; font-family: inherit; }
.cr-f textarea.field { min-height: 76px; resize: vertical; }
.cr-f small { font-weight: 400; color: var(--text-muted); }
.cr-rows { display: flex; flex-direction: column; gap: 8px; }
.cr-row { display: grid; gap: 8px; align-items: center; }
.cr-row .field { padding: 8px 10px; font-size: 13px; min-width: 0; width: 100%; }
.cr-row.node { grid-template-columns: minmax(0, 1.4fr) 90px auto; }
.cr-row.walkin { grid-template-columns: minmax(0, 1.5fr) 62px 68px 68px 68px 62px minmax(0, 1.6fr) auto; }
.cr-row.case { grid-template-columns: minmax(0, 1.5fr) 62px 80px minmax(0, 1.8fr) auto; }
.cr-row.cu { grid-template-columns: minmax(0, 1.4fr) 62px minmax(0, 1.2fr) minmax(0, 1.6fr) auto; }
.cr-row .rm { font: inherit; border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-secondary); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; }
.cr-row .rm:hover { color: var(--st-critical); border-color: var(--st-critical); }
.cr-rowhead { font-size: 11px; color: var(--text-muted); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.cr-add { align-self: flex-start; margin-top: 8px; }

@media (max-width: 1250px) { .cr-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .cr-split { grid-template-columns: 1fr; } .cr-listcard { position: static; max-height: 340px; } }
@media (max-width: 760px) {
  .cr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cr-grid { grid-template-columns: 1fr; } .cr-f, .cr-f.w2, .cr-f.w4, .cr-f.w6 { grid-column: auto; }
  .cr-row.walkin, .cr-row.case, .cr-row.cu { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
  .cr-rowhead { display: none; }
}
