/* ===========================================================================
   Profile and settings pages
   ---------------------------------------------------------------------------
   Your profile runs the full width of the main column as a grid of its
   containers ("Your profile: full width, in columns" below), so the width
   goes on more columns and no container runs wider than a form reads at.
   The settings tabs do the same with their own columns (.setcols in
   settings.css); the voice page keeps a reading column ("measure" in
   interaction.css). .fgrid is auto-fit, so fields sit side by side on a desk
   and stack on a phone without a breakpoint being involved.
   =========================================================================== */

/* Your profile, in the company drawer's language: one column of white
   containers on the page grey, each with its own plain heading, 12px apart;
   inside, fields in a grid and settings as rows split by hairlines. */
.formpage { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 820px }
.settingspage { display: flex; flex-direction: column; gap: 16px }
.fpanel {
  background: var(--card); border: 1px solid rgba(16, 33, 31, .07); border-radius: 16px;
  /* even all round: the gap under the last thing matches the sides */
  padding: var(--pad-box); box-shadow: 0 1px 2px rgba(16, 33, 31, .04);
}
.fpanel > h3 { margin: 0 0 16px; font-size: 17px; font-weight: 600 }
.fpanel__lede { font-size: 12.5px; color: var(--muted); margin-bottom: 16px }
.fpanel__head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px }
.fpanel__head h3 { margin: 0; font-size: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.fpanel__head .muted { font-size: 12.5px; font-weight: 500; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
/* Your face and what you can do to it: the buttons sit with the face. */
.pfphoto { display: flex; align-items: center; flex-wrap: wrap; gap: 8px }

/* Auto-fit so two fields sit side by side on a desktop and stack on a phone
   without a breakpoint deciding it. */
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px }
.fgrid .field + .field { margin-top: 0 }
/* Three short fields to a row: name, title, phone; timezone, hours, sends. */
.fgrid--3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) }
/* Your working day: five short fields (hours, lunch, calls a day), one row on a desk. */
.fgrid--day { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)) }
.flabel { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 7px }
.finput--muted { background: var(--page); color: var(--muted) }
.fpanel .segment { min-height: var(--control-h) }
/* A select across from a segmented control stands as tall as it (44, as
   the segment's own rule in css/add-company.css sets it). */
.fgrid:has(> * > .segment) .select { height: max(44px, var(--control-h)); padding-block: 0 }
.fgrid + label, .fgrid + .merows { display: block; margin-top: 16px }
textarea.mesig { min-height: 84px }

/* Settings that are on or off, or open somewhere else: rows split by
   hairlines, the first flush under a heading, the last on the container's edge. */
.merows { display: flex; flex-direction: column; margin-bottom: -14px }
label + .merows { margin-top: 12px }
.fpanel > h3 + .merows { margin-top: -14px }
.merows > .notif.notif--btn { background-position: 10px 0; min-height: 52px }
.fpanel > h3 + .merows > .notif.notif--btn:first-child { background-image: none }
.merows .notif__label { flex: 1; min-width: 0; font-size: 15px; font-weight: 500 }
.merows .notif__icon { color: var(--text) }
.merows .notif__value { font-size: 13px; font-weight: 500; color: var(--muted) }
.merows .notif__go { font-size: 20px; color: var(--muted); margin-left: -6px }
.merows .statemark { font-size: 13px; font-weight: 600 }
/* Accounts: the kind as the row's name, which account under it. */
.fpanel .acct__name { font-size: 15px; font-weight: 500 }

/* ---------------------------------------------------------------------------
   Your profile: full width, in columns
   --------------------------------------------------------------------------- */
/* The page fills the width beside the nav as a grid of its six containers:
   one column on a phone, two on a laptop, three on a wide monitor. Six, so a
   row is full at each count, and a row's containers stand as tall as each
   other. A container is never much wider than the old 820px column, which is
   what kept a label within reach of the value it names. The grid measures
   the screen, not the window: the display scale zooms the body, so the
   window's width is not the layout's. Each container is a container too, so
   what is inside it lays out by the room it has, not by the page's. */
.main > .screen[data-shape="profileForm"] { container: mescreen / inline-size }
.mepage { display: grid; grid-template-columns: minmax(0, 1fr); max-width: none }
.mepage > .fpanel { container: mepanel / inline-size; min-width: 0 }
@container mescreen (min-width: 1000px) { .mepage { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
/* Three across, the containers are placed rather than flowed: a row of three
   would stand as tall as its tallest and leave the short ones half empty, so
   each column stacks two that add up to about the same (who you are over the
   accounts; email over what to be told; the day over signing in). A viewer
   has no accounts and no day, so theirs is who they are, email, and the two
   short ones stacked. */
@container mescreen (min-width: 1700px) {
  .mepage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: "who email day" "accounts email day" "accounts notify signin";
  }
  .mepage--view { grid-template-areas: "who email notify" "who email signin" }
  .mepage > [data-part="who"] { grid-area: who }
  .mepage > [data-part="accounts"] { grid-area: accounts }
  .mepage > [data-part="email"] { grid-area: email }
  .mepage > [data-part="day"] { grid-area: day }
  .mepage > [data-part="notify"] { grid-area: notify }
  .mepage > [data-part="signin"] { grid-area: signin }
}

/* Who you are: the face, large, and beside it the name, the address and what
   can be done to the face. In a narrow container the buttons drop under both. */
.mehead {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  gap: 12px 18px; margin-bottom: 20px;
}
.mehead .avatar { grid-row: span 2; width: 88px; height: 88px; font-size: 26px; cursor: default }
.mehead__who { min-width: 0; align-self: end }
.mehead h3 { margin: 0; font-size: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.mehead .muted { font-size: 12.5px; font-weight: 500; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.mehead .pfphoto { align-self: start }
@container mepanel (max-width: 419.98px) {
  .mehead .avatar { grid-row: auto; width: 64px; height: 64px; font-size: 19px }
  .mehead__who { align-self: center }
  .mehead .pfphoto { grid-column: 1 / -1 }
}

/* Fields fill their row: one with fewer of them gives each more room, so no
   row ends in a gap. The name has a row to itself; the day's start and finish
   share one, and lunch, its length and the calls share the next. */
.mepage .fgrid { display: flex; flex-wrap: wrap }
.mepage .fgrid > * { flex: 1 1 190px; min-width: 0 }
.mepage .mefields > :first-child { flex-basis: 100% }
.mepage .fgrid--day > * { flex-basis: 118px }
.mepage .fgrid--day > :nth-child(-n + 2) { flex-basis: 40% }

/* Switches two across where the container has the room, so a label is never
   a container's width from its switch. Both of the first row sit flush under
   the heading. */
@container mepanel (min-width: 420px) {
  .merows--2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px }
  .fpanel > h3 + .merows--2 > .notif.notif--btn:nth-child(2) { background-image: none }
}

/* Log out: the one row that ends something, in the colour Sign out has. */
.merows .notif--danger, .merows .notif--danger .notif__icon { color: var(--bad) }

/* Unsaved changes: the bar is there only while something on the page differs
   from what is saved, floating at the foot of the screen so Save is in reach
   from any container. It keeps to the right, clear of a toast. */
.savebar {
  grid-column: 1 / -1; justify-self: end; position: sticky; bottom: 16px; z-index: 2;
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  padding: 8px 8px 8px 20px; border-radius: calc(var(--r-btn) + 8px);
  background: var(--card); border: 1px solid rgba(16, 33, 31, .07); box-shadow: var(--shadow-low);
}
.savebar[hidden] { display: none }
.savebar__label { margin-right: 8px; font-size: 13.5px; font-weight: 500; white-space: nowrap }
/* A field tabbed to is never left under the bar. */
.main:has(.savebar:not([hidden])) { scroll-padding-bottom: 96px }
@container mescreen (max-width: 519.98px) {
  .savebar { justify-self: stretch; padding-left: 8px }
  .savebar__label { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%) }
  .savebar > .btn { flex: 1 1 0; justify-content: center }
}
