:root {
  --canvas: #f4f5f0;
  --surface: #ffffff;
  --surface-soft: #eef1eb;
  --ink: #17201d;
  --muted: #6e7771;
  --muted-light: #98a09a;
  --line: #e1e4de;
  --line-strong: #d2d7cf;
  --green: #28644f;
  --green-dark: #1f4f40;
  --green-soft: #e7f0eb;
  --sage: #b9c9bd;
  --orange: #a85b2f;
  --orange-soft: #fff0e6;
  --red: #a9483e;
  --red-soft: #faebe8;
  --blue: #436a80;
  --blue-soft: #ebf1f4;
  --shadow-sm: 0 1px 2px rgb(25 42 34 / 4%), 0 6px 18px rgb(25 42 34 / 3%);
  --shadow-lg: 0 18px 60px rgb(25 42 34 / 14%);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --sidebar-width: 248px;
  --font-sans: "Avenir Next", "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 4%, rgb(223 232 222 / 55%), transparent 25rem),
    var(--canvas);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button,
select {
  cursor: pointer;
}

button {
  color: inherit;
}

.button-reset {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  position: relative;
  display: grid;
  min-height: 100dvh;
  grid-template-columns: minmax(360px, 1.04fr) minmax(420px, 0.96fr);
  overflow: hidden;
  background: #f4f5f0;
}

.auth-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-atmosphere span {
  position: absolute;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 50%;
}

.auth-atmosphere span:nth-child(1) {
  top: -22vw;
  left: -18vw;
  width: 60vw;
  height: 60vw;
}

.auth-atmosphere span:nth-child(2) {
  bottom: -30vw;
  left: 15vw;
  width: 65vw;
  height: 65vw;
}

.auth-atmosphere span:nth-child(3) {
  top: 13%;
  left: 36%;
  width: 16vw;
  height: 16vw;
  border-color: rgb(164 205 180 / 12%);
}

.auth-intro {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 88%, rgb(89 133 107 / 34%), transparent 25rem),
    linear-gradient(145deg, #15241e 0%, #1e372c 58%, #27483a 100%);
  padding: clamp(28px, 4vw, 58px);
  color: #fff;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.auth-brand .brand-mark {
  border: 1px solid rgb(255 255 255 / 18%);
  background: rgb(255 255 255 / 10%);
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.auth-brand .brand-mark span {
  background: #f5f8f3;
}

.auth-brand .brand-copy small {
  color: rgb(224 236 227 / 48%);
}

.auth-message {
  max-width: 610px;
  margin: auto 0;
  padding: 8vh 0;
}

.auth-message .eyebrow {
  color: #9ec5ad;
}

.auth-message h1 {
  max-width: 580px;
  color: #f5f7f3;
  font-size: clamp(38px, 4.4vw, 66px);
  font-weight: 580;
  letter-spacing: -0.055em;
  line-height: 1.16;
}

.auth-message > p:not(.eyebrow) {
  max-width: 500px;
  margin: 22px 0 0;
  color: rgb(226 235 228 / 67%);
  font-size: 13px;
  line-height: 1.8;
}

.auth-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 29px;
}

.auth-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgb(220 238 226 / 12%);
  border-radius: 99px;
  background: rgb(255 255 255 / 6%);
  padding: 7px 10px;
  color: rgb(237 245 239 / 74%);
  font-size: 9px;
}

.auth-trust svg {
  width: 12px;
  height: 12px;
  color: #9ec5ad;
}

.auth-footnote {
  margin: 0;
  color: rgb(224 235 227 / 38%);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.auth-panel {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 32px;
}

.auth-card {
  width: min(430px, 100%);
  min-height: 390px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 255 255 / 91%);
  padding: clamp(26px, 4vw, 40px);
  box-shadow: 0 24px 70px rgb(25 42 34 / 9%);
  backdrop-filter: blur(18px);
}

.auth-loading {
  display: flex;
  min-height: 320px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--muted);
  font-size: 10px;
}

.auth-spinner {
  width: 27px;
  height: 27px;
  border: 2px solid #dce3dc;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.auth-kicker {
  margin: 0 0 -9px;
  color: var(--green);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth-form h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 630;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.auth-description {
  margin: -5px 0 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.auth-form .field {
  gap: 6px;
}

.auth-form .field input {
  height: 46px;
  background: #fff;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 3px;
}

.auth-back {
  width: 100%;
  justify-content: center;
}

.auth-policy {
  margin: 0;
  color: var(--muted-light);
  font-size: 8px;
  line-height: 1.6;
  text-align: center;
}

.form-error {
  min-height: 15px;
  margin: -5px 0;
  color: var(--red);
  font-size: 9px;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line);
  background: rgb(249 250 247 / 88%);
  backdrop-filter: blur(18px);
}

.brand,
.mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: none;
  padding: 0;
}

.brand {
  margin: 0 10px 38px;
  text-align: left;
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 36px;
  height: 36px;
  gap: 3px;
  border-radius: 11px;
  background: var(--ink);
  padding: 9px 8px;
  box-shadow: 0 7px 16px rgb(23 32 29 / 16%);
}

.brand-mark span {
  display: block;
  width: 4px;
  border-radius: 4px;
  background: #edf2eb;
}

.brand-mark span:nth-child(1) {
  height: 8px;
}

.brand-mark span:nth-child(2) {
  height: 15px;
  background: #a5c7b3;
}

.brand-mark span:nth-child(3) {
  height: 11px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: 0.06em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted-light);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 0 13px;
  color: #626b65;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.75;
}

.nav-item:hover {
  background: #edf0ea;
  color: var(--ink);
}

.nav-item:active {
  transform: scale(0.985);
}

.nav-item.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 7px 18px rgb(23 32 29 / 11%);
}

.sidebar-bottom {
  margin-top: auto;
}

.storage-card {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 66%);
  padding: 12px;
  text-align: left;
}

.storage-card:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.storage-card.syncing .storage-icon {
  color: var(--blue);
}

.storage-card.sync-error {
  border-color: #e9c9c4;
  background: #fff8f6;
}

.storage-card.sync-error .storage-icon {
  background: var(--red-soft);
  color: var(--red);
}

.storage-icon {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 33px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--green);
}

.storage-icon svg {
  width: 16px;
  height: 16px;
}

.storage-card span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.35;
}

.storage-card strong {
  font-size: 12px;
  font-weight: 650;
}

.storage-card small {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted-light);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-footnote {
  margin: 12px 0 0;
  color: #9aa19c;
  font-size: 9px;
  text-align: center;
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.desktop-topbar,
.mobile-header {
  align-items: center;
}

.desktop-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  height: 66px;
  border-bottom: 1px solid rgb(225 228 222 / 75%);
  background: rgb(244 245 240 / 80%);
  padding: 0 clamp(24px, 4vw, 56px);
  backdrop-filter: blur(18px);
}

.desktop-topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.save-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.save-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5a9b78;
  box-shadow: 0 0 0 3px rgb(90 155 120 / 11%);
}

.avatar-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #d8ddd5;
  border-radius: 50%;
  background: #fbfcf9;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

.mobile-header {
  display: none;
}

.content {
  width: 100%;
  max-width: 1450px;
  margin: 0 auto;
  padding: 50px clamp(24px, 4vw, 56px) 80px;
}

.view {
  display: none;
  animation: view-in 280ms ease both;
}

.view.active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 35px;
}

.overview-heading {
  align-items: center;
  margin-bottom: 38px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 620;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.overview-heading h1 {
  font-size: clamp(31px, 3.2vw, 46px);
}

.page-description {
  max-width: 650px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button svg {
  width: 16px;
  height: 16px;
}

.button.primary {
  background: var(--green-dark);
  color: #fff;
  box-shadow: 0 6px 16px rgb(31 79 64 / 16%);
}

.button.primary:hover {
  background: #173f33;
  box-shadow: 0 8px 20px rgb(31 79 64 / 22%);
}

.button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

.button.secondary:hover {
  border-color: #bfc6bd;
  background: #f9faf7;
}

.button.ghost {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  padding: 0 10px;
  color: var(--muted);
}

.button.ghost:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.button.danger {
  background: var(--red);
  color: #fff;
}

.button.tiny {
  min-height: 32px;
  padding: 0 11px;
  font-size: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 84%);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card::after {
  position: absolute;
  right: -24px;
  bottom: -35px;
  width: 105px;
  height: 105px;
  border: 1px solid rgb(40 100 79 / 8%);
  border-radius: 50%;
  background: rgb(231 240 235 / 42%);
  content: "";
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.stat-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green);
}

.stat-icon.warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.stat-icon svg {
  width: 15px;
  height: 15px;
}

.stat-value {
  position: relative;
  z-index: 1;
  margin: 18px 0 2px;
  font-size: 34px;
  font-weight: 630;
  letter-spacing: -0.045em;
  line-height: 1;
}

.stat-note {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  color: var(--muted-light);
  font-size: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.dashboard-full {
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 88%);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 20px;
  border-bottom: 1px solid #eceeea;
  padding: 0 20px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.panel-head p {
  margin: 3px 0 0;
  color: var(--muted-light);
  font-size: 10px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: none;
  padding: 7px 0;
  color: var(--green);
  font-size: 10px;
  font-weight: 650;
}

.text-button svg {
  width: 13px;
  height: 13px;
}

.panel-body {
  padding: 20px;
}

.today-list {
  display: flex;
  flex-direction: column;
}

.today-item {
  display: flex;
  gap: 13px;
  padding: 14px 0;
  border-bottom: 1px solid #eef0ec;
}

.today-item:first-child {
  padding-top: 2px;
}

.today-item:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.today-time {
  width: 35px;
  flex: 0 0 35px;
  color: var(--muted-light);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 2;
}

.today-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 4px #eff3ef;
}

.today-copy {
  min-width: 0;
}

.today-copy strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-copy p {
  display: -webkit-box;
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.attention-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 11px;
  padding: 10px 8px;
}

.attention-item:hover {
  background: #f7f8f5;
}

.attention-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--orange-soft);
  color: var(--orange);
}

.attention-mark svg {
  width: 15px;
  height: 15px;
}

.attention-copy {
  min-width: 0;
  flex: 1;
}

.attention-copy strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-copy span {
  color: var(--muted-light);
  font-size: 9px;
}

.activity-count {
  min-width: 22px;
  border-radius: 7px;
  background: #f0f2ee;
  padding: 3px 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  text-align: center;
}

.recent-protocol {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eef0ec;
  background: none;
  padding: 13px 0;
  text-align: left;
}

.recent-protocol:first-child {
  padding-top: 1px;
}

.recent-protocol:last-child {
  border: 0;
  padding-bottom: 1px;
}

.recent-protocol strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-protocol span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted-light);
  font-size: 9px;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  background: var(--green-soft);
  padding: 2px 7px;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 34px 20px;
  text-align: center;
}

.empty-state.compact {
  min-height: 170px;
  padding: 22px 10px;
}

.empty-icon {
  display: grid;
  width: 49px;
  height: 49px;
  place-items: center;
  border: 1px solid #dde3dc;
  border-radius: 15px;
  background: #f7f9f5;
  color: var(--green);
}

.empty-icon svg {
  width: 21px;
  height: 21px;
}

.empty-state h3 {
  margin: 14px 0 5px;
  font-size: 13px;
  font-weight: 650;
}

.empty-state p {
  max-width: 330px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.empty-state .button {
  margin-top: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.search-field {
  display: flex;
  width: min(390px, 100%);
  min-height: 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 78%);
  padding: 0 13px;
  color: var(--muted-light);
}

.search-field:focus-within {
  border-color: #9eb8a8;
  box-shadow: 0 0 0 3px rgb(40 100 79 / 7%);
}

.search-field svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}

.search-field input::placeholder {
  color: #9fa69f;
}

.filter-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  min-height: 33px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  padding: 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.filter-chip:hover {
  background: #ecefe9;
}

.filter-chip.active {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.select-compact {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: #fff;
  padding: 0 32px 0 12px;
  color: var(--ink);
  font-size: 10px;
}

.reagent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.reagent-card {
  position: relative;
  display: flex;
  min-height: 260px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 90%);
  padding: 19px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.reagent-card:hover {
  border-color: #cfd5cc;
  box-shadow: 0 10px 30px rgb(25 42 34 / 6%);
  transform: translateY(-2px);
}

.reagent-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--card-accent, #8eaa99);
  content: "";
}

.reagent-card[data-status="normal"]::before {
  background: #8eaa99;
}

.reagent-card[data-status="low"]::before {
  background: #d79a68;
}

.reagent-card[data-status="empty"]::before,
.reagent-card[data-status="expired"]::before {
  background: #c47d74;
}

.reagent-card[data-status="check"]::before {
  background: #82a0b1;
}

.reagent-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.reagent-title {
  min-width: 0;
}

.reagent-title h3 {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reagent-title p {
  margin: 5px 0 0;
  color: var(--muted-light);
  font-size: 9px;
}

.status-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  border-radius: 99px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.status-chip::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-chip.good {
  background: var(--green-soft);
  color: var(--green);
}

.status-chip.warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.status-chip.danger {
  background: var(--red-soft);
  color: var(--red);
}

.status-chip.neutral {
  background: var(--blue-soft);
  color: var(--blue);
}

.reagent-values {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  margin: 22px 0 16px;
}

.value-box {
  min-width: 0;
  border-radius: 12px;
  background: #f5f7f3;
  padding: 11px 12px;
}

.value-box span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-light);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.value-box strong {
  display: block;
  overflow: hidden;
  font-size: 18px;
  font-weight: 620;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.value-box strong.small {
  font-size: 13px;
  letter-spacing: 0;
}

.reagent-meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meta-row span:first-child {
  color: var(--muted-light);
}

.meta-row span:last-child {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-row.expiry-soon span:last-child {
  color: var(--orange);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: auto;
  border-top: 1px solid #edf0eb;
  padding-top: 12px;
}

.card-actions .button.ghost {
  min-height: 30px;
  font-size: 9px;
}

.card-actions .push-right {
  margin-left: auto;
}

.protocol-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.protocol-card {
  display: flex;
  min-height: 280px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 90%);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.protocol-card:hover {
  border-color: #cfd5cc;
  transform: translateY(-2px);
}

.protocol-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.category-label {
  overflow: hidden;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.protocol-card h3 {
  margin: 17px 0 9px;
  font-size: 18px;
  font-weight: 630;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.protocol-card h3 p,
.dialog-header h2 p {
  display: inline;
  min-height: 0;
  margin: 0;
}

.protocol-title-editor {
  min-height: 45px;
  font-size: 14px;
  font-weight: 650;
}

.rich-dialog-title {
  line-height: 1.4;
}

.protocol-import-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 20px;
  border: 1px solid #dbe5dc;
  border-radius: 14px;
  background: linear-gradient(135deg, #f3f8f3, #f9fbf7);
  padding: 13px 14px;
}

.protocol-import-bar > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.protocol-import-bar strong {
  font-size: 10px;
  font-weight: 680;
}

.protocol-import-bar span {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.55;
}

.protocol-import-status {
  grid-column: 1 / -1;
  display: none;
  border-radius: 8px;
  background: #eef3ed;
  padding: 7px 9px;
}

.protocol-import-status.loading,
.protocol-import-status.success,
.protocol-import-status.error {
  display: block;
}

.protocol-import-status.success {
  background: var(--green-soft);
  color: var(--green-dark);
}

.protocol-import-status.error {
  background: var(--red-soft);
  color: var(--red);
}

.protocol-objective {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 15px;
}

.tag {
  border: 1px solid #e2e6df;
  border-radius: 7px;
  background: #fafbf8;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 8px;
}

.protocol-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  border-top: 1px solid #edf0eb;
  padding-top: 14px;
}

.protocol-date {
  color: var(--muted-light);
  font-size: 8px;
}

.protocol-actions {
  display: flex;
  gap: 7px;
}

.log-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.log-categories {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.log-category {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 86%);
  box-shadow: var(--shadow-sm);
}

.log-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #edf0eb;
  padding: 15px 18px;
}

.log-category-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.log-category-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.log-category-head p {
  margin: 0;
  color: var(--muted-light);
  font-size: 8px;
}

.log-category-head > span {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 99px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 8px;
  font-weight: 700;
}

.log-category-planned .log-category-head > span {
  background: var(--blue-soft);
  color: var(--blue);
}

.log-category-completed .log-category-head > span {
  background: #f0f2ee;
  color: var(--muted);
}

.log-category-body {
  display: flex;
  flex-direction: column;
  gap: 19px;
  padding: 15px 18px 18px;
}

.log-category-empty {
  margin: 0;
  border: 1px dashed #dde3dc;
  border-radius: 11px;
  padding: 18px;
  color: var(--muted-light);
  font-size: 9px;
  text-align: center;
}

.log-day-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
}

.log-day-head strong {
  font-size: 11px;
  font-weight: 650;
}

.log-day-head span {
  color: var(--muted-light);
  font-size: 9px;
}

.log-day-head::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.log-items {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 88%);
  box-shadow: var(--shadow-sm);
}

.log-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid #edf0eb;
  padding: 18px 20px;
}

.log-card:last-child {
  border-bottom: 0;
}

.log-card:hover {
  background: #fbfcf9;
}

.log-card-main {
  min-width: 0;
}

.log-card-main h3 {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-card-main p {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.log-card-tail {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.completion-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.completion-chip.completed {
  border-color: rgb(61 122 91 / 18%);
  background: var(--green-soft);
  color: var(--green);
}

.completion-chip.pending {
  border-color: rgb(172 121 70 / 18%);
  background: #fbf2e8;
  color: #986337;
}

.log-protocol {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  margin-top: 7px;
  color: var(--green);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-protocol-link {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.log-protocol-link:hover {
  text-decoration: underline;
}

.log-protocol-link:disabled {
  cursor: default;
  text-decoration: none;
}

.log-protocol svg {
  width: 12px;
  height: 12px;
}

.log-open {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
}

.log-open:hover {
  border-color: #b9c7bb;
  color: var(--green);
}

.log-open svg {
  width: 14px;
  height: 14px;
}

/* Dialogs */
dialog {
  color: var(--ink);
}

.app-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border: 1px solid #d8ddd5;
  border-radius: 24px;
  background: var(--surface);
  padding: 0;
  box-shadow: var(--shadow-lg);
}

.app-dialog.wide {
  width: min(900px, calc(100vw - 32px));
}

.app-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgb(21 29 26 / 40%);
  backdrop-filter: blur(5px);
}

.dialog-shell {
  display: flex;
  max-height: calc(100dvh - 34px);
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 23px 25px 20px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 630;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.dialog-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.dialog-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fafbf8;
  color: var(--muted);
}

.dialog-close:hover {
  background: #f0f2ed;
  color: var(--ink);
}

.dialog-close svg {
  width: 16px;
  height: 16px;
}

.dialog-body {
  overflow-y: auto;
  padding: 23px 25px 26px;
  overscroll-behavior: contain;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 25px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 15px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: #4f5a53;
  font-size: 10px;
  font-weight: 650;
}

.field label .optional {
  margin-left: 4px;
  color: var(--muted-light);
  font-size: 8px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: #fcfdfa;
  padding: 10px 11px;
  color: var(--ink);
  font-size: 11px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field input,
.field select {
  height: 42px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.65;
}

.field textarea.tall {
  min-height: 160px;
}

.field textarea.medium {
  min-height: 118px;
}

.rich-editor-shell {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fcfdfa;
}

.rich-editor-shell:focus-within {
  border-color: #8fad9c;
  box-shadow: 0 0 0 3px rgb(40 100 79 / 7%);
}

.rich-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  border-bottom: 1px solid #e5e9e3;
  background: #f4f6f2;
  padding: 5px 7px;
  scrollbar-width: none;
}

.rich-toolbar::-webkit-scrollbar {
  display: none;
}

.rich-tool {
  display: inline-grid;
  min-width: 29px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  padding: 0 7px;
  color: #48534d;
  font-size: 10px;
  font-weight: 650;
}

.rich-tool:hover {
  border-color: #d9dfd8;
  background: #fff;
}

.rich-tool.active {
  border-color: #b7cfa1;
  background: #fff4bd;
  color: #665d13;
  box-shadow: inset 0 0 0 1px #dbe7b7;
}

.rich-tool.strong {
  font-size: 13px;
}

.rich-tool.color i {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tool-color);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%);
}

.rich-tool.color.red {
  --tool-color: #bd4d44;
}

.rich-tool.color.green {
  --tool-color: #2f7b59;
}

.rich-tool.color.blue {
  --tool-color: #3675b9;
}

.rich-tool.color.black {
  --tool-color: #17201d;
}

.rich-tool.color.orange {
  --tool-color: #d07932;
}

.rich-tool.color.marker {
  --tool-color: #f2d76b;
}

.rich-tool.subtle {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.rich-tool.format-brush.active {
  border-color: #85a892;
  background: var(--green-soft);
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px #b9cfc0;
}

.rich-tool-separator {
  width: 1px;
  height: 18px;
  flex: 0 0 1px;
  margin: 0 3px;
  background: #dce1da;
}

.rich-size-select {
  width: 58px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid #d8ded7;
  border-radius: 7px;
  outline: 0;
  background: #fff;
  padding: 0 18px 0 7px;
  color: #48534d;
  font-size: 9px;
}

.rich-editor {
  --rich-surface: #fcfdfa;
  min-height: 92px;
  outline: 0;
  overflow-wrap: anywhere;
  background: var(--rich-surface);
  padding: 11px 12px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.rich-editor.medium {
  min-height: 118px;
}

.rich-editor.tall {
  min-height: 190px;
}

.rich-editor:empty::before,
.rich-editor:has(> p:only-child:empty)::before {
  color: #abb1ab;
  content: attr(data-placeholder);
  pointer-events: none;
}

.rich-editor p {
  min-height: 1.7em;
  margin: 0;
}

.rich-editor ol,
.rich-editor ul,
.protocol-rich-content ol,
.protocol-rich-content ul {
  margin: 5px 0;
  padding-left: 24px;
}

.rich-editor ol.protocol-list-cn,
.protocol-rich-content ol.protocol-list-cn {
  list-style-type: simp-chinese-informal;
}

.rich-editor blockquote,
.protocol-rich-content blockquote {
  margin: 6px 0 6px 15px;
  border-left: 2px solid var(--sage);
  padding-left: 12px;
}

.rich-indent-1 {
  padding-left: 16px;
}

.rich-indent-2 {
  padding-left: 32px;
}

.rich-indent-3 {
  padding-left: 48px;
}

.rich-subheading {
  margin: 8px 0 4px !important;
  color: #33433a;
  font-weight: 700;
}

.rich-heading-level-3 {
  font-size: 0.94em;
}

.rich-color-red {
  color: #b8413a;
  font-weight: 650;
}

.rich-color-green {
  color: #287050;
  font-weight: 650;
}

.rich-color-blue {
  color: #2569a8;
  font-weight: 650;
}

.rich-color-black {
  color: #17201d;
  font-weight: inherit;
}

.rich-color-orange {
  color: #bc691f;
  font-weight: 650;
}

.rich-marker-yellow {
  border-radius: 2px;
  background: #fff0a8;
  box-decoration-break: clone;
  padding: 0 1px;
}

.rich-marker-clear {
  background: var(--rich-surface, #ffffff) !important;
}

.rich-size-small {
  font-size: 0.86em;
}

.rich-size-normal {
  font-size: 1em;
}

.rich-size-large {
  font-size: 1.24em;
}

.rich-size-xlarge {
  font-size: 1.5em;
}

.rich-size-px-9 { font-size: 9px; }
.rich-size-px-10 { font-size: 10px; }
.rich-size-px-11 { font-size: 11px; }
.rich-size-px-12 { font-size: 12px; }
.rich-size-px-14 { font-size: 14px; }
.rich-size-px-16 { font-size: 16px; }
.rich-size-px-18 { font-size: 18px; }
.rich-size-px-20 { font-size: 20px; }
.rich-size-px-24 { font-size: 24px; }
.rich-size-px-28 { font-size: 28px; }
.rich-size-px-32 { font-size: 32px; }

.rich-bold {
  font-weight: 750;
}

.rich-weight-normal {
  font-weight: 400;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #8fad9c;
  box-shadow: 0 0 0 3px rgb(40 100 79 / 7%);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #abb1ab;
}

.input-with-unit {
  display: flex;
}

.input-with-unit input {
  min-width: 0;
  border-radius: 10px 0 0 10px;
}

.input-with-unit select {
  width: 82px;
  flex: 0 0 82px;
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: #f3f5f1;
}

.form-hint {
  margin: -2px 0 0;
  color: var(--muted-light);
  font-size: 8px;
  line-height: 1.5;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.detail-kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 9px;
}

.detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.detail-meta svg {
  width: 12px;
  height: 12px;
}

.detail-section {
  margin-top: 24px;
}

.detail-section h3 {
  margin: 0 0 9px;
  color: #49534d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.detail-text {
  margin: 0;
  color: #3c4640;
  font-size: 11px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.detail-text.muted {
  color: var(--muted-light);
}

.protocol-rich-content {
  --rich-surface: #ffffff;
  color: #3c4640;
  font-size: 11px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.protocol-rich-content p {
  margin: 0 0 5px;
}

.protocol-rich-content.muted {
  color: var(--muted-light);
}

.log-image-section {
  padding-top: 2px;
}

.log-image-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.log-image-heading h3 {
  margin: 0;
}

.log-image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.log-image-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid #e0e5de;
  border-radius: 11px;
  background: #f8faf7;
}

.log-image-card > a {
  display: block;
  height: 115px;
  overflow: hidden;
  background: #eef1ed;
}

.log-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.log-image-file-icon {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 8px;
}

.log-image-file-icon svg {
  width: 17px;
  height: 17px;
}

.log-image-card figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
}

.log-image-card figcaption > span {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-image-card figcaption small {
  color: var(--muted-light);
  font-size: 7px;
}

.log-image-card figcaption button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  line-height: 1;
}

.log-image-empty,
.log-image-loading {
  grid-column: 1 / -1;
  border: 1px dashed #dce2dc;
  border-radius: 10px;
  padding: 15px;
  color: var(--muted-light);
  font-size: 8px;
  text-align: center;
}

.log-image-empty.error {
  color: var(--red);
}

.timeline-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.timeline-heading > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.timeline-heading h3 {
  margin: 0;
}

.timeline-heading span {
  color: var(--muted-light);
  font-size: 8px;
  text-align: right;
}

.protocol-modules {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.protocol-module {
  border: 1px solid #e2e7e0;
  border-radius: 14px;
  background: #f8faf7;
  padding: 12px;
}

.protocol-module-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
  padding: 0 2px;
}

.protocol-module-head span {
  border-radius: 99px;
  background: var(--green-soft);
  padding: 3px 7px;
  color: var(--green);
  font-size: 8px;
  font-weight: 700;
}

.protocol-module-head strong {
  font-size: 11px;
  font-weight: 650;
}

.protocol-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: 4px;
}

.protocol-timeline::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: 13px;
  width: 1px;
  background: #dce4dc;
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  gap: 11px;
}

.timeline-index {
  position: relative;
  z-index: 1;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid #b9cdbf;
  border-radius: 50%;
  background: #f4f8f3;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}

.timeline-card {
  border: 1px solid #e2e7e0;
  border-radius: 11px;
  background: #fbfcf9;
  padding: 10px 12px;
}

.timeline-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.timeline-top strong {
  font-size: 10px;
  font-weight: 650;
  line-height: 1.6;
}

.timeline-time {
  flex: 0 0 auto;
  border-radius: 99px;
  background: var(--green-soft);
  padding: 3px 7px;
  color: var(--green);
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.timeline-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.timeline-parameters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.timeline-parameters span {
  border: 1px solid #e2e6df;
  border-radius: 6px;
  background: #fff;
  padding: 2px 6px;
  color: var(--muted);
  font-size: 8px;
}

.timeline-note {
  margin: 10px 0 0 38px;
  color: var(--muted-light);
  font-size: 8px;
  line-height: 1.55;
}

.timeline-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.timeline-editor-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-module-editor {
  border: 1px solid #dce3dc;
  border-radius: 14px;
  background: #f8faf7;
  padding: 10px;
  transition:
    border-color 120ms ease,
    background 120ms ease;
}

.timeline-module-editor.dragging,
.timeline-step-editor.dragging {
  opacity: 0.55;
}

.timeline-module-editor.timeline-drag-target,
.timeline-step-editor.timeline-drag-target {
  border-color: #80aa8e;
  background: #f2f8f3;
}

.timeline-module-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.timeline-module-number {
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--green-soft);
  padding: 3px 7px;
  color: var(--green);
  font-size: 8px;
  font-weight: 700;
}

.timeline-module-name {
  min-width: 0;
  flex: 1;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: 0;
  background: transparent;
  padding: 6px 7px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.timeline-module-name:focus,
.timeline-step-editor textarea:focus {
  border-color: #9db6a5;
  background: #fff;
  box-shadow: 0 0 0 3px rgb(40 100 79 / 6%);
}

.timeline-drag-handle {
  width: 25px;
  height: 30px;
  flex: 0 0 25px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #9ba39d;
  cursor: grab;
  font-size: 16px;
  line-height: 1;
}

.timeline-drag-handle:hover {
  background: #edf1ec;
  color: var(--green);
}

.timeline-drag-handle:active {
  cursor: grabbing;
}

.timeline-move-buttons,
.timeline-step-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
}

.timeline-move-buttons button,
.timeline-step-actions button {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}

.timeline-move-buttons button:hover,
.timeline-step-actions button:hover {
  border-color: var(--line);
  background: #fff;
}

.timeline-move-buttons .danger-text,
.timeline-step-actions .danger-text {
  color: var(--red);
}

.timeline-step-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-left: 2px solid #dce5dd;
  padding-left: 9px;
}

.timeline-step-list.timeline-drag-target {
  background: #f1f7f2;
}

.timeline-step-editor {
  display: grid;
  grid-template-columns: 25px 22px minmax(0, 1fr) minmax(110px, 0.32fr) auto;
  gap: 6px;
  align-items: start;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 5px;
  transition:
    border-color 120ms ease,
    background 120ms ease;
}

.timeline-step-editor:hover {
  background: #fff;
}

.timeline-step-number {
  display: grid;
  width: 20px;
  height: 27px;
  place-items: center;
  color: var(--muted-light);
  font-size: 8px;
}

.timeline-step-editor textarea {
  width: 100%;
  min-height: 50px;
  resize: vertical;
  border: 1px solid #dfe4dd;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 9px;
  line-height: 1.55;
}

.timeline-step-module-select {
  height: 32px;
  border: 1px solid #dfe4dd;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  padding: 0 25px 0 8px;
  color: var(--muted);
  font-size: 8px;
}

.timeline-add-step {
  align-self: flex-start;
  border: 1px dashed #cbd6cc;
  border-radius: 8px;
  background: transparent;
  padding: 6px 10px;
  color: var(--green);
  font-size: 8px;
  font-weight: 650;
}

.timeline-add-step:hover {
  border-style: solid;
  background: #fff;
}

.detail-banner {
  border: 1px solid #e3e9e1;
  border-radius: 13px;
  background: #f6f8f4;
  padding: 13px 15px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 19px;
}

.detail-actions .push-right {
  margin-left: auto;
}

.history-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: flex-start;
}

.history-rail {
  position: relative;
  display: flex;
  height: 100%;
  justify-content: center;
}

.history-rail::before {
  position: absolute;
  inset: 14px auto -16px;
  width: 1px;
  background: #dce2db;
  content: "";
}

.history-item:last-child .history-rail::before {
  display: none;
}

.history-rail i {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #a5b1a8;
  box-shadow: 0 0 0 1px #ccd5cc;
}

.history-item.current .history-rail i {
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 14px;
}

.history-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-card-head strong {
  font-size: 11px;
  font-weight: 650;
}

.history-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.history-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted-light);
  font-size: 8px;
}

.history-buttons {
  display: flex;
  gap: 5px;
}

.stock-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 20px;
}

.stock-summary > div {
  border-radius: 11px;
  background: #f5f7f3;
  padding: 11px;
}

.stock-summary span {
  display: block;
  color: var(--muted-light);
  font-size: 8px;
}

.stock-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 630;
}

.movement-list {
  display: flex;
  flex-direction: column;
}

.movement-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  border-bottom: 1px solid #edf0eb;
  padding: 12px 0;
}

.movement-item:first-child {
  padding-top: 0;
}

.movement-item:last-child {
  border: 0;
  padding-bottom: 0;
}

.movement-item strong {
  display: block;
  font-size: 10px;
  font-weight: 650;
}

.movement-item p {
  margin: 4px 0 0;
  color: var(--muted-light);
  font-size: 8px;
}

.movement-value {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.settings-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 23px;
}

.settings-section + .settings-section {
  padding-top: 23px;
}

.settings-section h3 {
  margin: 0 0 13px;
  font-size: 12px;
  font-weight: 650;
}

.settings-section > p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 9px;
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8faf6;
  padding: 13px 14px;
}

.account-card > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.account-card span {
  color: var(--muted-light);
  font-size: 8px;
}

.account-card strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mfa-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  border: 1px solid #e8dfd2;
  border-radius: 13px;
  background: #fffaf2;
  padding: 13px 14px;
}

.mfa-status.enabled {
  border-color: #cfe1d5;
  background: #f2f8f4;
}

.mfa-status > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.mfa-status strong {
  font-size: 10px;
  font-weight: 650;
}

.mfa-status span {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.55;
}

.device-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #edf0eb;
  padding: 12px 13px;
}

.device-item:last-child {
  border-bottom: 0;
}

.device-mark {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green);
}

.device-mark svg {
  width: 14px;
  height: 14px;
}

.device-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.device-copy strong {
  font-size: 10px;
  font-weight: 650;
}

.device-copy span,
.device-capacity {
  color: var(--muted-light);
  font-size: 8px;
}

.device-capacity {
  margin: 7px 1px 11px;
  text-align: right;
}

.device-enrollment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #dce5dc;
  border-radius: 12px;
  background: #f6f9f5;
  padding: 12px 13px;
}

.device-enrollment > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.device-enrollment strong {
  font-size: 9px;
}

.device-enrollment span {
  color: var(--muted-light);
  font-size: 8px;
}

.device-enrollment code {
  color: var(--green-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.settings-loading {
  border-radius: 12px;
  background: #f5f7f3;
  padding: 17px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.totp-secret {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed #c7d2c9;
  border-radius: 12px;
  background: #f7faf6;
  padding: 12px 14px;
}

.totp-secret code {
  overflow-wrap: anywhere;
  color: var(--green-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.recovery-grid code {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8faf7;
  padding: 8px 10px;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-align: center;
}

.password-form {
  margin-top: 14px;
}

.password-form .dialog-actions {
  margin-top: 10px;
}

.conflict-note {
  margin-bottom: 4px;
}

.backup-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafbf8;
  padding: 15px;
}

.backup-card strong {
  display: block;
  font-size: 10px;
}

.backup-card p {
  max-width: 400px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 8px;
}

.backup-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.local-data-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border-radius: 11px;
  background: var(--blue-soft);
  padding: 12px;
  color: #4d6876;
  font-size: 8px;
  line-height: 1.6;
}

.local-data-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.confirm-dialog {
  width: min(390px, calc(100vw - 32px));
  border: 1px solid #d8ddd5;
  border-radius: 20px;
  background: #fff;
  padding: 0;
  box-shadow: var(--shadow-lg);
}

.confirm-dialog form {
  padding: 24px;
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 13px;
  place-items: center;
  border-radius: 14px;
  background: var(--orange-soft);
  color: var(--orange);
}

.confirm-icon svg {
  width: 20px;
  height: 20px;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.confirm-dialog p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.confirm-dialog .dialog-actions {
  justify-content: center;
}

.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 210px;
  max-width: min(360px, calc(100vw - 32px));
  border: 1px solid #d7ded6;
  border-radius: 12px;
  background: #1e2925;
  padding: 11px 14px;
  color: #fff;
  box-shadow: 0 10px 30px rgb(20 30 26 / 20%);
  font-size: 10px;
  animation: toast-in 220ms ease both;
}

.toast svg {
  width: 15px;
  height: 15px;
  color: #a9d6b9;
}

.toast.error svg {
  color: #f0aca5;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.bottom-nav {
  display: none;
}

@media (max-width: 1180px) {
  .reagent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 210px;
  }

  .sidebar {
    padding-inline: 12px;
  }

  .content {
    padding-inline: 25px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .protocol-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) and (min-width: 761px) {
  .auth-screen {
    grid-template-columns: minmax(300px, 0.9fr) minmax(380px, 1.1fr);
  }

  .auth-intro {
    padding: 34px;
  }

  .auth-message h1 {
    font-size: 40px;
  }

  .auth-panel {
    padding: 24px;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--canvas);
    font-size: 14px;
  }

  .sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
  }

  .desktop-topbar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    justify-content: space-between;
    height: calc(58px + env(safe-area-inset-top));
    border-bottom: 1px solid rgb(225 228 222 / 85%);
    background: rgb(244 245 240 / 88%);
    padding: env(safe-area-inset-top) 17px 0;
    backdrop-filter: blur(18px);
  }

  .mobile-brand {
    gap: 9px;
  }

  .mobile-brand .brand-mark {
    width: 31px;
    height: 31px;
    border-radius: 9px;
    padding: 7px;
  }

  .mobile-brand .brand-mark span:nth-child(1) {
    height: 6px;
  }

  .mobile-brand .brand-mark span:nth-child(2) {
    height: 13px;
  }

  .mobile-brand .brand-mark span:nth-child(3) {
    height: 9px;
  }

  .mobile-brand strong {
    font-size: 15px;
    letter-spacing: 0.06em;
  }

  .content {
    padding: 29px 17px calc(94px + env(safe-area-inset-bottom));
  }

  .auth-screen {
    display: block;
    min-height: 100dvh;
    background:
      radial-gradient(circle at 100% 0%, rgb(194 215 200 / 50%), transparent 20rem),
      var(--canvas);
    padding: 0;
  }

  .auth-atmosphere,
  .auth-footnote {
    display: none;
  }

  .auth-intro {
    min-height: auto;
    overflow: visible;
    border-radius: 0 0 28px 28px;
    padding: 25px 20px 27px;
  }

  .auth-message {
    margin: 44px 0 0;
    padding: 0;
  }

  .auth-message h1 {
    max-width: 410px;
    font-size: 32px;
  }

  .auth-message > p:not(.eyebrow) {
    margin-top: 14px;
    font-size: 11px;
  }

  .auth-trust {
    gap: 6px;
    margin-top: 19px;
  }

  .auth-trust span {
    padding: 6px 8px;
    font-size: 8px;
  }

  .auth-panel {
    min-height: auto;
    padding: 18px 16px calc(30px + env(safe-area-inset-bottom));
  }

  .auth-card {
    width: 100%;
    min-height: 0;
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: 0 16px 45px rgb(25 42 34 / 8%);
  }

  .auth-loading {
    min-height: 220px;
  }

  .auth-form h2 {
    font-size: 24px;
  }

  .account-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .mfa-status {
    align-items: stretch;
    flex-direction: column;
  }

  .mfa-status .button {
    width: 100%;
  }

  .account-card .button {
    width: 100%;
    border-color: var(--line);
  }

  .recovery-grid {
    grid-template-columns: 1fr;
  }

  .timeline-heading {
    align-items: flex-start;
  }

  .timeline-heading > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .timeline-heading span {
    text-align: left;
  }

  .timeline-step-editor {
    grid-template-columns: 25px 22px minmax(0, 1fr);
    gap: 4px;
  }

  .timeline-step-module-select {
    grid-column: 3;
    width: 100%;
  }

  .timeline-step-actions {
    grid-column: 3;
    justify-content: flex-end;
    margin-top: -2px;
  }

  .timeline-module-toolbar {
    flex-wrap: wrap;
  }

  .timeline-module-name {
    min-width: 120px;
  }

  .log-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .protocol-import-bar {
    grid-template-columns: 1fr;
  }

  .protocol-import-bar .button {
    width: 100%;
  }

  .protocol-import-status {
    grid-column: auto;
  }

  .device-enrollment {
    grid-template-columns: 1fr auto;
  }

  .device-enrollment > div {
    grid-column: 1 / -1;
  }

  .page-heading,
  .overview-heading {
    align-items: flex-start;
    margin-bottom: 24px;
  }

  .overview-heading {
    align-items: flex-start;
  }

  .page-heading h1,
  .overview-heading h1 {
    font-size: 27px;
    line-height: 1.28;
  }

  .page-description {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.65;
  }

  .eyebrow {
    margin-bottom: 7px;
    font-size: 9px;
  }

  .desktop-action {
    display: none;
  }

  .page-heading > .button.primary {
    min-width: 42px;
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .page-heading > .button.primary svg {
    width: 18px;
    height: 18px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 11px;
  }

  .stat-card {
    min-height: 119px;
    border-radius: 17px;
    padding: 15px;
  }

  .stat-top {
    font-size: 10px;
  }

  .stat-icon {
    width: 28px;
    height: 28px;
  }

  .stat-value {
    margin-top: 14px;
    font-size: 28px;
  }

  .stat-note {
    margin-top: 6px;
    font-size: 8px;
  }

  .dashboard-grid {
    gap: 11px;
  }

  .panel {
    border-radius: 18px;
  }

  .panel-head {
    min-height: 56px;
    padding: 0 16px;
  }

  .panel-head h2 {
    font-size: 13px;
  }

  .panel-body {
    padding: 16px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 15px;
  }

  .search-field {
    width: 100%;
    min-height: 43px;
  }

  .filter-scroll {
    margin-inline: -17px;
    padding-inline: 17px;
  }

  .select-compact {
    width: 100%;
    min-height: 42px;
  }

  .reagent-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .reagent-card {
    min-height: 245px;
    border-radius: 18px;
    padding: 17px;
  }

  .reagent-card:hover,
  .protocol-card:hover {
    transform: none;
  }

  .reagent-values {
    margin: 17px 0 13px;
  }

  .value-box strong {
    font-size: 17px;
  }

  .protocol-grid {
    gap: 10px;
  }

  .protocol-card {
    min-height: 248px;
    border-radius: 18px;
    padding: 18px;
  }

  .protocol-card h3 {
    margin-top: 14px;
    font-size: 16px;
  }

  .log-layout {
    gap: 19px;
  }

  .log-category-head {
    align-items: flex-start;
    padding: 13px 14px;
  }

  .log-category-head > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .log-category-body {
    padding: 13px 14px 14px;
  }

  .log-items {
    border-radius: 18px;
  }

  .log-card {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 15px;
  }

  .log-card > .status-chip {
    grid-column: 1;
    justify-self: start;
  }

  .log-card-main {
    grid-column: 1;
    grid-row: 2;
  }

  .log-card-tail {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: stretch;
    flex-direction: column;
  }

  .bottom-nav {
    position: fixed;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 64px;
    border: 1px solid rgb(209 215 208 / 92%);
    border-radius: 20px;
    background: rgb(253 254 251 / 93%);
    box-shadow: 0 12px 32px rgb(25 42 34 / 14%);
    padding: 6px;
    backdrop-filter: blur(20px);
  }

  .bottom-nav button {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted-light);
    font-size: 8px;
  }

  .bottom-nav button svg {
    width: 19px;
    height: 19px;
  }

  .bottom-nav button.active {
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 650;
  }

  .app-dialog,
  .app-dialog.wide {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 24px 24px 0 0;
  }

  .app-dialog[open] {
    animation: sheet-in 240ms ease both;
  }

  @keyframes sheet-in {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
  }

  .dialog-shell {
    max-height: 92dvh;
  }

  .dialog-header {
    padding: 20px 18px 16px;
  }

  .dialog-header::before {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 35px;
    height: 4px;
    border-radius: 4px;
    background: #d8ddd7;
    content: "";
    transform: translateX(-50%);
  }

  .dialog-header h2 {
    font-size: 20px;
  }

  .dialog-body {
    padding: 18px 18px calc(25px + env(safe-area-inset-bottom));
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .field.full {
    grid-column: auto;
  }

  .detail-top {
    flex-direction: column;
  }

  .detail-actions {
    gap: 7px;
  }

  .detail-actions .button {
    min-height: 41px;
    flex: 1 1 auto;
    padding-inline: 12px;
  }

  .detail-actions .push-right {
    margin-left: 0;
  }

  .history-item {
    grid-template-columns: 13px minmax(0, 1fr);
    gap: 10px;
  }

  .history-buttons {
    grid-column: 2;
    margin-top: -6px;
  }

  .stock-summary {
    gap: 6px;
  }

  .stock-summary > div {
    padding: 9px;
  }

  .backup-card {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .backup-actions .button {
    flex: 1;
  }

  .toast-region {
    right: 16px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    left: 16px;
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
