:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1d2528;
  --muted: #657174;
  --line: #d9dfdd;
  --accent: #12615f;
  --accent-strong: #0d4e4d;
  --gold: #b48234;
  --danger: #a43d3d;
  --soft: #edf4f1;
  --shadow: 0 18px 50px rgba(29, 37, 40, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background: var(--bg);
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: clamp(220px, 18vw, 264px) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(18, 97, 95, 0.12), rgba(180, 130, 52, 0.12)),
    var(--bg);
}

.login-card {
  width: min(480px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid;
  gap: 16px;
}

.login-card h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.login-brand {
  color: var(--ink);
  justify-content: center;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.small-text {
  font-size: 0.86rem;
  margin: 0;
}

.sidebar {
  background: #172326;
  color: #f8fbfa;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.brand-logo {
  width: min(100%, 260px);
  height: auto;
  display: block;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 10px;
}

.login-brand .brand-logo {
  width: min(100%, 330px);
}

.sidebar-logo {
  width: min(100%, 205px);
  flex: 0 0 auto;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aebcbd;
  font-size: 0.9rem;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  border: 0;
  color: #d7e0df;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-align: left;
  border-radius: 6px;
}

.nav-button:hover,
.nav-button.active {
  background: #26393d;
  color: #fff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 5px;
  background: rgba(244, 212, 156, 0.13);
  color: #f4d49c;
  font-size: 0.72rem;
  font-weight: 900;
}

.main {
  min-width: 0;
  width: 100%;
  padding: clamp(18px, 2.2vw, 28px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.global-search {
  width: min(360px, 32vw);
}

.current-user-badge {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.icon-button:disabled {
  background: #eef1f0;
  border-color: #d8dddb;
  color: #8a9491;
  cursor: not-allowed;
  opacity: 0.72;
}

.danger-button {
  background: #fff;
  border-color: #e3c4c4;
  color: var(--danger);
}

.icon-button {
  width: 40px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.content {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
}

.stat,
.panel,
.record-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(29, 37, 40, 0.03);
}

.stat {
  padding: 16px;
}

.stat span {
  color: var(--muted);
  font-size: 0.86rem;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  overflow-wrap: anywhere;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.64fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header,
.list-header,
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.panel h2,
.list-header h2,
.card-header h3 {
  margin: 0;
  font-size: 1.08rem;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  width: min(260px, 100%);
}

.compact-date-filter {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.compact-date-filter input {
  min-width: 142px;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.record-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.record-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.case-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.case-number-heading {
  color: var(--accent-strong);
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.1;
}

.case-court-heading {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 800;
}

.detail-case-heading .case-number-heading {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
}

.detail-case-heading .case-court-heading {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
}

.case-detail-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.bulk-entry-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.bulk-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) minmax(0, 1fr) 40px;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.bulk-entry-row > .field {
  min-width: 0;
}

.bulk-entry-row input,
.bulk-entry-row select {
  width: 100%;
  min-width: 0;
}

.bulk-defendant-quick-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.bulk-common-defendants {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.bulk-common-defendants select {
  width: 100%;
}

.bulk-defendant-quick-add .secondary-button {
  white-space: nowrap;
}

.remove-official-letter-row {
  grid-column: 4;
  grid-row: 1;
  align-self: end;
}

#official-letters-form {
  padding: 22px;
}

@media (max-width: 760px) {
  .bulk-entry-row {
    grid-template-columns: 1fr;
    padding-right: 52px;
    position: relative;
  }

  .bulk-defendant-quick-add {
    grid-template-columns: 1fr;
  }

  .remove-official-letter-row {
    position: absolute;
    top: 0;
    right: 0;
  }
}

.muted {
  color: var(--muted);
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.activity-record-reference {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.record-reference-link {
  border: 0;
  padding: 0;
  color: var(--accent-strong);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.record-reference-link:hover { text-decoration: underline; }

.record-reference-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  color: #24504f;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill.gold {
  background: #f8eddb;
  color: #815c24;
}

.pill.red {
  background: #f7e5e5;
  color: #8f3434;
}

.pill.social-approved { background: #e5f2ea; color: #23633f; }
.pill.response-with-information { background: #f6ead9; color: #8a5417; }
.partner-settlement-heading { margin-top: 24px; }
.pill.social-pending { background: #eef0ef; color: #5f6b68; }

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.case-detail {
  display: grid;
  gap: 18px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-left: 3px solid var(--accent);
  padding: 10px 0 10px 14px;
}

.timeline-item strong {
  display: block;
}

.calendar-list {
  display: grid;
  gap: 10px;
}

.chart-list {
  display: grid;
  gap: 14px;
}

.chart-row {
  display: grid;
  gap: 7px;
}

.chart-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.chart-label strong {
  color: var(--ink);
}

.chart-track {
  height: 12px;
  border-radius: 999px;
  background: #edf1ef;
  overflow: hidden;
}

.chart-fill {
  min-width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.chart-fill.expense {
  background: var(--gold);
}

.chart-fill.loss {
  background: var(--danger);
}

.investment-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.investment-kpis span,
.mini-investment {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.investment-kpis strong {
  display: block;
  color: var(--ink);
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.investment-report-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.participant-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.participant-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.participant-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.participant-row input { width: 100px; }
.participant-total { margin-top: 10px; text-align: right; }

@media (max-width: 760px) {
  .investment-report-toolbar,
  .participant-row { display: grid; grid-template-columns: 1fr; align-items: stretch; }
}

.positive strong {
  color: var(--accent);
}

.negative strong {
  color: var(--danger);
}

.mini-list {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
}

.notes-box {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notes-header .secondary-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.notes-list {
  display: grid;
  gap: 8px;
}

.note-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.note-item p {
  margin: 0 0 8px;
}

.finance-table {
  display: grid;
  gap: 8px;
}

.finance-row {
  display: grid;
  grid-template-columns: 130px 90px 140px 120px minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 0.88rem;
}

.finance-head {
  color: var(--muted);
  font-weight: 800;
  border-top: 0;
  padding-top: 0;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.calendar-item {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.calendar-date {
  color: var(--accent);
  font-weight: 800;
}

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

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 700;
}

.checkbox-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.checkbox-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.checkbox-grid input {
  width: auto;
}

.express-client-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: -4px;
}

.express-client-actions p {
  margin: 0;
}

.express-client-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfa;
}

.express-client-fields legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 800;
}

dialog {
  width: min(820px, calc(100vw - 28px));
  max-height: min(94vh, 94dvh);
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog.wide-dialog {
  width: min(980px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(23, 35, 38, 0.45);
}

#record-form {
  padding: 22px;
}

#password-form,
.client-window {
  padding: 22px;
}

.dialog-header,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.event-availability {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.availability-heading,
.calendar-nav,
.availability-entry {
  display: flex;
  align-items: center;
}

.availability-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.availability-heading h3,
.availability-heading p {
  margin: 0;
}

.calendar-nav {
  gap: 10px;
}

.calendar-nav strong {
  min-width: 150px;
  text-align: center;
  text-transform: capitalize;
}

.availability-weekdays,
.availability-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  gap: 5px;
}

.availability-weekdays span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.availability-day {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px;
}

.availability-day.blank {
  border-color: transparent;
  background: transparent;
}

.availability-day.busy small {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #ffe1a8;
  color: #6b4300;
  font-weight: 800;
}

.availability-day.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.availability-day.holiday {
  border-color: #d56d78;
  background: #fff0f2;
  color: #7c2630;
}

.day-markers {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 3px;
}

.day-markers i {
  color: #9a3140;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 800;
}

.calendar-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: var(--muted);
}

.calendar-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
}

.calendar-legend i {
  width: 13px;
  height: 13px;
  border: 1px solid #d56d78;
  border-radius: 3px;
  background: #fff0f2;
}

.day-availability {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.availability-entry {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 150px;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.availability-entry:last-child {
  border-bottom: 0;
}

.availability-entry small {
  color: var(--muted);
  text-align: right;
}

.overlap-warning,
.holiday-warning {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #e7b24d;
  border-radius: 6px;
  background: #fff7df;
  color: #684700;
}

@media (max-width: 620px) {
  .availability-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .availability-entry {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .availability-entry small {
    grid-column: 2;
    text-align: left;
  }

  .calendar-legend {
    align-items: flex-start;
    flex-direction: column;
  }
}

.expense-card-title,
.expense-bulk-bar,
.expense-bulk-bar label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expense-card-title h3 {
  margin: 0;
}

.expense-select,
.expense-bulk-bar input {
  width: auto;
  accent-color: var(--accent);
}

.expense-bulk-bar {
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agenda-week-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.agenda-week-toolbar div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.agenda-week-toolbar span {
  color: var(--muted);
  font-size: 0.88rem;
}

.agenda-calendar-panel {
  margin-bottom: 14px;
  padding: 16px;
}

.agenda-calendar-header {
  margin-bottom: 12px;
}

.agenda-calendar-header h2,
.agenda-calendar-header .eyebrow {
  margin: 0;
  text-transform: capitalize;
}

.agenda-calendar-selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--soft);
}

.agenda-calendar-scroll {
  overflow-x: auto;
}

.agenda-calendar-weekdays,
.agenda-calendar-grid {
  min-width: 760px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.agenda-calendar-weekdays {
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #f1f4f2;
}

.agenda-calendar-weekdays span {
  padding: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.agenda-calendar-day {
  min-height: 118px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.agenda-calendar-day:nth-child(7n + 1) {
  border-left: 1px solid var(--line);
}

.agenda-calendar-day.is-outside {
  background: #f7f8f6;
}

.agenda-calendar-day.is-today {
  background: #f0f7f5;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.agenda-calendar-day.is-selected {
  background: #e4f0ed;
  box-shadow: inset 0 0 0 2px var(--accent-strong);
}

.agenda-calendar-day.is-non-working:not(.is-selected) {
  background: #fff8f3;
}

.agenda-calendar-date {
  width: 100%;
  min-height: 27px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.agenda-calendar-date small {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  text-align: center;
}

.agenda-calendar-events {
  display: grid;
  gap: 4px;
}

.agenda-calendar-event,
.agenda-calendar-more {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 5px 6px;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background: #e9f3f1;
  color: var(--ink);
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-calendar-event span {
  margin-right: 4px;
  font-weight: 800;
}

.agenda-calendar-event.is-hearing {
  border-left-color: var(--gold);
  background: #f8f0e3;
}

.agenda-calendar-more {
  border-left: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.agenda-calendar-holiday {
  overflow: hidden;
  color: #8d4c2d;
  font-size: 0.63rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-calendar-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.agenda-calendar-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agenda-calendar-legend i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: #e9f3f1;
  border-left: 3px solid var(--accent);
}

.agenda-calendar-legend i.hearing {
  border-left-color: var(--gold);
  background: #f8f0e3;
}

.agenda-calendar-legend i.holiday {
  border: 1px solid #d8a184;
  background: #fff8f3;
}

.quick-event-assignee {
  min-width: 150px;
  width: auto;
  padding: 7px 28px 7px 8px;
}

.case-filter-bar {
  justify-content: flex-start;
}

.case-filter-bar select {
  width: min(260px, 100%);
}

.case-filter-bar span {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.88rem;
}

.expense-table-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.dashboard-list-stack {
  display: grid;
  gap: 22px;
}

.dashboard-list-stack .panel-header {
  margin-bottom: 10px;
}

.dashboard-table {
  min-width: 900px;
}

.dashboard-client-table {
  min-width: 700px;
}

.search-result-section {
  display: grid;
  gap: 10px;
}

.search-result-section .panel-header {
  margin-bottom: 0;
}

.search-results-table {
  min-width: 900px;
}

.search-result-link {
  display: block;
  width: 100%;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--accent-strong);
  text-align: left;
}

.search-result-link:hover {
  text-decoration: underline;
}

.search-result-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.list-limit-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.filtered-record-count {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.filtered-record-count strong {
  color: var(--ink);
  font-size: 1rem;
}

.panel-header .filtered-record-count {
  padding: 0;
  border-bottom: 0;
}

.expense-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 14px;
}

.expense-table th,
.expense-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.expense-table th {
  background: #f5f8f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.expense-table tr.auction-new-row td {
  background: #edf7f0;
}

.expense-table tr.auction-new-row td:first-child {
  box-shadow: inset 3px 0 #4f8b62;
}

.auction-new-badge {
  min-height: 22px;
  margin-left: 8px;
  padding: 0 7px;
  background: #d9eddf;
  color: #2f6842;
  font-size: 0.72rem;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.table-sort-button:hover {
  color: var(--ink);
}

.table-sort-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.table-sort-icon::before {
  content: "\2195";
  color: #8b9794;
  font-size: 14px;
}

th[aria-sort="ascending"] .table-sort-icon::before {
  content: "\2191";
  color: var(--accent-strong);
}

th[aria-sort="descending"] .table-sort-icon::before {
  content: "\2193";
  color: var(--accent-strong);
}

.expense-table tbody tr:hover {
  background: #f8fbfa;
}

.expense-table tbody tr.task-due-today > td,
.task-due-today {
  background: #edf7f0;
}

.expense-table tbody tr.task-due-overdue > td,
.task-due-overdue {
  background: #fbeeee;
}

.expense-table tbody tr.task-due-none > td,
.task-due-none {
  background: #fff8df;
}

.expense-table tbody tr.task-due-today:hover > td {
  background: #e4f2e8;
}

.expense-table tbody tr.task-due-overdue:hover > td {
  background: #f7e4e4;
}

.expense-table tbody tr.task-due-none:hover > td {
  background: #fbf1cf;
}

.expense-table tbody tr.task-due-today > td:first-child {
  box-shadow: inset 3px 0 #6aa77a;
}

.expense-table tbody tr.task-due-overdue > td:first-child {
  box-shadow: inset 3px 0 #c97878;
}

.expense-table tbody tr.task-due-none > td:first-child {
  box-shadow: inset 3px 0 #c4a24d;
}

.expense-table tbody tr:last-child td {
  border-bottom: 0;
}

.expense-check-cell {
  width: 36px;
  text-align: center !important;
}

.table-primary,
.table-subtext {
  display: block;
}

.table-subtext {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.money-cell {
  font-weight: 700;
  white-space: nowrap;
}

.expense-row-actions {
  white-space: nowrap;
}

.table-action-menu {
  position: relative;
  display: inline-block;
}

.table-action-trigger {
  min-width: 104px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  text-align: center;
}

.table-action-trigger::-webkit-details-marker {
  display: none;
}

.table-action-trigger::after {
  content: "\25BE";
  margin-left: 8px;
  color: var(--muted);
}

.table-action-menu[open] .table-action-trigger::after {
  content: "\25B4";
}

.activity-action-menu {
  align-self: flex-start;
  margin-left: auto;
}

.linked-task-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 8px 0 0;
  padding: 18px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.linked-task-editor > .full {
  grid-column: 1 / -1;
}

.expense-receipt-fields {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.expense-receipt-fields legend {
  padding: 0 8px;
  color: var(--accent-strong);
  font-weight: 800;
}

.expense-receipt-users {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.expense-receipt-user {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.expense-receipt-user strong {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .expense-receipt-user {
    grid-template-columns: 1fr;
  }

  .expense-receipt-user strong {
    grid-column: auto;
  }
}

.linked-task-editor legend {
  padding: 0 8px;
  color: var(--accent-strong);
  font-weight: 800;
}

@media (max-width: 720px) {
  .linked-task-editor {
    grid-template-columns: 1fr;
  }
}

.table-action-options {
  display: flex;
  flex-direction: column;
  min-width: 170px;
  margin-top: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(18, 42, 45, 0.14);
  white-space: normal;
}

.table-action-options .icon-text-button,
.table-action-options button,
.table-action-options a {
  width: 100%;
  padding: 9px 10px;
  border-radius: 4px;
  text-align: left;
  text-decoration: none;
}

.table-action-options .icon-text-button:hover,
.table-action-options button:hover,
.table-action-options a:hover {
  background: var(--soft);
  text-decoration: none;
}

.icon-text-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 4px 6px;
}

.icon-text-button:hover {
  text-decoration: underline;
}

.danger-text-button {
  color: var(--danger);
}

.task-table td:nth-child(2) {
  min-width: 220px;
}

.task-table td:nth-child(3) {
  min-width: 190px;
}

.case-table td:nth-child(2),
.case-table td:nth-child(3),
.case-table td:nth-child(4) {
  min-width: 180px;
}

.case-table-heading {
  font-size: 14px;
}

.client-table td:nth-child(2),
.client-table td:nth-child(4) {
  min-width: 210px;
}

.case-activities-table td:nth-child(2) {
  min-width: 240px;
}

.case-history-table td:nth-child(3),
.case-history-table td:nth-child(4) {
  min-width: 220px;
}

.dialog-header {
  margin-bottom: 18px;
}

.dialog-header h2 {
  margin: 0;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

#investment-settlement-form {
  padding: 22px;
}

.settlement-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.settlement-summary > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fbfa;
}

.settlement-summary span,
.settlement-summary strong {
  display: block;
}

.settlement-summary span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 5px;
}

.calculated-field {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  font-weight: 800;
}

.signature-pad {
  display: block;
  width: 100%;
  height: 190px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  touch-action: none;
}

.signature-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.signature-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.signature-qr-dialog {
  width: min(500px, calc(100vw - 28px));
}

.signature-qr-code {
  display: grid;
  place-items: center;
  min-height: 360px;
  margin: 20px auto 8px;
  background: #fff;
}

.signature-qr-code svg {
  display: block;
  width: min(360px, 100%);
  height: auto;
}

.signature-thumbnail {
  display: block;
  width: 120px;
  height: 44px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.expense-budget-panel {
  margin-bottom: 18px;
}

.expense-budget-month {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.expense-budget-month input {
  display: block;
  min-height: 42px;
  margin-top: 5px;
}

.expense-budget-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 12px;
}

.expense-budget-summary > div {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--soft);
}

.expense-budget-summary span,
.expense-budget-summary strong {
  display: block;
}

.expense-budget-summary span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 5px;
}

.expense-budget-summary strong {
  font-size: 1.35rem;
}

.expense-budget-track {
  height: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  border-radius: 3px;
  background: #e2e9e7;
}

.expense-budget-track span {
  display: block;
  height: 100%;
  background: #0b746c;
}

.expense-budget-track span.over {
  background: #b84b4f;
}

.budget-alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid #b84b4f;
  background: #fbefef;
  color: #8f292d;
}

.budget-current-week td {
  background: #eef8f5;
}

@media (max-width: 720px) {
  .expense-budget-summary { grid-template-columns: 1fr; }
  .signature-actions { align-items: stretch; flex-direction: column; }
  .signature-action-buttons { justify-content: stretch; }
  .signature-action-buttons button { flex: 1; }
  .settlement-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.toast {
  background: #172326;
  color: #fff;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: rgba(23, 35, 38, 0.2);
  backdrop-filter: blur(1px);
}

.processing-overlay[hidden] {
  display: none;
}

.processing-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(310px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  box-sizing: border-box;
  padding: 20px 22px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.processing-logo {
  display: block;
  width: 100%;
  max-width: 245px;
  height: auto;
  object-fit: contain;
}

.processing-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.processing-spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 3px solid #d8e2df;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: processing-spin 0.75s linear infinite;
}

.notice-dialog {
  width: min(560px, calc(100vw - 32px));
}

.notice-window {
  padding: 28px;
}

.notice-window h2 {
  margin: 4px 0 16px;
}

.notice-message {
  margin: 0 0 20px;
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 1.05rem;
}

.promotion-number-alert {
  padding: 18px;
  border: 1px solid #b9d2cc;
  border-radius: 6px;
  background: #edf6f3;
  color: var(--accent-strong);
  font-size: 1.45rem;
  font-weight: 800;
  text-align: center;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .processing-spinner { animation-duration: 1.5s; }
}

.empty {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.client-window-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
}

.client-window-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.client-window-panel.full {
  grid-column: 1 / -1;
}

.client-window-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.compact-records {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact-timeline {
  gap: 6px;
}

.compact-timeline .timeline-item {
  padding-top: 8px;
  padding-bottom: 8px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    gap: 0;
    padding: 8px 12px;
    overflow: hidden;
  }

  .sidebar .brand {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav-button {
    flex: 0 0 auto;
    padding: 9px 10px;
    white-space: nowrap;
  }

  .stats-grid,
  .grid-two,
  .client-window-grid {
    grid-template-columns: 1fr;
  }

  .client-window-panel.full {
    grid-column: auto;
  }
}

@media (max-width: 1180px) and (min-width: 681px) {
  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .global-search {
    flex: 1 1 280px;
    width: auto;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 18px 14px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions,
  .toolbar,
  .panel-header,
  .list-header {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions > *,
  .toolbar > button,
  .toolbar > input,
  .toolbar > select,
  .dialog-actions > button {
    width: 100%;
    max-width: none;
  }

  .global-search {
    width: 100%;
  }

  .current-user-badge {
    max-width: none;
    width: 100%;
  }

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

  .panel,
  .record-card {
    padding: 14px;
  }

  .expense-table-panel {
    margin-inline: -2px;
  }

  dialog,
  dialog.wide-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  #record-form,
  #password-form,
  .client-window {
    padding: 16px;
  }

  .dialog-header,
  .dialog-actions {
    align-items: stretch;
  }

  .dialog-header h2 {
    overflow-wrap: anywhere;
  }

  .login-screen {
    padding: 12px;
  }

  .login-card {
    padding: 20px 16px;
  }

  .form-grid,
  .calendar-item,
  .investment-kpis,
  .finance-row {
    grid-template-columns: 1fr;
  }

  .finance-head {
    display: none;
  }

}

@media (max-width: 720px) {
  .agenda-calendar-panel {
    padding: 12px;
  }

  .agenda-calendar-header,
  .agenda-calendar-selection {
    align-items: stretch;
    flex-direction: column;
  }

  .agenda-calendar-header .toolbar,
  .agenda-calendar-selection .toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .agenda-calendar-selection .toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .nav-icon {
    display: none;
  }

  .nav-button {
    min-height: 42px;
  }
}

.notice-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #d5dbe1;
  border-left: 4px solid #1fa999;
  background: #f7faf9;
  color: #33404b;
  font-size: 0.9rem;
}

.auction-map-panel {
  margin-bottom: 16px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auction-map-panel .panel-header p { margin: 4px 0 0; }

.auction-map-shell {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  background: #f4f7f6;
  border: 1px solid #dce4e1;
  border-radius: 6px;
}

.auction-map { width: 100%; max-width: 920px; margin: 0 auto; padding: 14px; }
.auction-map svg { display: block; width: 100%; height: auto; max-height: 520px; }
.auction-map.is-zoomed svg { min-height: 390px; }

.auction-map-state {
  fill: #e3e9e7;
  stroke: #fff;
  stroke-width: 1.2;
  cursor: pointer;
  transition: fill 140ms ease, opacity 140ms ease;
}

.auction-map-state:hover,
.auction-map-state:focus-visible { opacity: 0.78; outline: none; }
.auction-map-level-1 { fill: #b9dcd6; }
.auction-map-level-2 { fill: #78bdb3; }
.auction-map-level-3 { fill: #32978b; }
.auction-map-level-4 { fill: #0d6f68; }
.auction-map-state.is-selected { stroke: #0a4c49; stroke-width: 3; }

.auction-map-marker {
  fill: #d8474f;
  stroke: #fff;
  stroke-width: 2;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}

.auction-map-tooltip {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 2px;
  min-width: 140px;
  max-width: 220px;
  padding: 9px 11px;
  color: #fff;
  background: #253236;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(24, 35, 38, 0.2);
  pointer-events: none;
}

.auction-map-tooltip span,
.auction-map-tooltip small { color: #dce7e4; }

.auction-map-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.auction-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.auction-map-legend i { width: 14px; height: 14px; border-radius: 3px; background: #e3e9e7; }
.auction-map-legend .legend-low { background: #b9dcd6; }
.auction-map-legend .legend-high { background: #0d6f68; }
.auction-map-legend .legend-marker { border-radius: 50%; background: #d8474f; border: 2px solid #fff; box-shadow: 0 0 0 1px #d8474f; }

@media (max-width: 700px) {
  .auction-map-panel { padding: 14px; }
  .auction-map-shell { min-height: 220px; }
  .auction-map { padding: 8px; }
  .auction-map.is-zoomed svg { min-height: 280px; }
}

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

.auction-detail-wide {
  grid-column: 1 / -1;
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(110px, 0.4fr) 1fr;
  gap: 9px 14px;
  margin: 0;
}

.detail-list dt {
  color: #6c7780;
  font-weight: 600;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.source-links {
  margin-top: 14px;
}

.source-link {
  display: inline-block;
  margin: 0 8px 6px 0;
  color: #087d72;
  font-weight: 700;
}

.auction-source-text {
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.55;
}

.auction-upload-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
}

.auction-upload-bar input[type="file"] {
  flex: 1 1 320px;
  min-width: 0;
}

.auction-file-name-list { display: grid; gap: 8px; margin: -6px 0 18px; }
.auction-file-name-row { display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr); align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); background: #f8faf9; }
.auction-file-name-row span { min-width: 0; }
.auction-file-name-row strong, .auction-file-name-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auction-file-name-row small { color: var(--muted); margin-top: 3px; }
.auction-file-name-row input { width: 100%; }

.judicial-term-summary,
.judicial-term-detail {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid #d8c69f;
  border-left: 4px solid #ad7929;
  background: #fffaf0;
  color: #263238;
}

.judicial-term-summary[hidden] { display: none; }
.judicial-term-summary span,
.judicial-term-detail small { color: var(--muted); line-height: 1.45; }
.judicial-term-detail { margin: 16px 0 6px; }
.judicial-term-soon { background: #fffaf0; }
.judicial-term-urgent { background: #fff0f0; }
.judicial-terms-table td { vertical-align: top; }

.expense-table tbody tr.judicial-term-row > td,
.judicial-term-row {
  background: #fff4d6;
}

.expense-table tbody tr.judicial-term-row:hover > td {
  background: #fce9b7;
}

.expense-table tbody tr.judicial-term-row > td:first-child {
  box-shadow: inset 4px 0 #d99a22;
}

.commission-report-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
}

.commission-report-panel .field { margin: 0; }

@media (max-width: 980px) {
  .commission-report-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .commission-report-controls { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .auction-file-name-row { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .auction-detail-grid { grid-template-columns: 1fr; }
  .auction-detail-wide { grid-column: auto; }
  .detail-list { grid-template-columns: 1fr; gap: 3px; }
  .detail-list dd { margin-bottom: 10px; }
}

.promotion-scan-panel {
  display: grid;
  gap: 8px;
  border-left: 4px solid var(--accent);
}

.promotion-scan-panel label { font-weight: 800; color: var(--text); }
.promotion-scan-panel .muted { margin: 0; }

.promotion-dispatch-controls {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(280px, 1.25fr);
  gap: 12px;
}

.promotion-dispatch-controls label { display: grid; gap: 7px; }
.promotion-dispatch-controls select,
.promotion-dispatch-controls input { width: 100%; }

.promotion-scan-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.promotion-scan-row input {
  flex: 1 1 260px;
  min-width: 0;
  text-transform: uppercase;
  font-weight: 800;
}

.promotion-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0;
  background: var(--border);
  border: 1px solid var(--border);
}

.promotion-meta-grid > div {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  background: #fff;
}

.promotion-meta-grid span,
.promotion-next-action span { color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.promotion-meta-grid strong { overflow-wrap: anywhere; }

.promotion-next-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #f2f7f6;
  border-left: 4px solid var(--accent);
}

.promotion-next-action > div { display: grid; gap: 4px; }
.promotion-timeline { display: grid; margin-top: 18px; }

.promotion-event {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  min-height: 52px;
}

.promotion-event > span {
  position: relative;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.promotion-event > span::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 4px;
  bottom: -42px;
  width: 2px;
  background: var(--border);
}

.promotion-event:last-child > span::after { display: none; }
.promotion-event p { margin: 4px 0 0; color: var(--muted); }

@media (max-width: 900px) {
  .promotion-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .promotion-scan-row,
  .promotion-next-action { align-items: stretch; flex-direction: column; }
  .promotion-dispatch-controls { grid-template-columns: 1fr; }
  .promotion-meta-grid { grid-template-columns: 1fr; }
}
