:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1d2733; --muted: #66707d;
  --accent: #1f4e79; --accent-soft: #e8eff6; --line: #dde2e8;
  --ok: #1d7a46; --warn: #b7791f; --bad: #b3362c;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 215px; background: #16293d; color: #cfd8e3; padding: 14px 0; display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { font-size: 18px; font-weight: 700; color: #fff; padding: 4px 18px 14px; }
.sidebar .brand-logo { display: block; background: #fff; border-radius: 8px; margin: 0 14px 12px; padding: 9px 12px; }
.sidebar .brand-logo img { display: block; width: 100%; max-height: 48px; object-fit: contain; }
.sidebar a { display: block; padding: 9px 18px; color: #cfd8e3; }
.sidebar a:hover { background: #1f3550; text-decoration: none; }
.sidebar a.active { background: #1f4e79; color: #fff; }
.sidebar .firm-switch { padding: 0 14px 14px; }
.sidebar .firm-switch select { width: 100%; padding: 6px; border-radius: 6px; border: 1px solid #2d4258; background: #0f1f30; color: #fff; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #2d4258; padding-top: 8px; }
.sidebar .linklike { background: none; border: none; color: #8fa3b8; padding: 9px 18px; cursor: pointer; font-size: 14px; }
.sidebar .linklike:hover { color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 9px 24px; }
.searchbox { position: relative; flex: 1; max-width: 520px; }
.searchbox input { width: 100%; padding: 8px 14px; border-radius: 20px; background: #f1f3f5; border: 1px solid transparent; font-size: 14px; }
.searchbox input:focus { background: #fff; border-color: var(--accent); outline: none; }
.search-drop, .newmenu-drop { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(13,20,40,.14); z-index: 60; }
.search-drop { top: calc(100% + 4px); left: 0; right: 0; max-height: 440px; overflow-y: auto; }
.search-drop h4 { margin: 9px 12px 2px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.search-drop a { display: block; padding: 7px 12px; font-size: 13.5px; color: var(--ink); }
.search-drop a:hover { background: var(--accent-soft); text-decoration: none; }
.search-drop .sub { color: var(--muted); font-size: 12px; }
.search-drop .none { padding: 10px 12px; color: var(--muted); font-size: 13.5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.timer-live { display: flex; align-items: center; gap: 8px; margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.newmenu { position: relative; }
.newmenu-drop { right: 0; top: calc(100% + 4px); min-width: 150px; }
.newmenu-drop a { display: block; padding: 8px 14px; font-size: 14px; }
.newmenu-drop a:hover { background: var(--accent-soft); text-decoration: none; }
.topbar-user { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.crumbs { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.crumbs a { color: var(--muted); }

.content { flex: 1; padding: 22px 32px; max-width: 1200px; width: 100%; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.stat .value { font-size: 23px; font-weight: 700; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 10px 12px; background: #fafbfc; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table:not(.cal) tr:nth-child(even) td { background: #fafbfd; }
table:not(.cal) tr:hover td { background: #eef2f7; }

/* matter page tabs */
.mtabs { position: sticky; top: 55px; z-index: 30; background: var(--bg); padding: 10px 0 8px; margin: 0 0 10px;
  display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
.mtabs a { padding: 6px 13px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; white-space: nowrap; }
.mtabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.mtab-panel[hidden] { display: none; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: none; border-radius: 7px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.btn:hover { background: #163a5c; text-decoration: none; color: #fff; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.danger { background: #fbeae8; color: var(--bad); }
button.inline { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13.5px; }
button.inline:hover { text-decoration: underline; }

form.stack label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 13.5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { display: flex; flex-direction: column; gap: 3px; }
.inline-form label { font-size: 12px; font-weight: 600; color: var(--muted); }
.checkline { display: flex; align-items: center; gap: 7px; margin-top: 12px; }
.checkline input { width: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.open, .badge.sent, .badge.in_progress { background: #e8f0fb; color: var(--accent); }
.badge.pending, .badge.draft { background: #f3f4f6; color: var(--muted); }
.badge.closed, .badge.complete, .badge.paid { background: #e3f3e9; color: var(--ok); }
.badge.high, .badge.void, .badge.overdue { background: #fbeae8; color: var(--bad); }
.badge.deposit { background: #e3f3e9; color: var(--ok); }
.badge.disbursement { background: #fdf1e2; color: var(--warn); }

.muted { color: var(--muted); font-size: 13.5px; }
.error-banner { background: #fbeae8; color: var(--bad); border: 1px solid #f0c8c2; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.right { text-align: right; }
.money { font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }

/* calendar */
.cal { table-layout: fixed; }
.cal td { height: 104px; padding: 6px; font-size: 13px; }
.cal .daynum { font-weight: 600; color: var(--muted); }
.cal td.today { background: var(--accent-soft); }
.cal .ev { display: block; background: #e8f0fb; border-radius: 5px; padding: 2px 5px; margin-top: 3px; font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* AI intake dropzone */
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 34px 20px; text-align: center; cursor: pointer; background: #fafbfd; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone p { margin: 4px 0; }

/* AI summary card */
.ai-card { border-left: 3px solid var(--gold, #997443); }
.ai-card pre { white-space: pre-wrap; font-family: inherit; font-size: 14px; margin: 0; line-height: 1.5; }

/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 22px; max-width: 540px; width: 92%; }
dialog::backdrop { background: rgba(20,30,45,.45); }
dialog h2 { margin-top: 0; }

/* auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #16293d; }
.auth-card { background: #fff; border-radius: 14px; padding: 34px; width: 420px; max-width: 94%; }
.auth-card h1 { font-size: 20px; }
.auth-card .brand { font-size: 24px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; position: static; }
  .searchbox { order: 2; flex-basis: 100%; max-width: none; }
  .topbar-user { display: none; }
  .mtabs { top: 0; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px 6px; gap: 2px;
    position: sticky; top: 0; z-index: 50; -webkit-overflow-scrolling: touch; height: auto; overflow-y: visible; }
  .sidebar a { white-space: nowrap; padding: 8px 11px; border-radius: 7px; font-size: 14px; }
  .sidebar .brand { padding: 0 10px 0 6px; font-size: 16px; border: none !important; margin: 0 !important; }
  .sidebar .brand-logo { padding: 4px 8px !important; flex-shrink: 0; }
  .sidebar .brand-logo img { max-height: 24px; width: auto; max-width: 130px; }
  .sidebar .firm-switch { padding: 0 6px; }
  .sidebar .firm-switch select { width: auto; max-width: 130px; }
  .sidebar-bottom { margin: 0; border: 0; display: flex; align-items: center; }
  .content { padding: 16px 14px; }
  .row { flex-direction: column; }
  table { display: block; overflow-x: auto; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

.print-only-title { display: none; }
@media print {
  .sidebar, .page-head .btn, .tabs, form { display: none !important }
  .content { padding: 0 }
  .print-only-title { display: block; }
}

/* --- Round H: search snippets, dashboard billing card, task feed toggle --- */
mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }
td.snip { font-size: 13px; color: var(--muted); }
.money-rows .mrow { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.money-rows .mrow:last-child { border-bottom: 0; }
.money-rows .mrow .amt { font-weight: 600; text-align: right; white-space: nowrap; }
.agebar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); margin: 8px 0 6px; }
.agebar span { display: block; min-width: 0; }
.agebar .a0 { background: #5b9bd5; } .agebar .a1 { background: #e0b341; } .agebar .a2 { background: #e0833b; } .agebar .a3 { background: #c0392b; }
.agelegend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 12px; color: var(--muted); }
.agelegend b { display: block; color: inherit; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.seg a { padding: 2px 8px; border-radius: 12px; font-size: 12.5px; border: 1px solid var(--line); }
.seg a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar select { width: auto; }

/* --- Round I: matter template task rows --- */
.tpl-row { display: grid; grid-template-columns: 2fr 2fr 90px 100px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 700px) { .tpl-row { grid-template-columns: 1fr 1fr; } }

/* --- Round J: e-signature --- */
.badge.es-pending { background: #f3f4f6; color: var(--muted); }
.badge.es-viewed { background: #e8f0fb; color: var(--accent); }
.badge.es-signed { background: #e3f3e9; color: var(--ok); }
.badge.es-declined, .badge.es-voided { background: #fbeae8; color: var(--bad); }
.esign-new { border-left: 3px solid var(--ok); }
.esign-linkrow { display: flex; gap: 8px; margin-top: 8px; }
.esign-linkrow input { flex: 1; }
table.esign-kv th { width: 170px; text-align: left; vertical-align: top; white-space: nowrap; }
table.esign-kv td { overflow-wrap: anywhere; }

/* --- v2.3: row Actions menus, folder bar, bulk bar --- */
table.docs-table { overflow: visible; }
.newmenu-drop form { margin: 0; }
.newmenu-drop button, .newmenu-drop .menu-off { display: block; width: 100%; text-align: left; padding: 8px 14px; font-size: 14px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.newmenu-drop button:hover { background: var(--accent-soft); }
.newmenu-drop .menu-off { color: var(--muted); cursor: default; }
.newmenu-drop .menu-danger { color: var(--bad); }
td .newmenu-drop { min-width: 190px; }
.folderbar { margin: 0 0 12px; }
.fb-crumbs { font-size: 14px; margin-bottom: 8px; }
.bulkbar { display: flex; gap: 10px; align-items: center; background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.bulkbar form { margin: 0; }

/* --- v2.4: Documents browser (Clio parity): mini-rail, toolbar, mixed folder/file table, pager --- */
.docs-shell { display: flex; gap: 18px; align-items: flex-start; }
.docs-rail { display: flex; flex-direction: column; gap: 2px; width: 76px; flex-shrink: 0; position: sticky; top: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 4px; }
.docs-rail a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 7px; border-radius: 8px;
  font-size: 11.5px; color: var(--muted); }
.docs-rail a:hover { background: var(--accent-soft); text-decoration: none; color: var(--accent); }
.docs-rail a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold, #997443); }
.docs-rail .ic { width: 19px; height: 19px; }
.docs-main { flex: 1; min-width: 0; }
.docs-head { margin-bottom: 12px; }
.docs-head h1 { font-size: 26px; overflow-wrap: anywhere; }
.doc-crumbs { margin: 0 0 4px; }
.doc-crumbs a:hover { color: var(--accent); }
.doc-crumbs span:last-child { color: var(--ink); }
.doc-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pilltoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #fff; }
.pilltoggle a { padding: 5px 15px; font-size: 13.5px; color: var(--muted); }
.pilltoggle a:hover { text-decoration: none; background: var(--accent-soft); }
.pilltoggle a.on { background: var(--accent); color: #fff; }
.doc-filter { position: relative; margin: 0; flex: 1; max-width: 340px; }
.doc-filter input { width: 100%; padding-right: 26px; }
.doc-clear { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 18px; line-height: 1; color: var(--muted); }
.doc-drop { position: relative; border-radius: 10px; }
.doc-drop.drag { outline: 2px dashed var(--accent); outline-offset: 2px; background: var(--accent-soft); }
.doc-drop-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(232,239,246,.82);
  color: var(--accent); font-weight: 600; font-size: 16px; border-radius: 10px; pointer-events: none; z-index: 5; }
.doc-drop-hint[hidden] { display: none; }
table.doc-browser td, table.doc-browser th { padding: 0 10px; height: 42px; vertical-align: middle; }
table.doc-browser tr.drow:hover td { background: #f7f9fc; }
table.doc-browser .c-chk { width: 34px; padding-right: 0; }
table.doc-browser .c-star { width: 30px; padding: 0 2px; }
table.doc-browser .c-name { min-width: 240px; }
table.doc-browser .c-name > * { vertical-align: middle; }
table.doc-browser .c-act { width: 1%; white-space: nowrap; }
table.doc-browser .c-ver { width: 96px; }
table.doc-browser .c-mod { width: 120px; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
table.doc-browser .c-size { width: 90px; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
table.doc-browser .sortlink { color: inherit; white-space: nowrap; }
table.doc-browser .sortlink:hover { color: var(--accent); text-decoration: none; }
table.doc-browser .arr { color: var(--accent); font-size: 11px; }
table.doc-browser td.muted { height: auto; padding: 22px 12px; text-align: center; }
.ficon { display: inline-flex; margin-right: 9px; }
.ficon .ic { width: 18px; height: 18px; }
.ic-folder { color: var(--gold, #c8963e); }
.ic-pdf { color: #c0392b; } .ic-doc { color: #2b6cb0; } .ic-img { color: #1d7a46; } .ic-file { color: #7b8794; }
.dname-wrap { display: inline-block; max-width: calc(100% - 34px); }
.dname { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
a.dname:hover { color: var(--accent); }
.dloc { font-size: 12px; color: var(--muted); margin-top: -2px; }
.starbtn { background: none; border: 0; padding: 4px; cursor: pointer; color: #b9c0c9; line-height: 0; border-radius: 6px; }
.starbtn:hover { color: var(--gold, #c8963e); background: var(--accent-soft); }
.starbtn.on, .ic-star-on { color: var(--gold, #c8963e); }
form.inl { display: inline; margin: 0; }
.act-cell { display: inline-flex; align-items: center; gap: 6px; }
.iconlink { display: inline-flex; padding: 5px; border-radius: 6px; color: var(--muted); }
.iconlink:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.vchip { display: inline-block; padding: 1px 9px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.vchip:hover { text-decoration: none; background: #d6e3f0; }
.menu-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.pager { display: flex; align-items: center; gap: 6px; margin: 12px 2px 4px; flex-wrap: wrap; }
.pgbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; color: var(--accent); font-size: 16px; }
a.pgbtn:hover { background: var(--accent-soft); text-decoration: none; }
.pgbtn.off { color: #b9c0c9; background: #f7f8fa; }
.pg-info { margin: 0 10px 0 6px; font-size: 13.5px; color: var(--muted); }
.pg-size-form { margin: 0 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.pg-size-form select { width: auto; padding: 4px 8px; }
.docs-browse-note { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.trash-banner { background: #fdf1e2; border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 6px; margin: 0 0 12px; }
@media (max-width: 800px) {
  .docs-shell { flex-direction: column; gap: 10px; }
  .docs-rail { flex-direction: row; width: 100%; position: static; overflow-x: auto; }
  .docs-rail a { flex: 1; min-width: 62px; }
  table.doc-browser { display: block; overflow-x: auto; }
}
.doc-filter input[type=search] { padding: 8px 26px 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff; }
.bulkbar[hidden] { display: none; }
.docs-head > div:first-child { flex: 1; min-width: 0; }
.docs-head h1 { font-size: 22px; line-height: 1.25; }

/* --- v2.6 PASS A: Matters list, matter header/tabs, dashboard (Clio classic parity) --- */
.m-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pill-n { opacity: .75; font-size: 12px; margin-left: 2px; }
.pilltoggle a.on .pill-n { opacity: .9; }
.m-search { position: relative; margin: 0; flex: 1; min-width: 200px; max-width: 360px; }
.m-search input { width: 100%; padding: 8px 26px 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff; }
.fbadge { display: inline-block; margin-left: 4px; background: var(--accent); color: #fff; border-radius: 20px; padding: 0 8px; font-size: 11.5px; font-weight: 600; }
.col-menu, .filter-panel { right: auto; left: 0; }
.col-menu { min-width: 210px; padding: 6px 4px; max-height: 360px; overflow-y: auto; }
.colopt { display: flex; align-items: center; gap: 8px; padding: 5px 12px; font-size: 14px; cursor: pointer; margin: 0; }
.colopt:hover { background: var(--accent-soft); }
.colopt input { width: auto; }
.filter-panel { width: 340px; max-width: 92vw; padding: 6px 14px 12px; max-height: 80vh; overflow-y: auto; }
.filter-panel label { display: block; margin: 9px 0 3px; font-weight: 600; font-size: 12.5px; }
.filter-actions { margin: 12px 0 0; display: flex; gap: 8px; }
.col-hidden { display: none !important; }
table.matter-list { overflow: visible; }
table.matter-list th, table.matter-list td { vertical-align: middle; padding: 8px 10px; }
table.matter-list th .sortlink { color: inherit; white-space: nowrap; }
table.matter-list th .sortlink:hover { color: var(--accent); text-decoration: none; }
table.matter-list .arr { color: var(--accent); font-size: 11px; }
table.matter-list .c-chk { width: 34px; }
table.matter-list .nowrap { white-space: nowrap; }
table.matter-list .c-matter { min-width: 220px; max-width: 340px; }
.mnum { font-weight: 600; }
.mdesc { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
table.matter-list.expanded .mdesc { white-space: normal; overflow: visible; text-overflow: clip; max-width: none; }
.cl-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.cl-info { background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; }
.cl-info:hover { color: var(--accent); }
.cl-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 70; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(13,20,40,.16); padding: 10px 12px; font-size: 13.5px; }
.cl-pop[hidden] { display: none; }
.cl-row { margin-top: 3px; }
.cl-row .muted { display: inline-block; width: 44px; }
.expand-toggle { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; cursor: pointer; }
.expand-toggle input { width: auto; }
.tagchip { display: inline-block; color: #fff; border-radius: 20px; padding: 1px 10px; font-size: 12px; font-weight: 600; margin: 1px 2px 1px 0; }
a.tagchip:hover { text-decoration: none; filter: brightness(1.1); color: #fff; }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.tagopt { display: inline-flex; align-items: center; gap: 5px; font-weight: 400 !important; margin: 0 !important; }
.tagopt input { width: auto; }
.tag-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.tag-form input[type=text] { width: 190px; }
.swatches { display: inline-flex; gap: 4px; }
.sw { display: inline-block; margin: 0 !important; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw span { display: block; width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; }
.sw input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 1px #fff inset; }
/* matter header */
.mh-head { margin-bottom: 4px; align-items: flex-start; }
.mh-title h1 { margin: 0; font-size: 26px; }
.mh-desc { color: var(--muted); font-size: 14px; margin-top: 2px; }
.mh-actions { display: flex; gap: 8px; align-items: center; }
.mh-actions form { margin: 0; }
/* dashboard */
.md-grid { display: grid; grid-template-columns: minmax(0, 62fr) minmax(0, 38fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .md-grid { grid-template-columns: 1fr; } }
.mcard .card-head { margin-bottom: 10px; }
.mcard .card-head h2 { font-size: 16px; }
.card-toggle { background: none; border: 0; cursor: pointer; font-size: 15px; color: var(--muted); padding: 0 4px 0 0; }
.mcard.collapsed .card-body { display: none; }
.fin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 14px; }
@media (max-width: 560px) { .fin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fin-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.fin-label { color: var(--muted); font-size: 12.5px; }
.fin-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-sub { font-size: 12px; }
.fin-cell .btn { margin-top: 4px; }
dl.kv { margin: 0; }
.kvrow { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid #eef1f4; }
.kvrow:last-child { border-bottom: 0; }
.kvrow dt { width: 190px; flex-shrink: 0; color: var(--muted); font-size: 13.5px; }
.kvrow dd { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kvrow { flex-direction: column; gap: 2px; } .kvrow dt { width: auto; } }
h3.sect { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 14px 0 8px; }
h3.sect:first-child { margin-top: 0; }
.ccard { display: flex; gap: 12px; padding: 4px 0 6px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; flex-shrink: 0; }
.cinfo { min-width: 0; font-size: 13.5px; }
.cname { font-weight: 600; font-size: 15px; }
.crow { margin-top: 2px; overflow-wrap: anywhere; }
.crow .muted { display: inline-block; width: 56px; }
.rrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #eef1f4; font-size: 14px; }
.rrow:last-child { border-bottom: 0; }
.tl-day { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 12px 0 4px; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.tl-day:first-child { margin-top: 0; }
.tl-item { display: flex; gap: 9px; align-items: flex-start; padding: 5px 0; font-size: 13.5px; }
.tl-ic { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.tl-ic.tl-t-invoice, .tl-ic.tl-t-payment { background: #e3f3e9; color: var(--ok); }
.tl-ic.tl-t-task { background: #fdf1e2; color: var(--warn); }
.tl-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tl-time { font-size: 12px; white-space: nowrap; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid #eef1f4; font-size: 13.5px; }
.mini-row:last-child { border-bottom: 0; }
.card-head > a.muted { font-size: 13px; }
body:has(#matters-table) .content { max-width: none; }
table.matter-list th { padding: 8px 8px; font-size: 11.5px; }
table.matter-list th .sortlink { white-space: normal; }
table.matter-list td { font-size: 14px; padding: 8px 8px; }
table.matter-list .col-actions .btn { white-space: nowrap; }
table.matter-list td, table.matter-list th { font-size: 13px; }
table.matter-list th { font-size: 11px; }
table.matter-list .c-matter { min-width: 170px; max-width: 250px; }
.mdesc { max-width: 240px; }
table.matter-list .nowrap { font-size: 12.5px; }
body:has(#matters-table) .content { padding: 22px 18px; }
table.matter-list td, table.matter-list th { padding-left: 6px; padding-right: 6px; }
.filter-panel { left: auto; right: 0; }
@media (max-width: 800px) { .filter-panel, .col-menu { position: fixed; left: 8px; right: 8px; top: 120px; width: auto; } }

/* v2.6 — matter tab bar in Clio classic style: flat text tabs, underline on the active one */
#matter-tabs.mtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0; margin: 4px 0 16px; overflow-x: auto; }
#matter-tabs.mtabs a { background: transparent; border: 0; border-radius: 0; padding: 10px 12px 9px; color: var(--muted, #5b6472);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
#matter-tabs.mtabs a:hover { color: var(--accent); background: transparent; }
#matter-tabs.mtabs a.on { background: transparent; color: var(--accent); border-bottom-color: var(--accent); }

/* ===== v2.15.1 Documents keyword filter: text excerpts ===== */
.dsnip { font-size: 12.5px; color: var(--muted); margin-top: 2px; max-width: 70ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsnip mark { background: #fbeec9; color: inherit; padding: 0 1px; border-radius: 2px; }
