:root {
  color: #172033;
  background: #f4f6f8;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(48, 111, 143, 0.08) 0 28%, transparent 28% 100%),
    repeating-linear-gradient(90deg, rgba(42, 62, 76, 0.035) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(42, 62, 76, 0.03) 0 1px, transparent 1px 48px),
    linear-gradient(180deg, #f4f8f7 0%, #e9f1ef 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page,
.admin-page {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 16px;
}

h3 {
  margin: 0;
  font-size: 15px;
}

.hero-copy {
  margin: 8px 0 0;
  color: #647084;
}

.search-input,
.admin-filters input,
.admin-filters select,
.admin-form input,
.admin-form select,
.bulk-form input,
.bulk-form select,
.bulk-form textarea {
  height: 40px;
  border: 1px solid #ccd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #172033;
  padding: 0 12px;
  outline: none;
}

.bulk-form textarea {
  height: auto;
  min-height: 142px;
  padding: 10px 12px;
  resize: vertical;
}

.search-input {
  width: 100%;
}

.admin-link,
.primary-button,
.ghost-button,
.link-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0 13px;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  border-color: #244f7a;
  background: #244f7a;
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ghost-button {
  background: transparent;
}

.danger-button {
  border-color: #d7b4ae;
  color: #9f2f24;
  margin-left: 8px;
}

.admin-toolbar,
.admin-form-panel,
.admin-list-panel,
.login-panel {
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 16px;
  margin-bottom: 16px;
}

.link-main span,
.admin-table td span {
  color: #6b7586;
  font-size: 12px;
}

.link-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.link-main strong,
.link-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #758195;
}

.home-page {
  width: min(1440px, calc(100vw - 40px));
}

.access-page {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  padding: 48px 20px;
}

.access-page::before {
  content: "";
  position: absolute;
  inset: 10% auto auto 50%;
  width: min(720px, 76vw);
  height: min(720px, 76vw);
  border: 1px solid rgba(73, 96, 110, 0.12);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.08)),
    radial-gradient(circle at 40% 34%, rgba(47, 125, 104, 0.12), transparent 48%);
  transform: translate(-50%, -18%);
}

.access-page::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(255, 255, 255, 0.48) 42% 58%, transparent 58% 100%),
    radial-gradient(circle at 50% 58%, rgba(36, 79, 122, 0.08), transparent 36%);
  pointer-events: none;
}

.home-shell {
  position: relative;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 900px;
  overflow: hidden;
  border: 1px solid #d1dde5;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(48, 111, 143, 0.08) 0 28%, transparent 28% 100%),
    repeating-linear-gradient(90deg, rgba(42, 62, 76, 0.035) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(42, 62, 76, 0.03) 0 1px, transparent 1px 48px),
    linear-gradient(180deg, #f4f8f7 0%, #e9f1ef 100%);
  box-shadow: 0 28px 70px rgba(32, 50, 65, 0.14);
}

.home-shell::before {
  content: "";
  position: absolute;
  inset: 22px 40px auto 320px;
  height: 150px;
  border: 1px solid rgba(93, 116, 128, 0.12);
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.1));
}

.home-shell::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(214, 226, 224, 0.5));
}

.home-sidebar,
.home-content {
  position: relative;
  z-index: 1;
}

.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid #d9e3ea;
  background: rgba(250, 252, 252, 0.88);
  padding: 26px 24px;
  box-shadow: 18px 0 42px rgba(49, 69, 82, 0.06);
}

.home-brand h1 {
  font-size: 24px;
  line-height: 1.15;
}

.home-brand .hero-copy {
  max-width: 220px;
  font-size: 13px;
}

.home-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid #cfdae4;
  border-radius: 11px;
  background: #ffffff;
  padding: 0 12px;
  box-shadow: 0 10px 30px rgba(45, 67, 84, 0.08);
}

.home-search-icon {
  color: #7b8897;
  font-weight: 700;
}

.home-search .search-input {
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.home-categories {
  display: grid;
  gap: 14px;
}

.home-category-button {
  min-height: 76px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(243, 248, 247, 0.36);
  color: #354457;
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.home-category-button.active {
  border-color: #bfd1dd;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(38, 57, 72, 0.08);
}

.home-category-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.home-category-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.home-category-dot,
.link-icon {
  flex: 0 0 auto;
  background: #315d8b;
}

.home-category-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.home-category-dot.green,
.link-icon.green {
  background: #2f7d68;
}

.home-category-dot.blue,
.link-icon.blue {
  background: #315d8b;
}

.home-category-dot.brown,
.link-icon.brown {
  background: #9b6546;
}

.home-category-count {
  border-radius: 999px;
  background: #edf3f6;
  color: #607082;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 9px;
}

.home-category-desc {
  display: block;
  margin: 8px 0 0 20px;
  color: #758294;
  font-size: 12px;
  line-height: 1.45;
}

.home-sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  border-top: 1px solid #e1e8ee;
  padding-top: 16px;
}

.home-sidebar-footer small {
  color: #768596;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-line;
}

.home-sidebar-footer .admin-link {
  border-radius: 10px;
}

.home-sidebar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.compact-button {
  min-height: 34px;
  border-radius: 10px;
  padding: 0 11px;
}

.home-content {
  min-width: 0;
  padding: 50px 54px 64px 44px;
}

.home-content-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.home-content-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.16;
}

.home-content-copy {
  max-width: 560px;
  margin: 10px 0 0;
  color: #657588;
  font-size: 14px;
}

.home-stats {
  display: flex;
  gap: 10px;
}

.home-stat-card {
  min-width: 98px;
  border: 1px solid #d8e2e9;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px 14px;
}

.home-stat-card strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.home-stat-card span {
  color: #718092;
  font-size: 12px;
}

.home-panel {
  overflow: hidden;
  border: 1px solid #d8e3ea;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 36px rgba(35, 55, 69, 0.06);
}

.home-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.home-panel-title span {
  color: #758294;
  font-size: 12px;
}

.home-link-card {
  border: 1px solid #dfe7ed;
  border-radius: 12px;
  background: rgba(249, 251, 252, 0.92);
}

.home-link-card:hover {
  border-color: #bac7d7;
  background: #ffffff;
  transform: translateY(-1px);
}

.home-link-card .link-main span {
  overflow: hidden;
  color: #6d7a8a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-panel .home-panel-title {
  border-bottom: 1px solid #edf2f5;
  margin-bottom: 0;
  padding: 16px;
}

.home-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 16px 24px;
}

.home-link-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px;
}

.link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.link-icon.accent-blue {
  background: #315d8b;
}

.link-icon.accent-green {
  background: #2f7d68;
}

.link-icon.accent-brown {
  background: #9b6546;
}

.link-icon.accent-teal {
  background: #2d7f8a;
}

.link-icon.accent-indigo {
  background: #5c669e;
}

.link-icon.accent-rose {
  background: #a35261;
}

.link-icon.accent-slate {
  background: #556170;
}

.link-icon.accent-gold {
  background: #a87835;
}

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

.access-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  max-width: none;
  margin: 0;
  padding: 34px 34px 32px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(249, 251, 252, 0.84));
  border-color: rgba(198, 211, 222, 0.9);
  box-shadow: 0 24px 70px rgba(36, 55, 71, 0.16);
}

.access-card .eyebrow {
  margin-top: 12px;
}

.access-card h1 {
  margin-top: 4px;
  font-size: 32px;
  line-height: 1.16;
}

.access-copy {
  margin: 16px auto 22px;
  max-width: 340px;
  color: #526174;
  font-size: 15px;
}

.access-card .primary-button {
  min-width: 164px;
  min-height: 42px;
  border-color: #1f4c78;
  background: #1f4c78;
  box-shadow: 0 12px 24px rgba(31, 76, 120, 0.18);
  font-weight: 700;
}

.access-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(36, 79, 122, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #244f7a, #2f7d68);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(36, 79, 122, 0.2);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: #526071;
  font-size: 13px;
}

.admin-form .span-2 {
  grid-column: span 2;
}

.admin-form .check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 23px;
}

.admin-form .check input {
  width: 16px;
  height: 16px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.bulk-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e3e8ef;
}

.bulk-header {
  display: grid;
  grid-template-columns: 1fr 220px 160px;
  align-items: end;
  gap: 12px;
}

.bulk-form label {
  display: grid;
  gap: 6px;
  color: #526071;
  font-size: 13px;
}

.bulk-textarea {
  display: grid;
}

.bulk-feedback {
  min-height: 34px;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
}

.bulk-feedback.error {
  border: 1px solid #ecc4bd;
  background: #fff5f3;
  color: #9f2f24;
}

.bulk-feedback.success {
  border: 1px solid #b8dccf;
  background: #effaf5;
  color: #236653;
}

.list-header,
.admin-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-filters {
  flex-wrap: wrap;
}

.admin-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.admin-category-tabs button {
  min-height: 38px;
  border: 1px solid #d3dce8;
  border-radius: 7px;
  background: #f8fafc;
  color: #526071;
  cursor: pointer;
}

.admin-category-tabs button.active {
  border-color: #244f7a;
  background: #eef5fb;
  color: #244f7a;
  font-weight: 700;
}

.bulk-move-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 0 0;
}

.select-all,
.bulk-move-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #526071;
  font-size: 13px;
}

.bulk-move-actions select {
  height: 36px;
  min-width: 140px;
  border: 1px solid #ccd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #172033;
  padding: 0 10px;
}

.sort-hint {
  margin-top: 10px;
  color: #607082;
  font-size: 13px;
}

.sort-hint.disabled {
  color: #8a6570;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.admin-table th,
.admin-table td {
  border-top: 1px solid #e3e8ef;
  padding: 11px 8px;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: #647084;
  font-size: 12px;
  font-weight: 700;
}

.admin-table .drag-cell {
  width: 46px;
  min-width: 46px;
  text-align: center;
}

.admin-table .select-cell {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.admin-table .select-cell input,
.select-all input {
  width: 16px;
  height: 16px;
}

.admin-table .name-cell {
  display: grid;
  gap: 2px;
  min-width: 280px;
  max-width: 680px;
}

.admin-table .name-cell span {
  overflow-wrap: anywhere;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 32px;
  border: 1px solid #cbd7e4;
  border-radius: 7px;
  background: #f7fafc;
  color: #526071;
  cursor: grab;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  user-select: none;
}

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

.drag-handle.disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.admin-table tr.dragging-row {
  opacity: 0.48;
}

.admin-table tr.drag-over-before td {
  border-top-color: #244f7a;
  box-shadow: inset 0 2px 0 #244f7a;
}

.admin-table tr.drag-over-after td {
  box-shadow: inset 0 -2px 0 #244f7a;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  border-radius: 999px;
  background: #edf3f6;
  color: #607082;
  font-size: 12px;
  font-weight: 700;
  padding: 0 8px;
}

@media (max-width: 980px) {
  .page,
  .admin-page {
    width: min(100vw - 24px, 720px);
    padding-top: 18px;
  }

  .admin-header,
  .list-header {
    align-items: stretch;
    flex-direction: column;
  }

  .home-page {
    width: min(100vw - 24px, 720px);
  }

  .home-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    border-radius: 24px;
  }

  .home-shell::before {
    inset: 18px 22px auto 118px;
    height: 72px;
  }

  .home-shell::after {
    width: 44%;
  }

  .home-sidebar {
    gap: 16px;
    border-right: 0;
    border-bottom: 1px solid #d9e3ea;
    padding: 24px 22px 18px;
  }

  .home-brand .hero-copy {
    max-width: 100%;
  }

  .home-categories {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
  }

  .home-category-button {
    min-width: 132px;
    min-height: 40px;
    padding: 9px 10px;
  }

  .home-category-desc,
  .home-sidebar-footer {
    display: none;
  }

  .home-content {
    padding: 26px 22px 42px;
  }

  .home-content-header {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .home-content-title {
    font-size: 30px;
  }

  .home-stats {
    max-width: 220px;
  }

  .home-link-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-form .span-2 {
    grid-column: auto;
  }

  .bulk-header {
    grid-template-columns: 1fr;
  }

  .admin-category-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .admin-category-tabs button {
    min-width: 128px;
  }

  .bulk-move-bar,
  .bulk-move-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-move-actions select,
  .bulk-move-actions button {
    width: 100%;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
