@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/NotoSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/NotoSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif";
  src: url("/fonts/NotoSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif";
  src: url("/fonts/NotoSerif-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  font: var(--font-size) / var(--line-height) var(--font);
  color: var(--ink);
  background: var(--paper);
}

button, input, select { font: inherit; color: inherit; }

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

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: var(--top);
  padding: 0 14px 0 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  flex: 0 0 auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  height: 100%;
}

.logo {
  height: var(--top);
  width: auto;
  max-width: 220px;
  display: block;
  object-fit: contain;
  object-position: left center;
  border-radius: 0;
}

.login-logo {
  height: auto;
  max-height: var(--top);
  width: auto;
  max-width: 100%;
  margin: 0 0 14px;
}

.brand-word {
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -0.02em;
  padding-left: 14px;
}

.tools {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

.seg { display: flex; gap: 14px; }

.seg button, .tool {
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--r-8);
  padding: 0;
  cursor: pointer;
}

.seg button[aria-pressed="true"], .tool[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.menu-toggle {
  display: none;
  place-items: center;
  gap: 4px;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 1rem;
  height: 2px;
  background: var(--text);
}

button {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-10);
  padding: 6px 11px;
  font-size: 12.5px;
  cursor: pointer;
}

.primary {
  background: var(--ink);
  color: var(--chip);
  border: 0;
  border-radius: var(--r-10);
  font-size: 12.5px;
  font-weight: 650;
  width: auto;
}

button.outline, label.file-button {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-10);
  font-size: 12.5px;
  font-weight: 550;
  width: auto;
}

button.ghost {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0;
  width: auto;
  font-size: 12.5px;
}

.primary:disabled { opacity: 0.6; cursor: default; }

.gate-host { flex: 1; min-height: 0; overflow: auto; }

.gate {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 1.5rem;
}

.card {
  width: min(28rem, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-12);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px;
}

.shell {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: var(--side);
  flex: 0 0 var(--side);
  padding: 16px 10px 20px 12px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow: visible;
}

.sidebar button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r-8);
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 8px 10px;
}

.sidebar > button,
.nav-parent {
  height: 36px;
  font-size: 13px;
  font-weight: 500;
}

.sidebar button[aria-current="page"] {
  background: var(--card);
  color: var(--ink);
  font-weight: 500;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  padding-left: 7px;
}

.nav-group { display: flex; flex-direction: column; min-width: 0; }

.nav-admin {
  margin-top: auto;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-parent::after {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  flex: 0 0 auto;
}

.nav-parent[aria-expanded="true"]::after { transform: rotate(45deg); }

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  position: relative;
  margin-left: 14px;
  padding-left: 12px;
}

.nav-sub button {
  position: relative;
  height: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 0.32rem 0.55rem;
}

.nav-sub button::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--ink);
}

.nav-sub button[aria-current="page"] {
  background: var(--card);
  color: var(--ink);
  font-weight: 500;
  box-shadow: var(--shadow);
  border-left: 0;
  border-radius: var(--r-8);
}

.nav-sub button[aria-current="page"]::before {
  left: -13px;
  width: 3px;
  background: var(--mark);
}

.nav-leaf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.nav-leaf > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.nav-count.is-on { color: var(--free-ink); }

main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 0 42px calc(96px + env(safe-area-inset-bottom, 0px)) 18px;
}

main.desk-main { padding: 0 42px calc(96px + env(safe-area-inset-bottom, 0px)) 18px; }

.desk-home,
.concession-page,
.sheet-page,
.sales-page,
.memory-page,
main > .page-head { padding-top: 14px; }

.memory-page { display: flex; flex-direction: column; gap: 12px; }
.memory-actions, .memory-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.memory-filters { display: flex; flex-wrap: wrap; gap: 0.55rem 0.75rem; align-items: center; }
.memory-filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
  margin: 0;
}
.memory-filters select { width: auto; }
.memory-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.memory-tabs {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-9);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.memory-tabs button {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line-2);
  border-radius: 0;
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 11px;
}
.memory-tabs button:last-child { border-right: 0; }
.memory-tabs button[aria-current="page"] {
  color: var(--brand);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brand);
}
.memory-list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-12);
  box-shadow: var(--shadow);
  padding: 10px 12px;
}
.memory-list p { margin: 2px 0; }

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  margin: 0 0 12px;
}
.page-head h1 { min-width: 0; }

h1 {
  display: flex;
  align-items: baseline;
  gap: 0;
  min-width: 0;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  margin: 0 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-head h1 { margin: 0; }
h1 .crumb {
  color: var(--muted);
  font-weight: 500;
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  letter-spacing: inherit;
}
h1 .sep { color: var(--soft); font-weight: 500; padding: 0 6px; }
.page-meta, p.quiet, .status { color: var(--muted); font-size: 12.5px; margin: 0; }
p.quiet, .status { margin: 2px 0 0; font-size: 13px; }

label { display: block; margin: 12px 0 4px; color: var(--muted); font-size: 12.5px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="date"], input[type="color"], select {
  width: 100%;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-10);
  background: var(--card);
  font-size: 12.5px;
}
input::placeholder { color: var(--placeholder); }

textarea {
  width: 100%;
  min-height: 8.5rem;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-10);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  resize: none;
  overflow: hidden;
}

.bounds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.7rem;
}

.bounds label { margin: 0; }

.settings-form { max-width: 40rem; }
.settings-form h2 { margin: 22px 0 2px; font-size: 13.5px; font-weight: 650; letter-spacing: -0.02em; }

label.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.9rem;
  color: var(--text);
}

label.check input { width: auto; }

input[type="color"] {
  width: 3rem;
  height: 2.15rem;
  padding: 0.2rem;
}

.file-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.file-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
label.file-button {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 6px 11px;
  cursor: pointer;
}
.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.users-page { width: 100%; }
.users-page .card { width: 100%; }
.users-page .table-wrap { width: 100%; }
.users-page .table-wrap table { width: 100%; min-width: 100%; }

.checks { display: flex; gap: 0.9rem; }

.checks label { margin: 0; color: var(--text); }

.row { display: flex; align-items: center; gap: 0.7rem; margin-top: 1rem; }

.error { color: var(--accent-sold); min-height: 1.3rem; margin: 0.6rem 0 0; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-12);
  font-size: 12.5px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}

th {
  color: var(--soft);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--table-head);
  white-space: nowrap;
}

tbody tr:hover td { background: var(--hover); }

td.when, .mono { white-space: nowrap; font-variant-numeric: tabular-nums; }

code, td code { font-weight: 650; }

.stack { display: grid; gap: 1rem; margin-bottom: 1rem; }

.invite-once input {
  font-family: var(--mono);
  font-size: 12.5px;
}

.table-wrap { overflow-x: auto; }

.table-wrap table { width: max-content; min-width: 100%; }

td.email, td.when { white-space: nowrap; }

td select, .actions button { width: auto; }

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

.logo-preview { margin-top: 0.55rem; }

@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .shell { display: flex; }
  .sidebar {
    position: fixed;
    z-index: 25;
    top: var(--top);
    left: 0;
    bottom: 0;
    width: min(16rem, 86vw);
    flex-basis: auto;
    transform: translateX(-105%);
    visibility: hidden;
    box-shadow: var(--shadow-pop);
  }
  .sidebar.is-open {
    transform: none;
    visibility: visible;
  }
  .logo { height: 36px; max-width: 42vw; }
  .top { padding: 0 8px 0 0; gap: 8px; }
  .tools { flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; }
  .seg { gap: 8px; }
  .seg button, .tool { padding: 4px 2px; letter-spacing: 0; }
  .brand-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 700px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .table-wrap { overflow: visible; }
  .table-wrap table {
    width: 100%;
    min-width: 0;
    overflow: visible;
    background: transparent;
    border: 0;
  }
  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .table-wrap tr {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 8px;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-12);
    box-shadow: var(--shadow);
  }
  .table-wrap td {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
    border: 0;
    padding: 2px 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--soft);
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .table-wrap td.when,
  .table-wrap td.email { white-space: normal; }
  .table-wrap td select { width: 100%; max-width: 100%; }
  .table-wrap td.row-actions {
    display: block;
    padding-top: 4px;
  }
  .table-wrap td.row-actions::before { content: none; }
  .table-wrap td.row-actions:not(:has(button)) { display: none; }
}

@media (min-width: 901px) {
  .top {
    position: sticky;
    top: 0;
  }
  .sidebar {
    position: sticky;
    top: var(--top);
    align-self: flex-start;
    height: calc(100vh - var(--top));
    height: calc(100dvh - var(--top));
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: none;
    visibility: visible;
  }
}

.is-spot {
  outline: 2px solid var(--spot, var(--brand));
  outline-offset: 3px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--spot, var(--brand)) 28%, transparent);
  animation: spot-fade 2.5s ease forwards;
}
@keyframes spot-fade {
  0% { outline-color: var(--spot, var(--brand)); }
  70% { outline-color: var(--spot, var(--brand)); }
  100% { outline-color: transparent; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .is-spot { animation: none; }
}

/* Hairline scrollbar. 10px gutter, 6px thumb, no track and no arrows. */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background: transparent;
}
*::-webkit-scrollbar-track,
*::-webkit-scrollbar-track-piece,
*::-webkit-scrollbar-corner {
  background: transparent;
  border: 0;
}
*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
*::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--ink) 20%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover {
  border-width: 0;
  background-color: color-mix(in srgb, var(--ink) 40%, transparent);
}
*::-webkit-scrollbar-thumb:active {
  border-width: 0;
  background-color: color-mix(in srgb, var(--ink) 50%, transparent);
}
@-moz-document url-prefix() {
  html {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink) 20%, transparent) transparent;
  }
}
