:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --bg: #06152e;
  --surface: rgba(9, 29, 59, 0.9);
  --surface-2: rgba(11, 35, 70, 0.88);
  --border: rgba(92, 151, 219, 0.32);
  --text: #f2f7ff;
  --muted: #91a8c8;
  --blue: #4ca7ff;
  --cyan: #35e6d1;
  --violet: #9e72ff;
  --danger: #ff6f83;
  --control-height: 36px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(52, 135, 211, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 135, 211, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 8% 18%, #073a63 0, transparent 28%),
    radial-gradient(circle at 94% 42%, #302170 0, transparent 34%),
    #05142b;
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
}

button, input, select { font: inherit; }
button { cursor: pointer; text-align: center; }
.hidden { display: none !important; }
.ambient { position: fixed; pointer-events: none; border-radius: 999px; filter: blur(2px); opacity: .5; }
.ambient-one { width: 5px; height: 5px; background: var(--cyan); left: 7%; top: 26%; box-shadow: 1030px -68px 0 var(--cyan), 1380px 540px 0 var(--blue), 510px 620px 0 var(--cyan); }
.ambient-two { width: 3px; height: 3px; background: var(--violet); right: 8%; top: 20%; box-shadow: -1050px 420px 0 var(--blue), -520px 680px 0 var(--violet); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card {
  width: min(460px, 100%);
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(11, 37, 75, .97), rgba(6, 20, 45, .96));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 275px; }
.brand strong { display: block; font-size: 18px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: 1.2px; }
.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; font-size: 25px; font-weight: 800;
  background: linear-gradient(145deg, #2b9eff, #7654ff); box-shadow: 0 10px 28px rgba(66, 120, 255, .34);
}
.brand-login { margin-bottom: 44px; }
.login-heading h1, .page-heading h1 { margin: 10px 0 8px; font-size: 32px; }
.login-heading p, .page-heading p { color: var(--muted); margin: 0 0 26px; }
.eyebrow { color: #70bdff; font-size: 13px; letter-spacing: 1.4px; font-weight: 700; }
.eyebrow i, .health i { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: #2ce69a; box-shadow: 0 0 0 5px rgba(44, 230, 154, .12); }

.form-stack, .modal-card { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: #b7c8df; font-size: 13px; }
input, select {
  width: 100%; height: var(--control-height); border: 1px solid rgba(101, 157, 222, .36); border-radius: 12px;
  padding: 0 14px; color: var(--text); background: rgba(4, 17, 39, .72); outline: none;
}
input:focus, select:focus { border-color: #4b9dff; box-shadow: 0 0 0 3px rgba(75, 157, 255, .12); }
.select-native {
  position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important;
  padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important;
  white-space: nowrap !important; border: 0 !important; pointer-events: none;
}
.select-control { position: relative; width: 100%; min-width: 0; }
.select-trigger {
  width: 100%; height: var(--control-height); display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 13px; border: 1px solid rgba(101, 157, 222, .42); border-radius: 12px;
  color: var(--text); background: linear-gradient(180deg, rgba(9, 31, 65, .98), rgba(4, 18, 41, .98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04); outline: none;
}
.select-trigger:hover, .select-control.open .select-trigger {
  border-color: rgba(75, 174, 255, .82); box-shadow: 0 0 0 3px rgba(75, 157, 255, .11);
}
.select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.select-chevron {
  flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center;
  color: #70bdff; line-height: 0; transition: transform .18s ease;
}
.select-chevron::before { content: ""; width: 13px; height: 8px; background: currentColor; clip-path: polygon(0 0, 50% 100%, 100% 0); }
.select-control.open .select-chevron { transform: rotate(180deg); }
.select-menu {
  position: absolute; top: calc(100% + 7px); left: 0; right: 0; z-index: 40; display: grid; gap: 4px;
  max-height: 270px; overflow-y: auto; padding: 6px; border: 1px solid rgba(83, 165, 244, .46);
  border-radius: 13px; background: rgba(5, 21, 47, .985); box-shadow: 0 18px 45px rgba(0, 0, 0, .48);
}
.select-option {
  width: 100%; height: var(--control-height); display: flex; align-items: center; justify-content: flex-start;
  padding: 0 12px; border: 1px solid transparent; border-radius: 9px; color: #c5d6ec; background: transparent;
}
.select-option:hover, .select-option:focus, .select-option[aria-selected="true"] {
  border-color: rgba(75, 162, 246, .4); color: #fff; background: linear-gradient(90deg, rgba(31, 112, 197, .48), rgba(74, 71, 190, .32)); outline: none;
}
.form-error { min-height: 18px; margin: -3px 0 0; color: #ff9aaa; font-size: 13px; }

.button {
  height: var(--control-height); min-height: var(--control-height); display: inline-flex; align-items: center;
  justify-content: center; line-height: 1; white-space: nowrap; border: 1px solid transparent;
  border-radius: 11px; padding: 0 17px; color: var(--text); background: rgba(42, 76, 120, .45);
}
.button.primary { background: linear-gradient(135deg, #287dff, #5768ff); box-shadow: 0 8px 24px rgba(44, 103, 255, .2); }
.button.ghost { border-color: rgba(102, 154, 214, .24); background: rgba(10, 31, 62, .56); }
.button.ghost:hover, .button.ghost.active { border-color: rgba(73, 167, 255, .7); background: rgba(32, 93, 157, .4); }
.button.danger { color: #ff9ead; }
.button.full { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .56; }

.app-shell { width: min(1500px, calc(100% - 38px)); margin: 0 auto; padding-bottom: 48px; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.clock { color: #8ba4c7; font: 12px ui-monospace, monospace; }
.health { height: var(--control-height); display: inline-flex; align-items: center; justify-content: center; color: #48e2a0; padding: 0 13px; border: 1px solid rgba(47, 216, 153, .38); border-radius: 999px; background: rgba(26, 109, 84, .18); font-size: 13px; }
.health i { width: 7px; height: 7px; margin-right: 6px; }
.page { display: grid; gap: 22px; }
.panel-glow { border: 1px solid var(--border); background: linear-gradient(120deg, rgba(12, 36, 73, .96), rgba(8, 24, 53, .94)); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 22px 55px rgba(0,0,0,.18); }
.hero { min-height: 275px; border-radius: 27px; padding: 44px 38px; display: grid; grid-template-columns: 1.6fr .9fr; gap: 44px; align-items: center; overflow: hidden; position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; z-index: 0; inset: -85% -25%; opacity: .38; pointer-events: none;
  background:
    linear-gradient(112deg, transparent 35%, rgba(53, 230, 209, .16) 49%, transparent 61%),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(76, 167, 255, .075) 79px 80px),
    repeating-linear-gradient(0deg, transparent 0 48px, rgba(76, 167, 255, .045) 49px 50px);
  transform: translate3d(-7%, 0, 0); animation: hero-tech-flow 13s linear infinite;
}
.hero::after { content: ""; position: absolute; z-index: 0; width: 330px; height: 330px; right: 6%; border: 1px solid rgba(70, 143, 222, .18); border-radius: 50%; box-shadow: 0 0 0 45px rgba(47, 90, 164, .06), 0 0 0 90px rgba(47, 90, 164, .035); animation: hero-radar-pulse 5.5s ease-in-out infinite; }
.hero-copy, .metrics { position: relative; z-index: 1; }
.hero h1 { margin: 17px 0 12px; font-size: clamp(40px, 5vw, 62px); letter-spacing: -2px; }
.hero p { max-width: 750px; margin: 0; color: #9eb2ce; line-height: 1.9; font-size: 16px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.metrics article { min-height: 88px; padding: 17px; border: 1px solid rgba(90, 145, 210, .32); border-radius: 15px; background: linear-gradient(120deg, rgba(4, 18, 43, .72), rgba(12, 44, 83, .44)); box-shadow: inset 0 1px 0 rgba(255,255,255,.03); }
.metrics strong { display: block; color: #8dccff; font-size: 27px; }
.metrics span { display: block; margin-top: 7px; color: #8ca4c4; font-size: 12px; }

.directory-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 0 4px; }
.directory-heading h2 { margin: 0 0 7px; font-size: 25px; }
.directory-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.filters { display: grid; grid-template-columns: 170px minmax(260px, 420px) auto auto; gap: 9px; align-items: center; }
.filters > .select-control { min-width: 170px; }
.column-head, .project-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(92px, .34fr) repeat(3, minmax(0, 1.12fr)); gap: 12px; }
.column-head { padding: 0 20px; color: #7893b7; font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.project-list { display: grid; gap: 11px; }
.project-row { align-items: center; min-height: 98px; padding: 11px 17px; border: 1px solid rgba(82, 139, 205, .32); border-top: 4px solid transparent; border-radius: 21px; background: linear-gradient(100deg, rgba(9, 32, 67, .97), rgba(5, 20, 45, .94)); background-clip: padding-box; position: relative; }
.project-row::before { content: ""; position: absolute; top: -4px; left: 14px; right: 14px; height: 4px; border-radius: 999px; background: linear-gradient(90deg, #36c8e9, #926aff, #21bfee); }
.project-row > * { min-width: 0; }
.project-identity { display: grid; gap: 5px; min-width: 0; }
.project-name-line { display: grid; align-items: start; min-width: 0; }
.project-name-line strong { min-width: 0; font-size: 17px; line-height: 1.42; overflow-wrap: anywhere; }
.project-tags { display: grid; align-content: center; justify-items: start; gap: 6px; min-width: 0; }
.code-badge, .region-badge { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 5px 9px; border: 1px solid rgba(81, 153, 232, .35); border-radius: 999px; color: #8ec8ff; background: rgba(29, 83, 139, .3); font-size: 10px; }
.project-meta { color: #7f98ba; font-size: 12px; }
.entry-link, .entry-placeholder { min-height: 70px; display: grid; align-content: center; gap: 6px; padding: 12px; border: 1px solid rgba(81, 140, 210, .34); border-radius: 14px; background: rgba(6, 23, 50, .6); text-decoration: none; }
.entry-link:hover { border-color: rgba(73, 172, 255, .8); transform: translateY(-1px); }
.entry-link strong { color: #61b5ff; font-size: 14px; }
.entry-link[data-type="app"] strong { color: #40e0cc; }
.entry-link[data-type="daping"] strong, .entry-link[data-type="standalone"] strong { color: #ac82ff; }
.entry-link small { color: #8197b5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-placeholder { border-style: dashed; color: #536b8c; text-align: center; }
.empty-state { display: grid; place-items: center; gap: 8px; min-height: 190px; border: 1px dashed var(--border); border-radius: 20px; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 18px; }

.page-heading.compact { min-height: 165px; border-radius: 24px; padding: 30px 34px; display: flex; align-items: center; justify-content: space-between; }
.page-heading p { margin: 0; }
.admin-overview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(500px, .8fr); gap: 14px; align-items: center; padding: 11px; border: 1px solid var(--border); border-radius: 18px; background: rgba(8, 27, 57, .68); }
.panel-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 11px; }
.panel-chip { min-height: 56px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.panel-chip strong, .panel-chip span { display: inline-flex; align-items: center; }
.panel-chip span { margin-top: 0; color: var(--muted); font-size: 12px; }
.panel-chip.success strong { color: #5fe0a5; }
.panel-chip.failed strong { color: #ff8c9f; }
.admin-toolbar { display: grid; grid-template-columns: 170px minmax(220px, 1fr) auto; align-items: center; gap: 10px; }
.admin-toolbar > .select-control { min-width: 170px; }
.admin-toolbar input { max-width: none; }
.admin-toolbar span { color: var(--muted); white-space: nowrap; }
.admin-list { display: grid; gap: 12px; }
.admin-card { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); overflow: hidden; }
.admin-card-head { display: grid; grid-template-columns: minmax(180px, 1.4fr) 150px 140px 120px 90px auto; gap: 10px; align-items: end; padding: 18px; }
.admin-card-head label span { font-size: 11px; color: #7791b3; }
.switch-wrap { align-self: end; min-height: var(--control-height); display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px; border: 1px solid rgba(91, 148, 211, .22); border-radius: 11px; background: rgba(4, 17, 39, .36); }
.switch-wrap input { appearance: none; width: 20px; height: 20px; display: grid; place-items: center; margin: 0; padding: 0; border: 1px solid rgba(106, 177, 247, .72); border-radius: 5px; background: rgba(2, 14, 33, .88); }
.switch-wrap input::before { content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) scale(0); transition: transform .14s ease; }
.switch-wrap input:checked { border-color: #4b9dff; background: linear-gradient(135deg, #2588ff, #5c62ff); }
.switch-wrap input:checked::before { transform: rotate(-45deg) scale(1); }
.entry-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.entry-table th, .entry-table td { border-top: 1px solid rgba(90, 143, 205, .19); padding: 10px 18px; text-align: left; color: #9db1cd; }
.entry-table th { color: #718bad; background: rgba(1, 11, 28, .25); }
.entry-table code { color: #8bc7ff; }
.entry-table th:nth-child(4), .entry-table td:nth-child(4) { width: 42%; }
.entry-url-editor { display: grid; grid-template-columns: auto minmax(250px, 1fr) auto; gap: 8px; align-items: center; }
.entry-url-input { min-width: 0; color: #a9d6ff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.restore-entry-url { padding-inline: 13px; }
.url-mode { min-width: 58px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; border: 1px solid rgba(73, 162, 246, .28); border-radius: 999px; color: #82bdf5; font-size: 10px; white-space: nowrap; }
.url-mode.manual { border-color: rgba(165, 115, 255, .38); color: #c19dff; background: rgba(101, 61, 175, .18); }
.entry-status-cell { vertical-align: middle; }
.entry-status { min-width: 58px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 999px; font-weight: 700; }
.entry-status.valid { color: #54e3a4; border-color: rgba(58, 216, 153, .38); background: rgba(24, 125, 88, .2); }
.entry-status.offline { color: #ff8ea1; border-color: rgba(255, 103, 127, .38); background: rgba(148, 36, 57, .2); }
.entry-status.pending { color: #ffc56e; border-color: rgba(255, 184, 76, .38); background: rgba(151, 96, 21, .2); }
.admin-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 2px 4px 0; }
.pagination-pages { display: flex; align-items: center; gap: 7px; }
.pagination-button { min-width: var(--control-height); padding-inline: 12px; }
.pagination-button[aria-current="page"] { border-color: rgba(73, 167, 255, .8); color: #fff; background: linear-gradient(135deg, rgba(40, 125, 255, .75), rgba(87, 104, 255, .72)); }
.pagination-info { color: var(--muted); font-size: 12px; white-space: nowrap; }
.warning { color: #ffc46b; font-size: 12px; }

.modal { border: 0; padding: 0; background: transparent; color: var(--text); }
.modal::backdrop { background: rgba(0, 6, 18, .78); backdrop-filter: blur(6px); }
.modal-card { width: min(470px, calc(100vw - 30px)); padding: 28px; border: 1px solid var(--border); border-radius: 22px; background: #0a2348; box-shadow: 0 30px 80px #0008; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; }
.modal-heading h2 { margin: 8px 0 4px; }
.icon-button { width: var(--control-height); height: var(--control-height); display: grid; place-items: center; line-height: 1; border: 0; background: transparent; color: #9cb3d1; font-size: 30px; }
.profile-identity { color: var(--muted); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 380px; padding: 14px 18px; border: 1px solid rgba(76, 174, 255, .5); border-radius: 12px; background: #0b2a56; box-shadow: 0 16px 44px #0008; }
.toast.error { border-color: rgba(255, 94, 118, .7); background: #4a1625; }

@keyframes hero-tech-flow {
  from { transform: translate3d(-10%, -4%, 0); }
  to { transform: translate3d(14%, 8%, 0); }
}
@keyframes hero-radar-pulse {
  0%, 100% { opacity: .58; transform: scale(.96); }
  50% { opacity: 1; transform: scale(1.035); }
}

@media (max-width: 1100px) {
  .topbar { align-items: flex-start; padding: 18px 0; }
  .hero { grid-template-columns: 1fr; }
  .hero::after { opacity: .35; }
  .directory-heading { align-items: stretch; flex-direction: column; }
  .filters { grid-template-columns: 160px 1fr auto auto; }
  .column-head { display: none; }
  .project-row { grid-template-columns: 1fr 1fr; }
  .project-identity, .project-tags { grid-column: 1 / -1; }
  .admin-overview { grid-template-columns: 1fr; }
  .admin-card-head { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 1500px); }
  .topbar { display: grid; }
  .topbar-actions { justify-content: flex-start; }
  .clock, .health { order: -1; }
  .hero { padding: 28px 22px; border-radius: 20px; }
  .hero h1 { font-size: 39px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
  .project-row { grid-template-columns: 1fr; padding: 16px; }
  .project-identity, .project-tags { grid-column: auto; }
  .admin-card-head { grid-template-columns: 1fr; }
  .admin-toolbar { grid-template-columns: 1fr; }
  .admin-toolbar > .select-control { min-width: 0; }
  .admin-pagination { justify-content: center; flex-wrap: wrap; }
  .entry-url-editor { grid-template-columns: auto minmax(250px, 1fr) auto; }
  .entry-table { display: block; overflow-x: auto; }
  .entry-table tbody, .entry-table thead { min-width: 1080px; }
  .page-heading.compact { align-items: stretch; flex-direction: column; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero::before, .hero::after { animation: none; }
}
