/* The phone's tab bar is drawn at least this tall (at 760px and under); the toasts stand above it
   (components.css). */
:root {
  --tabbar-height: 66px;
  /* The tab bar floats this far from the screen's sides and bottom (spec 01 §H2, as approved). */
  --tabbar-inset: 18px;
  --tabbar-bottom: 20px;
}

.app-root {
  min-height: 100vh;
  min-height: 100dvh;
}

/* 100dvh is the height the browser shows now. iPadOS Safari takes 100vh as the height with its toolbar
   hidden, so a 100vh shell ran below the screen's bottom edge, the sidebar's account row was cut off and
   the whole page had to be swiped up (owner, iPad, 19/10/2026). 100vh stays as the fallback. */
.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  border-right: 0.5px solid var(--sep);
  background: var(--side);
  padding: 22px 12px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
}

.brand small,
.user-box small,
.page-eyebrow {
  color: var(--ink-soft);
}

.brand strong {
  letter-spacing: 0;
}

.brand small {
  display: block;
  font-size: 11px;
}

.nav {
  display: grid;
  gap: 2px;
  margin-top: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 40px;
  border-radius: 9px;
  padding: 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: 0.15s ease;
}

/* The short form of a tab's title is for the phone's tab bar only (below). */
.nav-label-short {
  display: none;
}

.nav-link .ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--blue);
}

.nav-link .ic .ic-svg {
  width: 19px;
  height: 19px;
}

/* The sidebar's own pages and area links fill the 20pt cell, with a lighter stroke (as approved). */
.nav-link .ic .ic-lg {
  width: 20px;
  height: 20px;
}

.nav-link .ic .ic-lg .ic-o {
  stroke-width: 1.8;
}

/* In the sidebar a page's icon is a little softer until it is pointed at or chosen (as approved);
   the phone's tab bar keeps its icons at full strength. */
@media (min-width: 761px) {
  .nav-link .ic {
    opacity: 0.72;
  }

  .nav-link:hover .ic,
  .nav-link.is-active .ic {
    opacity: 1;
  }
}

/* With Increase Contrast the icons are drawn at full strength. */
@media (min-width: 761px) and (prefers-contrast: more) {
  .nav-link .ic {
    opacity: 1;
  }
}

.nav-link:hover {
  background: rgba(20, 33, 61, 0.04);
  color: var(--ink);
}

/* Outline by default; switch to the filled glyph on hover/active. */
.nav-link:hover .ic-o,
.nav-link.is-active .ic-o {
  display: none;
}

.nav-link:hover .ic-f,
.nav-link.is-active .ic-f {
  display: block;
}

/* The selected item sits in a grey cell, its title in the text colour (macOS, spec 01 §H2). */
.nav-link.is-active {
  background: var(--sel);
  color: var(--ink);
  font-weight: 600;
}

/* Sections of the sidebar (spec 01 §H2): a title over a group of pages, and a link that leaves for
   another area of the app, marked with an arrow. On a phone only the tab bar's own entries show. */
.nav-sec {
  padding: 14px 12px 4px;
  color: var(--label-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-area .nav-ext {
  display: flex;
  margin-left: auto;
  color: var(--ink-soft);
}

.nav-area .nav-ext .ic-o {
  stroke-width: 1.6;
}

.nav-area .nav-ext .areaOut {
  width: 12px;
  height: 12px;
}

.nav-area .nav-ext .areaOutSm {
  width: 10px;
  height: 10px;
}

.nav-area .nav-ext:has(.areaOutSm) {
  opacity: 0.5;
}

@media (prefers-contrast: more) {
  .nav-area .nav-ext:has(.areaOutSm) {
    opacity: 1;
  }
}

.mtop-back {
  display: none;
}

/* Cài đặt is a list on a phone and the school details on a wide screen (admin-view.js); the
   student's account group shows on a phone only (student-view.js). */
.settings-menu,
.phone-only {
  display: none;
}

.side-foot {
  position: relative;
  margin-top: auto;
  padding-top: 8px;
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: inherit;
  text-align: left;
  padding: 8px;
  border-radius: 11px;
  transition: 0.15s ease;
}

.who:hover {
  background: rgba(0, 0, 0, 0.04);
}

.who .ava {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ava-tint);
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
}

.who-info {
  flex: 1;
  min-width: 0;
}

/* A full name with a title often runs to five words: two lines before it is cut. */
.who-info strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.who-info small {
  color: var(--ink-soft);
  font-size: 11.5px;
}

.who-caret {
  flex-shrink: 0;
  color: var(--ink-soft);
}

/* The account menu: a solid card like the row "…" menu (approved s08). With a mouse the item
   under the pointer or keyboard focus is filled blue, as in a Mac menu; on touch it is grey. */
.user-menu {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 12px;
  background: var(--bar);
  box-shadow: 0 0 0 0.5px var(--bar-line), 0 12px 34px rgba(0, 0, 0, 0.2);
  padding: 5px;
  transform-origin: bottom center;
  animation: rowMenuIn 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.user-menu.is-open {
  display: flex;
}

.user-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  padding: 6px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
}

.user-menu button.danger {
  color: var(--sys-red);
}

.user-menu button:is(:hover, :focus-visible) {
  outline: none;
  background: var(--blue-fill);
  color: #fff;
}

@media (pointer: coarse) {
  .user-menu {
    padding: 8px;
    border-radius: 18px;
  }

  .user-menu button {
    padding: 11px 12px;
    border-radius: 11px;
    font-size: 16px;
  }

  .user-menu button:is(:hover, :focus-visible) {
    background: var(--sel);
    color: var(--ink);
  }

  .user-menu button.danger:is(:hover, :focus-visible) {
    color: var(--sys-red);
  }
}

@media (prefers-reduced-motion: reduce) {
  .user-menu {
    animation: none;
  }
}

.user-menu button .mic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  flex-shrink: 0;
}

.user-menu button .mic .ic-svg {
  width: 17px;
  height: 17px;
}

/* ===== Mobile top bar (avatar · brand · bell) — hidden on desktop ===== */
.mtop {
  display: none;
}

.mtop-left {
  position: relative;
  flex-shrink: 0;
}

.mtop-ava {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-fill);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.mtop-brand {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.022em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mtop-menu {
  display: none;
  position: absolute;
  top: 44px;
  left: 0;
  z-index: 160;
  flex-direction: column;
  gap: 2px;
  width: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  box-shadow: var(--shadow-lift);
  padding: 5px;
  animation: pop 0.15s ease;
  transform-origin: top left;
}

.mtop-menu.is-open {
  display: flex;
}

.mtop-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.mtop-menu button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.mtop-menu button.danger {
  color: var(--bad);
}

.mtop-menu button .mic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  flex-shrink: 0;
}

.mtop-menu button .mic .ic-svg {
  width: 17px;
  height: 17px;
}

.main {
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  padding: 30px 38px 60px;
}

/* HIG (Layout; Scroll views): controls sit on a layer above the content, which scrolls beneath them.
   Above a phone the bell floats at the top right (.notification-fab). Once the page scrolls, the page's
   colour spans the top of the page and fades out downwards, the phone's top bar (.mtop::before) and
   macOS's scroll edge alike, so what passes under the bell fades away instead of running under a lone
   button (owner, 08/10/2026; a solid colour, no blur, spec 01 §H1). At the top of the page nothing lies
   over the title. Sticky in the page that scrolls and as wide as it; it takes no room, as its margins undo the page's padding (the bottom one
   is the padding less the bar's height). A sticky box keeps to the page's padding: its top is minus
   the padding, so the bar meets the top edge. */
.main-edge {
  position: sticky;
  top: -30px;
  z-index: 100; /* under the bell, over the page */
  height: 72px;
  margin: -30px -38px -42px;
  background: linear-gradient(var(--paper) 30%, color-mix(in srgb, var(--paper) 0%, transparent));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.main.is-scrolled .main-edge {
  opacity: 1;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-right: 56px;
}

/* A page's head is its large title only (spec 01 §H2, every approved screen): the tag above it and
   the line under it repeat what the title and the page already say. Hidden here, so the views keep
   them for a later change of mind. */
.page-eyebrow,
.page-head p,
.page-school {
  display: none;
}

/* A sub-page (a movement's detail, its attendance): a chevron-only circle up to the parent page,
   left of the title with a mouse (as in System Settings), above it on a touch iPad. On a phone it is
   the top bar's back button instead (shared.js upButton, approved s42–s46). */
.tb-back {
  display: none;
}

@media (min-width: 761px) {
  .page-head.has-up {
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
  }

  .tb-back {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--bar-line);
    border-radius: 999px;
    background: var(--bar);
    box-shadow: var(--lift);
    color: var(--ink);
  }

  .tb-back .ic-svg {
    width: 8px;
    height: 14px;
  }

  .tb-back .ic-o {
    stroke-width: 2.4;
  }

  .tb-back:active {
    transform: scale(0.94);
  }
}

@media (min-width: 761px) and (pointer: coarse) {
  .page-head.has-up {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .tb-back {
    width: 44px;
    height: 44px;
  }

  .tb-back .ic-svg {
    width: 10px;
    height: 17px;
  }
}

/* 3px under the top margin: the title's cap height lines up with the toolbar buttons' centre. */
.page-head h1 {
  margin: 3px 0 0;
  font-size: 33px;
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 4px 0 0;
  max-width: 64ch;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

@media (min-width: 981px) {
  .main {
    padding: 26px 30px 48px;
  }

  .main-edge {
    top: -26px;
    margin: -26px -30px -46px;
  }

  .page-head {
    margin-bottom: 20px;
  }

  .page-head h1 {
    font-size: 26px;
  }

  .page-head p {
    font-size: 13px;
  }
}

/* Compact sidebar links for a mouse or trackpad only; touch keeps 44px (HIG). */
@media (min-width: 981px) and (pointer: fine) {
  .sidebar {
    padding: 16px 10px;
  }

  .nav-link {
    min-height: 0;
    padding: 7px 11px;
    border-radius: 9px;
    font-size: 13.5px;
  }

  .nav-sec {
    padding: 14px 11px 4px;
    font-size: 11px;
  }
}

/* An iPad's sidebar (a touch screen): a lighter surface, and the selected item in the accent's tint
   with the accent's colour (iPadOS, spec 01 §H2). */
@media (min-width: 761px) and (pointer: coarse) {
  .sidebar {
    padding: 18px 12px;
    background: var(--side-touch);
  }

  /* iPadOS's sidebar type: 17pt items with 22pt symbols, 13pt section titles. */
  .sidebar .nav-link {
    min-height: 46px;
    gap: 12px;
    border-radius: 14px;
    font-size: 17px;
  }

  .nav-link .ic .ic-svg {
    width: 22px;
    height: 22px;
  }

  .nav-sec {
    padding: 18px 12px 6px;
    font-size: 13px;
  }

  .page-head h1 {
    font-size: 34px;
  }

  .nav-link.is-active {
    background: var(--sel-tint);
    color: var(--blue);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .main {
    padding: 26px 28px 54px;
  }

  .main-edge {
    top: -26px;
    margin: -26px -28px -46px;
  }
}

@media (max-width: 980px), (pointer: coarse) {
  .nav-link,
  .user-menu button,
  .mtop-menu button {
    min-height: 44px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  /* The tab bar: a solid capsule floating above the page, inset from the screen's edges (spec 01
     §H2); the selected tab sits in a soft grey pill. */
  .sidebar {
    position: fixed;
    z-index: 10;
    top: auto;
    right: var(--tabbar-inset);
    bottom: var(--tabbar-bottom);
    left: var(--tabbar-inset);
    flex-direction: row;
    align-items: center;
    gap: 4px;
    height: auto;
    min-height: var(--tabbar-height);
    border: 1px solid var(--bar-line);
    border-radius: 999px;
    padding: 4px;
    background: var(--bar);
    box-shadow: var(--lift);
    overflow: visible;
  }

  .brand {
    display: none;
  }

  /* Avatar + account menu live in the top bar on mobile, not the tab bar. */
  .side-foot {
    display: none;
  }

  /* No top bar (spec 01 §H2): round solid buttons float over the page, which fades into the page's
     colour under them so a line scrolling past never runs into a button. The strip between the
     buttons lets taps through to the page. */
  .mtop {
    display: flex;
    align-items: center;
    gap: 11px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 150;
    height: 60px;
    padding: 0 16px;
    pointer-events: none;
  }

  .mtop::before {
    content: "";
    position: absolute;
    inset: 0 0 -18px;
    z-index: -1;
    background: linear-gradient(var(--paper) 30%, color-mix(in srgb, var(--paper) 0%, transparent));
  }

  .mtop > * {
    pointer-events: auto;
  }

  .mtop .notification-shell {
    flex-shrink: 0;
    margin-left: auto;
  }

  /* A page opened from a list slides in from the trailing edge; back, the list slides in from the
     leading edge. Shorter than a native push, and with a fade, so it reads well in a browser. The
     reduced-motion rule in components.css turns it off. */
  .view-anim.is-push {
    animation: viewPush 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .view-anim.is-pop {
    animation: viewPop 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* Back to the list a page was opened from: a round button with a chevron only; its name is in its
     aria-label. Back to Quản trị from the Đoàn area keeps its title, in a capsule (spec 01 §H2). */
  .mtop-back,
  .mtop .notification-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--bar-line);
    border-radius: 999px;
    padding: 0;
    background: var(--bar);
    box-shadow: var(--lift);
    color: var(--ink);
  }

  .mtop-back span {
    display: none;
  }

  .mtop-back.is-area {
    gap: 7px;
    width: auto;
    padding: 0 16px 0 13px;
    font-size: 17px;
    font-weight: 500;
  }

  .mtop-back.is-area span {
    display: inline;
  }

  /* chevron.backward as the approved bar draws it: 10×17, a 2.4 stroke in its 11×19 box. */
  .mtop-back .ic-svg {
    width: 10px;
    height: 17px;
  }

  .mtop-back .ic-o {
    stroke-width: 2.4;
  }

  /* A page opened from a list has its title in the bar, centred, instead of a large one. */
  .mtop-brand.is-title {
    position: absolute;
    left: 110px;
    right: 110px;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
  }

  .page-head.is-pushed {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .settings-wide {
    display: none;
  }

  .settings-menu,
  .phone-only {
    display: block;
  }

  .mtop .notification-trigger:hover,
  .mtop .notification-trigger.is-open {
    box-shadow: var(--lift);
    transform: none;
  }

  .mtop .notification-trigger .ic-svg {
    width: 22px;
    height: 22px;
  }

  /* The phone's bell is a toolbar capsule with no count on it, as approved; the dropdown lists what
     is unread, and the button's name says how many. */
  .mtop .notification-trigger {
    width: 50px;
  }

  .mtop .notification-count,
  .mtop .notification-count.is-visible {
    display: none;
  }

  /* On a phone the panel spans the screen under the top bar and dims the page behind it, as a
     sheet would (approved s11). */
  .mtop .notification-dropdown {
    position: fixed;
    top: 62px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    border-radius: 28px;
    box-shadow: 0 0 0 100vmax var(--dim), 0 14px 40px rgba(0, 0, 0, 0.18);
    transform-origin: top center;
  }

  /* The floating desktop bell is replaced by the top-bar bell on mobile, and so is the bar under it. */
  .notification-fab,
  .main-edge {
    display: none;
  }

  /* Each tab's title fits on one line, down to a 320px phone (HIG, Tab bars): little padding, and a
     long title shows its short form (shared.js). */
  .nav {
    flex: 1;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    margin: 0;
    gap: 0;
  }

  .nav-link {
    display: grid;
    align-content: center;
    justify-content: center;
    min-height: 56px;
    padding: 5px 2px;
    gap: 3px;
    border-radius: 999px;
    text-align: center;
    font-size: 10.5px; /* a tab bar title: iOS sets them at 10pt */
    font-weight: 600;
    line-height: 1.25;
  }

  /* In the tab bar the icons take the title's colour: the selected tab's both turn blue. */
  .nav-link .ic {
    color: inherit;
  }

  .nav-link.is-active {
    color: var(--blue);
  }

  /* Section titles and the pages a phone opens from Cài đặt are the sidebar's, not the tab bar's. */
  .nav .nav-wide {
    display: none;
  }

  /* A page opened from a tab's list (Cài đặt → Nhật ký) is still in that tab. */
  .nav-link.is-tab-parent {
    background: var(--sel);
    color: var(--blue);
  }

  .nav-link.is-tab-parent .ic-o {
    display: none;
  }

  .nav-link.is-tab-parent .ic-f {
    display: block;
  }

  .nav:has(.nav-link:only-child) .nav-link {
    width: min(170px, 100%);
    margin: 0 auto;
  }

  .nav-link:has(.nav-label-short) .nav-label {
    display: none;
  }

  .nav-label-short {
    display: inline;
  }

  .nav-link .ic {
    width: 20px;
    height: 20px;
    justify-self: center;
    overflow: visible;
  }

  .nav-link .ic .ic-svg {
    width: 24px;
    height: 24px;
  }

  .main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    /* Clears the top buttons and the floating tab bar by the page margin, so a page ends as far
       above the tab bar as its title starts below the buttons. */
    padding: 70px 16px calc(var(--tabbar-height) + var(--tabbar-bottom) + 44px);
  }

  /* No room kept on the right: the phone's bell is in the top row, not floating over the header. */
  /* The head is as tall as its title, so the first block starts 20px under the large title on
     every page (the approved rhythm). */
  .page-head {
    position: relative;
    display: block;
    margin-bottom: 20px;
    padding-right: 0;
  }

  /* A head that also holds the page's buttons (under the title) leaves 24px under them (s47). */
  .page-head:not(.has-bar-action):has(.page-head-tools) {
    margin-bottom: 24px;
  }

  .page-head h1 {
    margin-top: 3px;
    font-size: 34px;
    line-height: 39px; /* 1.15, rounded to a whole point so what follows sits on whole points */
    letter-spacing: 0.005em;
  }

  /* The school under a student's large title (owner, Part 6 p03): iOS's subheadline in secondary grey. */
  .page-school:not(:empty) {
    display: block;
    margin-top: 2px;
    color: var(--label-2);
    font-size: 15px;
    line-height: 20px;
  }
}

@media (prefers-color-scheme: dark) {
  .brand-mark {
    border-radius: 12px;
    background: #F2F2F7;
    padding: 5px;
  }

  /* Not on the selected item: written after its blue fill, this tint would replace it under the pointer. */
  .nav-link:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.07);
  }
}

@media (prefers-color-scheme: dark) and (max-width: 760px) {
  /* Account-menu hover used rgba(0,0,0,.04) — invisible on the dark sheet. */
  .mtop-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

@keyframes viewPush {
  from {
    opacity: 0;
    transform: translateX(32px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes viewPop {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Phone push and pop (shared.js swapView): a view transition keeps a picture of the page being
   left. On push it slides a third of the way out, slightly dimmed, under the page coming in from
   the trailing edge; on pop the page on top slides off and the list comes back. The top bar's title
   cross-fades and the tab bar stays put. The page is opaque so the one under it never shows
   through. Reduced motion never gets here (swapView swaps at once). */
@media (max-width: 760px) {
  .main {
    background: var(--paper);
    view-transition-name: page;
  }

  .mtop {
    view-transition-name: topbar;
  }

  .sidebar {
    view-transition-name: tabbar;
  }
}

:root[data-slide]::view-transition-old(*),
:root[data-slide]::view-transition-new(*) {
  mix-blend-mode: normal;
}

:root[data-slide]::view-transition-old(root),
:root[data-slide]::view-transition-old(tabbar) {
  animation: none;
  opacity: 0;
}

:root[data-slide]::view-transition-new(root),
:root[data-slide]::view-transition-new(tabbar),
:root[data-slide]::view-transition-group(*) {
  animation: none;
}

:root[data-slide]::view-transition-old(topbar) {
  animation: slideFadeOut 0.2s ease-out both;
}

:root[data-slide]::view-transition-new(topbar) {
  animation: slideFadeIn 0.3s ease-out 0.08s both;
}

:root[data-slide="push"]::view-transition-old(page) {
  animation: slidePageAway 0.42s cubic-bezier(0.32, 0.72, 0, 1) both;
}

:root[data-slide="push"]::view-transition-new(page) {
  animation: slidePageIn 0.42s cubic-bezier(0.32, 0.72, 0, 1) both;
  box-shadow: -10px 0 28px rgba(0, 0, 0, 0.1);
}

:root[data-slide="pop"]::view-transition-old(page) {
  z-index: 1;
  animation: slidePageOff 0.36s cubic-bezier(0.32, 0.72, 0, 1) both;
  box-shadow: -10px 0 28px rgba(0, 0, 0, 0.1);
}

:root[data-slide="pop"]::view-transition-new(page) {
  animation: slidePageBack 0.36s cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes slidePageIn {
  from {
    transform: translateX(100%);
  }

  to {
    transform: none;
  }
}

@keyframes slidePageAway {
  from {
    transform: none;
    filter: none;
  }

  to {
    transform: translateX(-30%);
    filter: brightness(0.94);
  }
}

@keyframes slidePageOff {
  to {
    transform: translateX(100%);
  }
}

@keyframes slidePageBack {
  from {
    transform: translateX(-30%);
    filter: brightness(0.94);
  }
}

@keyframes slideFadeOut {
  to {
    opacity: 0;
  }
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
  }
}

/* The phone's top bar tools: the bell alone, or a page's + and the bell sharing one capsule. */
.mtop-tools {
  display: flex;
  align-items: center;
}

.mtop-add {
  display: none;
}

@media (max-width: 760px) {
  .mtop .mtop-tools {
    flex-shrink: 0;
    margin-left: auto;
  }

  .mtop .mtop-tools .notification-shell {
    margin-left: 0;
  }

  .mtop-tools.has-add {
    height: 44px;
    padding: 0 2px;
    border: 1px solid var(--bar-line);
    border-radius: 999px;
    background: var(--bar);
    box-shadow: var(--lift);
  }

  .mtop-add {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font: 500 17px/1 var(--font);
  }

  .mtop-tools.has-add .notification-trigger,
  .mtop-tools.has-add .notification-trigger:hover,
  .mtop-tools.has-add .notification-trigger.is-open {
    width: 44px;
    height: 40px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  /* A text action ("Thêm", approved mock b9; a filled "Gửi", b10) is a capsule of its own in the
     bell's place. */
  .mtop-tools.has-text-action {
    height: auto;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .mtop-tools.has-text-action .notification-shell {
    display: none;
  }

  .mtop-add.is-text {
    width: auto;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--bar-line);
    background: var(--bar);
    box-shadow: var(--lift);
    font-weight: 400;
  }

  /* An icon action alone in the bell's place (Nhật ký's filter, approved b2): a round button. */
  .mtop-add.is-solo {
    width: 44px;
    height: 44px;
    border: 1px solid var(--bar-line);
    background: var(--bar);
    box-shadow: var(--lift);
  }

  .mtop-add.is-send {
    border-color: transparent;
    background: var(--blue-fill);
    color: #fff;
    font-weight: 600;
  }

  .mtop-add.is-send:disabled {
    opacity: 0.4;
  }
}
