/* Application styles. Pico (vendor/pico.min.css) provides the base; this file dresses it in
   the Myriad360 look (colours and type taken from myriad360.com) and adds the few components
   Pico has no class for. No inline styles anywhere (CSP): everything the templates need is here. */

/* --- Poppins, self-hosted (vendor/poppins). Latin only; other characters fall back to Arial. -- */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/poppins/poppins-latin-400-normal.9212f6f9860f.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("vendor/poppins/poppins-latin-500-normal.a09f2fccfee3.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("vendor/poppins/poppins-latin-600-normal.72993dddf88a.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Theme: Pico's light variables, overridden ------------------------------------------------
   base.html fixes <html data-theme="light">. Pico sets its light values on
   `:root:not([data-theme=dark])` (specificity 0,2,0), so this selector matches that and wins
   by coming later. */

:root[data-theme="light"] {
  /* Myriad360 brand tokens */
  --m360-navy: #0a3971; /* primary: deep navy */
  --m360-blue: #2287fd; /* primary: dodger blue */
  --m360-amber: #fec234; /* primary: amber */
  --m360-midnight: #0a2546; /* secondary: midnight navy */
  --m360-alice: #f3f8ff; /* secondary: alice blue */
  --m360-steel: #48709f; /* secondary: steel blue */
  --m360-azure: #a7cffe; /* secondary: soft azure */
  --m360-n50: #f8fafb;
  --m360-n100: #f0f3f6;
  --m360-n200: #e8ecf0;
  --m360-n300: #dfe4e9;
  --m360-n400: #bbc3ce;
  --m360-n500: #96a1b2;
  --m360-n600: #728097;
  --m360-n700: #4d5e7b;
  --m360-n800: #293d60;
  --m360-n900: #041b45;
  --m360-blue-600: #1d4ed8;
  --m360-blue-700: #1e40af;
  /* States that are not brand colours: approved, and errors in forms. */
  --m360-green: #15803d;
  --m360-green-tint: #dcfce7;
  --m360-error: #b42318;
  --m360-error-tint: #fef3f2;
  /* Destructive buttons (Delete): 6.5:1 on white, so it reads as red without being a warning. */
  --m360-danger: #b91c1c;
  --m360-danger-hover: #991b1b;

  /* Type. Pico grows the root size with the window (up to 131%), which is too big for Poppins,
     so it stays at 16px. */
  --pico-font-family: "Poppins", Arial, sans-serif;
  --pico-font-weight: 400;
  --pico-font-size: 100%;
  --pico-border-radius: 0.5rem;

  /* Page, text and cards */
  --pico-background-color: var(--m360-alice);
  --pico-color: var(--m360-n800);
  --pico-muted-color: var(--m360-n700);
  --pico-muted-border-color: var(--m360-n200);
  --pico-text-selection-color: rgba(34, 135, 253, 0.25);
  --pico-h1-color: var(--m360-navy);
  --pico-h2-color: var(--m360-navy);
  --pico-h3-color: var(--m360-n800);
  --pico-h4-color: var(--m360-n800);
  --pico-h5-color: var(--m360-n700);
  --pico-h6-color: var(--m360-n700);
  --pico-card-background-color: #fff;
  --pico-card-border-color: var(--m360-n200);
  --pico-card-sectioning-background-color: var(--m360-n50);
  --pico-card-box-shadow: 0 1px 3px rgba(10, 37, 70, 0.08);
  --pico-table-border-color: var(--m360-n200);

  /* Links and filled buttons. Link text is blue-600 rather than dodger blue: dodger on white is
     only 3.5:1, blue-600 is 6.7:1. Button fills are dodger blue and go deep navy on hover. */
  --pico-primary: var(--m360-blue-600);
  --pico-primary-hover: var(--m360-navy);
  --pico-primary-underline: rgba(29, 78, 216, 0.45);
  --pico-primary-hover-underline: var(--m360-navy);
  --pico-primary-focus: rgba(34, 135, 253, 0.55);
  --pico-primary-background: var(--m360-blue);
  --pico-primary-hover-background: var(--m360-navy);
  --pico-primary-inverse: #fff;

  /* Outline buttons: .outline.secondary is navy, .outline.contrast (Delete, Remove, Deny) midnight. */
  --pico-secondary: var(--m360-navy);
  --pico-secondary-background: var(--m360-navy);
  --pico-secondary-hover: var(--m360-midnight);
  --pico-secondary-hover-background: var(--m360-midnight);
  --pico-secondary-underline: rgba(10, 57, 113, 0.45);
  --pico-secondary-focus: rgba(10, 57, 113, 0.3);
  --pico-contrast: var(--m360-midnight);
  --pico-contrast-background: var(--m360-midnight);
  --pico-contrast-hover: #000;
  --pico-contrast-hover-background: #000;
  --pico-contrast-focus: rgba(10, 37, 70, 0.3);

  /* Form fields: white, a visible border, a soft azure ring and a dodger blue edge on focus. */
  --pico-form-element-background-color: #fff;
  --pico-form-element-border-color: var(--m360-n500);
  --pico-form-element-color: var(--m360-n900);
  --pico-form-element-placeholder-color: var(--m360-n600);
  --pico-form-element-active-background-color: #fff;
  --pico-form-element-active-border-color: var(--m360-blue);
  --pico-form-element-focus-color: var(--m360-azure);
  --pico-form-element-invalid-border-color: var(--m360-error);
  --pico-form-element-invalid-active-border-color: var(--m360-error);

  /* Compact controls: Pico pads a field or button 0.75rem by 1rem, which the whole app inherits.
     This makes inputs, selects and buttons a little shorter and narrower. */
  --pico-form-element-spacing-vertical: 0.45rem;
  --pico-form-element-spacing-horizontal: 0.85rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  --pico-font-weight: 600;
}

strong,
b,
th {
  font-weight: 600;
}

h1 {
  --pico-font-size: 1.75rem;
}

h2 {
  --pico-font-size: 1.375rem;
}

/* Buttons and nav are Poppins 500, and a button's text is a little smaller than the page's. */
:is(button, [type="submit"], [type="button"], [role="button"]) {
  --pico-font-weight: 500;
  font-size: 0.9375rem;
}

/* Outline buttons tint on hover instead of staying see-through. Pico writes its hover rules
   as :is(..., [aria-current]:not(...), :hover, ...), which counts for as much as its most
   specific argument, so this repeats that form: equal weight, and later, so it wins. */
:is(button, [type="submit"], [type="button"], [role="button"]).outline:is(
    [aria-current]:not([aria-current="false"]),
    :hover,
    :active,
    :focus
  ) {
  --pico-background-color: rgba(34, 135, 253, 0.1);
}

/* A wider ring that stays visible on a white card. */
:where(select, textarea),
input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]) {
  --pico-outline-width: 0.1875rem;
}

/* --- Page frame: header, main, footer -------------------------------------------------------- */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* `body > main` because Pico's own padding rule is `body > main` and must be out-ranked. */
body > main {
  flex: 1 0 auto;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.site-header {
  padding-block: 0.625rem;
  background: var(--m360-navy);
  /* The bar is dark, so its links, hover underline and focus ring are redefined for it. */
  --pico-color: #fff;
  --pico-primary: #fff;
  --pico-primary-hover: #fff;
  --pico-primary-underline: transparent;
  --pico-primary-hover-underline: var(--m360-amber);
  --pico-primary-focus: rgba(254, 194, 52, 0.7);
  /* Sign out is a light outline button on the navy bar: white text and border. */
  --pico-secondary: #fff;
  --pico-secondary-hover: #fff;
  color: #fff;
}

.site-header nav {
  flex-wrap: wrap;
  row-gap: 0.25rem;
}

.site-header nav ul {
  flex-wrap: wrap;
}

.site-header nav li {
  padding-block: 0.25rem;
}

.site-header nav a {
  font-weight: 500;
  text-underline-offset: 0.4em;
  text-decoration-thickness: 2px;
}

.site-header .brand-logo {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.site-header .brand-logo img {
  display: block;
  width: auto;
  height: 36px;
}

.site-header .product-name {
  margin-left: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-weight: 500;
  line-height: 1.2;
}

.site-header button.outline.secondary {
  --pico-border-color: rgba(255, 255, 255, 0.7);
  padding: 0.375rem 1rem;
}

.site-header
  :is(button, [type="submit"], [type="button"], [role="button"]).outline:is(
    [aria-current]:not([aria-current="false"]),
    :hover,
    :active,
    :focus
  ) {
  --pico-background-color: rgba(255, 255, 255, 0.14);
}

@media (max-width: 575px) {
  /* "Conferences Wishlist" is short enough to sit beside the logo on a phone, so it stays on the
     logo's row with its divider and a tighter gap, and the links wrap beneath. */
  .site-header .brand-logo img {
    height: 30px;
  }

  .site-header .product-name {
    margin-left: 0.5rem;
    padding-left: 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 353px) {
  /* Under 354 px the name and its divider no longer fit beside the logo. The divider goes and
     the name sits flush: still beside the logo where it fits, on its own row under it where not. */
  .site-header .product-name {
    margin-left: 0;
    border-left: 0;
  }
}

.site-footer {
  padding-block: 1.25rem;
  background: var(--m360-midnight);
  color: var(--m360-n300);
}

.site-footer small {
  color: inherit;
}

/* The Sign out button sits in the nav next to links, so it must not carry form spacing. */
nav form.logout,
nav form.logout button {
  margin-bottom: 0;
}

/* --- Cards and tables ------------------------------------------------------------------------ */

article {
  border: 1px solid var(--m360-n200);
  border-radius: 0.75rem;
}

article > header {
  border-top-left-radius: calc(0.75rem - 1px);
  border-top-right-radius: calc(0.75rem - 1px);
}

article > footer {
  border-bottom-left-radius: calc(0.75rem - 1px);
  border-bottom-right-radius: calc(0.75rem - 1px);
}

/* Tables sit on a white card; the card scrolls sideways on a narrow screen. */
figure {
  margin-bottom: var(--pico-spacing);
  overflow-x: auto;
  border: 1px solid var(--m360-n200);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: var(--pico-card-box-shadow);
}

figure table {
  /* Narrower than this the columns crush each other, so the card scrolls instead. */
  min-width: 46rem;
  margin-bottom: 0;
  --pico-background-color: #fff;
}

thead th {
  background: var(--m360-n50);
  color: var(--m360-n700);
  font-size: 0.875rem;
  white-space: nowrap;
}

tbody tr:last-child > * {
  border-bottom: 0;
}

/* A conference's description under its name, in a bold row header, stays regular weight. */
th small {
  font-weight: 400;
}

/* A short table (the admin's Review and Decided lists) is only as wide as its columns need,
   instead of spreading a handful of short values across the page. It still scrolls sideways on a
   phone, like the rest. */
figure.fit {
  width: fit-content;
  max-width: 100%;
}

figure.fit table {
  width: auto;
  min-width: 0;
}

figure.fit :is(th, td) {
  padding-inline: 1rem;
  white-space: nowrap;
}

/* How many things a list page shows ("48 conferences", "4 wishlists waiting"), above the list. */
.list-count {
  margin-bottom: 0.5rem;
  color: var(--m360-n700);
}

/* Text for a screen reader only: out of sight and out of the layout, but still in the page (not
   `display: none`, which a screen reader skips too). The live region of the filter bars. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The filter bar above a list (Review, Decided): a search box, a picker and a Clear link on a row
   that wraps. The form is role="search", which Pico dresses as one joined group: the fields share
   borders, each stretches, only the ends of the row are rounded and the form itself takes the
   focus ring. The bar is separate controls, so each control's rule names the role to out-rank
   Pico's, and puts the control back as it is elsewhere (the search box stays a pill). */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  box-shadow: none;
  --pico-border-radius: 0.5rem;
}

.filter-bar :is(input, select) {
  font-size: 0.9375rem;
}

.filter-bar[role="search"] input[type="search"] {
  flex: 0 0 20rem;
  margin: 0;
  border-radius: var(--pico-border-radius);
}

.filter-bar[role="search"] select {
  flex: 0 0 auto;
  width: auto;
  max-width: 22rem;
  margin: 0;
  border-radius: var(--pico-border-radius);
}

/* Apply sits in a <noscript>, so it shows only without scripts, as wide as the button. (Not
   `display`: with scripts on, the browser's own display: none is what hides the markup.) */
.filter-bar > noscript {
  flex: none;
}

.filter-bar[role="search"] button[type="submit"] {
  flex: none;
  margin: 0;
  border-radius: var(--pico-border-radius);
  --pico-form-element-spacing-horizontal: 0.85rem;
}

.filter-clear {
  flex: none;
  font-size: 0.875rem;
}

/* The end of a bar: its hidden fields (the sort, and on Review the other section's choices) and
   Clear, in one element that the other section's bar refreshes. Only Clear shows. */
.filter-keep {
  flex: none;
}

@media (max-width: 575px) {
  .filter-bar[role="search"] input[type="search"] {
    flex-basis: 100%;
  }

  /* A picker is as wide as its longest option, up to 22rem; on a phone no wider than the row, so
     a long conference name is cut off in the picker and the page does not scroll sideways. */
  .filter-bar[role="search"] select {
    max-width: 100%;
  }
}

/* "(you)" after the viewer's own name in Review and Decided: a note, not part of the name, so it is
   not bold like the name it follows, and as small as Pico's <small> comes out there (13.3px of the
   16px name), which is what the approved mockup (T4) has. */
.you {
  font-weight: 400;
  font-size: 0.8333em;
}

/* A date, a choice or a link that should not break across lines inside a table cell. Without it
   a cell shrinks to one word per line when the table is wider than its card. */
.nowrap {
  white-space: nowrap;
}

/* A button in a table row (Edit, Archive, Delete, Add to wishlist, Delete wishlist, Approve) is
   small and stays on one line, so a row is as tall as its text and not as tall as stacked buttons.
   It is still over 24px tall. */
figure table :is(button, [role="button"]) {
  padding: 0.2rem 0.6rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

@media (max-width: 575px) {
  /* On a phone the table scrolls anyway, so the small buttons get a comfortable tap target. */
  figure table :is(button, [role="button"]) {
    padding: 0.5rem 0.75rem;
  }
}

/* A table with many columns (the admin's has nine) pads its cells less, so on a desktop it fits
   its card instead of scrolling sideways. Money and counts line up on their right edge, in
   columns that are tighter still. */
table.dense th,
table.dense td {
  padding-inline: 0.75rem;
}

table.dense thead th {
  white-space: normal;
}

table.dense th.num,
table.dense td.num {
  padding-inline: 0.625rem;
  text-align: right;
}

/* The admin table's row actions are small and stay on one line, so a row is as tall as its name and
   not as tall as three stacked buttons. */
table.dense .actions {
  flex-wrap: nowrap;
  gap: 0.375rem;
}

/* An admin's own wishlist control (Add to wishlist, "On your wishlist", I'm interested) sits
   above the row's buttons, on a line of its own: beside them the Actions column would be 130px
   wider than the card has room for at 1280. */
table.dense .wishlist-state {
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

table.dense .wishlist-state form,
table.dense .wishlist-state button {
  margin-bottom: 0;
}

/* The admin's Picks cell: approved, waiting and denied in one short line ("✓2 · ⏳1 · ✗0"), a link
   to Who asked, instead of three columns of their own. It stays on one line, and its digits line up
   from row to row. */
.picks-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Review: the conferences waiting for approval sit apart from the wishlists below them, each a
   section with a heading of its own. */
#approval-queue + #wishlists-waiting {
  margin-top: 2.5rem;
}

/* Review's queue of conferences waiting for approval is a fitted table, but it has seven columns
   and two of them hold names and places that can be long, so its cells wrap, as the admin's
   Conferences table's do, and it fits its card at 1280 instead of scrolling. A date, the adder's
   name and the day it was added each keep to one line (their pieces are .nowrap), and the two
   buttons stay side by side (table.dense .actions). */
figure.fit table.approval-table :is(th, td) {
  white-space: normal;
}

/* --- Sign-in, welcome, 403 and 404: one centred card ----------------------------------------- */

.centered-card {
  max-width: 28rem;
  margin: 1rem auto 2rem;
  padding: 2rem;
}

.centered-card h1 {
  font-size: 1.5rem;
  text-align: center;
}

.centered-card .card-logo {
  display: block;
  width: 180px;
  height: 40px;
  margin: 0 auto 1.5rem;
}

.centered-card p:last-child,
.centered-card form:last-child {
  margin-bottom: 0;
}

/* --- Status badges: pending is amber, approved green, denied neutral (never alarming red) -----
   Archived, on a conference, is neutral too. */

.badge {
  display: inline-block;
  padding: 0.125rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-pending {
  background: var(--m360-amber);
  color: var(--m360-navy);
}

.badge-approved {
  background: var(--m360-green-tint);
  color: var(--m360-green);
}

.badge-denied,
.badge-archived {
  background: var(--m360-n200);
  color: var(--m360-n700);
}

/* Beside a page's title (the Approval pill on a conference's page) the pill is a step larger than
   it is in a table row, in proportion to the heading. */
h1 .badge {
  font-size: 0.875rem;
}

/* --- Messages and form errors ---------------------------------------------------------------- */

.message,
p[role="alert"] {
  margin-bottom: var(--pico-spacing);
  padding: 0.75rem 1rem;
  border: 1px solid var(--m360-azure);
  border-left-width: 4px;
  border-radius: var(--pico-border-radius);
  background: #fff;
  color: var(--m360-n800);
}

.message.success {
  border-color: var(--m360-green);
  background: var(--m360-green-tint);
}

.message.error,
p[role="alert"] {
  border-color: var(--m360-error);
  background: var(--m360-error-tint);
  color: var(--m360-error);
}

small[role="alert"] {
  color: var(--m360-error);
  font-weight: 500;
}

small[role="status"] {
  color: var(--m360-green);
  font-weight: 500;
}

/* --- Row actions: buttons side by side, without the form and button spacing Pico adds -------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.actions form,
.actions form button,
.actions a[role="button"] {
  margin-bottom: 0;
}

/* Pico makes every submit button full width. Wherever one is not wrapped in a shrink-to-fit
   form (Save, Approve and Deny, Retry, the catalog form) it keeps to its label, and Approve and
   Deny sit side by side without the stacked button margin. Only the buttons of the centred
   cards (sign in, welcome, admins only) stay full width. */
button[type="submit"] {
  width: auto;
}

.centered-card button[type="submit"] {
  width: 100%;
}

.actions > button {
  margin-bottom: 0;
}

/* --- Destructive buttons: Delete wears .outline.contrast.danger ------------------------------
   Pico builds an outline contrast button from --pico-contrast and --pico-contrast-hover, so
   redefining those two (and the focus ring) on the element is enough to turn it red. The hover
   tint repeats the form of the app's blue one above, equal weight and later, so it wins. */

:is(button, [type="submit"], [type="button"], [role="button"]).danger {
  --pico-contrast: var(--m360-danger);
  --pico-contrast-hover: var(--m360-danger-hover);
  --pico-contrast-focus: rgba(185, 28, 28, 0.3);
  /* "Delete wishlist" stays on one line in a narrow table column; the table scrolls instead. */
  white-space: nowrap;
}

:is(button, [type="submit"], [type="button"], [role="button"]).danger:is(
    [aria-current]:not([aria-current="false"]),
    :hover,
    :active,
    :focus
  ) {
  --pico-background-color: rgba(185, 28, 28, 0.1);
}

/* --- Admins page: a key to the roles, then one white card per group, a row per person -------- */

/* The three roles side by side where there is room, one above the other on a phone. */
.role-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--pico-spacing);
  margin-bottom: 0.75rem;
}

.role-card {
  margin: 0;
  padding: 0.75rem 1rem;
  background: #fff;
  box-shadow: var(--pico-card-box-shadow);
}

.role-card h2 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.role-card p {
  margin: 0;
  color: var(--m360-n700);
  font-size: 0.9375rem;
}

.admin-list {
  margin: 0 0 var(--pico-spacing);
  padding: 0;
  list-style: none;
  border: 1px solid var(--m360-n200);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: var(--pico-card-box-shadow);
}

.admin-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--m360-n200);
}

.admin-list li:last-child {
  border-bottom: 0;
}

/* An admin's two email switches, under their address: one line of small boxes that wraps on a
   narrow screen, without the fieldset and label spacing Pico adds. */
.admin-notify {
  margin: 0.375rem 0 0;
}

.admin-notify fieldset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  margin: 0;
  font-size: 0.875rem;
}

.admin-notify label {
  margin: 0;
}

.admin-notify noscript button {
  margin: 0;
  padding: 0.25rem 0.75rem;
}

/* Under the boxes: "Saved" (or why not) and who last changed them, small and on one line. */
.admin-notify-feedback {
  font-size: 0.875rem;
}

.admin-notify-feedback span {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
}

.admin-notify-saved {
  color: var(--m360-green);
  font-weight: 500;
}

.admin-notify-error {
  color: var(--m360-error);
  font-weight: 500;
}

.admin-notify-changed {
  color: var(--m360-n700);
}

/* The address and its note take what the Remove button leaves, and a long address wraps in
   its own column instead of pushing the button down or off a narrow screen. */
.admin-list li > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-list .admin-email {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.admin-list form {
  flex: none;
}

.admin-list form,
.admin-list form button {
  margin-bottom: 0;
}

/* The role and Remove, side by side on the right of the row; on a phone they wrap under the
   address instead of squeezing it. */
.admin-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* A role that can't be changed here (a permanent admin's, or your own): the name in a quiet box
   the size of the select it stands in for. */
.role-fixed {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--m360-n200);
  border-radius: var(--pico-border-radius);
  background: var(--m360-n50);
  font-size: 0.9375rem;
}

/* The role select saves as it changes. "Saved" (for the eye; a screen reader hears the page's live
   region instead) appears to its left, so the select and Remove do
   not move when it does. */
.role-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-form select {
  width: auto;
  min-width: 11rem;
  margin-bottom: 0;
  font-size: 0.9375rem;
}

.role-form noscript button {
  margin: 0;
  padding: 0.25rem 0.75rem;
}

.role-saved {
  font-size: 0.875rem;
}

/* On the People tab the form sits in a table cell, left-aligned, and "Saved" follows the select, in
   room kept for it: the columns do not shift when it appears. */
table .role-form .role-saved {
  min-width: 3.5rem;
}

/* The team select is narrower than a role select: the longest team name needs less room. */
table .role-form select {
  min-width: 9rem;
}

@media (max-width: 575px) {
  .admin-list li {
    flex-wrap: wrap;
  }

  .admin-actions {
    justify-content: flex-start;
  }
}

/* --- Teams tab: a team's name with Rename under it, then its people and Delete -------------------
   Rename is a <details> (it needs no script, which the CSP could not allow anyway), shown as a small
   quiet link without Pico's accordion chevron; opened, it is a one-box form with Save. Delete on a
   team that can't be deleted stays, quietened by Pico's disabled look, so the rows line up. */

.team-rename {
  margin: 0;
  font-size: 0.875rem;
}

.team-rename > summary {
  display: inline-block;
  line-height: 1.5;
}

.team-rename > summary::after {
  display: none;
}

.team-rename[open] > summary {
  margin-bottom: 0.375rem;
}

.team-rename form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-rename input {
  width: 16rem;
  max-width: 100%;
  margin: 0;
  font-size: 0.9375rem;
}

.team-rename button {
  margin: 0;
  padding: 0.25rem 0.75rem;
}

.team-rename small {
  display: block;
  margin-top: 0.25rem;
}

.team-people {
  color: var(--m360-n700);
  font-size: 0.9375rem;
  white-space: nowrap;
}

/* The quietened Delete is not in a form, so it needs the margin reset the forms' buttons get. */
.admin-actions > button {
  margin-bottom: 0;
}

/* The boxes of "Add a person" and their button on one row, each box under its label. The email
   box is only as wide as an address needs, the button lines up with the boxes (not their labels),
   and on a phone everything drops into a column. A refusal, which follows the row, sits as close
   as Pico puts one under a box. */
.inline-field {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: var(--pico-spacing);
}

.inline-field-box {
  flex: none;
}

.inline-field-email {
  flex: 1 1 auto;
  /* The row may wrap (the team boxes take a row of their own), so the box says how little it
     needs before the others drop under it: it still grows to 22rem and shrinks as it did. */
  flex-basis: 12rem;
  min-width: 0;
  max-width: 22rem;
}

.inline-field input,
.inline-field select,
.inline-field button {
  margin-bottom: 0;
}

.inline-field button {
  flex: none;
}

/* "Teams it covers": for an attendee admin only. The boxes are in the form for every role, hidden
   until the role select has Attendee admin chosen (CSS alone, since the CSP allows no script), and
   then they take a row of their own between the role and the button. */
.add-covers {
  display: none;
  flex: 0 0 100%;
  margin: 0;
}

form:has(select[name="role"] option[value="attendee"]:checked) .add-covers {
  display: block;
}

.add-covers legend {
  margin-bottom: 0.25rem;
  padding: 0;
  font-weight: 500;
}

/* A row of boxes as tall as the text boxes above it (2.6rem), each box close to its name (Pico's
   own half-em after the box, and a quarter-rem more) and a rem from the next one. */
.add-covers label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0 1rem 0 0;
  line-height: 2.6rem;
}

/* Pico lifts a box by a tenth of its height; centred in the taller row it sits a pixel high. */
.add-covers input {
  margin-top: 0;
}

.inline-field ~ small {
  display: block;
  margin-bottom: 0.25rem;
}

.inline-field ~ small:last-of-type {
  margin-bottom: var(--pico-spacing);
}

.inline-field + small {
  margin-top: calc(var(--pico-spacing) * -0.75);
}

@media (max-width: 575px) {
  .inline-field {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-field-box,
  .inline-field-email,
  .add-covers {
    flex: none;
    width: 100%;
    max-width: none;
  }
}

/* --- Pick cards on My Conferences: the name and details on a line, then one row of controls -------
   The row is a grid: the "Why this conference?" label, then the box with Save and the move and
   remove buttons beside it, then the status line under the box (it keeps its height when empty,
   so Saved and an error do not move the row). .pick-justify is the element htmx targets for an
   autosave, and display: contents lets its children take their places in the row's grid without
   it being a box of its own; the move and remove buttons are separate forms in .pick-moves. */

.pick {
  /* Pico's card spacing, tightened: a wishlist is a list of these. */
  --pico-block-spacing-vertical: 0.75rem;
}

.pick > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
}

/* Where the pick stands (Waiting, Approved, Denied), at the right end of its header. */
.pick > header .badge {
  margin-left: auto;
}

/* A decided pick is locked: "Why this conference?", the justification read-only in a box like the
   admins' review card, and the line that says when it was decided. */
.pick-decided .pick-label {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--pico-muted-color);
}

.pick-locked {
  margin-bottom: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--m360-n200);
  border-radius: var(--pico-border-radius);
  background: var(--m360-n50);
}

.pick-decided > small {
  color: var(--pico-muted-color);
}

.pick-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "label label label"
    "text save moves"
    "feedback feedback feedback";
  column-gap: 0.5rem;
  align-items: start;
}

.pick-justify {
  display: contents;
}

.pick-row label {
  grid-area: label;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--pico-muted-color);
}

.pick-row textarea {
  grid-area: text;
  margin-bottom: 0;
}

.pick-feedback {
  grid-area: feedback;
  /* One line of small text (a line of the page's text size plus the padding), so the card is as
     tall without a message as with one. */
  min-height: 1.625rem;
  padding-top: 0.125rem;
}

.pick-save {
  grid-area: save;
}

.pick-moves {
  grid-area: moves;
}

.pick-row button {
  margin-bottom: 0;
  padding: 0.3rem 0.7rem;
  font-size: 0.875rem;
}

/* Up and down are arrows: square, and as wide as they are tall (the line, the padding and the
   border above and below it). */
.pick-row .pick-arrow {
  width: calc(0.875rem * var(--pico-line-height) + 0.6rem + 2 * var(--pico-border-width));
  padding-inline: 0;
}

@media (max-width: 575px) {
  /* The box takes the full width and the four buttons sit on one line under it. */
  .pick-row {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "label label"
      "text text"
      "feedback feedback"
      "save moves";
  }
}

@media (max-width: 360px) {
  /* A 320px phone is 16px short for the four buttons at full size, so they tighten up rather
     than let Remove drop to a second line. */
  .pick-row {
    column-gap: 0.375rem;
  }

  .pick-moves {
    gap: 0.375rem;
  }

  .pick-row button {
    padding-inline: 0.625rem;
  }
}

/* --- Interested rows on My Conferences: one card, a row for each conference ------------------
   Each row is the conference (its link and badge, with the details under them) and, at the
   right, its buttons. When the row is too narrow for both, as on a phone, the buttons drop
   under the details instead of running past the edge; the details wrap, as nothing in the row
   has a width of its own. */

/* The section sits apart from the wishlist above it, as a heading of its own. */
#interested {
  margin-top: 2.5rem;
}

/* The two intros under My Conferences' headings read as a paragraph, not a line across the whole
   page (the width of the export page's intro). */
#my-wishlist > p,
#interested > p {
  max-width: 52rem;
}

.interest-list {
  margin: 0 0 var(--pico-spacing);
  padding: 0;
  list-style: none;
  border: var(--pico-border-width) solid var(--m360-n200);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: var(--pico-card-box-shadow);
}

.interest-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0.75rem 1rem;
  list-style: none;
}

.interest-list li + li {
  border-top: var(--pico-border-width) solid var(--m360-n200);
}

.interest-info {
  flex: 1 1 16rem;
  min-width: 0;
}

.interest-info > a {
  font-weight: 600;
  margin-right: 0.25rem;
}

.interest-info > small {
  display: block;
  margin-top: 0.125rem;
  color: var(--pico-muted-color);
}

.interest-list button {
  padding: 0.3rem 0.7rem;
  font-size: 0.875rem;
}

/* --- Show filter above the admin's table: the one in use is bold, not underlined ------------- */

.show-links a[aria-current="true"] {
  font-weight: 600;
  text-decoration: none;
}

/* --- Sortable column headings: the name is a link, then a small stacked pair of arrows -------- */

/* The name keeps the heading's colour; navy on the column the list is sorted by (th[aria-sort]),
   blue under the pointer. */
a.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: inherit;
  text-decoration: none;
}

th[aria-sort] a.th-sort {
  color: var(--m360-navy);
}

th a.th-sort:hover {
  color: var(--m360-blue-600);
}

/* ▲ over ▼, both grey; the one for the direction of the sort is navy. */
.sort-arrows {
  display: flex;
  flex-direction: column;
  font-size: 0.6rem;
  line-height: 0.6rem;
  color: var(--m360-n400);
}

.sort-arrows.asc .up,
.sort-arrows.desc .down {
  color: var(--m360-navy);
}

/* A number column's name and arrows sit against its right edge, over its figures. */
th.num a.th-sort {
  justify-content: flex-end;
}

/* --- Calendar: the Table | Calendar switch, the year tabs and the year timeline -------------- */

/* Pico spreads a <nav> across the row like a menu bar; these are small pill links, left to
   right, with the current one filled navy. */
nav.tabs {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: var(--pico-spacing);
}

.tabs a {
  padding: 0.25rem 0.875rem;
  border: 1px solid var(--m360-n300);
  border-radius: 999px;
  background: #fff;
  font-weight: 500;
  text-decoration: none;
}

.tabs a:hover {
  border-color: var(--m360-blue);
}

.tabs a[aria-current="page"] {
  border-color: var(--m360-navy);
  background: var(--m360-navy);
  color: #fff;
}

/* The Admins page's tabs (Admins, Teams, People) are the same nav with the same aria-current, drawn
   as the approved mockup has them (T2, T2c, T2d): plain links on a light rule across the page,
   the current one in the brand blue with a 2px underline that sits on the rule. The Table |
   Calendar switch and the year tabs keep their pills. */
nav.tabs-underline {
  gap: 0.25rem;
  border-bottom: 2px solid var(--m360-n200);
}

nav.tabs-underline a {
  margin-bottom: -2px;
  padding: 0.5rem 1.25rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--m360-n700);
}

nav.tabs-underline a:hover {
  border-bottom-color: var(--m360-n400);
  color: var(--m360-navy);
}

nav.tabs-underline a[aria-current="page"] {
  border-bottom-color: var(--pico-primary);
  background: none;
  color: var(--pico-primary);
  font-weight: 600;
}

/* The timeline (an inline SVG, drawn by the server) fills its white card. Narrower than 56rem
   its text would be too small to read, so the card scrolls sideways instead, as the tables do.
   Its colours are SVG attributes; this is only size, links and hover. */
figure svg.timeline {
  display: block;
  width: 100%;
  height: auto;
  min-width: 56rem;
}

/* A hint for the narrow screens where that happens. The timeline needs 56rem; the card is
   700px wide from 768px up to 1023px (Pico's container) and narrower below, and 950px from
   1024px, which is enough. So the hint shows exactly where the card scrolls. */
.timeline-hint {
  display: none;
  margin-bottom: 0.5rem;
}

@media (max-width: 1023px) {
  .timeline-hint {
    display: block;
  }
}

.timeline a {
  text-decoration: none;
}

.timeline a:hover text,
.timeline a:focus-visible text {
  text-decoration: underline;
}

.timeline a:focus-visible {
  outline: 2px solid var(--m360-blue);
  outline-offset: 2px;
}

/* Hovering or tabbing to a row darkens its bar, so the eye can follow the label across. */
.timeline-row:is(:hover, :focus-within) rect {
  fill: var(--m360-blue-600);
}

/* --- The admin's review of a wishlist: under each pick's header, the justification in a box and,
   beside it, the decision (status, then Approve and Deny). Stacked on a phone. ---------------- */

/* The card is only as wide as what it holds (the box, the gap and the decision, plus its own
   padding), so no empty white runs off to the right on a wide screen. */
.review-card {
  max-width: 52rem;
}

/* The box is capped, so a justification wraps into a block rather than one long line, and the
   decision sits right beside it rather than at the far edge of a wide screen. */
.review-pick {
  display: grid;
  grid-template-columns: minmax(0, 34rem) 14rem;
  justify-content: start;
  gap: 1rem 1.5rem;
  align-items: start;
}

.review-justification {
  min-height: 5.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--m360-n200);
  border-radius: 0.5rem;
  background: var(--m360-n50);
}

.review-decision p {
  margin-bottom: 0.5rem;
}

.review-decision .actions {
  margin: 0;
}

/* A decided pick's email status, and its Retry when the email has not gone out. A long error from
   the mail server wraps rather than widening the column. */
.review-decision .email-status {
  color: var(--pico-muted-color);
  overflow-wrap: anywhere;
}

.review-decision .email-retry {
  margin: 0 0 0.5rem;
}

.review-decision .email-retry button {
  margin-bottom: 0;
}

.review-decision button {
  padding: 0.3rem 0.75rem;
  font-size: 0.875rem;
}

@media (max-width: 575px) {
  .review-pick {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- A conference's details page: the facts, then a card each for the venue, the hotel and the
   links, and the admin's panel (with who asked) under them --------------------------------------- */

.detail-facts {
  color: var(--pico-muted-color);
  font-size: 1.0625rem;
}

/* Who added a conference (the admin's table, under the name, and the conference's page): a quiet
   line, not part of the facts. */
.added-by {
  color: var(--pico-muted-color);
}

p.added-by {
  margin-top: calc(var(--pico-spacing) * -0.5);
}

.detail-description {
  max-width: 46rem;
}

/* The wishlist button sits under the facts, small like the table's, and does not stretch. */
.detail-wishlist {
  margin-bottom: var(--pico-spacing);
}

.detail-wishlist form,
.detail-wishlist button {
  margin-bottom: 0;
}

/* Venue, hotel and links are cards side by side where there is room (three across the 1200px
   container, two in the narrower ones) and one above the other on a phone. */
.detail-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: var(--pico-spacing);
  margin-bottom: var(--pico-spacing);
}

.detail-card {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--m360-n200);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: var(--pico-card-box-shadow);
}

.detail-card h2 {
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

/* Who asked, inside the admin panel: a sub-heading, one step below the panel's own. */
.detail-card h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.detail-card p {
  overflow-wrap: anywhere;
}

.detail-cards .detail-card {
  margin-bottom: 0;
}

.detail-card > :last-child {
  margin-bottom: 0;
}

/* Who asked is wrapped in a div that htmx swaps, so its table (or its empty-state line) is the end
   of the card now, not the wrapper. */
.detail-card #who-asked > :last-child {
  margin-bottom: 0;
}

.detail-admin {
  margin-bottom: var(--pico-spacing);
}

/* The Approval card (for those who manage conferences) sits between the description and the venue
   cards: a blue edge marks it as theirs to act on, the state and its buttons share a row, and
   the table of who is interested keeps to what it holds. */
.detail-approval {
  max-width: 52rem;
  margin-bottom: var(--pico-spacing);
  border-left: 4px solid var(--m360-blue);
}

.detail-approval .actions {
  align-items: center;
  margin-bottom: 0.5rem;
}

/* The state stands a little apart from the two buttons, and the buttons are shorter than a form's
   (0.3rem above and below, as the Interested rows' are), so the card does not grow tall for two
   decisions. */
.detail-approval .actions .badge {
  margin-right: 0.5rem;
}

.detail-approval .actions button {
  padding-block: 0.3rem;
}

.detail-approval table {
  margin-bottom: 0;
}

.detail-approval tbody th {
  font-weight: 400;
}

/* The interest box, on the page of a conference that isn't approved, where the wishlist button
   would be: an amber edge marks it as waiting on someone, the count sits over the button, and
   the note under them says why there is no Add. */
.interest-box {
  max-width: 46rem;
  margin-bottom: var(--pico-spacing);
  padding: 1rem 1.25rem;
  border: 1px solid var(--m360-n200);
  border-left: 4px solid var(--m360-amber);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: var(--pico-card-box-shadow);
}

.interest-box > strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--m360-n800);
}

.interest-box form,
.interest-box button {
  margin-bottom: 0;
}

/* The button is shorter than a form's, as the Approval card's are, and the note under it has the
   room of its two lines to read as a paragraph. */
.interest-box button {
  padding-block: 0.3rem;
}

.interest-box small {
  display: block;
  margin-top: 0.75rem;
  color: var(--m360-n700);
  line-height: 1.8;
}

/* "Interested ✓ · Remove": the state in green, and Remove as a link on the same line (a button
   in a form, so that it posts without scripts, dressed as the link it is next to). It stays on
   one line, as the table's last column is narrow, and is set a little smaller than the page's
   text (the state a step smaller than the link) so that column keeps the width the mockup gives
   it. */
.interest-state {
  font-size: 0.92rem;
  white-space: nowrap;
}

.interest-state form {
  display: inline;
  margin: 0;
}

.interested {
  color: var(--m360-green);
  font-size: 0.875rem;
  font-weight: 600;
}

button.link-button,
figure table button.link-button {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--pico-primary);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

button.link-button:hover,
button.link-button:focus-visible {
  color: var(--pico-primary-hover);
  text-decoration-color: var(--pico-primary-hover-underline);
}

/* What the add page says to someone whose conference will wait for approval, in the same card
   as a message (an azure edge, thicker at the left), above the form and as wide as it is, with
   a little more room inside and below than a message has, since the form's first label follows. */
.approval-note {
  max-width: 42rem;
  margin-bottom: 1.5rem;
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--m360-azure);
  border-left-width: 4px;
  border-radius: var(--pico-border-radius);
  background: #fff;
  color: var(--m360-n800);
}

.approval-note p {
  margin-bottom: 0.5rem;
}

.approval-note p:last-child {
  margin-bottom: 0;
}

/* The conference form's optional details sit under a heading of their own. */
.form-details {
  margin-top: 2rem;
  padding: 0;
  border: 0;
}

.form-details legend {
  margin-bottom: 0.25rem;
  color: var(--m360-navy);
  font-size: 1.125rem;
  font-weight: 600;
}

/* The conference form is at most 42rem wide, and each box is as wide as what it holds: the dates
   and the cost share a row, as do the venue and its address, and the hotel and its notes. A
   field is a .ff named for it (.ff-<name>), in a .form-grid that wraps. The order is the form's
   own, so it is also the tab order: nothing here reorders with CSS. On a phone every box is
   full width. */
.form-grid {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1rem;
  max-width: 42rem;
}

.ff {
  width: 100%;
}

.ff-starts_on,
.ff-ends_on {
  width: 11rem;
}

.ff-estimated_cost {
  width: 10rem;
}

.ff-location,
.ff-venue_name,
.ff-venue_address,
.ff-hotel_name,
.ff-hotel_notes {
  max-width: 20.5rem;
}

@media (max-width: 575px) {
  .ff {
    width: 100%;
    max-width: none;
  }
}

/* --- Export page: a card for each file (its description, options, two buttons and columns), then
   the workbook of all three. The cards share a row where there is room and stand at equal height,
   the buttons and the column list at the foot, so the buttons of a card with fewer options sit
   level with the others' unless its column list runs longer. -------------------------------------- */

.export-intro {
  max-width: 52rem;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  gap: var(--pico-spacing);
  margin-bottom: 1.25rem;
}

.export-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-size: 0.9375rem;
}

.export-card h2 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.export-options {
  flex: 1;
  margin-bottom: var(--pico-spacing);
}

.export-options fieldset {
  margin: 0;
}

.export-options label {
  margin: 0 0 0.4rem;
}

.export-options :is(input[type="radio"], input[type="checkbox"]) {
  margin-bottom: 0;
}

/* The columns of the file, small and quiet under its buttons. */
.export-columns {
  margin: 0.75rem 0 0;
  color: var(--pico-muted-color);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* The workbook's button, and what it holds beside it; the note drops under the button when the
   row is too narrow. */
.export-all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.export-all :is(button, p) {
  margin: 0;
}

.export-all p {
  font-size: 0.85rem;
}
