/* The CRM's own stylesheet. It loads after all of Django's admin CSS and sets the
   admin's colour variables from the tokens below, so admin widgets follow the palette.

   Themes: the admin's toggle sets data-theme="auto" | "light" | "dark" on <html>.
   The selectors match the admin's own (and win by coming later), so the toggle and
   prefers-color-scheme both keep working. */

:root,
html[data-theme] {
  --crm-bg: #f6f3ed;
  --crm-surface: #fbfaf7;
  --crm-ink: #1d1c1a;
  --crm-ink-soft: #3d3a35;
  --crm-muted: #6b665d;
  --crm-hairline: #e2ddd3;
  --crm-rule: #c9c2b5;
  --crm-field-border: #8c8579;
  --crm-field-bg: #fffefb;
  --crm-accent: #2f5b66;
  --crm-accent-hover: #234650;
  --crm-accent-ink: #ffffff;
  --crm-row-hover: #efebe3;
  --crm-row-selected: #e4ebea;
  --crm-danger: #9b2c22;
  --crm-danger-soft: #f4e2de;
  --crm-success-soft: #e2ebe0;
  --crm-warning-soft: #f2e9d5;

  /* Stage pills, by group: early, the two Pitched stages, in conversation, client,
     declined and closed, parked. Each has a background, text and edge. */
  --stage-early: #ebe7df; --stage-early-ink: #4a463f; --stage-early-edge: #928b7c;
  --stage-pitched: #e2e8ed; --stage-pitched-ink: #2c4a60; --stage-pitched-edge: #718fa7;
  --stage-pitched-strong: #d3dee8; --stage-pitched-strong-ink: #1f3e58; --stage-pitched-strong-edge: #6487a6;
  --stage-talking: #f1e5cc; --stage-talking-ink: #62461a; --stage-talking-edge: #ab843b;
  --stage-client: #dee7da; --stage-client-ink: #2c4c2a; --stage-client-edge: #74936a;
  --stage-closed: #efdfda; --stage-closed-ink: #783a30; --stage-closed-edge: #b67d71;
  --stage-parked: #e8e1d8; --stage-parked-ink: #56483c; --stage-parked-edge: #9e8773;

  --crm-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter",
    "Sitka Text", Cambria, Georgia, serif;
  --crm-sans: Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", "Segoe UI", sans-serif;
  --crm-page: 1200px;
  --crm-gutter: 40px;

  --primary: var(--crm-accent);
  --secondary: var(--crm-accent);
  --accent: var(--crm-accent);
  --primary-fg: var(--crm-accent-ink);
  --body-fg: var(--crm-ink);
  --body-bg: var(--crm-bg);
  --body-quiet-color: var(--crm-muted);
  --body-medium-color: var(--crm-ink-soft);
  --body-loud-color: var(--crm-ink);
  --header-color: var(--crm-ink);
  --header-branding-color: var(--crm-ink);
  --header-bg: var(--crm-bg);
  --header-link-color: var(--crm-ink-soft);
  --breadcrumbs-fg: var(--crm-muted);
  --breadcrumbs-link-fg: var(--crm-muted);
  --breadcrumbs-bg: transparent;
  --link-fg: var(--crm-accent);
  --link-hover-color: var(--crm-accent-hover);
  --link-selected-fg: var(--crm-accent);
  --hairline-color: var(--crm-hairline);
  --border-color: var(--crm-field-border);
  --error-fg: var(--crm-danger);
  --message-success-bg: var(--crm-success-soft);
  --message-warning-bg: var(--crm-warning-soft);
  --message-error-bg: var(--crm-danger-soft);
  --darkened-bg: var(--crm-surface);
  --selected-bg: var(--crm-row-hover);
  --selected-row: var(--crm-row-selected);
  --button-fg: var(--crm-accent-ink);
  --button-bg: var(--crm-accent);
  --button-hover-bg: var(--crm-accent-hover);
  --default-button-bg: var(--crm-accent);
  --default-button-hover-bg: var(--crm-accent-hover);
  --close-button-bg: var(--crm-ink-soft);
  --close-button-hover-bg: var(--crm-ink);
  --delete-button-bg: var(--crm-danger);
  --delete-button-hover-bg: var(--crm-danger);
  --object-tools-fg: var(--crm-ink);
  --object-tools-bg: transparent;
  --object-tools-hover-bg: var(--crm-row-hover);
  --font-family-primary: var(--crm-sans);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"],
  html:not([data-theme]) {
    --crm-bg: #191816;
    --crm-surface: #201f1c;
    --crm-ink: #ece8e0;
    --crm-ink-soft: #d3cec4;
    --crm-muted: #a39d92;
    --crm-hairline: #33302b;
    --crm-rule: #4d4943;
    --crm-field-border: #7a746b;
    --crm-field-bg: #1e1d1a;
    --crm-accent: #8cb8c2;
    --crm-accent-hover: #a9cdd5;
    --crm-accent-ink: #14211f;
    --crm-row-hover: #24221f;
    --crm-row-selected: #233130;
    --crm-danger: #e5928a;
    --crm-danger-soft: #3a2421;
    --crm-success-soft: #223023;
    --crm-warning-soft: #36301f;
    --stage-early: #2a2825; --stage-early-ink: #d0cabf; --stage-early-edge: #6f695f;
    --stage-pitched: #222b32; --stage-pitched-ink: #b9cad7; --stage-pitched-edge: #56708a;
    --stage-pitched-strong: #1d2a37; --stage-pitched-strong-ink: #c0d4e5; --stage-pitched-strong-edge: #6d92b4;
    --stage-talking: #32291a; --stage-talking-ink: #e3c690; --stage-talking-edge: #9b7a42;
    --stage-client: #212c20; --stage-client-ink: #bad2b2; --stage-client-edge: #6f906a;
    --stage-closed: #352321; --stage-closed-ink: #e4b4ac; --stage-closed-edge: #9c665d;
    --stage-parked: #2d2721; --stage-parked-ink: #d4c4b3; --stage-parked-edge: #8b7765;
    color-scheme: dark;
  }
}

html[data-theme="dark"] {
  --crm-bg: #191816;
  --crm-surface: #201f1c;
  --crm-ink: #ece8e0;
  --crm-ink-soft: #d3cec4;
  --crm-muted: #a39d92;
  --crm-hairline: #33302b;
  --crm-rule: #4d4943;
  --crm-field-border: #7a746b;
  --crm-field-bg: #1e1d1a;
  --crm-accent: #8cb8c2;
  --crm-accent-hover: #a9cdd5;
  --crm-accent-ink: #14211f;
  --crm-row-hover: #24221f;
  --crm-row-selected: #233130;
  --crm-danger: #e5928a;
  --crm-danger-soft: #3a2421;
  --crm-success-soft: #223023;
  --crm-warning-soft: #36301f;
  --stage-early: #2a2825; --stage-early-ink: #d0cabf; --stage-early-edge: #6f695f;
  --stage-pitched: #222b32; --stage-pitched-ink: #b9cad7; --stage-pitched-edge: #56708a;
  --stage-pitched-strong: #1d2a37; --stage-pitched-strong-ink: #c0d4e5; --stage-pitched-strong-edge: #6d92b4;
  --stage-talking: #32291a; --stage-talking-ink: #e3c690; --stage-talking-edge: #9b7a42;
  --stage-client: #212c20; --stage-client-ink: #bad2b2; --stage-client-edge: #6f906a;
  --stage-closed: #352321; --stage-closed-ink: #e4b4ac; --stage-closed-edge: #9c665d;
  --stage-parked: #2d2721; --stage-parked-ink: #d4c4b3; --stage-parked-edge: #8b7765;
  color-scheme: dark;
}

body {
  background: var(--crm-bg);
  color: var(--crm-ink);
  font-family: var(--crm-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a:link, a:visited { color: var(--crm-accent); text-decoration: none; }
a:hover, a:focus { color: var(--crm-accent-hover); text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--crm-accent); outline-offset: 2px; }

.num, td.num, th.num { font-variant-numeric: tabular-nums lining-nums; }

/* Top bar */

#header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 32px;
  min-height: 56px;
  padding: 0 var(--crm-gutter);
  background: var(--crm-bg);
  color: var(--crm-ink);
  border-bottom: 1px solid var(--crm-hairline);
}
#branding { display: flex; align-items: center; gap: 36px; flex: 1; min-width: 0; }
#branding .crm-brand:link, #branding .crm-brand:visited {
  font-family: var(--crm-serif);
  font-size: 1.125rem;
  color: var(--crm-ink);
  white-space: nowrap;
}
#branding .crm-brand:hover { text-decoration: none; color: var(--crm-accent); }

.crm-nav > ul { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; padding: 0; list-style: none; }
.crm-nav li { list-style: none; padding: 0; }
.crm-nav a:link, .crm-nav a:visited, .crm-nav summary {
  display: block;
  padding: 17px 0 15px;
  border-bottom: 1px solid transparent;
  color: var(--crm-muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.crm-nav a:hover, .crm-nav summary:hover { color: var(--crm-ink); text-decoration: none; }
.crm-nav a[aria-current="page"], .crm-nav summary[aria-current] { color: var(--crm-ink); border-bottom-color: var(--crm-ink); }

.crm-nav-more { position: relative; }
.crm-nav summary { list-style: none; }
.crm-nav summary::-webkit-details-marker { display: none; }
.crm-nav details[open] summary { color: var(--crm-ink); }
.crm-nav details ul {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: -16px;
  min-width: 13rem;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--crm-surface);
  border: 1px solid var(--crm-hairline);
}
.crm-nav details li a:link, .crm-nav details li a:visited { padding: 6px 16px; border: 0; }
.crm-nav details li a[aria-current="page"] { color: var(--crm-ink); text-decoration: underline; text-underline-offset: 3px; }

#user-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  font-weight: normal;
  text-transform: none;
  letter-spacing: 0;
  color: var(--crm-muted);
  white-space: nowrap;
}
#user-tools a:link, #user-tools a:visited, #logout-form button {
  color: var(--crm-muted);
  border: 0;
  text-transform: none;
  letter-spacing: 0;
  font: inherit;
}
#user-tools a:hover, #logout-form button:hover { color: var(--crm-ink); text-decoration: none; }
#logout-form { display: inline; }
#logout-form button { background: none; padding: 0; cursor: pointer; }
.crm-user { color: var(--crm-ink-soft); }
.theme-toggle svg { color: var(--crm-muted); fill: var(--crm-muted); }
.theme-toggle:hover svg { color: var(--crm-ink); fill: var(--crm-ink); }

/* Page header: the breadcrumbs sit above the title as a small uppercase label,
   and object tools (Add, History) line up with the title on the right. */

nav[aria-label="Breadcrumbs"] { width: 100%; max-width: var(--crm-page); margin: 0 auto; }
div.breadcrumbs {
  padding: 40px var(--crm-gutter) 0;
  background: none;
  color: var(--crm-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
div.breadcrumbs a:link, div.breadcrumbs a:visited { color: var(--crm-muted); }
div.breadcrumbs a:hover { color: var(--crm-ink); }

.main { width: 100%; max-width: var(--crm-page); margin: 0 auto; }
.main > .content, #content { min-width: 0; }
#content { position: relative; padding: 6px var(--crm-gutter) 72px; }
/* Pages without breadcrumbs (Home) need the space the label would have taken. */
#header + #main #content { padding-top: 44px; }
body.login #content, body.popup #content { padding-bottom: 24px; }

#content > h1 {
  margin: 0 0 32px;
  font-family: var(--crm-serif);
  font-size: 2.125rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--crm-ink);
}
#content:has(.object-tools) > h1 { padding-right: 20rem; }
#content > h1 + h2 {
  margin: -24px 0 32px;
  font-family: var(--crm-serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--crm-ink-soft);
}

.object-tools {
  position: absolute;
  top: 8px;
  right: var(--crm-gutter);
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  float: none;
  font-size: 0.875rem;
}
.object-tools li { display: block; float: none; height: auto; margin: 0; }
.object-tools a:link, .object-tools a:visited {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--crm-rule);
  border-radius: 4px;
  background: transparent;
  color: var(--crm-ink);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
}
.object-tools a:hover, .object-tools a:focus { background: var(--crm-row-hover); text-decoration: none; }
.object-tools a.addlink, .object-tools a.viewsitelink { background-image: none; padding-left: 14px; }

/* Messages */

ul.messagelist { max-width: var(--crm-page); margin: 24px auto 0; padding: 0 var(--crm-gutter); }
ul.messagelist li {
  margin: 0 0 8px;
  padding: 10px 16px;
  background: var(--crm-success-soft);
  background-image: none;
  border-left: 2px solid var(--crm-accent);
  color: var(--crm-ink);
  font-size: 0.9rem;
}
ul.messagelist li.warning { background: var(--crm-warning-soft); border-left-color: var(--crm-muted); }
ul.messagelist li.error { background: var(--crm-danger-soft); border-left-color: var(--crm-danger); }
ul.messagelist li.info { background: var(--crm-surface); }

/* Buttons */

.button, input[type=submit], input[type=button], a.button, .submit-row input {
  padding: 8px 16px;
  border: 1px solid var(--crm-accent);
  border-radius: 4px;
  background: var(--crm-accent);
  color: var(--crm-accent-ink);
  font-family: var(--crm-sans);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}
.button:hover, input[type=submit]:hover, input[type=button]:hover, a.button:hover, .submit-row input:hover {
  border-color: var(--crm-accent-hover);
  background: var(--crm-accent-hover);
  color: var(--crm-accent-ink);
  text-decoration: none;
}
a.button:link, a.button:visited { color: var(--crm-accent-ink); }

@media (max-width: 1024px) {
  :root, html[data-theme] { --crm-gutter: 24px; }
  #container { min-width: 0; }
}

/* On a phone the header is a grid: brand and user links on the first row, the
   section links wrapping underneath. #branding steps aside so its children join it. */
@media (max-width: 767px) {
  :root, html[data-theme] { --crm-gutter: 16px; }
  #header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand tools" "nav nav";
    align-items: center;
    gap: 4px 16px;
    padding: 12px var(--crm-gutter) 0;
  }
  #branding { display: contents; }
  #branding .crm-brand { grid-area: brand; }
  #user-tools { grid-area: tools; gap: 12px; font-size: 0.8rem; line-height: 1.4; text-align: right; }
  .crm-nav { grid-area: nav; }
  .crm-nav > ul { gap: 0 18px; }
  .crm-nav a:link, .crm-nav a:visited, .crm-nav summary { padding: 10px 0 8px; }
  div.breadcrumbs { padding-top: 24px; }
  #content > h1 { font-size: 1.75rem; margin-bottom: 20px; }
  #content:has(.object-tools) > h1 { padding-right: 0; }
  .object-tools { position: static; margin: -8px 0 20px; flex-wrap: wrap; }
}

/* Stage pills. The list pages also colour each row's left edge by stage, and dim
   declined and closed records. */

.stage-identified, .stage-mockup,
#result_list tr:has(:is(.stage-identified, .stage-mockup)) {
  --stage-bg: var(--stage-early); --stage-text: var(--stage-early-ink); --stage-bar: var(--stage-early-edge);
}
.stage-pitched_nobuild, #result_list tr:has(.stage-pitched_nobuild) {
  --stage-bg: var(--stage-pitched); --stage-text: var(--stage-pitched-ink); --stage-bar: var(--stage-pitched-edge);
}
.stage-pitched_build, #result_list tr:has(.stage-pitched_build) {
  --stage-bg: var(--stage-pitched-strong); --stage-text: var(--stage-pitched-strong-ink);
  --stage-bar: var(--stage-pitched-strong-edge);
}
.stage-talking, #result_list tr:has(.stage-talking) {
  --stage-bg: var(--stage-talking); --stage-text: var(--stage-talking-ink); --stage-bar: var(--stage-talking-edge);
}
.stage-client, #result_list tr:has(.stage-client) {
  --stage-bg: var(--stage-client); --stage-text: var(--stage-client-ink); --stage-bar: var(--stage-client-edge);
}
.stage-declined, .stage-closed_dnr,
#result_list tr:has(:is(.stage-declined, .stage-closed_dnr)) {
  --stage-bg: var(--stage-closed); --stage-text: var(--stage-closed-ink); --stage-bar: var(--stage-closed-edge);
}
.stage-parked, #result_list tr:has(.stage-parked) {
  --stage-bg: var(--stage-parked); --stage-text: var(--stage-parked-ink); --stage-bar: var(--stage-parked-edge);
}

.stage-pill {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--stage-bar);
  border-radius: 999px;
  background: var(--stage-bg);
  color: var(--stage-text);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
a.stage-pill:is(:link, :visited, :hover, :focus) { color: var(--stage-text); }
a.stage-pill:hover { text-decoration: underline; }
select.stage-pill { height: auto; padding: 3px 8px; background-color: var(--stage-bg); border-color: var(--stage-bar);
  color: var(--stage-text); }
select.stage-pill option { background: var(--crm-surface); color: var(--crm-ink); }
#result_list tbody tr:has(.stage-pill) td:first-child { box-shadow: inset 3px 0 0 var(--stage-bar); }
#result_list tr:has(:is(.stage-declined, .stage-closed_dnr)) :is(td, th, td a, th a) { color: var(--crm-muted); }

/* Tables: no zebra stripes; hairline rows. */

tr:nth-child(odd), tr:nth-child(even), .row1, .row2 { background: transparent; }
td, th { border-bottom-color: var(--crm-hairline); font-size: 0.9rem; line-height: 1.45; }

/* Home and the dashboard: sections under a hairline rule rather than in boxes. */

.dash {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 56px 64px;
  margin: 0 0 64px;
}
.dash.home { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); align-items: start; }
.home-column { display: grid; gap: 56px; min-width: 0; }
.business-dashboard .dash { grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); }
.dash section { min-width: 0; padding-top: 14px; border-top: 1px solid var(--crm-rule); }
.dash h2 {
  margin: 0 0 18px;
  padding: 0;
  background: none;
  font-family: var(--crm-serif);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--crm-ink);
}
.dash h2 small { margin-left: 6px; font-family: var(--crm-sans); font-size: 0.85rem; color: var(--crm-muted); }
.dash h3 {
  margin: 0 0 8px;
  padding: 0;
  background: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--crm-muted);
}
.dash h3.gap { margin-top: 28px; }
.dash table { width: 100%; border: 0; border-collapse: collapse; }
.dash td, .dash th { padding: 9px 0; border-bottom: 1px solid var(--crm-hairline); vertical-align: baseline; }
.dash td + td, .dash th + th { padding-left: 16px; }
.dash th {
  background: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  color: var(--crm-muted);
}
.dash td.num, .dash th.num { text-align: right; white-space: nowrap; }
.dash tr.total td { border-top: 1px solid var(--crm-rule); border-bottom: 0; font-weight: 600; }
.dash small { color: var(--crm-muted); }
.dash .measure td:first-child { width: 40%; }
.dash .measure .value, .dash .headline-value {
  font-family: var(--crm-serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.2;
  font-variant-numeric: lining-nums tabular-nums;
}
.dash .headline-value { margin: 0; }
.dash .measure td.sub { padding-left: 16px; color: var(--crm-muted); }
.dash .note, .dash .empty { margin: 14px 0 0; color: var(--crm-muted); font-size: 0.875rem; }
.dash p { margin: 14px 0 0; }
.late { color: var(--crm-danger); font-weight: 600; }

.dash .headline { display: flex; gap: 48px; margin: 0 0 24px; }
.dash .headline a:link, .dash .headline a:visited { display: flex; flex-direction: column; color: var(--crm-muted); }
.dash .headline a:hover { text-decoration: none; color: var(--crm-ink); }
.dash .headline strong {
  font-family: var(--crm-serif);
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.05;
  color: var(--crm-ink);
  font-variant-numeric: lining-nums tabular-nums;
}
.dash .pipeline { display: flex; flex-wrap: wrap; gap: 8px; }
.dash .pipeline a { font-weight: 500; }
.dash .pipeline strong { margin-right: 4px; font-variant-numeric: tabular-nums; }

.rag {
  display: inline-block;
  padding: 1px 9px;
  border: 1px solid var(--rag-edge);
  border-radius: 999px;
  background: var(--rag-bg);
  color: var(--rag-ink);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.rag-green { --rag-bg: var(--stage-client); --rag-ink: var(--stage-client-ink); --rag-edge: var(--stage-client-edge); }
.rag-amber { --rag-bg: var(--stage-talking); --rag-ink: var(--stage-talking-ink); --rag-edge: var(--stage-talking-edge); }
.rag-red { --rag-bg: var(--stage-closed); --rag-ink: var(--stage-closed-ink); --rag-edge: var(--stage-closed-edge); }

.trend { display: block; width: 100%; max-width: 560px; height: auto; margin: 20px 0 6px; }
.trend .grid { stroke: var(--crm-hairline); stroke-width: 1; }
.trend .axis-label { fill: var(--crm-muted); font-family: var(--crm-sans); font-size: 13px; }
.trend .line { fill: none; stroke: var(--crm-accent); stroke-width: 2; stroke-linejoin: round; }
.trend circle { fill: var(--crm-accent); stroke: var(--crm-bg); stroke-width: 2; }
.trend circle.now { fill: var(--crm-bg); stroke: var(--crm-accent); }
.trend-values { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; color: var(--crm-muted);
  font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.trend-values li { padding: 0; list-style: none; }

/* A form or buttons in the page header, on the right like object tools. */

.page-actions {
  position: absolute;
  top: 6px;
  right: var(--crm-gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
}
#content:has(.page-actions) > h1 { padding-right: 24rem; }
.page-actions label { color: var(--crm-muted); font-size: 0.875rem; }
.page-intro { margin: -18px 0 40px; color: var(--crm-muted); }

/* The model list under Home, kept quiet. */

.dashboard #content { width: auto; }
.dashboard .colMS { margin-right: 0; }
.dashboard #content-related { display: none; }
.dashboard #content-main { float: none; width: auto; }
#content-main .module { margin: 0 0 40px; background: none; border: 0; }
#content-main .module caption, #content-main .module h2, .inline-group h2 {
  padding: 0 0 8px;
  background: none;
  border-bottom: 1px solid var(--crm-rule);
  color: var(--crm-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
}
#content-main .module caption a:link, #content-main .module caption a:visited { color: var(--crm-muted); }
.dashboard .module table { width: 100%; max-width: 640px; }
.dashboard .module th, .dashboard .module td { padding: 9px 0; }
.dashboard .module th a { font-weight: 400; }
a.addlink, a.changelink, a.viewlink, a.inlineviewlink, a.deletelink { padding-left: 0; background-image: none; }

@media (max-width: 767px) {
  .dash, .home-column { gap: 40px; }
  .dash .measure td:first-child { width: auto; }
  .rag { white-space: normal; }
  .page-actions { position: static; margin: -6px 0 18px; }
  #content:has(.page-actions) > h1 { padding-right: 0; }
  .page-intro { margin: 0 0 28px; }
}

/* List pages (admin change lists). */

#changelist { gap: 40px; }
#changelist .changelist-form-container { min-width: 0; }

#toolbar {
  margin: 0 0 4px;
  padding: 0 0 16px;
  background: none;
  border: 0;
}
#toolbar form, #toolbar form > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#toolbar form > div { flex: 1; }
#toolbar form label[for="searchbar"] img, #toolbar #changelist-search img { display: none; }
#toolbar #searchbar {
  width: 22rem;
  max-width: 100%;
  height: auto;
  padding: 7px 10px;
  border: 1px solid var(--crm-field-border);
  border-radius: 4px;
  background: var(--crm-field-bg);
  color: var(--crm-ink);
  font-size: 0.9rem;
}
#toolbar form input[type="submit"] {
  box-shadow: none;
  padding: 7px 14px;
  border: 1px solid var(--crm-rule);
  background: transparent;
  color: var(--crm-ink);
}
#toolbar form input[type="submit"]:hover { background: var(--crm-row-hover); color: var(--crm-ink); }
#toolbar .quiet { color: var(--crm-muted); font-size: 0.85rem; }

#changelist .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 0;
  background: none;
  border-top: 1px solid var(--crm-hairline);
  color: var(--crm-muted);
  font-size: 0.875rem;
}
#changelist .actions label { color: var(--crm-muted); font-size: 0.875rem; }
#changelist .actions select {
  height: auto;
  padding: 5px 8px;
  border: 1px solid var(--crm-field-border);
  border-radius: 4px;
  background: var(--crm-field-bg);
  color: var(--crm-ink);
  font-size: 0.875rem;
}
#changelist .actions .button {
  box-shadow: none;
  padding: 5px 12px;
  border: 1px solid var(--crm-rule);
  background: transparent;
  color: var(--crm-ink);
  font-size: 0.875rem;
}
#changelist .actions .button:hover { background: var(--crm-row-hover); color: var(--crm-ink); }

/* A table too wide for its column scrolls inside this frame rather than running under the
   filters, and the header sticks to the top of the frame. The frame is short enough to stay in
   view with the paginator below it when the page is scrolled to the end. */
#changelist-form .results {
  overflow: auto;
  max-height: calc(100vh - 180px);
  max-height: calc(100dvh - 180px);
}
#result_list { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums lining-nums; }
#result_list thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  background: var(--crm-bg);
  border-top: 1px solid var(--crm-rule);
  border-bottom: 1px solid var(--crm-rule);
  color: var(--crm-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#result_list thead th .text a, #result_list thead th .text span { padding: 10px 12px; }
#result_list thead th .text a:link, #result_list thead th .text a:visited { color: var(--crm-muted); }
#result_list thead th .text a:hover { color: var(--crm-ink); text-decoration: none; }
#result_list thead th.sorted { background: var(--crm-bg); }
#result_list thead th.sorted .text a { color: var(--crm-ink); }
#result_list thead th .sortoptions { opacity: 0.55; }
#result_list thead th:hover .sortoptions { opacity: 1; }
#result_list thead th.action-checkbox-column { padding: 0 4px 0 12px; }

#result_list tbody td, #result_list tbody th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--crm-hairline);
  vertical-align: middle;
  font-size: 0.9rem;
  line-height: 1.4;
}
#result_list tbody th { font-weight: 500; white-space: nowrap; }
#result_list tbody tr:hover td, #result_list tbody tr:hover th { background: var(--crm-row-hover); }
#changelist tbody tr.selected td, #changelist tbody tr.selected th,
#changelist tbody tr:has(.action-select:checked) td, #changelist tbody tr:has(.action-select:checked) th {
  background: var(--crm-row-selected);
}
#result_list td.action-checkbox { padding-right: 4px; }
#result_list .action-checkbox input { margin: 0; }
#result_list tbody select, #result_list tbody input:not([type=checkbox]) { margin: -3px 0; }

/* The lists with the most columns: these fit beside the filters at 1280px. */
:is(.model-prospect, .model-client, .model-project, .model-expense) #result_list tbody :is(td, th) { padding: 10px 9px; }
:is(.model-prospect, .model-client, .model-project, .model-expense) #result_list thead th .text :is(a, span) {
  padding: 10px 9px;
}
:is(.model-prospect, .model-client, .model-project, .model-expense) #result_list tbody th {
  min-width: 7.5rem;
  white-space: normal;
}
:is(.model-prospect, .model-client) #result_list select.stage-pill { max-width: 8.75rem; padding-right: 4px; }
:is(.model-project, .model-expense) #result_list thead th .text { white-space: normal; }
.model-expense #result_list td.field-project { white-space: normal; }

/* Money and counts line up on the right. */
#result_list :is(.column-amount, .column-line_amount, .column-fee, .column-monthly, .column-price,
  .column-care_plan_annual, .column-mrr, .column-mrr_author, .column-mrr_organisation, .column-active_agreements,
  .column-active_clients, .column-mrr_target, .column-active_clients_target, .column-author_wins_target,
  .column-business_wins_target, .column-cash_target, .column-repeat_every) .text a,
#result_list :is(.column-amount, .column-line_amount, .column-fee, .column-monthly, .column-price,
  .column-care_plan_annual, .column-mrr, .column-mrr_author, .column-mrr_organisation, .column-active_agreements,
  .column-active_clients, .column-mrr_target, .column-active_clients_target, .column-author_wins_target,
  .column-business_wins_target, .column-cash_target, .column-repeat_every) .text span,
#result_list :is(.field-amount, .field-line_amount, .field-fee, .field-monthly, .field-price,
  .field-care_plan_annual, .field-mrr, .field-mrr_author, .field-mrr_organisation, .field-active_agreements,
  .field-active_clients, .field-mrr_target, .field-active_clients_target, .field-author_wins_target,
  .field-business_wins_target, .field-cash_target, .field-repeat_every) {
  text-align: right;
  white-space: nowrap;
}

#changelist .paginator {
  padding: 14px 0;
  background: none;
  border-bottom: 0;
  color: var(--crm-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}
#changelist .paginator a:link, #changelist .paginator a:visited, #changelist .paginator .this-page {
  padding: 3px 8px;
  border-radius: 4px;
  background: none;
  color: var(--crm-accent);
}
#changelist .paginator .this-page { color: var(--crm-ink); font-weight: 600; }
#changelist .paginator a.showall { background: none; }
#changelist .paginator input[type=submit] { float: right; margin: -4px 0 0; }

.xfull:not(:has(li)) { display: none; }
#changelist .toplinks, .xfull ul.toplinks { margin: 0 0 12px; padding: 0 0 10px; border-bottom: 1px solid var(--crm-hairline); }
ul.toplinks li { margin-right: 14px; }
ul.toplinks a:link, ul.toplinks a:visited { color: var(--crm-accent); }

/* Opaque and above the results frame (and its sticky header), so anything that ever overflows the
   frame goes behind the filters rather than through them. */
#changelist-filter {
  position: relative;
  z-index: 3;
  box-sizing: border-box;
  flex: 0 0 200px;
  margin: 0;
  padding: 0 0 0 20px;
  background: var(--crm-bg);
  border-left: 1px solid var(--crm-hairline);
}
#changelist-filter h2 {
  margin: 0 0 14px;
  padding: 2px 0 0;
  background: none;
  color: var(--crm-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
}
#changelist-filter h3, #changelist-filter details summary {
  margin: 0 0 6px;
  padding: 0;
  color: var(--crm-ink);
  font-size: 0.875rem;
  font-weight: 600;
}
#changelist-filter details > summary { cursor: pointer; }
#changelist-filter details > summary::before {
  display: inline-block;
  width: 1em;
  color: var(--crm-muted);
  font-weight: 400;
}
#changelist-filter ul { margin: 0 0 18px; padding: 0 0 0 1em; border-bottom: 0; }
#changelist-filter li { margin: 0; padding: 2px 0; }
#changelist-filter a:link, #changelist-filter a:visited { color: var(--crm-muted); font-size: 0.875rem; }
#changelist-filter a:hover { color: var(--crm-ink); text-decoration: none; }
#changelist-filter li.selected { margin-left: 0; padding-left: 0; border-left: 0; }
#changelist-filter li.selected a:link, #changelist-filter li.selected a:visited {
  color: var(--crm-ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
#changelist-filter #changelist-filter-extra-actions { margin: 0 0 18px; padding: 0 0 12px;
  border-bottom: 1px solid var(--crm-hairline); }
#changelist-filter #changelist-filter-extra-actions h3 { font-weight: 400; }
#changelist-filter a.viewlink, #changelist-filter a.hidelink { padding-left: 0; background-image: none; }

/* The Tasks page and the open-tasks list on a record's page. */

.task-sections { max-width: 880px; }
.task-sections section, .task-sections .done { margin: 0 0 40px; }
.task-sections h2, .task-sections summary {
  margin: 0 0 6px;
  padding: 0 0 8px;
  background: none;
  border-bottom: 1px solid var(--crm-rule);
  color: var(--crm-ink);
  font-family: var(--crm-serif);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.task-sections h2 small, .task-sections summary small {
  margin-left: 6px;
  font-family: var(--crm-sans);
  font-size: 0.85rem;
  color: var(--crm-muted);
}
.task-sections summary { cursor: pointer; list-style-position: inside; }
.task-sections summary::marker { color: var(--crm-muted); font-size: 0.8em; }
table.tasks { width: 100%; border: 0; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
table.tasks td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--crm-hairline); vertical-align: middle; }
table.tasks tr:hover td { background: var(--crm-row-hover); }
table.tasks td:first-child { width: 7.5rem; padding-left: 4px; white-space: nowrap; color: var(--crm-ink-soft); }
table.tasks td:first-child.late { color: var(--crm-danger); }
table.tasks td.num:last-child { width: 5.5rem; padding-right: 4px; text-align: right; }
table.tasks td small { color: var(--crm-muted); }
table.tasks form { margin: 0; }
#result_list td.field-done_button { text-align: right; white-space: nowrap; }
#result_list td.field-done_button small { color: var(--crm-muted); }
table.tasks .button, #result_list td.field-done_button .button {
  padding: 4px 12px;
  border-color: var(--crm-rule);
  background: transparent;
  color: var(--crm-ink);
  font-size: 0.85rem;
  font-weight: 600;
}
table.tasks .button:hover, #result_list td.field-done_button .button:hover { border-color: var(--crm-accent); background: var(--crm-accent); color: var(--crm-accent-ink); }
.task-sections .empty { margin: 10px 0 0; color: var(--crm-muted); font-size: 0.9rem; }
.client-tasks { margin: 0 0 40px; }
.client-tasks p:last-child { margin: 14px 0 0; }

@media (max-width: 1024px) {
  #changelist { gap: 0; }
  #changelist-filter { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--crm-hairline); }
}

@media (max-width: 767px) {
  #toolbar #searchbar { width: auto; flex: 1 1 12rem; }
  #result_list tbody td, #result_list tbody th { padding: 10px 8px; }
  table.tasks td:first-child { width: 5.5rem; }
}

/* Forms: labels above fields, hairlines between rows. */

form fieldset.module { margin: 0 0 44px; padding: 0; background: none; border: 0; }
form fieldset.module h2.fieldset-heading { margin: 0 0 4px; }
fieldset .description { margin: 0 0 8px; color: var(--crm-muted); font-size: 0.875rem; }

form .form-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--crm-hairline);
  overflow: visible;
  font-size: 0.9375rem;
}
form .aligned .form-row, form .aligned .form-row > div { display: block; }
form .aligned .flex-container { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
form .aligned .form-multiline { flex-direction: row; flex-wrap: wrap; gap: 16px 32px; }
form .aligned label:not(.vCheckboxLabel):not(.inline),
form .aligned .flex-container > label,
.task-form label {
  display: block;
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0 0 6px;
  color: var(--crm-ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}
form .aligned label.required, .task-form label.required { color: var(--crm-ink); }
form .aligned .checkbox-row { flex-direction: row; align-items: center; gap: 8px; }
form .aligned .checkbox-row label, form .aligned label.vCheckboxLabel {
  padding: 0;
  color: var(--crm-ink);
  font-size: 0.9375rem;
  font-weight: 400;
}
form .aligned div.help, form .aligned p.help, form div.help, .help, p.help {
  max-width: 40rem;
  margin: 6px 0 0;
  padding: 0;
  color: var(--crm-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
form .aligned div.help div { margin: 0; }
form .aligned div.readonly, form .aligned .readonly { margin: 0; padding: 4px 0 0; color: var(--crm-ink); font-size: 0.9375rem; }
form .aligned ul.errorlist, form ul.errorlist { margin: 0 0 6px; padding: 0; }
ul.errorlist li {
  margin: 0;
  padding: 0;
  background: none;
  color: var(--crm-danger);
  font-size: 0.85rem;
}
.errornote {
  margin: 0 0 24px;
  padding: 10px 16px;
  background: var(--crm-danger-soft);
  background-image: none;
  border: 0;
  border-left: 2px solid var(--crm-danger);
  border-radius: 0;
  color: var(--crm-ink);
  font-size: 0.9rem;
}
.errors input, .errors select, .errors textarea, .errors .select2-selection { border-color: var(--crm-danger); }

input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=tel],
input[type=search], input[type=date], textarea, select, .vTextField {
  padding: 8px 10px;
  border: 1px solid var(--crm-field-border);
  border-radius: 4px;
  background: var(--crm-field-bg);
  color: var(--crm-ink);
  font-family: var(--crm-sans);
  font-size: 0.9375rem;
  line-height: 1.35;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--crm-accent);
  box-shadow: 0 0 0 1px var(--crm-accent);
  outline: none;
}
select { height: auto; padding-right: 28px; }
input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { accent-color: var(--crm-accent); }
form .aligned .vTextField, form .aligned textarea, .task-form input[type=text], .task-form textarea,
.task-form select { width: 100%; max-width: 36rem; }
form .aligned textarea, .task-form textarea { min-height: 6.5rem; }
form .aligned select { max-width: 36rem; }
.vDateField { width: 10.5rem; }
.vTimeField { width: 7rem; }
input[type=file] { color: var(--crm-ink-soft); font-size: 0.9rem; }
input[type=file]::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  border: 1px solid var(--crm-rule);
  border-radius: 4px;
  background: transparent;
  color: var(--crm-ink);
  font: inherit;
  cursor: pointer;
}
p.file-upload { color: var(--crm-muted); font-size: 0.875rem; }

/* Admin widgets beside fields: date shortcuts, and the add/change icons next to a related field. */
.datetimeshortcuts { margin-left: 10px; color: var(--crm-muted); font-size: 0.85rem; }
.datetimeshortcuts a:link, .datetimeshortcuts a:visited { color: var(--crm-accent); }
.datetimeshortcuts .date-icon, .datetimeshortcuts .clock-icon { filter: grayscale(1); opacity: 0.6; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] :is(.date-icon, .clock-icon, .related-widget-wrapper-link img, .inline-deletelink) {
    filter: grayscale(1) invert(0.85);
  }
}
html[data-theme="dark"] :is(.date-icon, .clock-icon, .related-widget-wrapper-link img, .inline-deletelink) {
  filter: grayscale(1) invert(0.85);
}
.datetimeshortcuts a:hover .date-icon, .datetimeshortcuts a:hover .clock-icon { opacity: 1; }
.related-widget-wrapper { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.related-widget-wrapper-link img, .inline-deletelink, img.help-tooltip { filter: grayscale(1); }
.related-widget-wrapper-link { opacity: 0.5; }
.related-widget-wrapper-link:hover, .related-widget-wrapper-link:focus { opacity: 1; }
.calendarbox, .clockbox {
  background: var(--crm-surface);
  border: 1px solid var(--crm-rule);
  border-radius: 4px;
  box-shadow: none;
  color: var(--crm-ink);
}
.calendar caption, .calendarbox h2, .clockbox h2 {
  background: none;
  color: var(--crm-ink);
  font-family: var(--crm-serif);
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
}
.calendar th { background: none; color: var(--crm-muted); border-bottom: 1px solid var(--crm-hairline); }
.calendar td { border: 0; background: none; }
.calendar td a:hover, .calendar td a:focus, .timelist a:hover { background: var(--crm-accent); color: var(--crm-accent-ink); }
.calendar td.selected a { background: var(--crm-accent); color: var(--crm-accent-ink); }
.calendar td.today a { font-weight: 700; }
.calendar-shortcuts { border-top: 1px solid var(--crm-hairline); background: none; }
.calendarnav-previous, .calendarnav-next { opacity: 0.6; }
.calendar-cancel { background: none; border-top: 1px solid var(--crm-hairline); }
.calendar-cancel a:link, .calendar-cancel a:visited { color: var(--crm-muted); }

/* The client picker on invoices, projects and agreements (Select2). */
.select2-container--admin-autocomplete .select2-selection--single,
.select2-container--admin-autocomplete .select2-selection--multiple {
  min-height: 38px;
  border: 1px solid var(--crm-field-border);
  border-radius: 4px;
  background: var(--crm-field-bg);
}
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__rendered {
  padding-left: 10px;
  color: var(--crm-ink);
  line-height: 36px;
}
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--admin-autocomplete.select2-container--focus .select2-selection,
.select2-container--admin-autocomplete.select2-container--open .select2-selection {
  border-color: var(--crm-accent);
  box-shadow: 0 0 0 1px var(--crm-accent);
}
.select2-container--admin-autocomplete .select2-dropdown { background: var(--crm-surface); border-color: var(--crm-rule); }
.select2-container--admin-autocomplete .select2-results__option--highlighted[aria-selected] {
  background: var(--crm-accent);
  color: var(--crm-accent-ink);
}
.select2-container--admin-autocomplete .select2-search--dropdown .select2-search__field {
  border: 1px solid var(--crm-field-border);
  background: var(--crm-field-bg);
  color: var(--crm-ink);
}

/* Collapsible fieldsets ("Author details"). */
fieldset.collapse details > summary { cursor: pointer; list-style: none; }
fieldset.collapse details > summary::-webkit-details-marker { display: none; }
fieldset.collapse details > summary .fieldset-heading { display: block; }
fieldset.collapse details > summary .fieldset-heading::after {
  content: " · show";
  color: var(--crm-accent);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
fieldset.collapse details[open] > summary .fieldset-heading::after { content: " · hide"; }

/* Save, delete and the other buttons at the foot of a form. */
.submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 8px 0 28px;
  padding: 20px 0 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--crm-rule);
  border-radius: 0;
  overflow: visible;
}
.submit-row input, .submit-row input.default { height: auto; margin: 0; line-height: 1.3; text-transform: none; }
.button.default, input[type=submit].default, .submit-row input.default { border: 1px solid var(--crm-accent); font-weight: 600; }
.submit-row input:not(.default) {
  border-color: var(--crm-rule);
  background: transparent;
  color: var(--crm-ink);
}
.submit-row input:not(.default):hover { border-color: var(--crm-rule); background: var(--crm-row-hover); color: var(--crm-ink); }
.submit-row .help { flex-basis: 100%; margin: 0; }
.submit-row a.deletelink:link, .submit-row a.deletelink:visited {
  display: inline;
  height: auto;
  margin-left: auto;
  padding: 8px 0;
  background: none;
  color: var(--crm-danger);
  font-size: 0.9rem;
  line-height: 1.3;
}
.submit-row a.deletelink:hover { background: none; color: var(--crm-danger); text-decoration: underline; }
.submit-row a.closelink:link, .submit-row a.closelink:visited, .task-form .submit-row a:not(.deletelink) {
  height: auto;
  padding: 8px 4px;
  background: none;
  color: var(--crm-muted);
  line-height: 1.3;
}
.delete-confirmation form { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.delete-confirmation a.cancel-link:link, .delete-confirmation a.cancel-link:visited {
  height: auto;
  padding: 8px 16px;
  border: 1px solid var(--crm-rule);
  border-radius: 4px;
  background: transparent;
  color: var(--crm-ink);
  line-height: 1.3;
}
.delete-confirmation ul { padding-left: 1.2em; }
.delete-confirmation form input[type=submit] { border-color: var(--crm-danger); background: var(--crm-danger); color: var(--crm-accent-ink); }
.delete-confirmation h2 { margin: 28px 0 8px; font-family: var(--crm-serif); font-size: 1.2rem; font-weight: 400; }

/* Inline rows on a record's page (interactions, projects, care agreements, invoice lines). */
.inline-group { margin: 0 0 44px; padding: 0; border: 0; background: none; }
.inline-group .tabular fieldset.module { margin: 0; }
.inline-group h2.inline-heading { margin: 0; }
.inline-group .tabular { overflow-x: auto; }
.inline-group .tabular table { width: 100%; border-collapse: collapse; }
.inline-group td .vDateField { width: 8.5rem; }
.inline-group thead th {
  padding: 10px 10px 8px;
  background: none;
  border-bottom: 1px solid var(--crm-rule);
  color: var(--crm-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.inline-group thead th img.help-tooltip { opacity: 0.6; vertical-align: 0; }
.inline-group thead th { vertical-align: bottom; }
.inline-group td { padding: 8px 10px; border-bottom: 1px solid var(--crm-hairline); vertical-align: middle; }
.inline-group td.original { width: 1px; padding-left: 0; padding-right: 0; }
.inline-group .tabular td.original p { color: var(--crm-muted); font-size: 0.8rem; }
.inline-group .tabular td.original p a { font-size: 0.8rem; }
.inline-group td input, .inline-group td select, .inline-group td textarea { box-sizing: border-box; max-width: 100%; }
.inline-group td input[type=text], .inline-group td textarea { width: 100%; min-width: 8rem; }
.inline-group td textarea { min-height: 2.6rem; }
.inline-group td.delete { width: 4.5rem; text-align: center; }
.inline-group .tabular tr.add-row td { padding: 12px 10px; border-bottom: 0; background: none; }
.inline-group div.add-row, .inline-group tr.add-row td { background: none; }
.inline-group .add-row a:link, .inline-group .add-row a:visited {
  padding-left: 0;
  background-image: none;
  color: var(--crm-accent);
  font-size: 0.9rem;
}
.inline-group .add-row a::before { content: "+ "; }
.inline-group .tabular tr.has_original td { padding-top: 26px; }
.inline-group .tabular tr.has_original td.original { padding-top: 4px; vertical-align: top; }

/* Invoice lines: quantity, price, amount and the total line up on the right. */
#lines-group th.column-description { width: 46%; }
#lines-group :is(th.column-quantity, th.column-unit_price, th.column-amount) { text-align: right; }
#lines-group td.field-quantity input { width: 5.5rem; }
#lines-group td.field-unit_price input { width: 8rem; }
#lines-group :is(td.field-quantity, td.field-unit_price) { text-align: right; }
#lines-group td.line-amount {
  min-width: 7rem;
  color: var(--crm-ink-soft);
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
  white-space: nowrap;
}
#lines-group tr.line-deleted td { opacity: 0.45; }
#lines-group tr.line-deleted td.line-amount { text-decoration: line-through; }
#lines-group tfoot td {
  padding: 14px 10px;
  border-top: 1px solid var(--crm-rule);
  border-bottom: 0;
}
#lines-group tfoot td:first-child {
  color: var(--crm-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
}
#lines-group tfoot td.line-total {
  font-family: var(--crm-serif);
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
  white-space: nowrap;
}

/* The task form. */
.task-form { max-width: 40rem; }
.task-form .form-row { display: block; }
.task-form .repeat input { width: 6rem; }
.task-form .repeat select { width: auto; margin-left: 6px; }
.task-form .submit-row { border-top: 0; }

@media (max-width: 767px) {
  .submit-row a.deletelink:link, .submit-row a.deletelink:visited { margin-left: 0; }
  #lines-group th.column-description { width: auto; }
}

/* Login: username, password and authenticator code in one narrow column. */

body.login { height: auto; padding: 0 var(--crm-gutter); background: var(--crm-bg); }
.login #container {
  width: auto;
  max-width: 22rem;
  min-width: 0;
  height: auto;
  margin: 14vh auto 64px;
  overflow: visible;
  background: none;
  border: 0;
  border-radius: 0;
}
.login #header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  padding: 0 0 18px;
  background: none;
  border-bottom: 1px solid var(--crm-rule);
}
.login #branding { display: flex; align-items: center; gap: 12px; }
.login #branding .crm-brand:link, .login #branding .crm-brand:visited { font-size: 1.75rem; }
.login .main { max-width: none; }
.login #content, .login #header + #main #content { padding: 28px 0 0; }
.login #content-main { float: none; width: auto; }
.login .form-row { padding: 0 0 20px; border: 0; }
.login .form-row + .form-row { margin-top: 0; }
.login .form-row label {
  display: block;
  padding: 0 0 6px;
  color: var(--crm-ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}
.login .form-row input:not([type=hidden]) { width: 100%; box-sizing: border-box; }
.login .form-row #id_otp_token { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; }
.login .form-row .help { margin-top: 6px; }
.login .submit-row { margin: 4px 0 0; padding: 0; border: 0; text-align: left; }
.login .submit-row input, .login .submit-row input:not(.default) {
  width: 100%;
  padding: 10px 16px;
  border-color: var(--crm-accent);
  background: var(--crm-accent);
  color: var(--crm-accent-ink);
  font-weight: 600;
  text-transform: none;
}
.login .submit-row input:hover { border-color: var(--crm-accent-hover); background: var(--crm-accent-hover); }
.login .errornote { margin: 0 0 24px; }
.login ul.messagelist { padding: 0; }
