/* DueFirm — hand-written stylesheet. No framework, no external assets.
   Borders and spacing carry the design; colour is reserved for the accent
   and for the deadline badges, where it means something. */

:root {
  --accent: #0f6b5f;
  --accent-dark: #0b544a;
  --accent-tint: #e8f1ef;

  --page: #f6f6f4;
  --surface: #ffffff;
  --ink: #1b1c1a;
  --ink-soft: #4a4c48;
  --ink-muted: #74766f;
  --line: #e2e2dc;
  --line-strong: #cfd0c9;

  --overdue-bg: #7c1d1d;
  --overdue-fg: #ffffff;
  --urgent-bg: #fceceb;
  --urgent-fg: #a3241a;
  --urgent-line: #f0c8c4;
  --soon-bg: #fdf3e2;
  --soon-fg: #8a5c07;
  --soon-line: #eedcb4;
  --clear-bg: #ebf4ee;
  --clear-fg: #1c6b41;
  --clear-line: #cbe2d3;

  --radius: 6px;
  --shell: 1100px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.25;
  font-weight: 600;
}

h1 {
  font-size: 25px;
}
h2 {
  font-size: 17px;
}

p {
  margin: 0 0 12px;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration-color: rgba(15, 107, 95, 0.35);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

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

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: 58px;
}

.brand,
.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand__mark {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: var(--accent);
  flex: none;
}

.brand__name {
  font-weight: 400;
}

.brand__name strong {
  font-weight: 650;
}

.nav {
  display: flex;
  gap: 22px;
  flex: 1;
  flex-wrap: wrap;
}

.nav__link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  padding: 18px 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.nav__link:hover {
  color: var(--ink);
}

.nav__link.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.topbar__account {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--ink-muted);
}

.topbar__firm {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linkbtn:hover {
  color: var(--ink);
}

.page {
  flex: 1;
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 34px 24px 64px;
}

.page--bare {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 8vh;
}

.foot {
  max-width: var(--shell);
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 34px;
  color: var(--ink-muted);
  font-size: 12.5px;
  line-height: 1.55;
  border-top: 1px solid var(--line);
}

/* Spans the content column. A ch-based cap wrapped it at roughly half the
   width, which left it looking ragged and detached from the page above. */
.foot p {
  max-width: none;
}

.foot--bare {
  text-align: center;
  border-top: 0;
}

.foot--bare p {
  max-width: none;
}

/* ---------- page furniture ---------- */

.crumbs {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.crumbs span {
  margin: 0 4px;
  color: var(--line-strong);
}

.pagehead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.pagehead__lede {
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: 14px;
}

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

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.card + .card {
  margin-top: 20px;
}

.card__title {
  margin-bottom: 14px;
}

.card--danger {
  border-color: #e8d3d1;
}

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

.split--narrow {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.split__side .card + .card {
  margin-top: 20px;
}

.empty {
  text-align: center;
  padding: 56px 24px;
}

.empty p {
  max-width: 46ch;
  margin: 10px auto 22px;
  color: var(--ink-muted);
}

/* ---------- notices ---------- */

.notice {
  display: block;
  border: 1px solid var(--soon-line);
  border-left: 3px solid #d09a2a;
  background: var(--soon-bg);
  color: #6f4a06;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}

.notice--info {
  border-color: #cfe0dd;
  border-left-color: var(--accent);
  background: var(--accent-tint);
  color: #17453e;
}

.notice--warn {
  border-color: var(--urgent-line);
  border-left-color: #b8392c;
  background: var(--urgent-bg);
  color: #7d2019;
}

.flash {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid;
}

.flash--error {
  background: var(--urgent-bg);
  border-color: var(--urgent-line);
  color: var(--urgent-fg);
}

.flash--ok {
  background: var(--accent-tint);
  border-color: #cfe0dd;
  color: #17453e;
}

/* ---------- summary strip ---------- */

.stats {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 22px;
}

.stat {
  flex: 1;
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat__label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.stat__value {
  font-size: 27px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat--alert .stat__value {
  color: var(--overdue-bg);
}

/* ---------- filters ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

/* Underline sits on the link's own box, so a wrapped row stays tidy. */
.filters__link {
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.filters__link:hover {
  color: var(--ink);
}

.filters__link.is-active {
  color: var(--accent);
  font-weight: 500;
  border-bottom-color: var(--accent);
}

/* ---------- tables ---------- */

.tablewrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

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

.table th,
.table td {
  text-align: left;
  padding: 14px 18px;
  vertical-align: top;
  font-weight: 400;
}

.table thead th {
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody tr + tr th,
.table tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.table tbody tr:hover {
  background: #fafaf8;
}

.table--inset {
  border: 0;
}

.table--inset th,
.table--inset td {
  padding-left: 0;
}

.table--inset td:last-child,
.table--inset th:last-child {
  padding-right: 0;
}

.cell-client a {
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}

.cell-client a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cell-client__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.cell-client__flags:empty {
  display: none;
}

.cell-label {
  color: var(--ink-soft);
  max-width: 260px;
}

.cell-due {
  white-space: nowrap;
}

.cell-due .badge {
  margin-left: 10px;
}

.quietlink {
  font-size: 13.5px;
}

/* ---------- badges and chips ---------- */

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}

.badge--overdue {
  background: var(--overdue-bg);
  color: var(--overdue-fg);
}

.badge--urgent {
  background: var(--urgent-bg);
  color: var(--urgent-fg);
  border-color: var(--urgent-line);
}

.badge--soon {
  background: var(--soon-bg);
  color: var(--soon-fg);
  border-color: var(--soon-line);
}

.badge--clear {
  background: var(--clear-bg);
  color: var(--clear-fg);
  border-color: var(--clear-line);
}

.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-muted);
  background: #f2f2ee;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.chip--warn {
  color: var(--soon-fg);
  background: var(--soon-bg);
  border-color: var(--soon-line);
}

.chip--ok {
  color: var(--clear-fg);
  background: var(--clear-bg);
  border-color: var(--clear-line);
}

/* ---------- forms ---------- */

.form {
  margin-top: 4px;
}

.field {
  margin-bottom: 18px;
}

.field--narrow input {
  max-width: 130px;
}

label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='date'],
input[type='number'],
textarea {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
}

input[type='date'],
input[type='number'] {
  font-variant-numeric: tabular-nums;
}

textarea {
  resize: vertical;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.14);
}

.hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}

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

.formactions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  padding: 9px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: #b6b8ae;
  background: #fbfbf9;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn--danger {
  color: #a3241a;
  border-color: #ddb8b4;
}

.btn--danger:hover {
  background: #a3241a;
  border-color: #a3241a;
  color: #fff;
}

.btn--block {
  width: 100%;
  margin-top: 14px;
}

/* ---------- definition lists and lists ---------- */

.deflist {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 14px;
}

.deflist dt {
  color: var(--ink-muted);
  font-size: 13px;
  white-space: nowrap;
}

/* Let a wide chip wrap rather than squeeze the label column. */
.deflist .chip {
  white-space: normal;
}

.deflist dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.ticklist {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: var(--ink-soft);
}

.ticklist li {
  margin-bottom: 8px;
}

.ticklist li::marker {
  color: var(--accent);
}

/* ---------- disclosure ---------- */

details summary {
  cursor: pointer;
  font-size: 14px;
  color: #a3241a;
  padding: 2px 0;
}

details[open] summary {
  margin-bottom: 10px;
}

details p {
  font-size: 13.5px;
}

details form {
  margin-top: 12px;
}

/* ---------- auth ---------- */

.auth {
  width: 100%;
  max-width: 400px;
}

.auth__brand {
  justify-content: center;
  width: 100%;
  margin-bottom: 22px;
}

.auth__card {
  padding: 28px;
}

.auth__card h1 {
  font-size: 21px;
}

.auth__card .muted {
  font-size: 14px;
  margin: 6px 0 22px;
}

.auth__alt {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-muted);
}

/* ---------- responsive ---------- */

@media (max-width: 880px) {
  .split,
  .split--narrow {
    grid-template-columns: minmax(0, 1fr);
  }

  .split__side .card:first-child {
    margin-top: 20px;
  }

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

  .stats {
    flex-direction: column;
  }

  .stat + .stat {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .topbar__inner {
    flex-wrap: wrap;
    gap: 0 24px;
    padding: 10px 18px;
    min-height: 0;
  }

  .nav {
    order: 3;
    width: 100%;
    gap: 18px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
  }

  .nav__link {
    padding: 11px 0 9px;
  }

  .page {
    padding: 24px 18px 48px;
  }

  .foot {
    padding: 18px;
  }
}
