:root {
  --blue-900: #0f4f8a;
  --blue-800: #145ca1;
  --blue-700: #2563eb;
  --blue-100: #eaf4ff;
  --ink: #111827;
  --muted: #536174;
  --line: #dbe3ec;
  --surface: #ffffff;
  --page: #ffffff;
  --soft-page: #f8fafc;
  --good: #167348;
  --warn: #9a5b12;
  --danger: #a53030;
  --shadow: 0 10px 30px rgba(15, 79, 138, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--page);
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.brand {
  min-height: 78px;
  display: flex;
  align-items: center;
}

.brand img {
  width: 100%;
  max-height: 70px;
  object-fit: contain;
  object-position: left center;
}

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

.nav-item {
  border: 0;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue-900);
  background: var(--blue-100);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  color: var(--blue-800);
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--good);
}

.workspace {
  padding: 34px 38px;
  min-width: 0;
}

.topbar,
.section-toolbar,
.panel-header,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-700);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 36px;
  line-height: 1.08;
  font-weight: 700;
}

h2 {
  margin-bottom: 6px;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 700;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 600;
}

p {
  color: var(--muted);
  line-height: 1.58;
  font-size: 16px;
}

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

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

.sort-control,
.view-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  border-radius: 10px;
  background: #eef4fb;
}

.sort-control {
  gap: 8px;
  padding: 0 12px;
}

.sort-control select {
  min-height: 42px;
  padding: 0 28px 0 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  outline: 0;
}

.sort-icon {
  width: 22px;
  display: grid;
  gap: 4px;
}

.sort-icon span {
  display: block;
  height: 3px;
  border-radius: 3px;
  background: var(--ink);
}

.sort-icon span:nth-child(1) {
  width: 18px;
}

.sort-icon span:nth-child(2) {
  width: 22px;
}

.sort-icon span:nth-child(3) {
  width: 12px;
}

.view-toggle {
  gap: 4px;
  padding: 4px;
}

.view-mode {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.view-mode.active {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--blue-900);
}

.list-icon,
.grid-icon {
  display: block;
}

.list-icon {
  width: 22px;
  height: 16px;
  background:
    linear-gradient(var(--muted), var(--muted)) 0 0 / 22px 4px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 0 6px / 22px 4px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 0 12px / 22px 4px no-repeat;
}

.grid-icon {
  width: 22px;
  height: 22px;
  background:
    linear-gradient(var(--muted), var(--muted)) 0 0 / 9px 9px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 13px 0 / 9px 9px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 0 13px / 9px 9px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 13px 13px / 9px 9px no-repeat;
}

.view-mode.active .list-icon {
  background:
    linear-gradient(var(--ink), var(--ink)) 0 0 / 22px 4px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 6px / 22px 4px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 12px / 22px 4px no-repeat;
}

.view-mode.active .grid-icon {
  background:
    linear-gradient(var(--ink), var(--ink)) 0 0 / 9px 9px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 13px 0 / 9px 9px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 13px / 9px 9px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 13px 13px / 9px 9px no-repeat;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 330px;
  height: 50px;
  padding: 0 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 17px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--muted);
}

.button,
.icon-button {
  border: 0;
  cursor: pointer;
  border-radius: 8px;
}

.button {
  min-height: 44px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button.primary {
  color: #fff;
  background: var(--blue-700);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.button.secondary {
  color: var(--blue-900);
  background: #fff;
  border: 1px solid var(--line);
}

.button.danger {
  color: #b42318;
  background: #fff7f5;
  border: 1px solid #f7c7c1;
}

.button.danger:hover {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #c8ead5;
  border-radius: 999px;
  color: var(--good);
  background: #ecfdf3;
  font-size: 14px;
  font-weight: 600;
}

.sync-status[data-tone="saving"] {
  color: var(--warn);
  background: #fff7e8;
}

.sync-status[data-tone="saved"] {
  color: var(--good);
  background: #e9f6ef;
}

.sync-status[data-tone="error"] {
  color: var(--danger);
  background: #fdecec;
}

.icon-button {
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: var(--blue-100);
  font-size: 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#calendarView.view.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 190px);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.72fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.dashboard-hero > div:first-child,
.dashboard-hero-stats {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dashboard-hero > div:first-child {
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 79, 138, 0.08), rgba(45, 99, 220, 0.05)),
    #fff;
}

.dashboard-hero h2 {
  margin: 3px 0 8px;
  font-size: 32px;
  line-height: 1.08;
}

.dashboard-hero p {
  max-width: 760px;
  margin: 0;
}

.dashboard-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.dashboard-hero-stats div {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 128px;
  padding: 18px;
  border-left: 1px solid var(--line);
}

.dashboard-hero-stats div:first-child {
  border-left: 0;
}

.dashboard-hero-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-hero-stats strong {
  color: var(--blue-900);
  font-size: 28px;
  line-height: 1;
}

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

.dashboard-metrics {
  margin-bottom: 18px;
}

.metric,
.panel,
.client-card,
.plan-card,
.detail-panel,
.panel-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 20px;
}

.metric-accent {
  background:
    linear-gradient(180deg, rgba(15, 79, 138, 0.06), rgba(255, 255, 255, 0)),
    var(--surface);
}

.metric span,
.field-label {
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  display: block;
  margin: 12px 0 6px;
  font-size: 30px;
  color: var(--blue-900);
}

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

.metric.attention strong {
  color: var(--warn);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 20px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.dashboard-panel {
  padding: 18px;
}

.dashboard-panel.wide {
  grid-column: span 2;
}

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

.pipeline-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.pipeline-item div:first-child {
  display: grid;
  gap: 4px;
}

.pipeline-item span,
.pipeline-item small {
  color: var(--muted);
  font-size: 12px;
}

.pipeline-item strong {
  color: var(--blue-900);
  font-size: 21px;
  line-height: 1;
}

.pipeline-bar,
.aging-track {
  height: 8px;
  border-radius: 999px;
  background: #e8f1fb;
  overflow: hidden;
}

.pipeline-bar span,
.aging-track b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue-700);
}

.aging-bars,
.client-performance,
.work-queue {
  display: grid;
  gap: 10px;
}

.aging-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.aging-row > span {
  color: var(--muted);
}

.aging-row strong {
  color: var(--blue-900);
  text-align: right;
}

.client-performance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.client-performance-row:hover,
.dashboard-report-card:hover {
  border-color: var(--blue-700);
  box-shadow: 0 10px 24px rgba(15, 79, 138, 0.08);
}

.client-performance-row span {
  display: grid;
  gap: 3px;
}

.client-performance-row b {
  color: var(--blue-900);
}

.client-performance-row small {
  color: var(--muted);
}

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

.queue-card {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbff;
}

.queue-card strong {
  color: var(--blue-900);
  font-size: 28px;
  line-height: 1;
}

.queue-card span {
  font-weight: 700;
}

.queue-card small {
  color: var(--muted);
}

.dashboard-agenda-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
}

.dashboard-agenda-item > span {
  grid-column: 1 / -1;
}

.dashboard-agenda-item b {
  color: var(--blue-900);
  font-size: 13px;
  white-space: nowrap;
}

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

.dashboard-report-card {
  display: grid;
  gap: 6px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-report-card span {
  color: var(--blue-900);
  font-weight: 800;
}

.dashboard-report-card small {
  color: var(--muted);
  line-height: 1.35;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 28px;
  align-items: stretch;
  height: clamp(560px, calc(100vh - 295px), 720px);
  min-height: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  grid-template-rows: 38px;
  grid-auto-rows: minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 79, 138, 0.1);
}

.calendar-weekday,
.calendar-day {
  background: #fff;
}

.calendar-weekday {
  display: grid;
  place-items: center;
  color: var(--blue-900);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  background: #f4f9ff;
  border-bottom: 1px solid var(--line);
}

.calendar-day {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 9px 10px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-top: 0;
  border-left: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day:not(.muted-day):hover {
  background: #f7fbff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.22);
}

.calendar-day strong,
.hebrew-date {
  display: block;
}

.calendar-day strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.hebrew-date {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.calendar-day.today {
  position: relative;
  background: #f8fbff;
  box-shadow: inset 0 0 0 2px var(--blue-700);
}

.calendar-day.today strong {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--blue-700);
}

.calendar-day.selected-day {
  background: #edf6ff;
  box-shadow: inset 0 0 0 2px var(--blue-800);
}

.agenda-add-task {
  width: 38px;
  height: 38px;
  font-size: 22px;
  line-height: 1;
}

.muted-day {
  background: #eef4fa;
}

.calendar-events {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  min-height: 0;
  max-height: calc(100% - 44px);
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
}

.calendar-events::-webkit-scrollbar {
  width: 6px;
}

.calendar-events::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c4d7e8;
}

.calendar-event {
  display: block;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-event {
  color: #124678;
  background: #e6f2ff;
}

.payment-event {
  color: #147348;
  background: #e6f7ef;
}

.task-event {
  color: #9a5b12;
  background: #fff1d9;
}

.more-events {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.calendar-agenda {
  position: sticky;
  top: 24px;
  height: 100%;
  max-height: none;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 28px 28px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.calendar-agenda .panel-header {
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 8px;
}

.calendar-agenda h2 {
  font-size: 30px;
  margin-bottom: 10px;
}

.calendar-agenda .panel-header p {
  line-height: 1.45;
}

.calendar-agenda .stack-list {
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.calendar-agenda .list-item {
  position: relative;
  padding: 18px 18px 18px 22px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 79, 138, 0.06);
}

.calendar-agenda .list-item::before {
  content: "";
  position: absolute;
  inset: 16px auto 16px 0;
  width: 4px;
  border-radius: 999px;
  background: var(--blue-700);
}

.calendar-agenda .list-item strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.agenda-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mini-action {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--blue-900);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.mini-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-action:hover {
  border-color: var(--blue-800);
  background: var(--blue-100);
}
}

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

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 15px;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--soft-page);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-900);
  background: var(--blue-100);
  white-space: nowrap;
}

.badge.overdue {
  color: var(--danger);
  background: #fdecec;
}

.badge.closed {
  color: var(--good);
  background: #e9f6ef;
}

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

.list-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.list-item strong,
.client-card strong {
  display: block;
}

.list-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.section-toolbar {
  margin-bottom: 20px;
}

.section-toolbar p {
  margin-bottom: 0;
}

#calendarView .section-toolbar {
  align-items: flex-end;
  padding: 0 0 8px;
}

#calendarView .section-toolbar h2 {
  font-size: 32px;
}

.calendar-picker {
  min-width: 310px;
  height: 52px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 112px;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 79, 138, 0.06);
}

#calendarMonthName,
#calendarYear {
  width: 100%;
  height: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

#calendarYear {
  border-left: 1px solid var(--line);
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select {
  min-height: 48px;
  padding: 0 14px;
}

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

.client-list-view {
  display: block;
}

.client-list-table table {
  min-width: 960px;
}

.client-list-table tbody tr[data-action],
.client-card[data-action] {
  cursor: pointer;
}

.client-list-table tbody tr[data-action]:hover,
.client-card[data-action]:hover {
  background: var(--soft-page);
}

.table-actions {
  display: flex;
  gap: 10px;
}

.table-actions .button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 15px;
}

.client-card,
.plan-card {
  padding: 20px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.report-card {
  min-height: 190px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.report-card.active {
  border-color: var(--blue-800);
  box-shadow: 0 0 0 2px rgba(15, 79, 138, 0.12), var(--shadow);
}

.report-card span {
  color: var(--blue-900);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-card h3 {
  margin: 7px 0;
  font-size: 17px;
  line-height: 1.2;
}

.report-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.report-card-actions .button {
  min-height: 40px;
  padding: 0 10px;
  font-size: 13px;
}

.report-dialog-card {
  width: min(1180px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  display: grid;
  padding: 0;
  overflow: hidden;
}

.report-preview {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.report-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.report-preview-header span {
  color: var(--blue-900);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.report-preview-header h3 {
  margin: 5px 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.15;
}

.report-preview-header p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.report-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.report-preview-actions strong {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8e8f6;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--blue-900);
  background: #f0f7ff;
  font-size: 13px;
}

.report-table-wrap {
  max-height: min(68vh, 680px);
  overflow: auto;
  margin: 18px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 79, 138, 0.08);
}

.report-table-wrap table {
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

.report-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid #cfe0f0;
  color: var(--blue-900);
  background: #eef6ff;
  font-size: 12px;
  text-transform: uppercase;
}

.report-table-wrap th,
.report-table-wrap td {
  padding: 12px 14px;
  border-right: 1px solid #edf2f7;
}

.report-table-wrap tbody tr:nth-child(even) {
  background: #fbfdff;
}

.report-table-wrap tbody tr:hover {
  background: #f0f7ff;
}

.client-meta,
.detail-grid {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

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

.detail-grid > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #eef3f8;
  border-radius: 8px;
  background: #fbfdff;
}

.client-meta span,
.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
}

.detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.2;
}

.detail-grid .wide-detail strong {
  white-space: pre-wrap;
}

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

.client-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.client-stats b {
  display: block;
  color: var(--blue-900);
}

.client-stats span {
  color: var(--muted);
  font-size: 12px;
}

.client-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.accounts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

#accountsView:not(.account-detail-mode) #accountDetail {
  display: none;
}

#accountsView.account-detail-mode .section-toolbar,
#accountsView.account-detail-mode .panel-table {
  display: none;
}

#accountsView.account-detail-mode .accounts-layout {
  grid-template-columns: minmax(0, 1fr);
}

.tasks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

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

.task-item {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.task-item.done {
  background: var(--soft-page);
}

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

.task-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.task-heading strong {
  font-size: 16px;
}

.task-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 13px;
}

.task-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.icon-action {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue-900);
  background: #fff;
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
}

.labeled-action {
  width: 48px;
  height: 44px;
  gap: 1px;
  padding: 3px 2px;
  grid-template-rows: 1fr auto;
}

.labeled-action span {
  font-size: 12px;
  line-height: 1;
}

.labeled-action small {
  max-width: 44px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-action:hover {
  border-color: var(--blue-800);
  background: var(--blue-100);
}

.icon-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.danger-icon {
  color: #b42318;
  background: #fff7f5;
  border-color: #f7c7c1;
}

.task-summary {
  position: sticky;
  top: 18px;
}

.task-summary h2 {
  margin-bottom: 14px;
}

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

.summary-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-page);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--blue-900);
  font-size: 28px;
  line-height: 1;
}

.panel-table {
  padding: 4px;
}

.detail-panel {
  padding: 16px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
}

.compact-actions {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.primary-icon-action {
  color: #fff;
  border-color: var(--blue-900);
  background: var(--blue-900);
}

.primary-icon-action small {
  color: #fff;
}

.primary-icon-action:hover {
  color: var(--blue-900);
}

.detail-panel h2 {
  margin-bottom: 2px;
  font-size: 25px;
}

.detail-panel > p {
  margin-bottom: 8px;
}

.detail-panel h3 {
  margin: 10px 0 4px;
  font-size: 16px;
}

.compact-notes {
  max-height: 92px;
  overflow: auto;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.account-profile {
  display: grid;
  gap: 12px;
}

.account-back {
  justify-self: start;
  border: 0;
  padding: 0;
  color: var(--blue-900);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.account-profile-top,
.profile-follow-up,
.account-profile-actions,
.account-profile-details,
.account-timeline,
.promise-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.account-profile-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 20px;
  padding: 18px;
  align-items: start;
}

.account-profile-main h2 {
  margin-bottom: 4px;
  font-size: 30px;
}

.account-profile-main p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
}

.account-profile-contact,
.account-profile-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 13px;
}

.account-profile-dates {
  margin-top: 8px;
}

.account-profile-dates strong {
  color: var(--ink);
}

.account-profile-balance {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.account-profile-balance strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.account-profile-balance span {
  color: var(--muted);
  font-size: 13px;
}

.profile-follow-up {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.profile-follow-up span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.profile-follow-up button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--blue-900);
  background: var(--blue-100);
  cursor: pointer;
  font-weight: 800;
}

.account-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.profile-action {
  min-width: 92px;
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--blue-900);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.profile-action:hover,
.profile-action.active,
.profile-follow-up button:hover {
  border-color: var(--blue-800);
  background: #eef6ff;
}

.profile-action-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  line-height: 1;
}

.profile-action-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-action span:last-child {
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
}

.account-profile-details {
  padding: 0;
  overflow: hidden;
}

.account-profile-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 66px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.account-profile-details summary::-webkit-details-marker {
  display: none;
}

.account-profile-details summary::after {
  content: "+";
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: var(--blue-900);
  background: var(--blue-100);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.account-profile-details[open] summary::after {
  content: "-";
}

.account-profile-details summary strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
}

.account-profile-details summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.see-more-status {
  margin-left: auto;
  color: var(--blue-900);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.details-inner {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.account-profile-details .detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.account-timeline,
.promise-list,
.account-open-panel {
  padding: 14px;
}

.account-open-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.panel-note {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.timeline-list {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 58px;
  padding: 4px 0 16px;
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 38px;
  bottom: 0;
  left: 18px;
  width: 2px;
  border-radius: 999px;
  background: #e8edf4;
}

.timeline-icon {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--blue-900);
  background: var(--blue-100);
  box-shadow: 0 0 0 4px #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.timeline-item small {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.promise-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  border: 1px solid #f5d2d7;
  border-radius: 10px;
  padding: 12px;
  color: #9f1239;
  background: #fff7f8;
}

.inline-link {
  color: var(--blue-900);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.visually-hidden-file {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.file-picker-row input[readonly] {
  cursor: default;
  background: #fff;
}

.communication-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.log-activity-panel {
  display: grid;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  background: #fff;
}

.log-field {
  display: grid;
  gap: 10px;
  max-width: 620px;
}

.compact-log-field {
  max-width: 260px;
}

.log-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 320px));
  gap: 16px;
  align-items: end;
}

.log-field h3,
.log-field label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.activity-type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.activity-type-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 18px;
  color: var(--muted);
  background: #f1eff6;
  cursor: pointer;
  font-weight: 800;
}

.activity-type-pill:has(input:checked) {
  color: #fff;
  background: var(--blue-800);
  border-color: var(--blue-800);
  box-shadow: 0 10px 22px rgba(12, 77, 135, .18);
}

.activity-type-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.activity-pill-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.activity-pill-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.log-field textarea,
.log-field input {
  min-height: 118px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  color: var(--ink);
  background: #f4f2f8;
  font: inherit;
}

.log-field input {
  min-height: 54px;
  resize: none;
  border-radius: 999px;
  padding: 0 20px;
}

.log-field textarea:focus,
.log-field input:focus {
  border-color: var(--blue-800);
  outline: 3px solid rgba(12, 77, 135, .14);
}

.log-submit-button {
  width: fit-content;
  min-width: 170px;
  border-radius: 999px;
}

.communication-panel h3 {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-action-card {
  display: grid;
  gap: 4px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  color: var(--ink);
  background: var(--soft-page);
  text-decoration: none;
}

button.quick-action-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.quick-action-card span {
  color: var(--blue-900);
  font-weight: 800;
}

.quick-action-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.template-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.compact-send {
  min-height: 32px;
  padding: 0 14px;
  font-size: 12px;
}

.money {
  color: var(--blue-900);
  font-weight: 700;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e8f1fb;
  overflow: hidden;
  margin: 10px 0;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--blue-700);
}

dialog {
  width: min(760px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

#reportDialog {
  width: min(1180px, calc(100vw - 36px));
}

#letterDialog {
  width: min(1120px, calc(100vw - 36px));
}

#invoiceDialog {
  width: min(1180px, calc(100vw - 36px));
}

.letter-dialog-card {
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.invoice-dialog-card {
  width: min(1180px, calc(100vw - 36px));
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.letter-preview {
  min-height: 0;
  max-height: none;
  overflow: auto;
  margin-top: 14px;
  padding: 16px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-page);
}

.invoice-preview {
  min-height: 0;
  overflow: auto;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-page);
}

.print-letter {
  position: relative;
  box-sizing: border-box;
  width: 8.5in;
  min-height: 11in;
  margin: 0 auto;
  padding: 0.58in 0.72in;
  color: #111827;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 79, 138, 0.12);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13.5px;
  line-height: 1.35;
}

.letter-address-window {
  position: absolute;
  top: 1.12in;
  left: 0.88in;
  width: 3.65in;
  min-height: 0.82in;
  font-size: 12.5px;
  line-height: 1.2;
}

.letter-company {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.letter-company > div {
  display: grid;
  gap: 3px;
}

.letter-company span {
  color: var(--muted);
}

.letter-body {
  padding-top: 2.18in;
}

.letter-body h1 {
  margin: 0 0 14px;
  font-size: 21px;
  line-height: 1.2;
}

.letter-body dl {
  display: grid;
  gap: 4px;
  margin: 14px 0;
}

.letter-body dl div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
}

.letter-body dt {
  font-weight: 700;
}

.letter-body dd {
  margin: 0;
}

.print-invoice {
  box-sizing: border-box;
  width: 100%;
  min-width: 920px;
  margin: 0 auto;
  padding: 30px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 79, 138, 0.08);
}

.invoice-document-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--blue-900);
}

.invoice-document-header h2 {
  margin: 0 0 4px;
  color: var(--blue-900);
  font-size: 22px;
}

.invoice-document-header p,
.invoice-document-header span {
  display: block;
  margin: 0;
  color: var(--muted);
}

.invoice-document-header > div:last-child {
  text-align: right;
}

.invoice-document-header strong {
  display: block;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.invoice-client-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 20px;
  margin: 24px 0;
}

.invoice-client-box span,
.invoice-summary-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoice-client-box strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.invoice-client-box p {
  margin: 6px 0 0;
  color: var(--muted);
}

.invoice-summary-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.invoice-summary-box div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
}

.invoice-summary-box strong {
  font-size: 18px;
}

.invoice-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invoice-table-wrap table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.invoice-table-wrap th {
  color: var(--muted);
  background: #f8fbff;
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoice-table-wrap th,
.invoice-table-wrap td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
}

.invoice-table-wrap tr:last-child td {
  border-bottom: 0;
}

.invoice-total-row {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 18px;
}

.invoice-total-row strong {
  color: var(--blue-900);
}

dialog::backdrop {
  background: rgba(10, 30, 50, 0.45);
}

.dialog-card {
  padding: 28px;
}

.schedule-card {
  background: linear-gradient(180deg, #ffffff 0%, var(--soft-page) 100%);
}

.form-section {
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
}

.dialog-header + .form-section {
  border-top: 0;
  padding-top: 4px;
}

.form-section h3 {
  margin-bottom: 12px;
  color: var(--blue-900);
  font-size: 17px;
  line-height: 1.2;
}

.dialog-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.dialog-card input,
.dialog-card select,
.dialog-card textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--ink);
  font-weight: 400;
}

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

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

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fff;
}

.reminder-tray {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 28px));
}

.reminder-card {
  padding: 16px;
  border: 1px solid #b8d2ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(10, 35, 60, 0.28);
}

.reminder-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.reminder-label {
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.reminder-header h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.reminder-body {
  margin-top: 12px;
}

.reminder-body p {
  margin-bottom: 8px;
}

.reminder-facts {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--blue-100);
}

.reminder-facts span {
  color: var(--muted);
  font-size: 13px;
}

.reminder-facts strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.reminder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: 190px 1fr;
    align-items: center;
    padding: 12px 16px;
  }

  .brand {
    min-height: 58px;
  }

  .brand img {
    max-height: 52px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    min-width: max-content;
  }

  .sidebar-footer {
    display: none;
  }

  .metric-grid,
  .content-grid,
  .dashboard-hero,
  .cards-grid,
  .report-grid,
  .accounts-layout,
  .tasks-layout,
  .calendar-layout {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-layout,
  .dashboard-panel.wide {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

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

  .account-profile-top,
  .account-profile-details .detail-grid,
  .quick-action-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detail-panel,
  .calendar-agenda,
  .task-summary {
    position: static;
  }

  .task-item {
    grid-template-columns: 1fr;
  }

  #calendarView.view.active {
    display: block;
    min-height: 0;
  }

  .calendar-layout {
    height: auto;
    min-height: 0;
  }

  .calendar-grid {
    min-height: 680px;
    overflow: auto;
  }

  .calendar-agenda {
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-toolbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .toolbar-group,
  .search-box {
    width: 100%;
  }

  .metric-grid,
  .content-grid,
  .dashboard-hero,
  .dashboard-hero-stats,
  .cards-grid,
  .report-grid,
  .accounts-layout,
  .tasks-layout,
  .calendar-layout,
  .pipeline-grid,
  .work-queue,
  .dashboard-report-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-hero-stats div {
    min-height: 96px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .dashboard-hero-stats div:first-child {
    border-top: 0;
  }

  .account-profile-top,
  .account-profile-details .detail-grid,
  .quick-action-grid,
  .invoice-client-box,
  .file-picker-row,
  .template-row {
    grid-template-columns: 1fr;
  }

  .account-profile-balance {
    justify-items: start;
    text-align: left;
  }

  .report-card-actions,
  .report-preview-header {
    grid-template-columns: 1fr;
  }

  .report-preview-header {
    display: grid;
  }

  .report-preview-actions {
    justify-items: start;
    white-space: normal;
  }

  .account-profile-details summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .see-more-status {
    margin-left: 0;
    white-space: normal;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 25px;
  }
}

@media print {
  html,
  body {
    width: 8.5in;
    height: 11in;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body * {
    visibility: hidden;
  }

  #letterDialog,
  #letterDialog *,
  #invoiceDialog,
  #invoiceDialog *,
  .print-letter,
  .print-letter *,
  .print-invoice,
  .print-invoice * {
    visibility: visible;
  }

  #letterDialog,
  #invoiceDialog {
    position: static !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  #letterDialog::backdrop,
  #invoiceDialog::backdrop,
  #letterDialog .dialog-header,
  #letterDialog .form-grid,
  #letterDialog .dialog-actions,
  #invoiceDialog .dialog-header,
  #invoiceDialog .dialog-actions {
    display: none !important;
  }

  #letterDialog .letter-dialog-card,
  #letterDialog .letter-preview,
  #invoiceDialog .invoice-dialog-card,
  #invoiceDialog .invoice-preview {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    background: transparent !important;
  }

  #invoiceDialog .invoice-preview {
    padding: 0 !important;
  }

  .print-letter {
    position: fixed !important;
    inset: 0 auto auto 0 !important;
    box-sizing: border-box;
    width: 8.5in;
    height: 11in;
    min-height: 0;
    padding: 0.52in 0.68in;
    margin: 0;
    box-shadow: none;
    font-size: 10.5pt;
    line-height: 1.32;
    page-break-after: avoid;
    page-break-inside: avoid;
    overflow: hidden;
  }

  .letter-address-window {
    top: 1.08in;
    left: 0.88in;
    width: 3.65in;
    min-height: 0.82in;
    font-size: 9.7pt;
  }

  .letter-company {
    font-size: 9.3pt;
  }

  .letter-body {
    padding-top: 2.08in;
  }

  .letter-body h1 {
    margin-bottom: 0.12in;
    font-size: 15.5pt;
  }

  .letter-body dl div {
    grid-template-columns: 1.35in 1fr;
  }

  .letter-body p {
    margin: 0.11in 0;
  }

  .letter-body dl {
    gap: 0.03in;
    margin: 0.12in 0;
  }

  .print-invoice {
    position: fixed !important;
    inset: 0 auto auto 0 !important;
    box-sizing: border-box;
    width: 8.5in;
    min-width: 0;
    min-height: 11in;
    padding: 0.45in;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }

  .invoice-document-header h2 {
    font-size: 16pt;
  }

  .invoice-document-header strong {
    font-size: 22pt;
  }

  .invoice-client-box {
    grid-template-columns: 1fr 2.9in;
    gap: 0.25in;
    margin: 0.22in 0;
  }

  .invoice-table-wrap {
    overflow: visible;
  }

  .invoice-table-wrap table {
    min-width: 0;
    font-size: 8pt;
  }

  .invoice-table-wrap th,
  .invoice-table-wrap td {
    padding: 5px;
  }

  @page {
    size: letter;
    margin: 0;
  }
}
