/* The users' portal's own layout (plan 0.4 P21), after internal/ui's
   common.css (colours, fonts, cards, tables, forms, buttons, notices):
   a phone first (390 px), logical properties only so dir="rtl" mirrors
   it (SPEC §11.7), no script for the look. Two layouts: one centred card
   with the logo (sign-in, 2FA, passwords, a phone's link) and a header
   with the organization's name and the menu (the profile, the devices). */

/* the card pages: common.css's .center, a card a little wider, the
   organization's name under the logo */
.center .card { max-width: 440px; }
.center .card h1 { font-size: 1.35rem; }
.org-name { text-align: center; font-weight: 650; font-size: 1.1rem; margin-block: 0 var(--gap); overflow-wrap: break-word; }
.center .card form.stack { max-width: none; }
.center .card button[type="submit"] { inline-size: 100%; }
.after { margin-block: var(--gap) 0; text-align: center; }
details.more { margin-block-start: var(--gap); }
details.more summary { color: var(--accent); font-weight: 400; }
details.more form { margin-block-start: 10px; }

/* the header: the organization's mark and name, then the menu (common.css's
   drawer: on a narrow screen ☰ opens it; on a wide one the links stand in
   the bar, without the toggle) */
header.top { background: var(--surface); border-block-end: 1px solid var(--border); }
header.top .bar { max-inline-size: 960px; margin-inline: auto; padding-block: 10px; padding-inline: var(--gap);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
a.org { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text);
  text-decoration: none; min-inline-size: 0; overflow-wrap: break-word; }
a.org .mark { inline-size: 1.25em; block-size: 1.25em; flex: none; }
header.top nav { flex: 0 1 auto; }
header.top .drawer { display: block; }
ul.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.menu a { display: block; padding-block: 8px; padding-inline: 10px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
ul.menu a:hover { background: var(--surface-2); }
ul.menu a[aria-current="page"] { background: var(--surface-2); font-weight: 600; }
ul.menu form { margin: 0; }
/* the signed-in user, beside Sign out (plan 0.4) */
ul.menu li.who { color: var(--muted); font-size: 0.9rem; padding-block: 4px; padding-inline: 10px; overflow-wrap: break-word; }
@media (max-width: 760px) {
  header.top nav { flex: 1 1 100%; }
  .drawer[open] { border-block-start: 1px solid var(--border); padding-block-start: 6px; }
  ul.menu button { inline-size: 100%; }
}
@supports selector(::details-content) {
  @media (min-width: 761px) {
    ul.menu { flex-direction: row; align-items: center; }
  }
}

/* the profile and devices pages */
main.page { max-inline-size: 960px; margin-inline: auto; padding: var(--gap); }
main.page h2 { margin-block-start: 0; }
.titlebar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-block-end: var(--gap); }
.titlebar h2 { margin: 0; }
.seats { font-weight: 600; }
ul.device-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.device-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding-block: 8px; padding-inline: 10px;
  border: 1px solid var(--border); border-radius: var(--radius); }
.device-name { font-weight: 600; overflow-wrap: break-word; }
section.add-device form.stack { max-width: 520px; }
.table-wrap { margin-block-end: var(--gap); }

/* the phone's link and the 2FA key: long values wrap, the code fits */
a.device-link, code.secret { overflow-wrap: anywhere; word-break: break-all; }
figure.qr-figure { margin-inline: 0; margin-block: var(--gap); display: grid; justify-items: center; gap: 8px; }
figure.qr-figure .qr { inline-size: min(220px, 100%); block-size: auto; aspect-ratio: 1; }
figure.qr-figure figcaption { color: var(--muted); font-size: 0.9rem; text-align: center; }

/* the foot of every page: "Powered by Tunnelwright", one place in the template */
footer.foot, .center .foot { text-align: center; padding-block: var(--gap); }
p.powered { margin: 0; color: var(--muted); font-size: 0.8rem; }

/* a narrow screen: a fact's name above its value (an e-mail address keeps
   its line), a device's state its own line */
@media (max-width: 480px) {
  dl.facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.facts dt { font-size: 0.85rem; }
  dl.facts dd { margin-block-end: 8px; }
}
@media (max-width: 760px) {
  .table-wrap:not(.scroll) td:has(.status) { grid-column: 1 / -1; }
}
