/* Legal Dashboard — colours, font and sizes from docs/brand-charter.md (charter v2).
   No shadows, gradients, transparency effects or animations (docs/design.md). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter/Inter-Regular.3875f8357497.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter/Inter-SemiBold.b72fa2728a8e.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter/Inter-Bold.66894432e7ff.woff2") format("woff2");
}

:root {
  --blue: #1a4f86;          /* AMLegal blue: header, primary button */
  --blue-mid: #2d6caa;      /* links, hover */
  --azure: #4ba7c7;         /* accent, decor (not for text) */
  --azure-dark: #1f6e8c;    /* accent text */
  --gold-light: #e3be74;    /* only the line under the active menu item */
  --text: #1c2733;
  --text-muted: #5b6673;
  --border: #dde2e7;
  --bg-grey: #f3f5f7;
  --azure-light: #e8f4f9;   /* selection / filter background */
  --white: #ffffff;

  --font: "Inter", Arial, sans-serif;
  --fs-h1: 30px;
  --fs-h2: 22px;
  --fs-body: 16px;
  --fs-table: 15px;
  --fs-note: 14px;

  --content-max: 1320px;
  --gap: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--white);
}

a { color: var(--blue-mid); text-decoration: underline; }
a:hover { color: var(--blue); }

h1 { font-size: var(--fs-h1); font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: var(--fs-h2); font-weight: 600; line-height: 1.3; }

.muted { color: var(--text-muted); font-size: var(--fs-note); }

/* ---------- Header ---------- */
.site-header { background: var(--blue); color: var(--white); }

.site-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 24px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
  padding: 10px 0;
}
.brand:hover { color: var(--white); }

/* The mark sits on a white plate: the charter forbids placing it on a coloured background without one. */
.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border-radius: 6px;
  padding: 4px 5px;
}
.brand__mark img { display: block; width: 32px; height: auto; }

/* Mobile menu: plain checkbox toggle, no JavaScript. */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle__label {
  margin-left: auto;
  border: 1px solid var(--white);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: var(--fs-note);
  cursor: pointer;
}

.main-nav {
  display: none;
  width: 100%;
  padding-bottom: 12px;
}
.nav-toggle:checked ~ .main-nav { display: block; }

.main-nav ul { list-style: none; margin: 0; padding: 0; }
.main-nav li a,
.main-nav li span {
  display: block;
  padding: 10px 0;
  color: var(--white);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.main-nav li a.is-active { border-bottom-color: var(--gold-light); font-weight: 600; }
.main-nav li .is-disabled { color: var(--border); cursor: default; }

.nav-tools { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.lang-switch { display: flex; gap: 4px; }
.logout { margin: 0; }
.nav-link { color: var(--white); font-size: var(--fs-note); text-decoration: none; }
.nav-link:hover { color: var(--white); text-decoration: underline; }
.logout button {
  font: inherit;
  font-size: var(--fs-note);
  color: var(--white);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
}
.logout button:hover { text-decoration: underline; }
.lang-switch button {
  font: inherit;
  font-size: var(--fs-note);
  background: transparent;
  color: var(--white);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
}
.lang-switch button.is-active { border-color: var(--white); font-weight: 600; }
.lang-switch button:hover { text-decoration: underline; }

@media (min-width: 900px) {
  .nav-toggle__label { display: none; }
  .main-nav {
    display: flex;
    width: auto;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    padding: 0;
  }
  .main-nav ul { display: flex; gap: 24px; }
  .main-nav li a,
  .main-nav li span { padding: 18px 0 15px; }
  .nav-tools { margin-top: 0; }
}

/* ---------- Content ---------- */
.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px var(--gap) 48px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.content--narrow { max-width: 440px; }
.content--narrow h1 { margin-bottom: 16px; }

.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.messages__item {
  padding: 10px 12px;
  border-left: 3px solid var(--azure);
  background: var(--azure-light);
  margin-bottom: 8px;
}
.messages__item--error { border-left-color: #b42318; background: #fdecea; }

.notice { border-left: 3px solid var(--azure-dark); background: var(--azure-light); padding: 10px 14px; margin-bottom: 16px; }
.notice p { margin: 4px 0; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 4px; }
.qr { display: block; width: 200px; height: 200px; }
#recovery_codes { font-family: ui-monospace, Menlo, monospace; }

.section { padding: 16px 0; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: 0; }
.section h2 { margin: 0 0 8px; }

/* ---------- Forms ---------- */
.form p { margin: 0 0 14px; }
.form label { display: block; font-weight: 600; margin-bottom: 4px; }
.form input[type="checkbox"] + label { display: inline; font-weight: 400; }
.form input:not([type="checkbox"]):not([type="radio"]),
.form select,
.form textarea {
  width: 100%;
  font: inherit;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--azure);
  outline-offset: 0;
  border-color: var(--azure-dark);
}
.form .helptext, .form p > span { display: block; color: var(--text-muted); font-size: var(--fs-note); margin-top: 4px; }
.form__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.errorlist { list-style: none; margin: 0 0 6px; padding: 0; color: #b42318; font-size: var(--fs-note); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--blue);
  text-decoration: none;
  cursor: pointer;
}
.btn--primary { background: var(--blue); color: var(--white); }
.btn--primary:hover { background: var(--blue-mid); border-color: var(--blue-mid); color: var(--white); }
.btn--secondary { background: var(--white); color: var(--blue); }
.btn--secondary:hover { color: var(--blue-mid); border-color: var(--blue-mid); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
.table th {
  background: var(--bg-grey);
  text-align: left;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* ---------- Status pills (charter: text colour on light background, no borders) ---------- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-note); font-weight: 600; }
.pill--ok { color: #2b6b35; background: #eaf4ec; }
.pill--running { color: #1a4f86; background: #e9eff7; }
.pill--soon { color: #8a5300; background: #fdf1dc; }
.pill--notice { color: #6b5200; background: #fbf6e6; }
.pill--late { color: #b42318; background: #fdecea; }
.pill--closed { color: #5b6673; background: #f3f5f7; }

/* ---------- Page parts ---------- */
.breadcrumb { margin: 0 0 8px; font-size: var(--fs-note); color: var(--text-muted); }
.page-head__sub { margin: 6px 0 0; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty { color: var(--text-muted); padding: 12px 0; }
.result-count { margin: 0 0 8px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 4px 0; }
.notes { white-space: normal; margin: 0; }
h3 { font-size: var(--fs-body); font-weight: 600; margin: 16px 0 6px; }
.section--quiet { border-bottom: 0; padding-top: 24px; }

.card-grid { display: grid; gap: 0 32px; }
@media (min-width: 900px) { .card-grid { grid-template-columns: 2fr 1fr; } }

/* Definition list: label above value on the phone, side by side on wider screens. */
.details { margin: 0; display: grid; grid-template-columns: 1fr; gap: 2px 16px; }
.details dt { color: var(--text-muted); font-size: var(--fs-note); margin-top: 8px; }
.details dd { margin: 0; }
@media (min-width: 600px) {
  .details { grid-template-columns: 180px 1fr; }
  .details dt { margin-top: 0; padding: 4px 0; }
  .details dd { padding: 4px 0; }
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filters__field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; }
.filters__field--wide { flex: 3 1 260px; }
.filters label { font-weight: 600; font-size: var(--fs-note); }
.filters input, .filters select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
  width: 100%;
}
.filters input:focus, .filters select:focus { outline: 2px solid var(--azure); border-color: var(--azure-dark); }

.quick-filters { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; padding: 0; }
.quick-filters a { display: inline-block; padding: 4px 8px; border-radius: 4px; }
.quick-filters a.is-active { font-weight: 600; background: var(--azure-light); color: var(--azure-dark); }

.pagination { display: flex; gap: 16px; align-items: center; padding: 12px 0; }

/* ---------- Table extras ---------- */
.table__sub { display: block; color: var(--text-muted); font-size: 13px; }
.table__signal { width: 1%; white-space: nowrap; }

/* On the phone every row becomes a small card: the first cell is the title,
   the others show their column name before the value. */
@media (max-width: 699px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table--cards td { border: 0; padding: 2px 0; }
  .table--cards td[data-label] { display: flex; gap: 8px; }
  .table--cards td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 40%;
    color: var(--text-muted);
    font-size: var(--fs-note);
  }
}

/* ---------- Form layout ---------- */
.field { margin: 0 0 14px; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 4px; padding: 0; }
.field--required > label::after { content: " *"; color: var(--text-muted); }
.field__choices { border: 0; margin: 0; padding: 0; }
.field__choices .choice { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin-right: 20px; }
.field input[type="checkbox"] + label { display: inline; font-weight: 400; }
.field--error input, .field--error select, .field--error textarea { border-color: #b42318; }
.form__group { border: 0; border-top: 1px solid var(--border); margin: 8px 0 0; padding: 16px 0 0; }
.form__group > legend { font-size: var(--fs-body); font-weight: 600; padding: 0 8px 0 0; }
.form__grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 700px) {
  .form__grid { grid-template-columns: 1fr 1fr; }
  .form__grid .field--wide { grid-column: 1 / -1; }
}
.form .errorlist.nonfield { padding: 10px 12px; background: #fdecea; margin-bottom: 16px; }

/* Contact form: only the fields of the chosen type are shown (no JavaScript needed). */
.contact-form:has(input[name="kind"][value="person"]:checked) .only-organization,
.contact-form:has(input[name="kind"][value="organization"]:checked) .only-person { display: none; }

.btn--quiet { background: none; border-color: transparent; color: var(--text-muted); font-weight: 400; text-decoration: underline; padding-left: 0; }
.btn--quiet:hover { color: var(--text); }

/* ---------- Matter card ---------- */
.section__head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.section__head h2 { margin: 0 0 8px; }

/* Underlined tabs with a counter in an AMLegal-blue circle (design.md). */
.tabs { display: flex; flex-wrap: wrap; gap: 0 24px; border-bottom: 1px solid var(--border); margin: 8px 0 0; overflow-x: auto; }
.tabs a, .tabs .is-disabled { padding: 10px 0 8px; border-bottom: 3px solid transparent; text-decoration: none; color: var(--blue-mid); white-space: nowrap; }
.tabs a.is-active { border-bottom-color: var(--blue); color: var(--text); font-weight: 600; }
.tabs .is-disabled { color: var(--text-muted); cursor: default; }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--blue); color: var(--white); font-size: 12px; font-weight: 600; text-align: center; line-height: 20px; }

.table__actions { white-space: nowrap; text-align: right; }
.table__actions form, .inline-form { display: inline; margin-left: 12px; }
.table__actions > a { margin-left: 12px; }
.table__actions > :first-child { margin-left: 0; }
.btn--small { padding: 4px 10px; font-size: var(--fs-note); }
.section__buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.btn--link { font: inherit; background: none; border: 0; padding: 0; color: var(--blue-mid); text-decoration: underline; cursor: pointer; }
.btn--link:hover { color: var(--blue); }
.archived-list { margin-top: 16px; color: var(--text-muted); }
.archived-list summary { cursor: pointer; }
.form--narrow { max-width: 640px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 699px) {
  .table--cards td.table__actions { text-align: left; padding-top: 6px; }
  .table--cards td.table__signal:empty { display: none; }
  .table__actions form { margin-left: 16px; }
}

/* Quick add inside a form (a court while entering a proceeding). */
.quick-add { margin: -6px 0 16px; }
.quick-add > summary { cursor: pointer; color: var(--blue-mid); text-decoration: underline; }
.quick-add__body { border-left: 3px solid var(--azure); background: var(--azure-light); padding: 12px 14px; margin-top: 8px; }
.quick-add__body .field input { background: var(--white); }
.quick-add__more { margin: 0 0 12px; }
.quick-add__more > summary { cursor: pointer; font-size: var(--fs-note); color: var(--text-muted); margin-bottom: 8px; }

/* ---------- Quick search in the header ---------- */
.quick-search { position: relative; display: flex; order: 3; width: 100%; margin: 0 0 10px; }
.nav-toggle__label { order: 2; }
.main-nav { order: 4; }
.quick-search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--fs-note);
  padding: 8px 10px;
  border: 1px solid var(--white);
  border-right: 0;
  border-radius: 4px 0 0 4px;
  color: var(--text);
  background: var(--white);
}
.quick-search input:focus { outline: 2px solid var(--azure); outline-offset: 0; }
.quick-search__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  background: var(--azure);
  border: 1px solid var(--azure);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}
.quick-search__button:hover { background: var(--azure-dark); border-color: var(--azure-dark); }

.quick-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 4px;
}
.quick-search:not(:focus-within) .quick-results { display: none; }
.quick-results__panel {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px 0;
  outline: none;
}
.quick-results__head { margin: 6px 12px 2px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.quick-results__list { list-style: none; margin: 0; padding: 0; }
.quick-results__list a { display: block; padding: 6px 12px; color: var(--text); text-decoration: none; font-size: var(--fs-note); }
.quick-results__list a:hover, .quick-results__list a:focus { background: var(--azure-light); color: var(--azure-dark); outline: none; }
.quick-results__all { margin: 4px 12px 6px; font-size: var(--fs-note); }
.quick-results__empty { margin: 8px 12px; color: var(--text-muted); font-size: var(--fs-note); }

@media (min-width: 900px) {
  .quick-search { order: 0; width: auto; flex: 0 1 340px; margin: 0; }
  .main-nav { order: 0; }
  .quick-results { min-width: 380px; }
}

/* Subtasks under their task (R-039) */
.table__child td:first-child { padding-left: 28px; }

/* ---------- List / calendar switch and month calendar (R-039) ---------- */
.view-switch { display: flex; gap: 16px; }
.view-switch a { color: var(--text-muted); text-decoration: none; padding-bottom: 4px; border-bottom: 2px solid transparent; }
.view-switch a.is-active { color: inherit; font-weight: 600; border-bottom-color: currentColor; }
.calendar-head { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; }
.calendar-head h2 { margin: 0; min-width: 10em; text-align: center; }
.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar th { font-size: var(--fs-note); font-weight: 600; color: var(--text-muted); padding: 4px; text-align: center; }
.calendar__day { border: 1px solid #e3e7ec; height: 64px; vertical-align: top; padding: 0; }
.calendar__day > a, .calendar__day > .calendar__number { display: block; height: 100%; padding: 6px; box-sizing: border-box; }
.calendar__day > a { text-decoration: none; color: inherit; }
.calendar__day > a:hover, .calendar__day > a:focus-visible { background: #f3f7fb; }
.calendar__day > span.calendar__number { color: var(--text-muted); }
.calendar__day > a .calendar__number { font-weight: 600; display: block; }
.calendar__day--other { background: #fafbfc; }
.calendar__day--today { outline: 2px solid #1a4f86; outline-offset: -2px; }
.calendar__day--chosen { background: #e9eff7; }
.calendar__count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; font-size: var(--fs-note); font-weight: 600; text-align: center; color: #1a4f86; background: #e9eff7; }
.calendar__count--deadline { color: #8a5300; background: #fdf1dc; }
.calendar__count--late { color: #b42318; background: #fdecea; }
.calendar__legend { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
@media (max-width: 600px) {
  .calendar__day { height: 52px; }
  .calendar__day > a, .calendar__day > .calendar__number { padding: 3px; }
}
