/* Lawyer / Paralegal dashboard */
.ld-page {
  --ld-ink: #0f1724;
  --ld-txt: #1c2430;
  --ld-muted: #5b6778;
  --ld-faint: #8b97a8;
  --ld-line: rgba(15, 23, 36, 0.08);
  --ld-line-2: rgba(15, 23, 36, 0.14);
  --ld-paper: #ffffff;
  --ld-wash: #f4f7fb;
  --ld-blue: #1467c7;
  --ld-blue-deep: #0b4f9e;
  --ld-sky: #e8f1fc;
  --ld-green: #1a7f4b;
  --ld-green-soft: #e5f6ee;
  --ld-amber: #b86a12;
  --ld-amber-soft: #fdf3e3;
  --ld-red: #c0392b;
  --ld-red-soft: #fdecea;
  --ld-purple: #5b3cc4;
  --ld-shadow: 0 10px 28px rgba(15, 23, 36, 0.07);
  --ld-shadow-sm: 0 4px 14px rgba(15, 23, 36, 0.05);
  color: var(--ld-txt);
  padding: 18px 8px 36px;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(20, 103, 199, 0.14), transparent 60%),
    radial-gradient(700px 360px at 92% 0%, rgba(26, 127, 75, 0.08), transparent 55%),
    linear-gradient(180deg, #f7fafd 0%, #eef3f9 100%);
  min-height: calc(100vh - 120px);
  animation: ld-fade-in 0.45s ease both;
}

@keyframes ld-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.ld-hero {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
  padding: 22px 22px 16px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(232, 241, 252, 0.88));
  border: 0.5px solid rgba(20, 103, 199, 0.12);
  box-shadow: var(--ld-shadow-sm);
  position: relative;
  overflow: hidden;
}

.ld-hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.ld-hero::before {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 103, 199, 0.16), transparent 70%);
  pointer-events: none;
}

.ld-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ld-blue);
  margin-bottom: 6px;
  opacity: 0.85;
}

.ld-hero h1 {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.035em;
  margin: 0 0 6px;
  color: var(--ld-ink);
  background: linear-gradient(120deg, #0858a8, #2888d8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ld-hero p {
  margin: 0;
  color: var(--ld-muted);
  font-size: 14px;
  max-width: 640px;
  line-height: 1.45;
}

.ld-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.ld-hero-ai {
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 0.5px solid rgba(20, 103, 199, 0.14);
  position: relative;
  z-index: 1;
}

.ld-hero-ai-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #6d4bd8;
  letter-spacing: -0.01em;
}

.ld-hero-ai-head i {
  font-size: 16px;
}

.ld-hero-ai-head-note {
  font-size: 11px;
  font-weight: 500;
  color: var(--ld-muted);
  margin-left: 4px;
}

@media (max-width: 720px) {
  .ld-hero-ai-head {
    flex-wrap: wrap;
  }

  .ld-hero-ai-head-note {
    flex: 1 1 100%;
    margin: 2px 0 0 24px;
  }
}

.ld-hero-ai-bar {
  display: flex;
  gap: 8px;
  align-items: stretch;
  max-width: 720px;
}

.ld-hero-ai-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 0.5px solid rgba(20, 103, 199, 0.22);
  background: #fff;
  font-size: 14px;
  color: var(--ld-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}

.ld-hero-ai-input[type="search"]::-webkit-search-decoration,
.ld-hero-ai-input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.ld-hero-ai-input:focus {
  outline: none;
  border-color: rgba(109, 75, 216, 0.55);
  box-shadow: 0 0 0 3px rgba(109, 75, 216, 0.12);
}

.ld-hero-ai-input::placeholder {
  color: #94a3b8;
}

.ld-hero-ai-mic {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  border: 0.5px solid rgba(20, 103, 199, 0.22);
  background: #fff;
  color: var(--ld-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.ld-hero-ai-mic i {
  font-size: 18px;
}

.ld-hero-ai-mic:hover {
  border-color: rgba(20, 103, 199, 0.4);
  color: var(--ld-blue);
}

.ld-hero-ai-mic.on {
  background: #fdecec;
  border-color: #f3c9c7;
  color: #e0443e;
  animation: ld-mic-pulse 1.2s ease-in-out infinite;
}

@keyframes ld-mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(224, 68, 62, 0.25);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(224, 68, 62, 0.12);
  }
}

.ld-hero-ai-speech-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ld-muted);
  max-width: 720px;
}

.ld-hero-ai-send {
  flex-shrink: 0;
  height: 42px;
  padding-left: 18px;
  padding-right: 18px;
}

.ld-hero-ai-try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.4;
}

.ld-hero-ai-suggest-label {
  color: var(--ld-muted);
  font-weight: 600;
}

.ld-hero-ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 0.5px solid rgba(91, 60, 196, 0.28);
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  color: #5b3cc4;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.ld-hero-ai-chip i {
  font-size: 14px;
  opacity: 0.9;
}

.ld-hero-ai-chip:hover {
  background: #f7f4ff;
  border-color: rgba(109, 75, 216, 0.45);
}

.ld-hero-ai-chip-secondary {
  border-color: rgba(20, 103, 199, 0.28);
  color: var(--ld-blue);
  text-decoration: none;
}

.ld-hero-ai-chip-secondary:hover {
  background: rgba(20, 103, 199, 0.06);
  border-color: rgba(20, 103, 199, 0.45);
  color: #0858a8;
}

@media (max-width: 640px) {
  .ld-hero-ai-bar {
    flex-direction: column;
    max-width: none;
  }

  .ld-hero-ai-send {
    width: 100%;
  }
}

.ld-btn {
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 0.5px solid var(--ld-line-2);
  background: var(--ld-paper);
  color: var(--ld-txt);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 36, 0.04);
}

.ld-btn:hover { border-color: var(--ld-blue); color: var(--ld-blue); transform: translateY(-1px); }

.ld-btn.primary {
  background: linear-gradient(135deg, var(--ld-blue), var(--ld-blue-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 103, 199, 0.28);
}

.ld-btn.primary:hover { filter: brightness(1.05); color: #fff; }

.ld-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.ld-page .ld-stats:has(.ld-stat:nth-child(5):last-child) {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ld-stat {
  background: var(--ld-paper);
  border: 0.5px solid var(--ld-line);
  border-radius: 16px;
  padding: 14px 14px 12px;
  cursor: pointer;
  min-height: 98px;
  transition: 0.16s ease;
  box-shadow: var(--ld-shadow-sm);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.ld-stat:hover {
  border-color: rgba(20, 103, 199, 0.28);
  transform: translateY(-2px);
  box-shadow: var(--ld-shadow);
}

.ld-stat.on { box-shadow: 0 0 0 3px rgba(20, 103, 199, 0.14), var(--ld-shadow-sm); border-color: var(--ld-blue); }

.ld-stat-ic {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--ld-sky);
  color: var(--ld-blue-deep);
  font-size: 17px;
}

.ld-stat .n {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ld-ink);
}

.ld-stat .l {
  margin-top: 5px;
  font-size: 12px;
  color: var(--ld-muted);
  font-weight: 650;
}

.ld-stat .h {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ld-faint);
}

.ld-stat.overdue { background: var(--ld-paper); }
.ld-stat.overdue .n, .ld-stat.overdue .l { color: var(--ld-red); }
.ld-stat.overdue .ld-stat-ic { background: var(--ld-wash); color: var(--ld-red); }

.ld-stat.today { background: var(--ld-paper); }
.ld-stat.today .n { color: var(--ld-amber); }
.ld-stat.today .ld-stat-ic { background: var(--ld-wash); color: var(--ld-amber); }

.ld-stat.unpaid .ld-stat-ic { background: #f3e8ff; color: var(--ld-purple); }
.ld-stat.unpaid .n { color: var(--ld-purple); }

.ld-grid {
  --ld-queue-h: min(520px, calc(100vh - 220px));
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}

.ld-grid > * {
  min-height: 0;
}

/* Client work / work queue — fixed panel height, scroll the list */
.ld-card.ld-queue-card {
  display: flex;
  flex-direction: column;
  height: var(--ld-queue-h);
  max-height: var(--ld-queue-h);
  overflow: hidden;
}

.ld-queue-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ld-queue-scroll::-webkit-scrollbar,
.ld-side-scroll::-webkit-scrollbar {
  width: 6px;
}

.ld-queue-scroll::-webkit-scrollbar-thumb,
.ld-side-scroll::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 36, 0.18);
  border-radius: 999px;
}

.ld-queue-scroll::-webkit-scrollbar-track,
.ld-side-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.ld-grid-side {
  height: var(--ld-queue-h);
  max-height: var(--ld-queue-h);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ld-card.ld-side-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ld-side-section {
  flex-shrink: 0;
}

.ld-side-section.grow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ld-side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.ld-side-section + .ld-side-section {
  border-top: 0.5px solid var(--ld-line);
}

.ld-grid-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.ld-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.ld-widgets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.ld-card {
  background: var(--ld-paper);
  border: 0.5px solid var(--ld-line);
  border-radius: 16px;
  overflow: hidden;
  min-height: 0;
  box-shadow: var(--ld-shadow-sm);
}

.ld-chart-card .ld-chart-body {
  padding: 0 8px 8px;
  min-height: 300px;
}

.ld-chart-meta {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ld-faint);
}

.ld-donut-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(160px, 0.9fr);
  gap: 8px;
  align-items: center;
  padding: 4px 14px 16px !important;
}

.ld-donut-chart {
  position: relative;
  min-height: 280px;
}

.ld-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}

.ld-donut-center .n {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--ld-ink);
  line-height: 1;
}

.ld-donut-center .l {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ld-faint);
}

.ld-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow: auto;
}

.ld-donut-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 9px;
}

.ld-donut-legend li:hover {
  background: var(--ld-wash);
}

.ld-donut-legend .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.ld-donut-legend .lb {
  font-size: 12px;
  font-weight: 650;
  color: var(--ld-txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ld-donut-legend .vl {
  font-size: 12px;
  font-weight: 750;
  color: var(--ld-ink);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .ld-donut-wrap {
    grid-template-columns: 1fr;
  }
}

.ld-card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  background: linear-gradient(180deg, rgba(232, 241, 252, 0.55), transparent 85%);
}

.ld-card-h h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ld-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ld-card-h h2 i { font-size: 16px; color: var(--ld-blue); }

.ld-link {
  border: 0;
  background: none;
  color: var(--ld-blue);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
}

.ld-tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
  flex-wrap: wrap;
}

.ld-tab {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 0.5px solid transparent;
  background: transparent;
  color: var(--ld-muted);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ld-tab .cnt {
  font-size: 10.5px;
  background: var(--ld-wash);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--ld-muted);
}

.ld-tab.on {
  background: var(--ld-sky);
  color: var(--ld-blue-deep);
  border-color: rgba(20, 103, 199, 0.18);
}

.ld-tab.on .cnt { background: #fff; color: var(--ld-blue-deep); }

.ld-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-top: 0.5px solid var(--ld-line);
  cursor: pointer;
  transition: background 0.12s ease;
}

.ld-row:hover { background: var(--ld-wash); }

.ld-date {
  width: 44px;
  flex-shrink: 0;
  text-align: center;
  border-radius: 10px;
  padding: 6px 0 5px;
  background: var(--ld-wash);
  border: 0.5px solid var(--ld-line);
}

.ld-date .d { display: block; font-size: 15px; font-weight: 750; line-height: 1; }
.ld-date .m { display: block; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; color: var(--ld-faint); margin-top: 3px; }
.ld-date.overdue { background: var(--ld-paper); border-color: var(--ld-line); color: var(--ld-red); }
.ld-date.overdue .m { color: var(--ld-red); }
.ld-date.today { background: var(--ld-amber-soft); border-color: transparent; color: var(--ld-amber); }
.ld-date.today .m { color: var(--ld-amber); }

.ld-row-main { min-width: 0; flex: 1; }
.ld-row-title { font-size: 13.5px; font-weight: 650; color: var(--ld-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-row-sub { font-size: 12px; color: var(--ld-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ld-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.3;
}

.ld-pill.overdue { background: var(--ld-paper); color: var(--ld-red); border: 0.5px solid rgba(192, 57, 43, 0.28); }
.ld-pill.today { background: var(--ld-amber-soft); color: var(--ld-amber); }
.ld-pill.soon { background: var(--ld-sky); color: var(--ld-blue-deep); }
.ld-pill.task { background: #efeafc; color: var(--ld-purple); }
.ld-pill.ok { background: var(--ld-green-soft); color: var(--ld-green); }
.ld-pill.muted { background: var(--ld-wash); color: var(--ld-muted); }

.ld-empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--ld-muted);
}

.ld-empty i { font-size: 22px; color: var(--ld-green); display: block; margin-bottom: 8px; }
.ld-empty p { margin: 0 0 12px; font-size: 13.5px; }

.ld-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 0 14px 14px;
}

.ld-day {
  border: 0.5px solid var(--ld-line);
  border-radius: 10px;
  padding: 8px 4px 7px;
  text-align: center;
  background: var(--ld-wash);
  transition: 0.12s ease;
}

.ld-day.on {
  background: linear-gradient(160deg, var(--ld-blue), var(--ld-blue-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 16px rgba(20, 103, 199, 0.28);
}
.ld-day.on .w,
.ld-day.on .n,
.ld-day.on .c { color: #fff; }
.ld-day .w { font-size: 10px; font-weight: 700; color: var(--ld-faint); text-transform: uppercase; }
.ld-day .n { font-size: 14px; font-weight: 750; margin-top: 2px; }
.ld-day .c { font-size: 10px; color: var(--ld-muted); margin-top: 3px; min-height: 14px; }
.ld-day.has .c { color: var(--ld-blue); font-weight: 700; }
.ld-day.on.has .c { color: rgba(255, 255, 255, 0.9); }

.ld-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px;
}

.ld-act {
  border: 0.5px solid var(--ld-line);
  background: var(--ld-wash);
  border-radius: 11px;
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ld-txt);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.12s ease;
}

.ld-act i { color: var(--ld-blue); font-size: 15px; }
.ld-act:hover { background: #fff; border-color: var(--ld-blue); transform: translateY(-1px); }

.ld-remind {
  padding: 0 6px 8px;
}

.ld-rem {
  display: flex;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.ld-rem:hover { background: var(--ld-wash); }
.ld-rem-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ld-blue); margin-top: 6px; flex-shrink: 0; }
.ld-rem-title { font-size: 13px; font-weight: 650; }
.ld-rem-sub { font-size: 12px; color: var(--ld-muted); }

.ld-fav {
  padding: 12px 16px;
  border-top: 0.5px solid var(--ld-line);
  cursor: pointer;
}
.ld-fav:hover { background: var(--ld-wash); }
.ld-fav-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.ld-fav-title { font-size: 13.5px; font-weight: 650; color: var(--ld-ink); }
.ld-fav-sub { font-size: 12px; color: var(--ld-muted); margin-top: 2px; }

.ld-activity { padding: 0 4px 8px; max-height: 280px; overflow: auto; }
.ld-act-row {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.ld-act-row:hover { background: var(--ld-wash); }
.ld-act-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--ld-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ld-act-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ld-faint);
}
.ld-act-ref { color: var(--ld-blue); font-weight: 650; }

.ld-invoice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 8px;
}
.ld-inv-tile {
  background: var(--ld-wash);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}
.ld-inv-tile .n {
  font-size: 16px;
  font-weight: 750;
  color: var(--ld-ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
  word-break: break-word;
}
.ld-inv-tile .l {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ld-muted);
}
.ld-inv-tile.unpaid .n { color: var(--ld-red); }
.ld-inv-tile.paid .n { color: var(--ld-green); }

.ld-matter.ld-matter-portal {
  grid-template-columns: 120px minmax(0, 1fr) 120px;
}

.ld-mini-bars {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ld-mini-bar-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
}

.ld-mini-bar-row .lb {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ld-muted);
}

.ld-mini-bar-row .track {
  height: 7px;
  background: var(--ld-wash);
  border-radius: 99px;
  overflow: hidden;
}

.ld-mini-bar-row .track > span {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.ld-mini-bar-row .vl {
  font-size: 12px;
  font-weight: 750;
  text-align: right;
  color: var(--ld-ink);
  font-variant-numeric: tabular-nums;
}

.ld-matter {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 160px 110px;
  gap: 12px;
  align-items: center;
  padding: 11px 16px;
  border-top: 0.5px solid var(--ld-line);
  cursor: pointer;
}

.ld-matter:hover { background: var(--ld-wash); }
.ld-ref {
  font-size: 12px;
  font-weight: 750;
  color: var(--ld-blue-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ld-matter-title { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-matter-sub { font-size: 12px; color: var(--ld-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-prog-wrap {
  display: grid;
  grid-template-columns: 1fr 40px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.ld-prog {
  height: 6px;
  background: var(--ld-wash);
  border-radius: 99px;
  overflow: hidden;
  min-width: 0;
}
.ld-prog > span { display: block; height: 100%; background: linear-gradient(90deg, var(--ld-blue), #4ea3e0); border-radius: 99px; }
.ld-prog-n {
  font-size: 12px;
  font-weight: 700;
  color: var(--ld-txt);
  width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ld-matter-status {
  justify-self: stretch;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

.ld-matter-status .ld-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ld-metric {
  padding: 12px 16px 4px;
}

.ld-metric + .ld-metric { border-top: 0.5px solid var(--ld-line); }
.ld-metric-h { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.ld-metric-h span { color: var(--ld-muted); font-weight: 600; font-size: 12.5px; }
.ld-metric .bar { height: 8px; background: var(--ld-wash); border-radius: 99px; overflow: hidden; }
.ld-metric .bar > span { display: block; height: 100%; border-radius: 99px; }
.ld-metric .hint { margin: 7px 0 8px; font-size: 12px; color: var(--ld-faint); }

.ld-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 0.5px solid var(--ld-line);
  background: var(--ld-paper);
  box-shadow: var(--ld-shadow-sm);
  animation: ld-fade-in 0.5s ease 0.08s both;
}

.ld-alert strong { display: block; font-size: 13.5px; color: var(--ld-red); }
.ld-alert span { font-size: 12.5px; color: var(--ld-muted); }

.ld-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ld-docgrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px;
}

.ld-docstat {
  background: var(--ld-wash);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.ld-docstat .n { font-size: 20px; font-weight: 750; line-height: 1; }
.ld-docstat .l { font-size: 11px; color: var(--ld-muted); margin-top: 5px; font-weight: 650; }
.ld-docstat.ok .n { color: var(--ld-green); }
.ld-docstat.wait .n { color: var(--ld-amber); }
.ld-docstat.bad .n { color: var(--ld-red); }

@media (max-width: 1200px) {
  .ld-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ld-widgets { grid-template-columns: 1fr; }
  .ld-charts { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .ld-grid, .ld-grid-bottom { grid-template-columns: 1fr; }
  .ld-matter { grid-template-columns: 100px minmax(0, 1fr) 110px; }
  .ld-matter .ld-prog-wrap { display: none; }
}

@media (max-width: 640px) {
  .ld-stats { grid-template-columns: 1fr 1fr; }
  .ld-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ld-hero { padding: 16px; }
  .ld-hero h1 { font-size: 22px; }
}

.dark-mode .ld-page {
  --ld-ink: #f3f6fb;
  --ld-txt: #e6ebf3;
  --ld-muted: #b7c0cc;
  --ld-faint: #8b97a8;
  --ld-line: rgba(255, 255, 255, 0.08);
  --ld-line-2: rgba(255, 255, 255, 0.16);
  --ld-paper: #1b2230;
  --ld-wash: #151b27;
  --ld-sky: #1d2d45;
  --ld-green: #6bcf97;
  --ld-green-soft: rgba(107, 207, 151, 0.14);
  --ld-amber: #e0a54b;
  --ld-amber-soft: rgba(224, 165, 75, 0.16);
  --ld-red: #e57373;
  --ld-red-soft: rgba(229, 115, 115, 0.16);
  --ld-blue: #4ea3e0;
  --ld-blue-deep: #7ec2f0;
  --ld-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --ld-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(78, 163, 224, 0.12), transparent 60%),
    linear-gradient(180deg, #121820 0%, #0f141c 100%);
}

.dark-mode .ld-hero {
  background: linear-gradient(135deg, rgba(27, 34, 48, 0.95), rgba(29, 45, 69, 0.7));
  border-color: rgba(78, 163, 224, 0.18);
}

.dark-mode .ld-hero h1 {
  background: linear-gradient(120deg, #7ec2f0, #4ea3e0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dark-mode .ld-card-h {
  background: linear-gradient(180deg, rgba(29, 45, 69, 0.45), transparent 85%);
}

.dark-mode .ld-stat.overdue {
  background: var(--ld-paper);
  border-color: var(--ld-line);
}

.dark-mode .ld-stat.today {
  background: var(--ld-paper);
  border-color: var(--ld-line);
}

.dark-mode .ld-stat.on {
  box-shadow: 0 0 0 3px rgba(78, 163, 224, 0.18);
}

.dark-mode .ld-btn {
  background: var(--ld-paper);
  color: var(--ld-txt);
}

.dark-mode .ld-btn.primary {
  background: linear-gradient(135deg, var(--ld-blue), #2f7ab8);
  border-color: transparent;
  color: #0f1724;
}

.dark-mode .ld-alert {
  background: var(--ld-paper);
  border-color: var(--ld-line);
}

.dark-mode .ld-pill.overdue {
  background: var(--ld-paper);
}

.dark-mode .ld-date.overdue {
  background: var(--ld-paper);
}

.dark-mode .ld-act {
  background: var(--ld-wash);
  color: var(--ld-txt);
}

.dark-mode .ld-day.on {
  background: linear-gradient(160deg, #2f7ab8, #1d5f96);
}
