@font-face {
  font-family: Inter;
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/inter-vietnamese-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/inter-vietnamese-600-normal.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
:root {
  /* Warm editorial palette: ivory, oat, slate and clay accent */
  --primary: #ae5630;
  --primary-hover: #964826;
  --primary-foreground: #fff;
  --primary-light: #f5e8df;
  --leaf: #3f6b32;
  --leaf-light: #e9efe0;
  --background: #faf9f5;
  --oat: #f0eee6;
  --surface: #fffefb;
  --slate: #1f1e1d;
  --foreground: #1f1e1d;
  --muted: #6b6963;
  --border: #e6e2d6;
  --border-strong: #d4cfc1;
  --radius: 12px;
  --danger: #a62640;
  --danger-bg: #fdf0ef;
  --warning: #865219;
  --warning-bg: #fbf3e2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
.button {
  cursor: pointer;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  max-width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--foreground);
  font-weight: 600;
  line-height: 1.4;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  text-align: center;
  white-space: nowrap;
}
button:hover,
.button:hover {
  background: var(--oat);
}
.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.primary:hover {
  background: var(--primary-hover);
}
.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 0;
}
.ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--foreground);
}
input:focus,
textarea:focus,
select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #ae56301f;
}
textarea {
  min-height: 112px;
  resize: vertical;
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.field {
  margin-bottom: 16px;
}
.field small {
  color: var(--muted);
  font-weight: 400;
}
.required {
  color: var(--danger);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  color: var(--foreground);
}
h1 {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
}
h2 {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}
h3 {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}
p {
  color: var(--muted);
  max-width: 75ch;
}
small {
  font-size: 12px;
}
.site-header {
  background: #faf9f5eb;
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 1240px;
  margin: auto;
  padding: 14px 32px;
  display: flex;
  gap: 32px;
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
}
nav {
  display: flex;
  gap: 28px;
  margin-left: auto;
  align-items: center;
}
nav a {
  white-space: nowrap;
  padding: 8px 0;
  color: var(--muted);
  font-size: 13px;
  transition: color 0.15s ease;
}
nav a:hover {
  color: var(--foreground);
}
nav a[aria-current="page"] {
  color: var(--foreground);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--primary);
}
.account-link {
  font-size: 13px;
}
.mobile-only {
  display: none;
}
.wrap {
  max-width: 1240px;
  margin: auto;
  padding: 40px 32px;
}
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 32px 0 40px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.eyebrow:before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
}
.hero h1 {
  font-size: 48px;
  letter-spacing: -2px;
  line-height: 1.18;
  margin-bottom: 24px;
}
.hero h1 span {
  color: var(--primary);
}
.hero p {
  font-size: 16px;
  max-width: 48ch;
}
.hero-art {
  position: relative;
}
.hero-art img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  border-radius: 24px;
  object-fit: cover;
}
.art-caption {
  position: absolute;
  bottom: 24px;
  left: 24px;
  background: var(--slate);
  color: #e8e6dc;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 12px;
}
.art-caption b {
  display: block;
  font-size: 14px;
  color: #faf9f5;
}
.search-bar {
  display: flex;
  gap: 8px;
  max-width: 620px;
  margin-top: 24px;
}
.search-bar input {
  min-width: 0;
  min-height: 52px;
  padding: 10px 16px;
  border-radius: 14px;
  box-shadow: 0 1px 2px #1f1e1d0d;
}
.search-bar button {
  min-height: 52px;
  padding: 8px 22px;
  border-radius: 14px;
  flex-shrink: 0;
}
.suggestions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  font-size: 12px;
  color: var(--muted);
}
.suggestions button,
.suggestions .button {
  font-size: 12px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  background: transparent;
}
.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 28px 0;
  gap: 32px;
}
.principles p {
  font-size: 13px;
  margin: 4px 0 0;
}
.principles strong {
  font-weight: 600;
}
.section {
  padding: 40px 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 24px;
}
.section-head h2 {
  font-size: 24px;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}
.section-head p {
  margin: 0;
}
.text-link {
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 12px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-width: 0;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.card-content {
  padding: 20px;
}
.card-content p {
  font-size: 13px;
  margin-bottom: 20px;
}
.herb-visual {
  height: 140px;
  background: var(--oat);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.herb-visual span {
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -5px;
  color: var(--primary);
}
.herb-visual small {
  position: absolute;
  bottom: 12px;
  left: 16px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
}
.latin {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 12px;
  display: block;
}
.tag {
  display: inline-flex;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 3px 10px;
  background: var(--oat);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.tag.green {
  color: var(--leaf);
  background: var(--leaf-light);
}
.tag.warning {
  color: var(--warning);
  background: var(--warning-bg);
}
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card h3 {
  margin-bottom: 4px;
}
.saved {
  color: var(--primary);
  background: var(--primary-light);
}
.split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
}
.feature-panel {
  background: var(--slate);
  color: #e8e6dc;
  border-radius: 20px;
  padding: 36px;
}
.feature-panel h2 {
  font-size: 24px;
  letter-spacing: -0.5px;
  color: #faf9f5;
}
.feature-panel p {
  color: #bdbab0;
}
.feature-panel .button {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.feature-panel .button:hover {
  background: var(--primary-hover);
}
.feature-panel .number {
  font-size: 12px;
  letter-spacing: 1.2px;
  color: #d98f6f;
  display: block;
  margin-bottom: 24px;
}
.news-row {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.news-row h3 {
  margin: 8px 0;
}
.news-row p {
  margin: 0 0 12px;
}
.page-heading {
  margin-bottom: 24px;
}
.page-heading p {
  margin-bottom: 0;
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  align-items: end;
}
.toolbar .field {
  margin: 0;
  flex: 1;
  min-width: 150px;
}
.toolbar .search-field {
  flex: 2;
}
.count {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.empty {
  padding: 40px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  text-align: center;
}
.empty p {
  margin: 0 auto 16px;
  max-width: 52ch;
}
.empty h3 {
  margin-bottom: 8px;
}
.notice {
  padding: 16px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  margin: 20px 0;
}
.notice p {
  margin: 4px 0 0;
  color: inherit;
}
.error {
  background: var(--danger-bg);
  color: var(--danger);
}
.error p {
  color: inherit;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.list {
  display: grid;
  gap: 12px;
}
.list-item {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.list-item h3 {
  margin-bottom: 8px;
}
.list-item p {
  margin: 8px 0 16px;
}
.list-item .actions {
  margin-top: 16px;
}
.thread {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.thread-message {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.thread-message.mine {
  margin-left: 40px;
  background: var(--primary-light);
  border-color: #ebd3c4;
}
.thread-message p {
  margin: 6px 0 0;
  white-space: pre-line;
}
.meta {
  font-size: 12px;
  color: var(--muted);
}
.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.narrow {
  max-width: 720px;
  margin: 0 auto;
}
.login {
  padding: 40px 0;
  max-width: 560px;
  margin: auto;
}
.login h1 {
  font-size: 24px;
}
.login p {
  font-size: 14px;
}
.form-message {
  margin: 12px 0;
  color: var(--danger);
}
.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
}
.detail-art .herb-visual {
  height: 240px;
  border-radius: 12px;
}
.detail-art .herb-visual span {
  font-size: 96px;
}
.detail h3 {
  margin: 24px 0 8px;
}
.detail p {
  white-space: pre-line;
}
.source-link {
  overflow-wrap: anywhere;
  color: var(--primary);
  text-decoration: underline;
}
.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 22px;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: min(760px, calc(100% - 32px));
  max-height: 90vh;
  overflow-y: auto;
  color: var(--foreground);
  background: var(--surface);
}
dialog::backdrop {
  background: #1f1e1d80;
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.dialog-top h2 {
  margin: 0;
}
.dialog-top button {
  border: 0;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--foreground);
  color: white;
  z-index: 100;
  display: none;
  max-width: calc(100% - 32px);
}
#toast.visible {
  display: block;
}
footer {
  border-top: 1px solid var(--border);
  max-width: 1176px;
  margin: 24px auto 0;
  padding: 32px 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 40px;
}
footer .brand-logo {
  height: 44px;
}
.footer-grid p {
  font-size: 12px;
  margin-top: 12px;
}
.footer-grid b {
  font-size: 13px;
}
.footer-grid > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12px;
}
.footer-bottom {
  border-top: 1px solid var(--border);
  margin-top: 32px;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.loading {
  padding: 80px 24px;
  text-align: center;
}
.skip {
  position: fixed;
  left: 8px;
  top: -60px;
  padding: 12px;
  background: var(--surface);
  z-index: 100;
}
.skip:focus {
  top: 8px;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.muted {
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
button[aria-busy="true"] {
  opacity: 0.7;
  cursor: wait;
}
@media (max-width: 1100px) {
  .header-inner {
    gap: 20px;
  }
  nav {
    gap: 18px;
  }
  .hero h1 {
    font-size: 40px;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  footer {
    margin-left: 32px;
    margin-right: 32px;
  }
}
@media (max-width: 760px) {
  .header-inner {
    padding: 16px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .brand-logo {
    height: 32px;
  }
  .mobile-only {
    display: inline-flex;
    margin-left: auto;
  }
  .account-link {
    font-size: 12px;
    padding: 8px 12px;
  }
  nav {
    display: none;
    order: 4;
    width: 100%;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  nav.open {
    display: flex;
  }
  nav a {
    padding: 12px;
  }
  .wrap {
    padding: 24px 16px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 16px 0 32px;
  }
  .hero h1 {
    font-size: 36px;
    letter-spacing: -1.2px;
  }
  .hero p {
    font-size: 14px;
  }
  .hero-art {
    max-width: 460px;
  }
  .hero-art img {
    aspect-ratio: 1.4;
    border-radius: 20px;
  }
  .principles {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 0;
  }
  .section {
    padding: 32px 0;
  }
  .section-head {
    align-items: start;
  }
  .section-head h2 {
    font-size: 20px;
  }
  .section-head p {
    font-size: 13px;
  }
  .section-head .text-link {
    font-size: 12px;
  }
  .grid,
  .split,
  .two-columns,
  .detail-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .card-content {
    padding: 16px;
  }
  .herb-visual {
    height: 120px;
  }
  .hero .search-bar {
    flex-direction: column;
  }
  .hero .search-bar button {
    width: 100%;
  }
  .search-bar {
    margin-top: 16px;
  }
  .feature-panel {
    padding: 24px;
  }
  .feature-panel h2 {
    font-size: 20px;
  }
  .toolbar {
    gap: 12px;
  }
  .toolbar .field {
    min-width: 100%;
    width: 100%;
  }
  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }
  button,
  .button {
    min-height: 44px;
  }
  .suggestions button,
  .suggestions .button {
    min-height: 36px;
  }
  .icon-button {
    width: 44px;
    height: 44px;
  }
  .list-item {
    padding: 16px;
  }
  footer {
    margin: 16px;
    padding: 24px 0;
  }
  .footer-grid {
    gap: 20px;
  }
  .footer-bottom {
    gap: 16px;
    flex-direction: column;
  }
  .detail-art .herb-visual {
    height: 140px;
  }
  dialog {
    padding: 16px;
  }
  .art-caption {
    bottom: 16px;
    left: 16px;
  }
  .eyebrow {
    font-size: 10px;
    margin-bottom: 16px;
  }
  .count {
    margin-bottom: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Shared controls stay aligned across header, catalog and footer. */
nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.card h3 a,
.card h3 button {
  white-space: normal;
  padding: 0;
  text-align: left;
  justify-content: flex-start;
  color: var(--foreground);
  font-size: 16px;
  font-weight: 600;
}
.card h3 a:hover,
.card h3 button:hover {
  background: transparent;
  color: var(--primary);
}
.herb-visual small,
.eyebrow {
  font-size: 12px;
}
.footer-grid > div:last-child a {
  min-height: 40px;
  display: flex;
  align-items: center;
}
.art-caption {
  border: 0;
}
@media (min-width: 761px) and (max-width: 1000px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-grid > div:last-child {
    grid-column: 1/-1;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px;
  }
}
.hero-art img {
  height: auto;
}
@media (max-width: 760px) {
  .hero-art img {
    height: auto;
    aspect-ratio: 1.4;
  }
}
.split > *,
.two-columns > * {
  min-width: 0;
}

/* Phân rõ giao diện Người dùng và Trang Quản trị */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-header-link {
  font-size: 13px;
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.admin-header-link:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.admin-mobile-link {
  color: var(--primary) !important;
  font-weight: 600 !important;
  border-top: 1px dashed var(--border);
  margin-top: 8px;
  padding-top: 12px !important;
}

/* Hàng tiêu đề + nút: nhóm nút xuống dòng cùng nhau thay vì rớt từng nút */
.section-head {
  flex-wrap: wrap;
}
.section-head > :first-child {
  flex: 1 1 320px;
  min-width: 0;
}

/* Header gập vào menu ☰ từ 900px: logo + menu + nhóm nút không còn vừa một hàng */
@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
  }
  #menu-toggle {
    display: inline-flex;
    order: 3;
    margin-left: 0;
  }
  .brand {
    margin-right: auto;
  }
  .header-actions {
    order: 2;
  }
  .admin-header-link {
    display: none;
  }
  nav {
    display: none;
    order: 4;
    width: 100%;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  nav.open {
    display: flex;
  }
  nav a {
    padding: 12px;
  }
  nav .admin-mobile-link {
    display: inline-flex;
    margin-left: 0;
  }
}
.field-group {
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 12px;
}
.field-group legend {
  font-weight: 600;
  padding: 0 6px;
}


/* ===== Khu vực riêng tư (tài khoản + quản trị) =====
   Khung có cột trái từ 1024px; hẹp hơn là hàng tab cuộn trong khung. Phẳng, viền mảnh, không bóng. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.app-wrap {
  padding-top: 32px;
  padding-bottom: 56px;
}
.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.app-main {
  min-width: 0;
}
.app-main > .notice {
  margin: 0 0 16px;
}
.workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.workspace-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-group-label {
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: #4d4b46;
}
.nav-item:hover {
  background: #f5f3ec;
  color: var(--foreground);
}
.nav-item.active {
  background: var(--oat);
  color: var(--foreground);
  font-weight: 600;
}
/* Giữ bề rộng chữ đậm cho mọi trạng thái để chọn mục không làm hàng xô ngang */
.label::after {
  content: attr(data-text);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 600;
}
.nav-select {
  display: none;
}
.num {
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.active > .num {
  color: var(--foreground);
}

/* Đầu trang */
.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header-text {
  flex: 1 1 320px;
  min-width: 0;
}
.page-header h1 {
  margin: 0;
}
.page-header p {
  margin: 4px 0 0;
  max-width: 55ch;
  text-wrap: pretty;
}
.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.block {
  margin-bottom: 32px;
}
.block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.block-head h2 {
  margin: 0;
  font-size: 16px;
}

/* Tab gạch chân (đổi trạng thái danh sách) và viên lọc */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: inset 0 -1px 0 var(--border-strong);
}
.tab {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  white-space: nowrap;
  color: #4d4b46;
  box-shadow: inset 0 -2px 0 transparent;
}
.tab:hover {
  color: var(--foreground);
}
.tab.active {
  color: var(--foreground);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--primary);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
}
.chip:hover {
  background: var(--oat);
}
.chip.active {
  background: var(--primary-light);
  border-color: #ebd3c4;
  color: var(--primary-hover);
}

/* Danh sách là một khối chia đường kẻ */
.row-list,
.status-list,
.queue-list,
.inbox-list,
.table-scroll,
.identity,
.status-strip {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.row-list {
  overflow: hidden;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.row:first-child,
.task-row:first-child,
.queue-row:first-child,
.inbox-row:first-child,
.status-list > div:first-child {
  border-top: 0;
}
.row-main {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.row-title h3 {
  margin: 0;
  font-size: 15px;
}
.row-title-line {
  margin: 0;
  color: var(--foreground);
}
.row-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.row-meta a {
  color: var(--primary);
}
.row-text {
  margin: 8px 0 0;
  font-size: 14px;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.row-actions button {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
}
.row-warning,
.warn-list li {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
  line-height: 1.5;
}
.warn-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.warn-list li {
  margin: 0;
}
.warn-list li::before {
  content: "⚠ ";
}
.quiet-empty {
  margin: 0;
  padding: 24px 0;
  text-align: center;
  color: var(--muted);
}
.status-strip {
  margin-bottom: 16px;
  padding: 12px 16px;
}
.status-strip .tag {
  margin: 0 4px;
}

/* Việc cần làm, thẻ đang chờ, tình trạng hệ thống */
.task-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.task-row:hover,
.queue-row:hover,
.inbox-row:hover {
  background: #f6f4ec;
}
.task-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.task-main b {
  font-size: 15px;
}
.task-go {
  font-size: 20px;
  color: var(--muted);
}
.identity {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px;
}
.identity p {
  margin: 4px 0 0;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.stat-card:hover {
  border-color: var(--border-strong);
  background: #f6f4ec;
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
}
.stat-num {
  font-size: 24px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-go {
  font-size: 12px;
  color: var(--muted);
}
.split-blocks {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (min-width: 1280px) {
  .split-blocks {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  }
}
.status-list {
  margin: 0 0 12px;
  overflow: hidden;
}
.status-list > div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 4px 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.status-list dt {
  font-size: 13px;
  color: var(--muted);
}
.status-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Hàng chờ bản tin và hộp thư: danh sách bên trái, chi tiết bên phải; hẹp thì lần lượt */
.queue,
.inbox {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.queue-list {
  overflow-y: auto;
  max-height: 72vh;
}
.queue-row,
.inbox-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.queue-row.active,
.inbox-row.active {
  background: var(--oat);
}
.queue-title {
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.queue-source .meta {
  flex: 1;
  min-width: 0;
}
.queue-source .tag {
  flex-shrink: 0;
  white-space: nowrap;
}
.queue-source {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.signal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}
/* Nhãn bằng chứng dài phải xuống dòng trong cột hẹp, không đẩy cả trang tràn ngang ở 375px. */
.signal-tags .tag {
  white-space: normal;
  max-width: 100%;
  text-align: left;
}
.queue-detail,
.inbox-thread {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.queue-article h2,
.thread-head h2 {
  margin: 12px 0 8px;
  font-size: 18px;
}
.thread-head h2 {
  margin: 0 0 4px;
}
.summary {
  margin: 12px 0;
  color: var(--foreground);
  white-space: pre-line;
}
.quote {
  margin: 16px 0;
  padding-left: 12px;
  border-left: 3px solid var(--border-strong);
}
.quote p {
  margin: 4px 0 0;
}
.decision {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.back-link {
  display: none;
  align-items: center;
  min-height: 44px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary);
}
.inbox-line,
.thread-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.thread-head {
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.thread-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inbox-snippet {
  font-size: 13px;
  color: var(--foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.inbox-thread .thread {
  margin: 16px 0;
}
.inbox-thread .quiet-empty {
  padding: 48px 0;
}

/* Bảng thành viên: cuộn trong khung riêng, cột đầu ghim */
.table-scroll {
  position: relative; /* chứa .sr-only tuyệt đối để không làm trang cuộn ngang */
  overflow-x: auto;
}
.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  white-space: nowrap;
  padding: 12px 16px;
  text-align: left;
  border-top: 1px solid var(--border);
}
.data-table thead th {
  border-top: 0;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
}
.data-table tbody th {
  position: sticky;
  left: 0;
  background: var(--surface);
}
.data-table .cell-actions {
  text-align: right;
  white-space: nowrap;
}
.cell-actions button {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
}
.cell-actions button + button {
  margin-left: 8px;
}
.settings-form {
  max-width: 640px;
}
.settings-form .field-group {
  border-color: var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
}

@media (min-width: 1024px) and (min-height: 720px) {
  .app-aside {
    position: sticky;
    top: 96px;
  }
}
@media (max-width: 1023px) {
  .app-shell {
    display: block;
  }
  .app-aside {
    margin-bottom: 16px;
  }
  .workspace {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .app-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 4px;
    box-shadow: inset 0 -1px 0 var(--border-strong);
  }
  .app-nav.has-select {
    display: none;
  }
  .nav-select {
    display: block;
  }
  .nav-group {
    display: contents;
  }
  .nav-group-label {
    display: none;
  }
  .nav-item {
    flex-shrink: 0;
    min-height: 44px;
    border-radius: 0;
    white-space: nowrap;
    box-shadow: inset 0 -2px 0 transparent;
  }
  .nav-item:hover {
    background: transparent;
  }
  .nav-item.active {
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--primary);
  }
  .inbox {
    grid-template-columns: minmax(0, 1fr);
  }
  .inbox[data-view="list"] .inbox-thread,
  .inbox[data-view="thread"] .inbox-list {
    display: none;
  }
  .inbox-thread .back-link {
    display: inline-flex;
  }
}
/* Hàng chờ bản tin: hai khung chỉ khi đủ rộng cho cột danh sách (tín hiệu không rớt dòng lẻ) */
@media (max-width: 1279px) {
  .queue {
    grid-template-columns: minmax(0, 1fr);
  }
  .queue-list {
    max-height: none;
  }
  .queue[data-view="list"] .queue-detail,
  .queue[data-view="detail"] .queue-list {
    display: none;
  }
  .queue-detail .back-link {
    display: inline-flex;
  }
}
@media (max-width: 760px) {
  .app-wrap {
    padding-top: 16px;
  }
  .chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chip {
    justify-content: center;
  }
  .decision .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .row {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
  .row-actions {
    justify-content: flex-start;
  }
  .row-actions button,
  .cell-actions button {
    min-height: 44px;
  }
  .task-row {
    padding: 16px;
  }
  .status-list > div {
    grid-template-columns: minmax(0, 1fr);
  }
  .queue-detail,
  .inbox-thread {
    padding: 16px;
  }
  .page-header-actions {
    width: 100%;
  }
  .thread-message.mine {
    margin-left: 16px;
  }
  .workspace button {
    min-height: 44px;
  }
}

/* Ảnh minh hoạ dược liệu và bản tin */
.herb-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--oat);
  border-bottom: 1px solid var(--border);
}
.herb-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 10px 6px;
  font-size: 10px;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}
.news-thumb .photo-note,
.herb-hero .photo-note {
  position: static;
  display: block;
  padding: 4px 0 0;
  color: var(--muted);
  background: none;
}
.herb-hero,
.article-hero {
  margin: 0 0 16px;
}
.herb-hero img,
.article-hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--oat);
}
.herb-hero img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.article-hero img {
  max-height: 420px;
  object-fit: cover;
}
.article-hero.fallback img {
  max-height: 160px;
  object-fit: contain;
}
.herb-hero figcaption,
.article-hero figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.herb-hero figcaption a,
.article-hero figcaption a {
  text-decoration: underline;
}
.news-row.has-thumb {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.news-thumb {
  min-width: 0;
}
.news-thumb a {
  display: block;
}
.news-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: var(--oat);
}
.news-thumb.fallback img {
  object-fit: contain;
  padding: 8px;
}
.news-body {
  min-width: 0;
}
@media (max-width: 760px) {
  .news-row.has-thumb {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .news-thumb img {
    aspect-ratio: 16 / 9;
  }
}

/* Mục "Ảnh minh hoạ" trong trình biên tập hồ sơ */
.media-panel {
  display: grid;
  gap: 12px;
  margin: 8px 0 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.media-panel .tabs {
  margin-bottom: 0;
}
.media-current {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.media-current img,
.media-card img,
.media-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--oat);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.media-card {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 8px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  min-width: 0;
}
.media-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.media-card span {
  overflow-wrap: anywhere;
}
.media-preview {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 760px) {
  .media-current,
  .media-preview {
    grid-template-columns: minmax(0, 1fr);
  }
}
.media-thumb {
  vertical-align: middle;
  border-radius: 4px;
}
