:root {
  --bg: #f6efe4;
  --bg-deep: #efe2d2;
  --surface: rgba(255, 249, 242, 0.9);
  --surface-strong: #fffaf5;
  --surface-soft: #fff2e5;
  --surface-accent: #eef4ec;
  --text: #2f241d;
  --muted: #6f6157;
  --primary: #5d896a;
  --primary-strong: #3f6249;
  --primary-soft: #dce9db;
  --accent: #cd7d59;
  --accent-soft: #f3d5c4;
  --warning: #ba7a2b;
  --danger: #b54a42;
  --success: #3f7350;
  --border: #e6d8c8;
  --border-strong: #d8c7b3;
  --focus: #2f6e4e;
  --shadow-lg: 0 24px 60px rgba(92, 62, 31, 0.14);
  --shadow-md: 0 12px 30px rgba(92, 62, 31, 0.1);
  --shadow-sm: 0 6px 16px rgba(92, 62, 31, 0.08);
  --radius-xl: 2rem;
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --radius-sm: 0.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(205, 125, 89, 0.2), transparent 24rem),
    radial-gradient(circle at top right, rgba(93, 137, 106, 0.18), transparent 30rem),
    linear-gradient(180deg, #fbf6ef 0%, var(--bg) 48%, var(--bg-deep) 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto auto 8% -6rem;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: -1;
}

body::after {
  inset: 10% -4rem auto auto;
  width: 16rem;
  height: 16rem;
  background: radial-gradient(circle, rgba(220, 233, 219, 0.65), rgba(220, 233, 219, 0));
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

p,
ul,
ol,
dl {
  margin-block: 0;
}

h1,
h2,
h3,
h4 {
  margin-block: 0;
}

label,
legend {
  font-weight: 700;
  color: var(--text);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.skip-link:focus {
  top: 1rem;
  z-index: 20;
}

.page-shell {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0 2rem;
  display: grid;
  gap: 1.25rem;
}

.page-main {
  display: grid;
  gap: 1.25rem;
}

.site-header,
.page-header,
.hero-panel,
.section-card,
.stat-card,
.form-card,
.medicine-card,
.empty-state,
.flash {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(230, 216, 200, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0)),
    var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.site-header::before,
.page-header::before,
.hero-panel::before,
.section-card::before,
.stat-card::before,
.form-card::before,
.medicine-card::before,
.empty-state::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, rgba(205, 125, 89, 0.8), rgba(93, 137, 106, 0.55), rgba(205, 125, 89, 0));
}

.site-header {
  border-radius: 2.25rem;
  padding: 1.35rem;
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 0.8rem;
  z-index: 10;
}

.site-header-main {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.9fr);
  align-items: stretch;
}

.brand-block,
.header-note {
  display: grid;
  gap: 0.5rem;
}

.brand-block {
  align-content: center;
}

.brand-link {
  display: inline-flex;
  width: fit-content;
  text-decoration: none;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: clamp(1.85rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-copy {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
}

.header-note {
  align-content: start;
  padding: 1rem 1.1rem;
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at top right, rgba(205, 125, 89, 0.14), transparent 9rem),
    linear-gradient(180deg, rgba(255, 242, 229, 0.95), rgba(255, 249, 242, 0.92));
  border: 1px solid rgba(216, 199, 179, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.header-note-label,
.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.header-note-copy {
  color: var(--text);
}

.header-note-link {
  width: fit-content;
  color: var(--primary-strong);
  font-weight: 700;
  text-decoration-color: rgba(63, 98, 73, 0.35);
}

.eyebrow {
  margin-bottom: 0.15rem;
}

.site-nav {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: thin;
}

.site-nav-link {
  text-decoration: none;
  padding: 0.8rem 1.05rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.site-nav-link:hover {
  transform: translateY(-1px);
  background: rgba(220, 233, 219, 0.8);
  border-color: rgba(93, 137, 106, 0.2);
  color: var(--primary-strong);
}

.site-nav-link.is-active {
  color: #fffaf6;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: var(--shadow-sm);
}

.hero-panel,
.page-header,
.section-card,
.form-card,
.empty-state {
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

.hero-panel,
.page-header {
  display: grid;
  gap: 1.25rem;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.85fr);
  align-items: start;
}

.page-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.hero-copy-block,
.page-header > div:first-child {
  display: grid;
  gap: 0.55rem;
}

.hero-panel h1,
.page-header h1,
.empty-state h1,
.empty-state h2 {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.section-card h2,
.stat-card h2,
.medicine-card h2,
.form-card h2 {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: 1.3rem;
  line-height: 1.2;
}

.section-card h3,
.form-card h3 {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.3;
}

.hero-copy,
.page-header p,
.muted-text,
.hint-text {
  color: var(--muted);
}

.page-header-note {
  width: fit-content;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 242, 229, 0.95);
  border: 1px solid rgba(205, 125, 89, 0.16);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}

.hero-actions,
.form-actions,
.stack-item-actions,
.page-header-actions,
.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.78rem 1.05rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

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

.button-primary {
  color: #fffaf6;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 10px 22px rgba(63, 98, 73, 0.24);
}

.button-primary:hover {
  box-shadow: 0 14px 26px rgba(63, 98, 73, 0.28);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(216, 199, 179, 0.95);
  color: var(--text);
}

.button-secondary:hover {
  border-color: rgba(93, 137, 106, 0.24);
  background: rgba(238, 244, 236, 0.95);
}

.button-danger {
  border-color: rgba(181, 74, 66, 0.28);
  color: var(--danger);
  background: rgba(251, 236, 234, 0.88);
}

.button-danger:hover {
  background: rgba(251, 227, 223, 0.98);
  border-color: rgba(181, 74, 66, 0.38);
}

.hero-badges,
.chip-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.hero-badge,
.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.82rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.hero-badge,
.chip {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(216, 199, 179, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.chip {
  color: var(--primary-strong);
  background: rgba(220, 233, 219, 0.9);
}

.chip-muted {
  color: var(--muted);
  background: rgba(239, 232, 221, 0.95);
}

.hero-summary-card {
  display: grid;
  align-content: start;
  gap: 0.8rem;
  padding: 1.15rem;
  border-radius: 1.65rem;
  background:
    radial-gradient(circle at top right, rgba(205, 125, 89, 0.14), transparent 10rem),
    linear-gradient(180deg, rgba(255, 242, 229, 0.95), rgba(255, 249, 242, 0.88));
  border: 1px solid rgba(216, 199, 179, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.capsule-list,
.feature-list,
.stack-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.capsule-list {
  display: grid;
  gap: 0.7rem;
}

.capsule-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 0.9rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(216, 199, 179, 0.85);
}

.capsule-time {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(220, 233, 219, 0.9);
  color: var(--primary-strong);
  font-weight: 800;
}

.capsule-copy {
  display: grid;
  gap: 0.15rem;
}

.stats-grid,
.card-grid,
.content-grid {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.content-grid-wide {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.task-board-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.06fr) minmax(20rem, 0.94fr);
  align-items: start;
}

.detail-overview-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(17rem, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
}

.detail-side-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.stat-card {
  border-radius: 1.65rem;
  padding: 1.2rem;
  display: grid;
  gap: 0.5rem;
}

.stat-card:nth-child(3n + 1) {
  background:
    linear-gradient(180deg, rgba(238, 244, 236, 0.88), rgba(255, 249, 242, 0.92)),
    var(--surface);
}

.stat-card:nth-child(3n + 2) {
  background:
    linear-gradient(180deg, rgba(255, 242, 229, 0.92), rgba(255, 249, 242, 0.92)),
    var(--surface);
}

.stat-card h2 {
  font-size: 0.98rem;
  color: var(--muted);
}

.stat-value {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: clamp(2rem, 4vw, 2.5rem);
  line-height: 1;
  color: var(--text);
}

.section-card,
.form-card,
.medicine-card {
  display: grid;
  gap: 1rem;
}

.medicine-card {
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.section-heading,
.medicine-card-header,
.stack-item-title,
.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.section-heading {
  align-items: end;
}

.feature-list,
.stack-list {
  display: grid;
  gap: 0.85rem;
}

.feature-list li,
.stack-item {
  padding: 1rem;
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(216, 199, 179, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.feature-list li {
  display: grid;
  gap: 0.3rem;
}

.feature-list a {
  width: fit-content;
  font-weight: 700;
  text-decoration-color: rgba(63, 98, 73, 0.28);
}

.stack-item {
  display: grid;
  gap: 0.6rem;
}

.stack-item-body,
.stack-item-copy {
  display: grid;
  gap: 0.35rem;
}

.stack-item-meta {
  color: var(--text);
  font-weight: 600;
}

.stack-item-note {
  max-width: 52ch;
}

.task-board-card,
.restock-item-card {
  align-content: start;
}

.task-board-summary {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.05rem;
  border-radius: 1.2rem;
  background:
    radial-gradient(circle at top right, rgba(220, 233, 219, 0.38), transparent 9rem),
    linear-gradient(180deg, rgba(248, 252, 247, 0.94), rgba(255, 249, 242, 0.96));
  border: 1px solid rgba(216, 199, 179, 0.88);
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.task-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(216, 199, 179, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.task-card-state {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.task-card-state .muted-text:first-child:last-child {
  margin: 0;
}

.task-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.restock-item-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 0.95fr) minmax(18rem, 1.05fr);
  align-items: start;
}

.restock-item-summary {
  display: grid;
  gap: 1rem;
}

.restock-form-panel {
  padding: 1rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(216, 199, 179, 0.88);
  background:
    radial-gradient(circle at top right, rgba(255, 242, 229, 0.32), transparent 10rem),
    rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.medicine-cover-preview {
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid rgba(216, 199, 179, 0.86);
  background: #f6ede1;
}

.medicine-cover-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.medicine-cover-card,
.medicine-cover-detail {
  margin-bottom: 0.25rem;
}

.badge {
  white-space: nowrap;
}

.badge-正常 {
  color: #24503a;
  background: #dcebdc;
}

.badge-临期 {
  color: #8b5a1f;
  background: #f8ead7;
}

.badge-低库存,
.badge-缺货 {
  color: #8a4d1e;
  background: #f7dfcb;
}

.badge-已过期 {
  color: var(--danger);
  background: #f6ddd9;
}

.info-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.info-list > div {
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(216, 199, 179, 0.9);
}

.info-list > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.info-list dd {
  margin-top: 0.2rem;
  font-weight: 600;
}

.filter-grid,
.form-grid {
  display: grid;
  gap: 1rem;
  align-items: end;
}

.filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: grid;
  gap: 0.45rem;
}

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

.input,
.textarea {
  width: 100%;
  min-height: 2.95rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(216, 199, 179, 0.98);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.textarea {
  min-height: 7rem;
  resize: vertical;
}

.input[type="file"] {
  padding: 0.35rem;
  min-height: 3.15rem;
  cursor: pointer;
}

.input[type="file"]::file-selector-button {
  margin-right: 0.85rem;
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(220, 233, 219, 0.96), rgba(238, 244, 236, 0.98));
  color: var(--primary-strong);
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.input[type="file"]:hover::file-selector-button {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(63, 98, 73, 0.14);
}

.file-picker {
  display: grid;
  gap: 0.65rem;
}

.file-picker-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(216, 199, 179, 0.92);
  background:
    radial-gradient(circle at top right, rgba(220, 233, 219, 0.24), transparent 9rem),
    rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.file-picker.has-file .file-picker-shell {
  border-color: rgba(93, 137, 106, 0.3);
  background:
    radial-gradient(circle at top right, rgba(220, 233, 219, 0.32), transparent 9rem),
    rgba(248, 252, 247, 0.92);
}

.file-picker-name {
  min-width: 0;
  color: var(--muted);
  font-weight: 600;
  word-break: break-all;
}

.file-picker.has-file .file-picker-name {
  color: var(--text);
}

.readonly-textarea {
  background: rgba(252, 248, 242, 0.96);
  line-height: 1.6;
}

.field-error {
  color: var(--danger);
  font-size: 0.9rem;
}

.notice-banner {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.05rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(216, 199, 179, 0.92);
}

.notice-copy {
  color: inherit;
}

.notice-warning {
  color: #86571a;
  background: rgba(255, 243, 227, 0.96);
}

.notice-success {
  color: #2e6342;
  background: rgba(230, 246, 239, 0.96);
}

.checkbox-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.checkbox-card {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(216, 199, 179, 0.92);
}

.checkbox-inline {
  min-height: 2.95rem;
}

.checkbox-inline label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.copy-stack,
.inline-form,
.flash-stack {
  display: grid;
  gap: 0.85rem;
}

.scan-uploader-card {
  display: grid;
  gap: 0.95rem;
  padding: 1rem;
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at top right, rgba(220, 233, 219, 0.35), transparent 10rem),
    linear-gradient(180deg, rgba(255, 249, 242, 0.96), rgba(255, 255, 255, 0.82));
  border: 1px solid rgba(216, 199, 179, 0.92);
}

.scan-uploader-card[aria-busy="true"] {
  border-color: rgba(93, 137, 106, 0.4);
  box-shadow: inset 0 0 0 1px rgba(93, 137, 106, 0.12);
}

.scan-uploader-copy {
  display: grid;
  gap: 0.35rem;
}

.scan-uploader-status {
  width: fit-content;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(220, 233, 219, 0.9);
  color: var(--primary-strong);
  font-weight: 800;
}

.scan-uploader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.scan-uploader-note {
  min-height: 1.6rem;
}

.scan-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(238, 244, 236, 0.92);
  border: 1px solid rgba(93, 137, 106, 0.2);
}

.scan-progress[hidden] {
  display: none;
}

.scan-progress-indicator {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
  border-radius: 50%;
  border: 2px solid rgba(93, 137, 106, 0.2);
  border-top-color: var(--primary-strong);
  animation: scan-spin 800ms linear infinite;
}

.scan-progress-copy {
  display: grid;
  gap: 0.2rem;
}

.scan-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.scan-file-empty {
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed rgba(216, 199, 179, 0.92);
  color: var(--muted);
}

.scan-file-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 0.95rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(216, 199, 179, 0.84);
}

.scan-file-preview {
  flex-shrink: 0;
  width: 4.75rem;
  height: 4.75rem;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(216, 199, 179, 0.9);
  background: rgba(246, 237, 225, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.scan-file-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-file-info {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
  flex: 1;
}

.scan-file-name {
  font-weight: 700;
  word-break: break-all;
}

.scan-file-meta {
  color: var(--muted);
  white-space: nowrap;
}

.scan-file-remove {
  flex-shrink: 0;
  min-height: 2.35rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(181, 74, 66, 0.28);
  border-radius: 999px;
  background: rgba(251, 236, 234, 0.92);
  color: var(--danger);
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.scan-file-remove:hover {
  transform: translateY(-1px);
  background: rgba(251, 227, 223, 0.98);
  border-color: rgba(181, 74, 66, 0.38);
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.ocr-preview-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.7rem;
}

.ocr-preview-item {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(216, 199, 179, 0.84);
}

.ocr-preview-frame {
  overflow: hidden;
  width: 5rem;
  height: 5rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(216, 199, 179, 0.9);
  background: rgba(246, 237, 225, 0.95);
}

.ocr-preview-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ocr-preview-copy {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.ocr-preview-copy strong {
  word-break: break-all;
}

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

.candidate-button {
  min-height: 2.35rem;
  padding-inline: 0.85rem;
}

.candidate-source-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.2rem;
  padding-left: 1.2rem;
}

.progress-track {
  width: 100%;
  height: 0.7rem;
  margin-top: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(230, 216, 200, 0.92);
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.flash {
  padding: 1rem 1.1rem;
  border-radius: 1.2rem;
  font-weight: 700;
}

.flash-success {
  color: #24503a;
  background: rgba(220, 239, 228, 0.96);
}

.flash-error {
  color: var(--danger);
  background: rgba(251, 227, 223, 0.96);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 0.65rem;
  min-height: 16rem;
  text-align: center;
}

.empty-state::after {
  content: "";
  position: absolute;
  inset: auto auto 1.25rem 1.25rem;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 233, 219, 0.45), rgba(220, 233, 219, 0));
}

.muted-text a {
  color: inherit;
}

.js-ready .site-header,
.js-ready .page-header,
.js-ready .hero-panel,
.js-ready .stat-card,
.js-ready .section-card,
.js-ready .form-card,
.js-ready .medicine-card,
.js-ready .empty-state,
.js-ready .flash {
  animation: rise-in 420ms ease both;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scan-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  .site-header,
  .site-header-main,
  .hero-grid,
  .page-header,
  .content-grid-wide,
  .task-board-grid,
  .restock-item-grid,
  .detail-overview-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: start;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 1rem, 1320px);
    padding-top: 0.75rem;
  }

  .site-header,
  .hero-panel,
  .page-header,
  .section-card,
  .form-card,
  .empty-state {
    padding: 1.15rem;
    border-radius: 1.5rem;
  }

  .site-header {
    position: static;
  }

  .site-nav {
    flex-wrap: nowrap;
    padding-bottom: 0.35rem;
  }

  .site-nav-link {
    padding-inline: 0.95rem;
  }

  .hero-panel h1,
  .page-header h1,
  .empty-state h1,
  .empty-state h2 {
    font-size: clamp(1.8rem, 9vw, 2.6rem);
  }

  .button,
  .page-header > .button,
  .page-header > .hero-actions,
  .page-header > .stack-item-actions,
  .page-header > .page-header-actions {
    width: 100%;
  }

  .hero-actions,
  .form-actions,
  .stack-item-actions,
  .scan-uploader-actions,
  .page-header-actions,
  .empty-state-actions {
    align-items: stretch;
  }

  .button {
    width: 100%;
  }

  .capsule-item,
  .stack-item-title,
  .section-heading,
  .medicine-card-header,
  .progress-row,
  .scan-file-item,
  .ocr-preview-item,
  .file-picker-shell,
  .task-card-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .detail-side-grid {
    grid-template-columns: 1fr;
  }

  .scan-file-remove {
    width: 100%;
  }

  .scan-file-preview {
    width: 100%;
    height: 8.5rem;
  }

  .ocr-preview-frame {
    width: 100%;
    height: 9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }
}
