/* TITAN Med visual identity, shared with the Pricing Tool.
   Colours are defined once here; the Django admin's own variables are mapped onto them.
   Fonts are self-hosted (SIL Open Font License, see fonts/OFL-*.txt). */

@font-face { font-family: "Fenix"; src: url("fonts/fenix-regular.8a45d706b6bb.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("fonts/pt-sans-regular.bc37928c6c13.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("fonts/pt-sans-bold.e118d7cb1cd4.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("fonts/pt-sans-italic.b589db8a6d07.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "PT Mono"; src: url("fonts/pt-mono-regular.ec65806793f3.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }

html[data-theme="light"], html[data-theme="dark"], :root {
  /* TITAN Med palette */
  --bg: #F1F3F7;          /* page */
  --surface: #FFFFFF;     /* cards */
  --sunk: #E9EDF3;        /* inset panels */
  --ink: #0A1B2E;         /* text */
  --muted: #54686E;
  --line: #D3DAE3;        /* borders */
  --brand: #02172C;       /* TITAN Med navy: name, header text */
  --orange: #EF8A17;      /* accent lines and focus outline */
  --orange-text: #B85F00; /* orange used as text */
  --orange-soft: #FCEBD5;
  --accent: #0B2F86;      /* primary buttons, active tabs, section labels */
  --accent-soft: #E2E8F7;
  --good: #24764A; --good-soft: #DCEFE3;
  --warn: #9A6312; --warn-soft: #F6E7CC;
  --bad: #A83636;  --bad-soft: #F5DCDC;

  --font-heading: "Fenix", Georgia, "Times New Roman", serif;
  --font-body: "PT Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: "PT Mono", ui-monospace, Menlo, Consolas, monospace;

  /* Django admin variables, in terms of the palette */
  --primary: var(--accent);
  --secondary: var(--accent);
  --primary-fg: #fff;
  --body-fg: var(--ink);
  --body-bg: var(--surface);
  --body-quiet-color: var(--muted);
  --body-medium-color: var(--ink);
  --body-loud-color: var(--brand);
  --header-color: var(--brand);
  --header-branding-color: var(--brand);
  --header-bg: var(--surface);
  --header-link-color: var(--brand);
  --breadcrumbs-fg: var(--muted);
  --breadcrumbs-link-fg: var(--accent);
  --breadcrumbs-bg: transparent;
  --link-fg: var(--accent);
  --link-hover-color: var(--brand);
  --link-selected-fg: var(--accent);
  --hairline-color: var(--line);
  --border-color: var(--line);
  --error-fg: var(--bad);
  --message-success-bg: var(--good-soft);
  --message-warning-bg: var(--warn-soft);
  --message-error-bg: var(--bad-soft);
  --darkened-bg: var(--sunk);
  --selected-bg: var(--accent-soft);
  --selected-row: var(--orange-soft);
  --button-fg: #fff;
  --button-bg: var(--accent);
  --button-hover-bg: var(--brand);
  --default-button-bg: var(--accent);
  --default-button-hover-bg: var(--brand);
  --close-button-bg: var(--muted);
  --close-button-hover-bg: var(--ink);
  --delete-button-bg: var(--bad);
  --delete-button-hover-bg: #8a2b2b;
  --object-tools-fg: #fff;
  --object-tools-bg: var(--accent);
  --object-tools-hover-bg: var(--brand);
  --font-family-primary: var(--font-body);
  --font-family-monospace: var(--font-mono);
  color-scheme: light;
}

html, body { background: var(--bg); }
body { font-family: var(--font-body); font-size: 14px; color: var(--ink); }

:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* Numbers, unit numbers, release numbers, amounts */
.tf-num, input[type="number"], code, pre, kbd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
td.tf-num, th.tf-num { white-space: nowrap; }

/* Headings: Fenix, regular weight; page and section titles get a short orange rule */
h1, h2, h3, #content h1, .module h2, .module caption {
  font-family: var(--font-heading); font-weight: 400;
}
#content > h1, #content > h2, .tf-title {
  color: var(--brand); font-size: 1.6rem; line-height: 1.25; margin: 4px 0 22px;
}
#content > h2 { font-size: 1.25rem; }
#content > h1::after, #content > h2::after, .tf-title::after {
  content: ""; display: block; width: 28px; height: 2px; margin-top: 8px; background: var(--orange);
}
h3 { color: var(--brand); }

/* Header: white bar, 3px orange bottom border */
#header {
  background: var(--surface); color: var(--brand); border-bottom: 3px solid var(--orange);
  padding: 10px 24px; gap: 12px 24px; flex-wrap: wrap;
}
#branding { align-items: center; min-width: 0; }
.tf-brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
#header a.tf-brand:link, #header a.tf-brand:visited { color: var(--brand); }
#header a.tf-brand:hover, #header a.tf-brand:focus { text-decoration: none; }
.tf-brand img { height: 44px; width: auto; flex: none; }
.tf-name, .tf-page { font-family: var(--font-heading); font-weight: 400; font-size: 1.45rem;
  line-height: 1.2; white-space: nowrap; margin: 0; }
.tf-name { color: var(--brand); }
.tf-page { color: var(--orange-text); border-left: 1px solid var(--line); padding-left: 12px;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#user-tools { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap;
  justify-content: flex-end; width: auto; margin: 0 0 0 auto; font-size: 0.875rem;
  text-transform: none; letter-spacing: 0; color: var(--muted); }
#user-tools strong { color: var(--brand); font-weight: 700; }
#header #user-tools a:link, #header #user-tools a:visited { color: var(--accent); }
#header #logout-form button, #user-tools button {
  width: auto; color: var(--accent); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; background: var(--surface); font: inherit; text-transform: none; }
#header #logout-form button:hover { background: var(--accent-soft); text-decoration: none; }

/* Pill tabs for the main sections */
.tf-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 24px 0; margin: 0; list-style: none; }
.tf-tabs a { display: inline-block; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; }
.tf-tabs a:hover { background: var(--accent-soft); color: var(--accent); }
.tf-tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
div.breadcrumbs { background: transparent; color: var(--muted); padding: 12px 24px 0; }
div.breadcrumbs a { color: var(--accent); }

#main, .main { background: var(--bg); }
#content { padding: 16px 24px 28px; }
#footer { padding: 0; }

/* Cards: white, 1px border, 3px orange top border, 6px radius */
.module, #changelist .results, #changelist-filter, .inline-group, .tf-card,
.submit-row, fieldset.module {
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--orange);
  border-radius: 6px;
}
.module { overflow: hidden; margin-bottom: 20px; }
.module h2, .module caption, .inline-group h2, #changelist-filter h2 {
  background: var(--surface); color: var(--accent); font-family: var(--font-body); font-weight: 700;
  font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.module caption a:link, .module caption a:visited, .module h2 a { color: var(--accent); }
.inline-group .module, fieldset.module .module { border: 0; border-radius: 0; }
#changelist.module { background: transparent; border: 0; border-radius: 0; overflow: visible; }
#changelist #toolbar { padding: 10px 12px; margin-bottom: 12px; background: var(--sunk); border: 1px solid var(--line);
  border-radius: 6px; }
#changelist .results { overflow-x: auto; }
#changelist-filter { overflow: hidden; }
#changelist-filter h3 { font-family: var(--font-body); font-weight: 700; color: var(--brand); }
.submit-row { border-top-width: 1px; background: var(--sunk); }
.calendar caption, .calendarbox h2 { background: var(--accent); color: #fff; }

table thead th, thead th, tfoot td { background: var(--sunk); color: var(--muted); }
thead th a:link, thead th a:visited { color: var(--muted); }
tr:nth-child(even), .row-form-errors { background: transparent; }
#changelist table tbody tr:hover { background: var(--accent-soft); }
td, th { border-bottom-color: var(--line); }
.paginator { color: var(--muted); }

/* Buttons: primary accent blue, white text */
.button, input[type=submit], input[type=button], .submit-row input, a.button, button.button {
  background: var(--accent); color: #fff; border-radius: 6px; font-family: var(--font-body);
  font-weight: 700; border: 0; }
.button:hover, input[type=submit]:hover, input[type=button]:hover, a.button:hover {
  background: var(--brand); color: #fff; }
.object-tools a:link, .object-tools a:visited { border-radius: 999px; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number],
input[type=tel], textarea, select, .vTextField {
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }

/* Messages and status chips */
ul.messagelist li { border-radius: 6px; color: var(--ink); background-image: none; padding-left: 14px; }
ul.messagelist li.success { background: var(--good-soft); border-left: 4px solid var(--good); }
ul.messagelist li.warning { background: var(--warn-soft); border-left: 4px solid var(--warn); }
ul.messagelist li.error { background: var(--bad-soft); border-left: 4px solid var(--bad); }
.errornote { border-radius: 6px; background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.tf-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.8125rem;
  font-weight: 700; background: var(--sunk); color: var(--muted); }
.tf-chip.good { background: var(--good-soft); color: var(--good); }
.tf-chip.warn { background: var(--warn-soft); color: var(--warn); }
.tf-chip.bad { background: var(--bad-soft); color: var(--bad); }

/* Sign-in page */
body.login { background: var(--bg); }
.login #container {
  width: 28rem; max-width: calc(100% - 32px); min-width: 0; margin: 72px auto; border: 1px solid var(--line);
  border-top: 3px solid var(--orange); border-radius: 6px; background: var(--surface); }
.login #header { border-bottom: 1px solid var(--line); justify-content: flex-start; padding: 16px 20px; }
.login #main, .login .main { background: var(--surface); }
.login #content { padding: 20px; }
.login .tf-signin-lead { color: var(--muted); margin: 0 0 16px; }
.login a.button.tf-signin { display: block; text-align: center; padding: 11px; margin: 0 0 18px; }
.login .submit-row { background: transparent; border: 0; padding: 12px 0 0; }
.login .submit-row input { width: 100%; padding: 10px; }

/* Phone widths */
@media (max-width: 767px) {
  #header { padding: 8px 16px; flex-direction: row; justify-content: space-between; align-items: center; }
  #branding { width: 100%; }
  .tf-brand img { height: 36px; }
  .tf-name, .tf-page { font-size: 1.15rem; }
  #user-tools { margin: 0; justify-content: flex-start; width: 100%; }
  .tf-tabs { padding: 12px 16px 0; }
  div.breadcrumbs { padding: 10px 16px 0; }
  #content { padding: 12px 16px 24px; }
  .login #container { margin: 24px auto; }
}
@media (max-width: 380px) {
  .tf-brand { gap: 8px; }
  .tf-page { padding-left: 8px; }
}
