:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #1f2937;
  --muted: #64748b;
  --line: #d9e2ec;
  --line-soft: #edf2f7;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --focus: #2563eb;
  --danger: #be123c;
  --warning: #a16207;
  --radius: 8px;
  --shadow: 0 14px 35px rgba(31, 41, 55, 0.08);
}

/* phrae-db-css-v1 link hub theme */
:root {
  --bg: #f2f6f5;
  --surface: rgba(255, 255, 255, 0.97);
  --surface-soft: #f5faf8;
  --text: #102a43;
  --muted: #5a6e7f;
  --line: rgba(11, 47, 85, 0.16);
  --line-soft: rgba(11, 47, 85, 0.09);
  --primary: #087f5b;
  --primary-dark: #0b2f55;
  --focus: #164e8a;
  --danger: #a61b46;
  --warning: #9a6b16;
  --gold: #c69a45;
  --navy-deep: #071f3a;
  --navy: #0b2f55;
  --royal: #164e8a;
  --radius: 16px;
  --shadow: 0 14px 34px rgba(7, 31, 58, 0.10);
}

body {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(8, 127, 91, 0.14), transparent 30rem),
    radial-gradient(circle at 94% 5%, rgba(22, 78, 138, 0.14), transparent 32rem),
    linear-gradient(135deg, #fffdf7, #eef6f4 52%, #edf3f8);
}

body::before {
  content: "HDC\A PHRAE";
  position: fixed;
  right: -1rem;
  bottom: -2rem;
  z-index: -1;
  color: rgba(7, 31, 58, 0.045);
  font-size: clamp(5rem, 16vw, 12rem);
  font-weight: 700;
  line-height: 0.72;
  letter-spacing: -0.06em;
  white-space: pre;
  pointer-events: none;
  user-select: none;
}

.container { width: min(1280px, calc(100% - 32px)); }

.site-header,
.admin-header {
  position: relative;
  overflow: hidden;
  color: #fff;
  border-bottom: 4px solid var(--gold);
  background:
    linear-gradient(120deg, rgba(7, 31, 58, 0.99), rgba(11, 47, 85, 0.98) 56%, rgba(8, 94, 80, 0.96));
  box-shadow: 0 16px 36px rgba(7, 31, 58, 0.22);
}

.site-header::after,
.admin-header::after {
  content: "PHRAE HEALTH LINK HUB";
  position: absolute;
  right: 22px;
  bottom: -10px;
  color: rgba(255, 255, 255, 0.065);
  font-size: clamp(2rem, 5vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.07em;
  white-space: nowrap;
  pointer-events: none;
}

.site-header > *,
.admin-header > * { position: relative; z-index: 1; }
.site-header h1,
.site-header .brand,
.admin-header h1,
.admin-header .eyebrow { color: #fff; }
.site-header .subtitle,
.site-header .updated { color: rgba(235, 250, 245, 0.82); }
.site-header .eyebrow { color: #f1d695; letter-spacing: 0.16em; }

.brand img {
  width: 48px;
  height: 48px;
  padding: 5px;
  border: 2px solid rgba(198, 154, 69, 0.72);
  border-radius: 50%;
  background: #fffdf7;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.site-header .admin-link,
.admin-header .button {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.23);
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(8px);
}
.site-header .admin-link:hover,
.admin-header .button:hover {
  color: #fff;
  border-color: rgba(198, 154, 69, 0.75);
  background: rgba(255, 255, 255, 0.18);
}

.site-header .summary-panel {
  border-color: rgba(198, 154, 69, 0.36);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}
.site-header .summary-item { background: rgba(255, 255, 255, 0.10); }
.site-header .summary-item strong { color: #fff; }
.site-header .summary-item span { color: rgba(235, 250, 245, 0.78); }

.search-box input {
  border-color: rgba(11, 47, 85, 0.18);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(7, 31, 58, 0.07);
}
.site-header .search-box input { border-color: rgba(198, 154, 69, 0.44); }

.filter-chip.is-active {
  color: #fff;
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--navy), var(--primary));
  box-shadow: 0 7px 16px rgba(7, 31, 58, 0.14);
}

.category-card,
.panel,
.auth-shell {
  border-color: var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.category-card { border-top-color: var(--accent); }
.category-heading {
  background: linear-gradient(100deg, rgba(22, 78, 138, 0.07), rgba(8, 127, 91, 0.06), rgba(198, 154, 69, 0.08));
}
.category-heading h2 { color: var(--navy); }
.category-count { border: 1px solid rgba(198, 154, 69, 0.28); }
a.link-row:hover { background: linear-gradient(90deg, rgba(22, 78, 138, 0.05), rgba(8, 127, 91, 0.05)); }

.panel { border-top: 3px solid rgba(198, 154, 69, 0.72); }
.panel-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(198, 154, 69, 0.24);
}
.panel-heading h2,
.panel-heading h3 { color: var(--navy); }

.field input,
.field textarea,
.field select {
  border-radius: 10px;
  border-color: rgba(11, 47, 85, 0.19);
}
.field input:focus,
.field textarea:focus,
.field select:focus,
.search-box input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198, 154, 69, 0.20);
}

.button { border-radius: 10px; }
.button.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--navy), var(--primary));
  box-shadow: 0 7px 16px rgba(7, 31, 58, 0.14);
}
.button.primary:hover { background: linear-gradient(135deg, var(--royal), #0b6e5b); }
.button:disabled { cursor: not-allowed; opacity: 0.48; box-shadow: none; }
.button.compact { min-height: 32px; padding: 5px 10px; font-size: 0.86rem; }

.admin-main { gap: 18px; }
.admin-header-inner { min-height: 92px; }
.admin-header .eyebrow { margin-bottom: 3px; color: #f1d695; letter-spacing: 0.16em; }

.batch-save-form { display: none; }
.batch-toolbar {
  position: sticky;
  top: 10px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 10px;
  padding: 12px 14px;
  color: #fff;
  border: 1px solid rgba(198, 154, 69, 0.62);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(7, 31, 58, 0.97), rgba(11, 47, 85, 0.96) 58%, rgba(8, 94, 80, 0.94));
  box-shadow: 0 12px 28px rgba(7, 31, 58, 0.22);
}
.batch-toolbar > div:first-child { display: grid; gap: 2px; }
.batch-toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.batch-toolbar .button:not(.primary) { color: #fff; border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.10); }
.batch-toolbar .button.primary { border-color: rgba(198, 154, 69, 0.62); }
.batch-status { color: rgba(235, 250, 245, 0.76); font-size: 0.84rem; }
.batch-status.is-dirty { color: #ffe2a6; font-weight: 600; }
.batch-help {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  color: var(--muted);
  border: 1px dashed rgba(8, 127, 91, 0.28);
  border-radius: 12px;
  background: rgba(240, 249, 246, 0.82);
}

.category-batch-list { display: grid; gap: 12px; }
.batch-category {
  overflow: clip;
  border: 1px solid rgba(11, 47, 85, 0.15);
  border-left: 4px solid var(--primary);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(7, 31, 58, 0.08);
}
.batch-category[open] { box-shadow: 0 14px 32px rgba(7, 31, 58, 0.11); }
.batch-category-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(100deg, rgba(22, 78, 138, 0.08), rgba(8, 127, 91, 0.06), rgba(198, 154, 69, 0.08));
}
.batch-category-summary::-webkit-details-marker { display: none; }
.batch-category-heading { display: grid; min-width: 0; gap: 2px; }
.batch-category-heading strong { color: var(--navy); font-size: 1.05rem; overflow-wrap: anywhere; }
.batch-category-heading small { color: var(--muted); }
.batch-category-body { display: grid; gap: 12px; padding: 14px; border-top: 1px solid var(--line-soft); }
.batch-category-fields { padding: 12px; border-radius: 12px; background: #f7faf9; }

.batch-link-list { display: grid; gap: 9px; min-height: 24px; padding: 3px; border-radius: 12px; }
.batch-link-list:empty::before {
  content: "ลากลิงก์มาวางในหมวดนี้ได้";
  padding: 16px;
  color: var(--muted);
  border: 1px dashed rgba(11, 47, 85, 0.2);
  border-radius: 10px;
  text-align: center;
}
.batch-link-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(11, 47, 85, 0.12);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(7, 31, 58, 0.05);
}
.batch-link-card:hover { border-color: rgba(8, 127, 91, 0.3); }
.batch-link-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
}
.batch-link-head strong { color: var(--navy); overflow-wrap: anywhere; }
.batch-link-fields { padding-left: 28px; }
.drag-handle,
.drag-symbol {
  color: #7b8fa1;
  font-weight: 700;
  letter-spacing: -0.14em;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.is-dragging { opacity: 0.45; outline: 2px dashed var(--gold); outline-offset: 2px; }
.order-buttons { display: inline-flex; gap: 4px; }
.icon-button {
  width: 31px;
  height: 31px;
  padding: 0;
  color: var(--navy);
  border: 1px solid rgba(11, 47, 85, 0.16);
  border-radius: 8px;
  background: #fff;
}
.icon-button:hover { color: #fff; border-color: var(--primary); background: var(--primary); }
.add-link-panel {
  border: 1px dashed rgba(8, 127, 91, 0.32);
  border-radius: 12px;
  background: rgba(240, 249, 246, 0.72);
}
.add-link-panel > summary { padding: 11px 13px; color: var(--primary-dark); font-weight: 600; cursor: pointer; }
.add-link-panel > form { padding: 0 13px 13px; }

.auth-shell {
  position: relative;
  border-top: 4px solid var(--gold);
  box-shadow: 0 20px 46px rgba(7, 31, 58, 0.16);
}
.auth-title { color: var(--navy); }

@media (max-width: 900px) {
  .batch-toolbar { position: static; align-items: stretch; flex-direction: column; }
  .batch-toolbar-actions { justify-content: flex-start; }
  .batch-link-fields { padding-left: 0; }
}

@media (max-width: 620px) {
  .container { width: min(100% - 20px, 1280px); }
  .site-header::after,
  .admin-header::after { right: 8px; font-size: 1.5rem; }
  .batch-category-summary,
  .batch-link-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .batch-category-summary .category-count,
  .batch-link-head .status-badge { grid-column: 2; justify-self: start; }
  .batch-category-summary .order-buttons,
  .batch-link-head .order-buttons { grid-column: 3; grid-row: 1 / span 2; }
  .batch-toolbar-actions .button { flex: 1 1 auto; }
}

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

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Kanit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  padding: 18px 0 24px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.admin-link,
.ghost-button,
.filter-chip,
.button {
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.admin-link:hover,
.ghost-button:hover,
.filter-chip:hover,
.button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: end;
}

.eyebrow,
.category-kicker,
.updated,
.result-line,
.form-hint,
.small-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 1.12;
  font-weight: 700;
}

.subtitle {
  max-width: 760px;
  margin-bottom: 10px;
  color: #475569;
  font-size: 1.12rem;
  line-height: 1.7;
}

.updated {
  margin-bottom: 0;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.summary-item {
  min-width: 0;
  background: #ffffff;
  padding: 16px;
}

.summary-item strong {
  display: block;
  color: var(--primary-dark);
  font-size: 1.7rem;
  line-height: 1;
}

.summary-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 24px;
}

.search-box {
  position: relative;
  display: block;
}

.search-box input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  padding: 11px 16px 11px 46px;
  outline: none;
}

.search-box input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.search-mark {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 2px solid #64748b;
  border-radius: 50%;
  transform: translateY(-58%);
}

.search-mark::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: #64748b;
  transform: rotate(45deg);
}

.main-content {
  padding: 22px 0 48px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  min-height: 36px;
  color: #475569;
  background: #ffffff;
}

.filter-chip.is-active {
  border-color: var(--primary);
  background: #e6fffb;
  color: var(--primary-dark);
}

.result-line {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.category-card {
  --accent: var(--primary);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.theme-teal { --accent: #0f766e; }
.theme-indigo { --accent: #4f46e5; }
.theme-violet { --accent: #7c3aed; }
.theme-rose { --accent: #be123c; }
.theme-amber { --accent: #b45309; }
.theme-green { --accent: #15803d; }
.theme-blue { --accent: #2563eb; }
.theme-slate { --accent: #475569; }

.category-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.category-kicker {
  margin-bottom: 6px;
}

.category-heading h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
  line-height: 1.35;
  color: #0f172a;
}

.category-heading p:last-child {
  margin-bottom: 0;
  color: #64748b;
  line-height: 1.65;
}

.category-count {
  min-width: 54px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--accent);
  font-weight: 700;
  padding: 8px 10px;
  text-align: center;
}

.link-list {
  display: grid;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
  text-decoration: none;
}

.link-row:last-child {
  border-bottom: 0;
}

a.link-row:hover {
  background: #f8fafc;
}

a.link-row:focus-visible,
.admin-link:focus-visible,
.ghost-button:focus-visible,
.filter-chip:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.link-main {
  min-width: 0;
}

.link-main strong {
  display: block;
  overflow-wrap: anywhere;
  color: #1e293b;
  font-weight: 600;
  line-height: 1.45;
}

.link-main small {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: #64748b;
  line-height: 1.35;
}

.is-disabled {
  background: #fbfcfe;
}

.is-disabled .link-main strong {
  color: #64748b;
}

.status-badge {
  width: max-content;
  max-width: 120px;
  border-radius: var(--radius);
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-draft {
  background: #fef3c7;
  color: #92400e;
}

.status-hidden {
  background: #f1f5f9;
  color: #475569;
}

.empty-state {
  margin-top: 20px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line-soft);
  background: #ffffff;
  color: var(--muted);
  padding: 20px 0;
  text-align: center;
}

.auth-page,
.admin-page {
  min-height: 100vh;
}

.auth-shell {
  width: min(440px, calc(100% - 32px));
  margin: 8vh auto;
  background: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.admin-header {
  background: #ffffff;
  border-bottom: 1px solid var(--line-soft);
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.admin-title {
  margin: 0;
  font-size: 1.35rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-main {
  display: grid;
  gap: 16px;
  padding: 22px 0 48px;
}

.panel {
  background: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading h2,
.panel-heading h3 {
  margin-bottom: 4px;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.form-grid.three {
  grid-template-columns: 1.5fr 0.8fr 0.8fr;
}

.field {
  display: grid;
  gap: 6px;
}

.auth-shell .field + .field {
  margin-top: 12px;
}

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

.field label {
  color: #334155;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.field textarea {
  min-height: 74px;
  resize: vertical;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

.button.danger {
  border-color: #fecdd3;
  background: #fff1f2;
  color: var(--danger);
}

.button.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--warning);
}

.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
}

.notice.success {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.notice.error {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.category-admin {
  display: grid;
  gap: 12px;
}

.category-admin + .category-admin {
  margin-top: 10px;
}

.category-admin summary {
  list-style: none;
  cursor: pointer;
}

.category-admin summary::-webkit-details-marker {
  display: none;
}

.category-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
}

.category-summary h3 {
  margin-bottom: 4px;
  font-size: 1.08rem;
}

.category-summary p {
  margin-bottom: 0;
  color: var(--muted);
}

.link-editor {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 12px;
  margin-top: 10px;
}

.link-editor h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.link-editor summary {
  cursor: pointer;
}

.link-editor summary::-webkit-details-marker {
  display: none;
}

.link-editor summary h4 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-search {
  margin-bottom: 12px;
}

.backup-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

@media (max-width: 900px) {
  .intro-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    max-width: 520px;
  }

  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 20px, 1180px);
  }

  .topbar,
  .admin-header-inner,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .intro-grid {
    gap: 18px;
  }

  .summary-panel {
    grid-template-columns: 1fr;
  }

  .site-header .intro-grid > .summary-panel {
    display: none;
  }

  .search-shell {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .filter-chip {
    white-space: nowrap;
  }

  .category-heading,
  .link-row,
  .category-summary {
    grid-template-columns: 1fr;
  }

  .status-badge,
  .category-count {
    justify-self: start;
  }
}

/* Final cascade: keep the Phrae theme above legacy component rules. */
body {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(8, 127, 91, 0.14), transparent 30rem),
    radial-gradient(circle at 94% 5%, rgba(22, 78, 138, 0.14), transparent 32rem),
    linear-gradient(135deg, #fffdf7, #eef6f4 52%, #edf3f8);
}
.container { width: min(1280px, calc(100% - 32px)); }
.site-header,
.admin-header {
  color: #fff;
  border-bottom: 4px solid var(--gold);
  background: linear-gradient(120deg, rgba(7, 31, 58, 0.99), rgba(11, 47, 85, 0.98) 56%, rgba(8, 94, 80, 0.96));
  box-shadow: 0 16px 36px rgba(7, 31, 58, 0.22);
}
.site-header h1,
.site-header .brand,
.admin-header h1,
.admin-header .eyebrow { color: #fff; }
.site-header .subtitle,
.site-header .updated { color: rgba(235, 250, 245, 0.82); }
.site-header .eyebrow,
.admin-header .eyebrow { color: #f1d695; }
.site-header .admin-link,
.admin-header .button {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.23);
  background: rgba(255, 255, 255, 0.10);
}
.site-header .summary-item { background: rgba(255, 255, 255, 0.10); }
.site-header .summary-item strong { color: #fff; }
.site-header .summary-item span { color: rgba(235, 250, 245, 0.78); }
.category-card,
.panel,
.auth-shell {
  border-color: var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel { border-top: 3px solid rgba(198, 154, 69, 0.72); }
.category-heading { background: linear-gradient(100deg, rgba(22, 78, 138, 0.07), rgba(8, 127, 91, 0.06), rgba(198, 154, 69, 0.08)); }
.category-heading h2,
.panel-heading h2,
.panel-heading h3 { color: var(--navy); }
.button.primary { color: #fff; border-color: var(--primary); background: linear-gradient(135deg, var(--navy), var(--primary)); }
.filter-chip.is-active { color: #fff; border-color: var(--primary); background: linear-gradient(135deg, var(--navy), var(--primary)); }

@media (max-width: 620px) {
  .container { width: min(100% - 20px, 1280px); }
}
