/*
  Client portal styles.

  Written for people who do not use software all day, often on a phone, often
  older: large type, generous targets, high contrast, one column. Mostly
  element selectors, because the sign-in and second-factor pages are rendered
  by allauth's own unclassed markup and must look right without rewriting them.
*/

:root {
  --ink: #1d2733;
  --muted: #55606e;
  --line: #d5dbe3;
  --paper: #ffffff;
  --wash: #f4f6f8;
  --brand: #2f5d3a;
  --brand-dark: #234a2c;
  --focus: #0b57d0;
  --danger: #a3261a;
  --danger-wash: #fbecea;
  --ok-wash: #e8f3ea;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { font-size: 112.5%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--wash);
}

.skip { position: absolute; left: -999px; }
.demo-banner { background: #7a1f1f; color: #fff; text-align: center; padding: .5rem 1rem; font-weight: 600; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .5rem 1rem; z-index: 10; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding: .9rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: .85rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.brand img { height: 44px; width: auto; }

.top nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.top nav a { padding: .4rem 0; }

main { max-width: 44rem; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

/* ---- left navigation (portal/navigation.py) ---------------------------- */

/* On a phone the sidebar sits above the page; from tablet width up it is a
   column on the left that stays in view while the page scrolls. */
.sidenav {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.25rem;
}
.sidenav label { font-size: .9rem; color: var(--muted); }
.sidenav select { max-width: 100%; }
.sidenav__switch { margin: 0 0 .5rem; }
.sidenav__switch button { margin-top: .5rem; }
.sidenav__matter { font-weight: 600; margin: 0 0 .2rem; line-height: 1.3; }
.sidenav__type { color: var(--muted); font-size: .88rem; margin: 0 0 .75rem; }
.sidenav__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.sidenav__links a {
  display: block;
  padding: .55rem .85rem;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--line);
}
.sidenav__links a:hover { background: var(--wash); color: var(--ink); }
.sidenav__links a[aria-current="page"] { background: var(--ok-wash); border-color: #b9d8bf; color: var(--brand-dark); box-shadow: inset 4px 0 0 var(--brand); }

@media (min-width: 52rem) {
  .shell--nav { display: grid; grid-template-columns: 16rem minmax(0, 1fr); align-items: start; }
  .shell--nav .sidenav {
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    min-height: calc(100vh - 5rem);
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 1.5rem 1rem;
  }
  .shell--nav .sidenav__links { flex-direction: column; gap: .2rem; }
  .shell--nav .sidenav__links a { border-color: transparent; }
  .shell--nav main { margin: 0; padding-left: 2rem; }
}

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .6rem; }
p { margin: 0 0 1rem; }

a { color: var(--brand-dark); text-underline-offset: .15em; }
a:hover { color: var(--brand); }

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

form { margin: 0 0 1.5rem; }
form p { margin: 0 0 1.1rem; }

label { display: block; font-weight: 600; margin-bottom: .3rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input:not([type]),
select,
textarea {
  display: block;
  width: 100%;
  max-width: 26rem;
  font: inherit;
  padding: .7rem .8rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid #8b96a3;
  border-radius: var(--radius);
}

input[type="checkbox"], input[type="radio"] { width: 1.2rem; height: 1.2rem; margin-right: .5rem; vertical-align: middle; }

button,
.button,
input[type="submit"] {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  min-height: 2.9rem;
  padding: .65rem 1.3rem;
  margin: .25rem .5rem .25rem 0;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}

button:hover, .button:hover, input[type="submit"]:hover { background: var(--brand-dark); color: #fff; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin: 0 0 1rem;
}

.card h2 { margin-top: 0; }

.muted, .helptext, small { color: var(--muted); font-size: .92rem; }
.helptext { display: block; margin-top: .35rem; }

ul.rules { margin: 0 0 1.25rem; padding-left: 1.2rem; color: var(--muted); font-size: .95rem; }

.errorlist {
  list-style: none;
  margin: .35rem 0 0;
  padding: .6rem .8rem;
  color: var(--danger);
  background: var(--danger-wash);
  border-radius: var(--radius);
  font-weight: 600;
}

.flash { margin: 0 0 1.25rem; }
.flash__item { padding: .8rem 1rem; border-radius: var(--radius); background: var(--ok-wash); border: 1px solid #b9d8bf; }
.flash__item--error { background: var(--danger-wash); border-color: #e7b6b0; color: var(--danger); }

/* The authenticator-app QR code and the secret under it. */
main img[src^="data:image/svg"] { display: block; width: 14rem; height: 14rem; margin: 1rem 0; background: #fff; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); }
main input[readonly], main textarea[readonly] { font-family: ui-monospace, Consolas, monospace; background: var(--wash); }

.foot { max-width: 44rem; margin: 0 auto; padding: 0 1.25rem 2.5rem; color: var(--muted); font-size: .88rem; }

/* ---- questionnaire ---------------------------------------------------- */

[hidden] { display: none !important; }

.crumb, .step { color: var(--muted); font-size: .92rem; margin-bottom: .4rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }

.q { margin: 0 0 1.5rem; }
.q--error { border-left: 4px solid var(--danger); padding-left: .9rem; }
.q--check label, .later label { display: inline; font-weight: 400; }
.req { font-weight: 400; font-size: .82rem; color: var(--muted); margin-left: .25rem; }
.later { margin: .45rem 0 0; color: var(--muted); font-size: .95rem; }

fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: .3rem; }
/* Django renders radio and checkbox lists as a div of divs, each a label
   wrapping its input. */
fieldset > div > div { margin: .15rem 0; }
fieldset label { font-weight: 400; display: flex; align-items: center; gap: .1rem; min-height: 2.4rem; }

input[type="date"] { font: inherit; padding: .7rem .8rem; border: 1.5px solid #8b96a3; border-radius: var(--radius); background: var(--paper); color: var(--ink); }
textarea { max-width: 100%; }

.button--quiet, button.button--quiet {
  color: var(--brand-dark); background: var(--paper); border: 1.5px solid var(--brand);
}
.button--quiet:hover, button.button--quiet:hover { background: var(--ok-wash); color: var(--brand-dark); }

button.linkish {
  background: none; border: 0; padding: 0; margin: 0; min-height: 0;
  color: var(--danger); font-weight: 400; text-decoration: underline; cursor: pointer;
}
button.linkish:hover { background: none; color: var(--danger); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 1.5rem 0 1rem; }

.list__rows { list-style: none; margin: 0 0 1rem; padding: 0; }
.list__rows li {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem;
  padding: .7rem 0; border-top: 1px solid var(--line);
}
.list__rows li:first-child { border-top: 0; }
.list__title { font-weight: 600; }
.list__title .muted { font-weight: 400; margin-left: .4rem; }
.list__actions { display: flex; gap: 1.1rem; }

.card--notice { border-left: 5px solid var(--brand); }
.task { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.task h3 { margin-top: 0; }

.progress { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
progress { width: 14rem; max-width: 100%; height: .9rem; accent-color: var(--brand); }

.sections { list-style: none; margin: 1.5rem 0; padding: 0; counter-reset: section; }
.sections__item {
  counter-increment: section;
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem;
  padding: .85rem 1rem; margin-bottom: .5rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.sections__item > a, .sections__item > span:first-child { flex: 1 1 14rem; font-weight: 600; }
.sections__item > a::before, .sections__item > span:first-child::before { content: counter(section) ". "; color: var(--muted); font-weight: 400; }

.badge { font-size: .85rem; padding: .15rem .65rem; border-radius: 999px; background: var(--wash); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge--complete { background: var(--ok-wash); color: var(--brand-dark); border-color: #b9d8bf; }
.badge--in_progress { background: #fff6e0; color: #6b4a00; border-color: #ecd9a6; }

.save-status { min-height: 1.5rem; margin: 0; font-size: .92rem; color: var(--muted); }
.save-status[data-state="error"] { color: var(--danger); font-weight: 600; }
.save-status[data-state="warn"] { color: #6b4a00; }

.summary { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; }
.summary h2 { margin-top: 0; display: flex; justify-content: space-between; gap: 1rem; }
.summary__edit { font-size: .92rem; font-weight: 400; }
.summary dl { margin: 0; }
.summary dt { color: var(--muted); font-size: .92rem; margin-top: .7rem; }
.summary dd { margin: 0; }
.summary__block { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .6rem; }
.summary__block-title { font-weight: 600; margin: 0; }
.warn { color: var(--danger); }

/* ---- family tree ------------------------------------------------------- */

.tree { overflow: auto; max-width: 100%; margin: 1rem 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.tree svg { display: block; }
.tree a:focus-visible rect { stroke: var(--focus); stroke-width: 3; }
.tree-unplaced { background: #fff6e0; border: 1px solid #ecd9a6; border-radius: var(--radius); padding: .9rem 1.1rem; margin: 1rem 0; }
.tree-unplaced h2 { margin-top: 0; }
.tree-add select { max-width: 26rem; }

@media (max-width: 30rem) {
  .brand span { display: none; }
  button, .button, input[type="submit"] { width: 100%; margin-right: 0; }
}
