:root {
  --ink: #182433;
  --navy: #22364f;
  --paper: #f7f4ee;
  --panel: #fffdf8;
  --gold: #b8924b;
  --gold-dark: #84652f;
  --line: #ddd5c7;
  --danger: #9f2f2f;
  --muted: #687485;
  --font-body: "Segoe UI", Arial, Helvetica, sans-serif;
  --font-display: Cambria, Georgia, "Times New Roman", serif;
  --font-ui: "Segoe UI", Arial, Helvetica, sans-serif;
}

html {
  font-size: 15px;
}

* { box-sizing: border-box; }
body.legal-shell {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  line-height: 1.45;
}

body.legal-shell h1,
body.legal-shell h2,
body.legal-shell h3,
.nl-brand-name,
.nl-banner-title,
.dashboard-hero h1,
.page-title h1 {
  font-family: var(--font-display);
}

body.legal-shell input,
body.legal-shell select,
body.legal-shell textarea,
body.legal-shell button,
.btn,
.form-control,
.form-select,
.legal-table,
.nl-table,
.dt-container,
.swal2-popup,
.note-editor {
  font-family: var(--font-ui);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: clamp(218px, 18vw, 292px) minmax(0, 1fr);
  background: #fbfaf6;
}

.nl-sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 22px;
  background: #efe7df;
  border-right: 1px solid #ddd2c2;
}

.nl-brand {
  display: block;
  padding: 6px 2px 12px;
  border-bottom: 1px solid #d8cdbd;
  color: #1c2a52;
  text-decoration: none;
  text-align: center;
}

.nl-brand:hover { color: #1c2a52; }

.nl-brand img {
  width: min(210px, 100%);
  max-height: 190px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.nl-brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #1c2a52;
  color: #c9a24b;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: 0;
}

.nl-brand-name {
  font-size: 1.58rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.nl-brand-sub {
  margin: 28px 4px 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid #d8cdbd;
  color: #8a7a5f;
  font-family: Arial, Helvetica, sans-serif;
}

.nl-brand-sub p {
  margin: 0 0 4px;
  line-height: 1.25;
}

.nl-nav {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.nl-nav-group {
  display: grid;
  gap: 6px;
}

.nl-nav-group .nl-nav-item {
  margin: 0;
}

.nl-subnav-chevron {
  margin-left: auto;
  font-size: .8rem;
  transition: transform .16s ease;
}

.nl-nav-group.open .nl-subnav-chevron {
  transform: rotate(90deg);
}

.nl-court-toggle.active .nl-subnav-chevron {
  transform: rotate(180deg);
}

.nl-nav-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #453b2b;
  text-decoration: none;
  font: 600 1.08rem/1.15 var(--font-ui);
  text-align: left;
}

.nl-nav-item:hover {
  background: rgba(28, 42, 82, .08);
  color: #1c2a52;
}

.nl-nav-item.active {
  background: #1c2a52;
  color: #fff;
}

.nl-nav-item .fa-solid,
.nl-admin-subnav .fa-solid {
  color: #a08a42;
}

.nl-nav-item.active .fa-solid {
  color: #c9a24b;
}

.nl-nav-icon,
.nl-search-icon,
.nl-square {
  width: 18px;
  height: 18px;
  display: inline-block;
  border: 3px solid #a08a42;
  border-radius: 2px;
  flex: 0 0 auto;
}

.nl-nav-item.active .nl-nav-icon { border-color: #c9a24b; }

.nl-sidebar-bottom {
  margin-top: auto;
  padding-top: 28px;
  border-top: 1px solid #d8cdbd;
}

.nl-admin-toggle {
  cursor: pointer;
}

.nl-admin-chevron {
  margin-left: auto;
  transition: transform .18s ease;
}

.nl-admin-toggle.active .nl-admin-chevron {
  transform: rotate(180deg);
}

.nl-admin-subnav {
  display: none;
  margin: -4px 0 4px 36px;
  padding: 8px 0 8px 14px;
  border-left: 1px solid #d8cdbd;
}

.nl-admin-subnav.open {
  display: grid;
  gap: 6px;
}

.nl-admin-subnav a {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #453b2b;
  text-decoration: none;
  font: 700 .88rem/1.1 var(--font-ui);
}

.nl-admin-subnav a:hover,
.nl-admin-subnav a.active {
  background: rgba(28, 42, 82, .09);
  color: #1c2a52;
}

.nl-hover-subnav {
  display: none;
  margin: -2px 0 4px 36px;
  padding: 8px 0 8px 14px;
  border-left: 1px solid #d8cdbd;
}

.nl-nav-group.open .nl-hover-subnav {
  display: grid;
  gap: 6px;
}

.nl-hover-subnav a {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #453b2b;
  text-decoration: none;
  font: 700 .88rem/1.1 var(--font-ui);
}

.nl-hover-subnav a:hover,
.nl-hover-subnav a.active {
  background: rgba(28, 42, 82, .09);
  color: #1c2a52;
}

.nl-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.nl-topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 36px;
  border-bottom: 1px solid #ece7d8;
  background: #fbfaf6;
}

.nl-search {
  width: min(500px, 48vw);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: 10px;
  background: #f3f0e7;
}

.nl-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #3a3628;
  font: 600 1rem/1 var(--font-ui);
}

.nl-search input::placeholder { color: #8a8365; }
.nl-topbar-spacer { flex: 1; }

.mobile-menu-toggle,
.mobile-sidebar-backdrop {
  display: none;
}

.nl-user-profile {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #3a3628;
  text-decoration: none;
  font: 700 1.05rem/1.1 var(--font-ui);
}

.nl-user-profile:hover { color: #1c2a52; }

.nl-user-chip {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #1c2a52;
  color: #c9a24b;
  font-weight: 800;
}

.nl-pill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border: 1px solid #ddd2c2;
  border-radius: 12px;
  background: #fffdf8;
  color: #8a8365;
  text-decoration: none;
  font: 700 .92rem/1 var(--font-ui);
}

.nl-pill:hover {
  border-color: #c9a24b;
  color: #1c2a52;
}

.nl-content {
  width: 100%;
  max-width: none;
  padding: 34px 36px;
}

.live-presence-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 42px;
  padding: 14px 18px;
  border: 1px solid #e1d6c7;
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: #fffdf8;
  box-shadow: 0 10px 22px rgba(24, 36, 51, .04);
}

.live-presence-heading {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  color: var(--navy);
  font: 700 .95rem/1.2 Arial, Helvetica, sans-serif;
}

.live-presence-heading i {
  color: var(--gold);
}

.live-presence-heading span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .82rem;
}

.live-presence-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.live-viewer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 330px;
  padding: 7px 10px;
  border: 1px solid #e7decf;
  border-radius: 999px;
  background: #f8f3ea;
  color: var(--ink);
  font: 700 .86rem/1.1 Arial, Helvetica, sans-serif;
}

.live-viewer-chip img,
.live-viewer-initials {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.live-viewer-chip img {
  object-fit: cover;
}

.live-viewer-initials {
  display: inline-grid;
  place-items: center;
  background: var(--navy);
  color: var(--gold);
  font-size: .72rem;
}

.live-viewer-chip small {
  display: block;
  color: var(--muted);
  font-size: .74rem;
}

.row-view-value {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.status-pill.role {
  border-color: #e8dcc9;
  background: #f8f3ea;
  color: var(--navy);
}

.nl-banner {
  min-height: 142px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
  padding: 28px 36px;
  border: 1px solid #ece7d8;
  border-radius: 16px;
  background: #fffdf8;
}

.nl-banner.compact { min-height: auto; }

.nl-banner-title {
  margin: 0;
  color: #1c2a52;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.05;
}

.nl-banner-sub {
  margin: 10px 0 0;
  color: #6f6b5d;
  font: 600 1.05rem/1.25 var(--font-ui);
}

.nl-btn-primary {
  min-width: 168px;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #1c2a52;
  color: #fff;
  text-decoration: none;
  font: 800 1.02rem/1 var(--font-ui);
}

.nl-btn-primary:hover { background: #142141; color: #fff; }

.nl-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.nl-stat-card {
  min-height: 128px;
  padding: 22px;
  border: 1px solid #ece7d8;
  border-radius: 14px;
  background: #fffdf8;
  text-align: left;
}

.nl-stat-button {
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.nl-stat-button:hover {
  border-color: #c9a24b;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(28, 42, 82, .08);
}

.nl-stat-label {
  margin: 0 0 20px;
  color: #8a8365;
  font: 700 .94rem/1.16 var(--font-ui);
}

.nl-stat-value {
  margin: 0;
  color: #1c2a52;
  font: 800 2.05rem/1 var(--font-ui);
}

.nl-stat-danger {
  border-color: #ecc9c9;
  background: #fdf3f3;
}

.nl-stat-danger .nl-stat-label,
.nl-stat-danger .nl-stat-value {
  color: #7a2020;
}

.nl-section-card {
  margin-bottom: 26px;
  padding: 24px 28px;
  border: 1px solid #ece7d8;
  border-radius: 14px;
  background: #fffdf8;
}

.nl-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.nl-section-title h2 {
  margin: 0;
  color: #3a3628;
  font: 800 1.15rem/1.1 var(--font-ui);
}

.nl-table {
  width: 100%;
  border-collapse: collapse;
  color: #3a3628;
  font-family: var(--font-ui);
}

.nl-table th {
  padding: 13px 16px;
  background: #1c2a52;
  color: #fff;
  font-weight: 800;
  border: 1px solid #ece7d8;
}

.nl-table td {
  padding: 14px 16px;
  border: 1px solid #ece7d8;
  background: #fffdf8;
  vertical-align: middle;
  font-size: .94rem;
}

.nl-table td span {
  display: block;
  color: #6f6b5d;
}

.nl-cell-ref a {
  display: block;
  color: #857214;
  font-weight: 800;
  text-decoration: none;
}

.nl-cell-ref a:hover { text-decoration: underline; }
.nl-cell-danger { color: #8f2424 !important; font-weight: 800; }
.nl-empty { color: #8a8365; text-align: center; }

.legal-modal {
  background: #fffdf8;
  border: 1px solid #ece7d8;
}

.legal-modal .modal-title {
  color: #1c2a52;
  font-size: 1.35rem;
  font-weight: 800;
}

.modal-dialog-scrollable .legal-modal .modal-body {
  overflow-y: auto;
}

.legal-modal .note-editor {
  max-height: 330px;
  overflow: hidden;
}

.task-modal-dialog {
  max-width: min(1180px, calc(100vw - 34px));
}

.task-create-modal .modal-header {
  align-items: flex-start;
}

.task-create-modal .modal-header .muted {
  margin: 6px 0 0;
  font: 700 .88rem/1.3 Arial, Helvetica, sans-serif;
}

.task-modal-grid {
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(360px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.task-modal-fields,
.task-modal-notes,
.task-quick-attachments {
  min-width: 0;
}

.task-modal-fields {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #eee6d7;
  border-radius: 10px;
  background: #fffaf1;
}

.task-modal-notes {
  display: grid;
  gap: 14px;
}

.task-modal-notes .note-editor {
  min-height: 230px;
}

.task-quick-attachments {
  padding: 12px;
  border: 1px solid #eee6d7;
  border-radius: 10px;
  background: #fffdf8;
}

.court-billing-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

input[type="date"],
input[type="datetime-local"],
input[type="time"] {
  cursor: pointer;
}

.stat-modal-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stat-filter {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #ddd2c2;
  border-radius: 999px;
  background: #fffdf8;
  color: #453b2b;
  font-weight: 700;
}

.stat-filter.active {
  border-color: #1c2a52;
  background: #1c2a52;
  color: #fff;
}

.court-diary-heading-row {
  align-items: flex-start;
  gap: 16px;
}

.court-diary-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-left: auto;
}

.court-diary-filter-bar .stat-filter {
  text-decoration: none;
}

.court-diary-table {
  min-width: 1180px;
}

.court-diary-ref,
.court-diary-followup {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font: 800 .74rem/1.25 Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.court-diary-ref {
  color: var(--gold-dark);
}

.court-diary-followup {
  text-transform: none;
  letter-spacing: 0;
}

.court-reference-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #eadfcb;
  border-radius: 8px;
  background: #fffaf1;
}

.court-reference-strip span {
  color: var(--muted);
  font: 800 .74rem/1 Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}

.court-reference-strip strong {
  color: var(--navy);
  font-size: 1.05rem;
}

.court-reference-strip em {
  color: var(--muted);
  font-style: normal;
}

.court-diary-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .82rem;
}

.court-diary-status.upcoming {
  background: #edf3f8;
  color: #1f3a59;
}

.court-diary-status.attended {
  background: #e9f6ee;
  color: #1f6b3b;
}

.court-note-cell {
  min-width: 260px;
  max-width: 380px;
}

.court-note-block + .court-note-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eee4d4;
}

.court-note-label {
  display: block;
  margin-bottom: 5px;
  color: #6b7890;
  font: 800 .72rem/1 Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}

.rich-content.compact p {
  margin: 0 0 6px;
}

.empty-table-message {
  padding: 22px;
  color: #6b7890;
  text-align: center;
}

.filter-count {
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f0ebe0;
  color: var(--navy);
  font: 800 .84rem/1 Arial, Helvetica, sans-serif;
}

.stat-filter.active .filter-count {
  background: #c9a24b;
  color: #fff;
}

.stat-panel { display: none; }
.stat-panel.active { display: block; overflow-x: auto; }

.inline-panel {
  display: none;
  overflow-x: auto;
}

.inline-panel.active {
  display: block;
}

.dashboard-inline-filters {
  margin: 0 0 0 auto;
}

.landing-alert {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: 10px;
  font: 700 1rem/1.35 Arial, Helvetica, sans-serif;
}

.landing-alert.success {
  border: 1px solid #9bc9a0;
  background: #eef9ef;
  color: #246b2f;
}

.legal-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(24, 36, 51, .06);
}
.legal-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--navy); }
.legal-brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: transparent;
  border-radius: 10px;
}
.nav-link { color: var(--navy); font-weight: 600; }
.legal-userbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.legal-userbar span { color: var(--navy); font-weight: 700; }
.topbar-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  text-decoration: none;
}
.topbar-profile-link:hover { color: var(--gold-dark); }
.notification-icon-button {
  position: relative;
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f5d78a, var(--gold) 58%, var(--gold-dark));
  color: #fff;
  font-size: 1.12rem;
  box-shadow: 0 0 0 4px rgba(184, 146, 75, .16), 0 10px 22px rgba(34, 54, 79, .2);
  animation: notificationPulse 2.2s ease-in-out infinite;
}
.notification-icon-button span:first-child {
  font-size: 0;
}
.notification-icon-button span:first-child::before {
  content: "\1F514";
  font-size: 1.12rem;
}
.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff !important;
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
  border: 2px solid #fff;
  font-size: .72rem;
  font-weight: 700;
}
@keyframes notificationPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}
.notification-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1050;
  width: min(430px, 100vw);
  height: 100vh;
  padding: 22px;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 36px rgba(24, 36, 51, .18);
  transform: translateX(104%);
  transition: transform .22s ease;
}
.notification-drawer.open { transform: translateX(0); }
.notification-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.notification-drawer-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.35rem;
}
.notification-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
}
.notification-list {
  display: grid;
  gap: 10px;
}
.notification-item {
  position: relative;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fff;
}
.notification-item.notification-complete {
  border-left-color: #2f8f46;
  background: #f3fbf4;
}
.notification-item.notification-cancelled {
  border-left-color: var(--danger);
}
.notification-item.notification-sla {
  border-color: #e9b8b8;
  border-left-color: var(--danger);
  background: #fff2f2;
}
.notification-item.notification-sla strong {
  color: #8f2626;
}
.notification-state-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  color: #2f8f46;
  font-size: 1rem;
}
.notification-item.notification-complete strong {
  padding-right: 24px;
}
.notification-item strong {
  display: block;
  color: var(--navy);
  margin-bottom: 8px;
}
.notification-item span {
  display: block;
  color: var(--ink);
  line-height: 1.35;
  margin-top: 4px;
}
.notification-actions,
.notification-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.topbar-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
}
.legal-main { max-width: 1480px; padding: 28px; }
.legal-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 28px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: #fffdf8;
}

.dashboard-hero, .page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  background: var(--navy);
  color: #fff;
}
.dashboard-hero h1, .page-title h1 { margin: 0; font-size: 2rem; letter-spacing: 0; }
.dashboard-hero p, .page-title p { margin: 4px 0 0; color: #e8e0d1; }
.page-title a.hero-mail-link { color: #fff; text-decoration: underline; }
.hero-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  background: #fff;
}
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--gold) !important; }

.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 700; }
.btn-gold:hover { background: var(--gold-dark); border-color: var(--gold-dark); color: #fff; }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.btn-navy:hover { background: #17263a; color: #fff; }

.metric-grid, .content-grid, .form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.users-admin-grid { grid-template-columns: minmax(300px, .82fr) minmax(620px, 1.18fr); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric-card, .legal-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(24, 36, 51, .05);
  overflow-x: auto;
}
.metric-card span { display: block; color: var(--muted); font-weight: 700; }
.metric-card strong { font-size: 2.1rem; }
.metric-card.danger strong { color: var(--danger); }
.admin-tile { color: var(--ink); text-decoration: none; }
.admin-tile:hover { border-color: var(--gold); color: var(--ink); }
.panel-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.panel-heading h2 { font-size: 1.08rem; margin: 0; }
.panel-heading span, .muted { color: var(--muted); }
.panel-heading.compact {
  padding-bottom: 10px;
  border-bottom: 1px solid #eee6d7;
}

.matter-info-panel,
.matter-task-workspace {
  margin-bottom: 18px;
}

.matter-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.matter-info-grid div {
  min-height: 76px;
  padding: 10px;
  border: 1px solid #eee6d7;
  border-radius: 8px;
  background: #fff;
}

.matter-info-grid span,
.matter-summary-strip > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font: 800 .76rem/1.15 var(--font-ui);
  text-transform: uppercase;
}

.matter-info-grid strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.matter-category-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.matter-summary-strip {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #eee6d7;
  border-radius: 8px;
  background: #fffdf8;
}

.task-composer-panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #eee6d7;
  border-radius: 8px;
  background: #fffaf1;
}

.task-summary-panel {
  margin-bottom: 18px;
}

.task-summary-edit-form .form-actions {
  margin-top: 16px;
}

.matter-info-grid .full-row {
  grid-column: 1 / -1;
}

.matter-description-edit {
  display: block;
  width: 100%;
  margin-top: 14px;
}

.matter-description-edit .note-editor {
  width: 100%;
}

.matter-description-display {
  display: block;
  width: 100%;
  margin-top: 14px;
}

.editable-description-preview {
  min-height: 120px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #eadfcb;
  border-radius: 8px;
  background: #fffdf8;
}

.task-summary-grid .linked-readonly-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid #eadfcb;
  border-radius: 8px;
  background: #f8f4ec;
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.task-calendar-edit {
  align-self: stretch;
}

.task-description-edit {
  display: block;
  margin-top: 14px;
}

.option-check-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 64px;
  padding: 12px;
  border: 1px solid #eadfcb;
  border-radius: 8px;
  background: #fffaf1;
}

.option-check-card input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.option-check-card strong,
.option-check-card small {
  display: block;
}

.option-check-card small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.task-summary-panel.is-editing .task-type-edit-field input {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 146, 75, .14);
}

.task-summary-sla,
.task-summary-description {
  margin-top: 14px;
}

.task-action-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee6d7;
}

.task-action-strip form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.task-file-title {
  align-items: flex-start;
}

.task-page-actions {
  max-width: 620px;
  justify-content: flex-end;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.task-page-actions .btn {
  white-space: nowrap;
}

.swal-form-grid {
  display: grid;
  gap: 8px;
  text-align: left;
}

.swal-field-label {
  margin: 6px 0 0;
  color: var(--navy);
  font-weight: 800;
}

.swal-form-grid .swal2-input,
.swal-form-grid .swal2-textarea {
  width: 100%;
  margin: 0;
}

.task-updates-grid {
  align-items: start;
}

.legal-form .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 700;
}

.legal-form .check-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.update-feed {
  display: grid;
  gap: 14px;
}

.update-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid #eee6d7;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(24, 36, 51, .04);
}

.update-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold);
  font: 800 .92rem/1 Arial, Helvetica, sans-serif;
}

.update-avatar-icon {
  font-size: 1.1rem;
}

.update-avatar-note {
  background: #1c2a52;
  color: #d4af37;
}

.update-avatar-task {
  background: #174b52;
  color: #f1d78f;
}

.update-avatar-court {
  background: #7a5a18;
  color: #fff8df;
}

.update-avatar-court-followup {
  background: #1f5f4b;
  color: #eefbf4;
}

.update-card-task {
  border-left: 4px solid #174b52;
}

.update-card-court {
  border-left: 4px solid #b8924b;
  background: #fffaf0;
}

.update-card-court-followup {
  border-left: 4px solid #2c8b68;
  background: #f7fff9;
}

.update-body {
  min-width: 0;
}

.update-body .rich-content {
  min-height: 0;
}

.update-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.update-head strong {
  color: var(--navy);
}

.update-head span,
.update-context {
  color: var(--muted);
  font: 700 .9rem/1.25 Arial, Helvetica, sans-serif;
}

.update-context {
  display: inline-block;
  margin-bottom: 10px;
}

.update-context i {
  margin-right: 6px;
}

.update-context-court,
.update-context-court-followup {
  color: #755612;
}

a.update-context {
  color: #857214;
  text-decoration: none;
}

a.update-context:hover {
  text-decoration: underline;
}

.update-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.update-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f3f0e7;
  color: var(--muted);
  font: 800 .78rem/1 Arial, Helvetica, sans-serif;
}

.search-strip {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 280px) auto;
  gap: 12px;
  margin-bottom: 18px;
}

.dashboard-user-strip {
  align-items: center;
}

.dashboard-user-strip .form-control {
  min-height: 44px;
}
.search-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(24, 36, 51, .04);
  align-items: end;
}
.dashboard-search { grid-template-columns: 1fr auto; }
.report-filters { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr)); }
.user-charges-filter {
  grid-template-columns: minmax(150px, 190px) minmax(240px, 1fr) minmax(170px, 210px) minmax(170px, 210px) auto;
}

.user-charges-filter label {
  display: grid;
  gap: 6px;
  margin: 0;
}
.legal-form label { display: grid; gap: 6px; margin-bottom: 12px; font-size: .94rem; font-weight: 700; }
.legal-form .check-line { display: flex; align-items: center; gap: 10px; }
.legal-form .check-line input { width: 18px; height: 18px; }
.required { color: var(--danger); font-weight: 700; }
.field-label { display: inline-flex; align-items: baseline; gap: 4px; }
.optional { color: var(--muted); font-size: .86rem; font-weight: 600; }
.form-control, .form-select { border-color: var(--line); border-radius: 6px; min-height: 38px; font-size: .94rem; }
.panel-actions { margin-bottom: 12px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f0ebe0;
  color: var(--ink);
  font-weight: 700;
  font-size: .86rem;
}
.status-pill.status-active { background: #e7f5ea; color: #256a3b; }
.dropdown-filter-input {
  min-height: 36px;
  margin-bottom: 6px;
  font-size: .92rem;
}
.note-editor { margin-bottom: 14px; }

.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.combo-select {
  position: relative;
}

.combo-select-input {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.combo-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1040;
  display: none;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(24, 36, 51, .14);
}

.combo-select.open .combo-select-menu {
  display: grid;
  gap: 4px;
}

.combo-select-option {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.combo-select-option:hover,
.combo-select-option:focus {
  background: #f3f0e7;
  color: var(--navy);
}

.multi-select-dropdown {
  position: relative;
}

.multi-select-toggle {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.multi-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1040;
  display: none;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(24, 36, 51, .14);
}

.multi-select-dropdown.open .multi-select-menu {
  display: grid;
  gap: 6px;
}

.multi-select-search {
  min-height: 36px;
  margin-bottom: 4px;
}

.multi-select-option {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px !important;
  margin: 0 !important;
  padding: 7px 8px;
  border-radius: 6px;
  font-weight: 600 !important;
  cursor: pointer;
}

.multi-select-option:hover {
  background: #f3f0e7;
}

.multi-select-option input {
  width: 16px;
  height: 16px;
}

.file-dropzone {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 190px;
  padding: 26px;
  border: 2px dashed #cdbf9d;
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.file-dropzone input[type="file"] { display: none; }
.file-dropzone.drag-over {
  border-color: var(--gold);
  background: #f7efd9;
}

.file-dropzone-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 1.25rem;
}

.billing-total-box {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid #ece7d8;
  border-radius: 12px;
  background: #fffdf8;
}

.billing-disbursement-editor {
  margin: 4px 0 18px;
  padding: 16px;
  border: 1px solid #ece7d8;
  border-radius: 12px;
  background: #fffdf8;
}

.billing-task-selector {
  margin: 4px 0 18px;
  padding: 16px;
  border: 1px solid #ece7d8;
  border-radius: 12px;
  background: #fffdf8;
}

.billing-task-options {
  display: grid;
  gap: 10px;
}

.billing-task-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #eee5d6;
  border-radius: 10px;
}

.billing-task-option small {
  display: block;
  margin-top: 4px;
  color: #4f5b68;
}

.billing-nav-dropdown .dropdown-menu {
  border-color: #e2d7c8;
  box-shadow: 0 14px 32px rgba(20, 35, 63, .16);
}

.already-charged-panel {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #eee6d7;
  border-radius: 8px;
  background: #fffaf1;
}

.already-charged-panel .legal-table {
  margin-top: 10px;
}

.disbursement-heading,
.disbursement-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 190px) auto;
  gap: 10px;
  align-items: start;
}

.disbursement-heading {
  margin-bottom: 8px;
  color: var(--muted);
  font: 800 .82rem/1.15 Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}

.disbursement-rows {
  display: grid;
  gap: 10px;
}

.disbursement-row {
  padding: 10px;
  border: 1px solid #eee6d7;
  border-radius: 8px;
  background: #fff;
}

.disbursement-row.is-deleted {
  display: none;
}

.disbursement-row label {
  margin: 0;
}

.disbursement-row-actions {
  align-self: end;
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
}

.disbursement-add-button,
.disbursement-remove-button {
  min-height: 42px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  line-height: 1;
}

.disbursement-add-button {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.disbursement-add-button:hover,
.disbursement-add-button:focus {
  background: #152941;
  border-color: #152941;
  color: #fff;
}

.disbursement-remove-button {
  border-color: #dc3545;
  background: #fff;
  color: #9f2f2f;
}

.disbursement-remove-button:hover,
.disbursement-remove-button:focus {
  background: #9f2f2f;
  border-color: #9f2f2f;
  color: #fff;
}

.disbursement-total-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee6d7;
}

.disbursement-total-strip span {
  color: var(--muted);
  font-weight: 800;
}

.disbursement-total-strip strong {
  color: var(--navy);
  font-size: 1.18rem;
}

.billing-total-box span {
  color: #8a8365;
  font-weight: 800;
}

.billing-total-box strong {
  color: #1c2a52;
  font-size: 1.4rem;
}

.billing-total-box small {
  color: #6f6b5d;
}

.payment-panel { margin-top: 18px; }
.payment-grid { align-items: end; }

.attachment-selector {
  margin-top: 14px;
  max-width: 760px;
}

.cms-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-heading {
  padding: 12px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
}

.calendar-day {
  min-height: 150px;
  padding: 10px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fffdf8;
}

.calendar-day-empty { background: #f3f0e7; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--gold); }

.calendar-day-number {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.calendar-event {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
  padding: 7px 8px;
  border-radius: 6px;
  text-decoration: none;
  background: #edf1f5;
  color: var(--ink);
  font-size: .86rem;
  line-height: 1.2;
}

.calendar-event small {
  color: inherit;
  opacity: .82;
  font-weight: 700;
}

.calendar-event.watch { background: #f7efd9; }
.calendar-event.warning { background: #f4dca5; color: #46340e; }
.calendar-event.danger { background: #f3c6b5; color: #7a2a16; }
.calendar-event.breach,
.calendar-event.court { background: #9f2f2f; color: #fff; }

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 700;
}

.calendar-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  border-radius: 50%;
  background: #edf1f5;
}

.calendar-dot.watch { background: #f7efd9; }
.calendar-dot.warning { background: #f4dca5; }
.calendar-dot.danger { background: #f3c6b5; }
.calendar-dot.court { background: #9f2f2f; }

.matter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.matter-tabs .nav-link {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 8px;
  color: var(--navy);
  font-weight: 800;
}

.matter-tabs .nav-link.active {
  background: var(--navy);
  color: #fff;
}

.matter-tab-content > .tab-pane {
  min-height: 280px;
}

.legal-table { width: 100% !important; margin: 0; vertical-align: middle; }
.legal-table th { color: var(--navy); border-bottom: 2px solid var(--line); }
.legal-table td { border-color: #eee6d7; }
.table-preview {
  max-width: 240px;
  display: block;
  overflow: hidden;
  color: var(--ink);
  line-height: 1.35;
}
.matter-ref-cell strong { color: var(--navy); white-space: nowrap; }
.approval-type-pill {
  display: inline-block;
  min-width: 132px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--navy);
  font-weight: 700;
  text-align: center;
}
.legal-table th,
.legal-table td {
  padding: .58rem .72rem;
  font-size: .92rem;
}

.dt-container { font-family: var(--font-ui); font-size: .92rem; }
.dt-container .dt-buttons { display: flex; gap: 8px; margin-bottom: 12px; }
.dt-container .dt-button {
  background: var(--navy) !important;
  border: 1px solid var(--navy) !important;
  border-radius: 6px !important;
  color: #fff !important;
  font-weight: 700;
  padding: 6px 11px !important;
  font-size: .88rem !important;
}
.dt-container .dt-search input, .dt-container .dt-length select {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 34px;
  font-size: .9rem;
}
.sla-pill { display: inline-block; min-width: 86px; padding: 5px 9px; border-radius: 999px; background: #efe5d1; color: var(--navy); font-size: .88rem; font-weight: 700; text-align: center; }
.sla-pill.sla-neutral { background: #f7f2e8; color: var(--ink); }
.sla-pill.sla-watch { background: #efe5d1; color: var(--navy); }
.sla-pill.sla-warning { background: #f2c66d; color: #3d2b04; }
.sla-pill.sla-danger { background: #c96f3d; color: #fff; }
.sla-pill.sla-breach { background: #9f2f2f; color: #fff; }
.approval-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.lookup-edit-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.user-edit-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, .7fr) minmax(210px, 1fr) minmax(120px, .7fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.holiday-edit-form {
  display: grid;
  grid-template-columns: 170px minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.user-filter-form {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row-edit-field:disabled {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  padding-left: 0;
  opacity: 1;
}
.matter-row, .approval-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.matter-row em, .approval-row small { color: var(--muted); font-style: normal; }
.action-cell { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { margin: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mini-input { width: 64px; min-height: 31px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.rich-content { min-height: 180px; color: var(--ink); }
.login-wrap {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
  padding: 34px 16px;
  background:
    linear-gradient(180deg, rgba(34, 54, 79, .06), rgba(184, 146, 75, .08)),
    var(--paper);
}
.login-panel {
  width: min(100%, 440px);
  padding: 28px;
  border-top: 5px solid var(--navy);
}
.login-panel h1 {
  margin: 12px 0 0;
  font-size: 1.42rem;
  color: var(--navy);
}
.login-logo-wrap { text-align: center; margin-bottom: 22px; }
.login-logo-wrap img.login-nl-mark {
  width: 88px;
  height: 88px;
  object-fit: contain;
  background: var(--navy);
  border-radius: 16px;
  margin-bottom: 12px;
  box-shadow: 0 12px 26px rgba(34, 54, 79, .18);
}
.login-logo-wrap img.login-full-logo {
  width: 250px;
  height: auto;
  display: block;
  margin: 0 auto 12px;
}
.login-logo-wrap strong { display: block; font-size: 2rem; letter-spacing: 0; color: var(--navy); line-height: 1; }
.login-logo-wrap span { display: block; color: var(--ink); font-weight: 700; text-transform: uppercase; font-size: .82rem; }
.login-panel .form-control { background: #fff; border-color: #d7cab8; }
.login-panel .btn { min-height: 40px; padding-inline: 16px; }
.login-contact-link { margin-top: 0; }
.profile-form { max-width: 620px; }
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 18px;
  align-items: start;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.profile-edit-grid label,
.matter-edit-form label {
  min-width: 0;
}

.profile-edit-form .form-actions,
.matter-edit-form .form-actions {
  margin-top: 16px;
}

.profile-edit-form [data-edit-field]:disabled,
.matter-edit-form [data-edit-field]:disabled,
.task-summary-edit-form [data-edit-field]:disabled {
  color: var(--ink);
  font-weight: 700;
  background: #f8f4ec;
  border-color: #eadfcb;
  opacity: 1;
  cursor: default;
}

.profile-edit-form.is-editing,
.matter-info-panel.is-editing,
.task-summary-panel.is-editing {
  box-shadow: 0 0 0 2px rgba(184, 146, 75, .18);
}

.profile-detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.profile-detail-list div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #eee6d7;
}

.profile-detail-list dt {
  color: var(--muted);
  font-weight: 800;
}

.profile-detail-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.profile-photo-panel {
  position: sticky;
  top: 24px;
}

.profile-photo-preview {
  width: min(100%, 260px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: #f3f0e7;
  color: var(--navy);
  font: 800 3rem/1 Arial, Helvetica, sans-serif;
}

.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bill-textarea { min-height: 150px; }
.bill-textarea-sm { min-height: 76px; }
.contact-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
}
.contact-hero img {
  width: min(260px, 44vw);
  height: auto;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
}
.contact-hero h1 { margin: 0; font-size: 2.2rem; color: var(--navy); }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.contact-card {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 18px;
  align-items: start;
}
.contact-card img {
  width: 190px;
  height: 190px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.contact-card h2 { margin: 0; color: var(--navy); }
.contact-card p { margin: 0 0 8px; }
.contact-return { margin-top: 18px; text-align: center; }

.floating-court-calendar-button {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 1040;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(184, 146, 75, .55);
  border-radius: 18px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 18px 36px rgba(28, 42, 82, .28);
}

.floating-court-calendar-button i {
  font-size: 1.55rem;
}

.court-badge {
  position: absolute;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  font: 800 .78rem/1 Arial, Helvetica, sans-serif;
}

.court-badge-today {
  top: -9px;
  right: -9px;
  background: #9f2f2f;
}

.court-badge-tomorrow {
  top: -9px;
  left: -9px;
  background: #f2c66d;
  color: #3d2b04;
}

.floating-court-calendar {
  position: fixed;
  right: 28px;
  bottom: 106px;
  z-index: 1039;
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 140px));
  display: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 24px 60px rgba(28, 42, 82, .24);
}

.floating-court-calendar.open {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.floating-calendar-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.floating-calendar-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.25rem;
}

.floating-calendar-controls,
.floating-calendar-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 20px;
}

.floating-calendar-controls {
  border-bottom: 1px solid #eee6d7;
}

.floating-calendar-legend {
  padding-top: 0;
  color: var(--muted);
  font-size: .9rem;
}

.legend-dot {
  width: 11px;
  height: 11px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-today { background: #9f2f2f; }
.legend-tomorrow { background: #f2c66d; }

.floating-calendar-body {
  overflow-y: auto;
  padding: 0 20px 18px;
}

.floating-calendar-day {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #eee6d7;
  border-radius: 10px;
  background: #fff;
}

.floating-calendar-day.today {
  border-color: rgba(159, 47, 47, .38);
  background: #fff5f5;
}

.floating-calendar-day.tomorrow {
  border-color: rgba(242, 198, 109, .7);
  background: #fff9e8;
}

.floating-calendar-day h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 1rem;
}

.floating-court-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid #eee6d7;
}

.floating-court-item:first-of-type {
  border-top: 0;
}

.floating-court-item span,
.floating-court-item small,
.floating-calendar-empty {
  display: block;
  margin: 2px 0 0;
  color: var(--muted);
}

.floating-court-item a:not(.btn) {
  color: #857214;
  font-weight: 800;
  text-decoration: none;
}

.floating-court-item a:not(.btn):hover {
  text-decoration: underline;
}

.nl-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(24, 36, 51, .34);
  backdrop-filter: blur(2px);
}

.nl-loader-overlay.open {
  display: grid;
}

.nl-loader-card {
  width: min(320px, 92vw);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 24px 60px rgba(24, 36, 51, .28);
}

.nl-loader-card strong {
  color: var(--navy);
  font: 800 1.04rem/1.25 Arial, Helvetica, sans-serif;
}

.nl-loader-card span {
  color: var(--muted);
  font: 700 .88rem/1.3 Arial, Helvetica, sans-serif;
}

.nl-loader-mark {
  position: relative;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
}

.nl-loader-mark img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 12px;
}

.nl-loader-ring {
  position: absolute;
  inset: 0;
  border: 4px solid rgba(184, 146, 75, .22);
  border-top-color: var(--gold);
  border-right-color: var(--navy);
  border-radius: 50%;
  animation: nlLoaderSpin 1s linear infinite;
}

body.nl-loader-active {
  cursor: progress;
}

@keyframes nlLoaderSpin {
  to { transform: rotate(360deg); }
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.holiday-range-form {
  margin-bottom: 18px;
}

.users-admin-grid {
  grid-template-columns: minmax(260px, .55fr) minmax(760px, 1.45fr);
  align-items: start;
}

.users-table {
  min-width: 980px;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) { min-width: 170px; }
.users-table th:nth-child(2),
.users-table td:nth-child(2) { min-width: 140px; }
.users-table th:nth-child(3),
.users-table td:nth-child(3) { min-width: 280px; }
.users-table th:nth-child(4),
.users-table td:nth-child(4) { min-width: 150px; }
.users-table th:nth-child(6),
.users-table td:nth-child(6) { min-width: 120px; }

.users-table .row-edit-field[name="role"] {
  min-width: 138px;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font: 800 .82rem/1 Arial, Helvetica, sans-serif;
}

.status-pill.active {
  background: #eef9ef;
  color: #246b2f;
}

.status-pill.archived {
  background: #f8ecec;
  color: var(--danger);
}

.matter-overview-attachment-upload {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.2fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #eee6d7;
  border-radius: 8px;
  background: #fffaf1;
}

.matter-overview-attachment-upload strong,
.matter-overview-attachment-upload span {
  display: block;
}

.matter-overview-attachment-upload span {
  color: var(--muted);
  font: 700 .88rem/1.3 Arial, Helvetica, sans-serif;
}

.file-dropzone.compact {
  min-height: 74px;
  grid-template-columns: auto minmax(0, 1fr);
  justify-items: start;
  place-items: center start;
  padding: 12px 14px;
  text-align: left;
}

.file-dropzone.compact .file-dropzone-icon {
  width: 42px;
  height: 42px;
}

.attachment-selection-actions,
.attachment-download-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.attachment-select-all {
  margin: 0 !important;
  color: var(--ink);
}

.attachment-select-all input,
[data-attachment-checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.business-date-message {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  color: var(--danger);
  font: 700 .82rem/1.25 Arial, Helvetica, sans-serif;
}

.calendar-day-holiday {
  background: #e5e2db;
}

.calendar-day-weekend {
  background: #f0ede7;
}

.calendar-day-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(34, 54, 79, .1);
  color: var(--navy);
  font: 800 .76rem/1 Arial, Helvetica, sans-serif;
}

.calendar-dot.holiday { background: #b8b3aa; }
.calendar-dot.weekend { background: #d8d2c8; }

.report-filters {
  grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(150px, 1fr));
  align-items: end;
}

.report-filters > *,
.report-filters label {
  min-width: 0;
  width: 100%;
}

.report-filters input[type="date"] {
  min-width: 0;
}

.report-filters .btn {
  min-height: 42px;
  align-self: stretch;
  white-space: nowrap;
}

.user-charges-filter {
  grid-template-columns: minmax(160px, .7fr) minmax(260px, 1.4fr) minmax(155px, .7fr) minmax(155px, .7fr) minmax(130px, auto);
}

@media (max-width: 1180px) {
  .report-filters,
  .user-charges-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-filters > input[name="search"],
  .report-filters .btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .report-filters,
  .user-charges-filter {
    grid-template-columns: 1fr;
  }

  .report-filters > input[name="search"],
  .report-filters .btn {
    grid-column: auto;
  }
}

.report-chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  align-items: start;
}

.dashboard-report-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-chart-grid canvas {
  max-height: 460px;
}

.report-chart-panel {
  min-height: 500px;
}

.report-chart-canvas {
  width: 100% !important;
  height: 400px !important;
}

@media (max-width: 900px) {
  html { font-size: 14.5px; }
  .app-shell { grid-template-columns: 1fr; }
  .mobile-menu-toggle {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf8;
    color: var(--navy);
    font-size: 1.05rem;
  }
  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1054;
    border: 0;
    background: rgba(24, 36, 51, .38);
  }
  body.sidebar-open .mobile-sidebar-backdrop {
    display: block;
  }
  .nl-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1055;
    width: min(320px, 84vw);
    min-height: 100vh;
    overflow-y: auto;
    padding: 20px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 38px rgba(24, 36, 51, .2);
  }
  body.sidebar-open .nl-sidebar { transform: translateX(0); }
  .nl-nav {
    grid-template-columns: 1fr;
  }
  .nl-nav-item {
    min-height: 44px;
    font-size: .98rem;
  }
  .nl-admin-subnav {
    grid-column: 1 / -1;
    margin-left: 0;
  }
  .nl-nav-group {
    display: block;
  }
  .nl-hover-subnav {
    margin-left: 0;
  }
  .nl-sidebar-bottom { margin-top: 18px; }
  .nl-topbar {
    min-height: auto;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px;
  }
  .nl-search {
    flex: 1 1 calc(100% - 58px);
    min-width: 0;
    width: auto;
    padding: 13px 16px;
  }
  .nl-topbar-spacer { display: none; }
  .nl-content {
    width: 100%;
    padding: 22px 16px;
  }
  .live-presence-panel {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 16px;
  }
  .nl-banner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 24px;
  }
  .nl-banner-title { font-size: 1.8rem; }
  .nl-btn-primary { width: 100%; }
  .nl-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .nl-section-card { padding: 18px; overflow-x: auto; }
  .nl-table { min-width: 720px; }
  .cms-calendar { min-width: 860px; }
  .dashboard-hero, .page-title { align-items: flex-start; flex-direction: column; }
  .metric-grid, .content-grid, .users-admin-grid, .form-grid, .search-strip, .contact-grid, .profile-layout, .profile-edit-grid, .matter-info-grid { grid-template-columns: 1fr; }
  .form-grid.three,
  .report-filters,
  .report-chart-grid,
  .dashboard-report-grid,
  .task-modal-grid,
  .court-billing-note-grid,
  .matter-overview-attachment-upload { grid-template-columns: 1fr; }
  .disbursement-heading { display: none; }
  .disbursement-row { grid-template-columns: 1fr; }
  .disbursement-total-strip { justify-content: space-between; }
  .profile-photo-panel { position: static; }
  .contact-hero { flex-direction: column; text-align: center; }
  .contact-card { grid-template-columns: 1fr; }
  .contact-card img { width: 100%; height: auto; max-height: 320px; }
  .matter-row, .approval-row { grid-template-columns: 1fr; }
  .floating-court-calendar-button {
    right: 18px;
    bottom: 18px;
  }
  .floating-court-calendar {
    right: 16px;
    bottom: 92px;
  }
  .update-card {
    grid-template-columns: 1fr;
  }
  .task-action-strip,
  .task-action-strip form {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .nl-nav,
  .nl-stat-grid {
    grid-template-columns: 1fr;
  }
  .nl-user-name { display: none; }
  .nl-pill { min-height: 42px; padding-inline: 14px; }
  .profile-detail-list div { grid-template-columns: 1fr; gap: 4px; }
  .mobile-menu-toggle {
    width: 42px;
    height: 42px;
  }
  .nl-search {
    flex-basis: calc(100% - 54px);
    min-height: 42px;
    padding: 11px 13px;
  }
  .nl-search input {
    font-size: .92rem;
  }
}
