@import url("https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #111315;
  --ink-soft: #343a40;
  --muted: #6c747d;
  --line: #d9dee5;
  --line-strong: #c5ccd6;
  --primary: #111315;
  --accent: #b7791f;
  --accent-soft: #fff3d7;
  --teal: #0f766e;
  --danger: #b42318;
  --success: #147a4d;
  --focus: rgba(183, 121, 31, .24);
  --shadow: 0 16px 38px rgba(21, 25, 32, .10);
  --shadow-soft: 0 8px 22px rgba(21, 25, 32, .07);
  --radius: 8px;
  --max: 1320px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(17, 19, 21, .045) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcfd 0%, var(--bg) 100%);
  background-size: 32px 32px, auto;
  color: var(--ink);
  font-family: "Fira Sans", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  overflow-x: hidden;
}

a {
  color: inherit;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
}

.brand-mark,
.topbar-action {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-mark {
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
  box-shadow: 8px 0 0 var(--accent);
}

.topbar-action {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.topbar-action:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.launchpad,
.admin-shell {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

.command-panel,
.admin-hero,
.form-panel,
.list-panel,
.system-card,
.empty-state {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
}

.command-panel,
.admin-hero {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.command-panel {
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
}

.portal-page .command-panel {
  grid-template-columns: 1fr;
  width: min(520px, 100%);
}

.google-panel {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 18px 0 14px;
}

.google-logo {
  display: flex;
  align-items: center;
  font-family: Arial, sans-serif;
  font-size: clamp(64px, 7vw, 92px);
  font-weight: 500;
  line-height: .95;
  letter-spacing: 0;
}

.google-blue {
  color: #4285f4;
}

.google-red {
  color: #ea4335;
}

.google-yellow {
  color: #fbbc05;
}

.google-green {
  color: #34a853;
}

.google-search {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 38px 38px auto;
  align-items: center;
  gap: 10px;
  width: min(820px, 100%);
  min-height: 64px;
  padding: 0 12px 0 16px;
  border: 1px solid #e4e7eb;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 5px 16px rgba(32, 33, 36, .15);
}

.google-input-label {
  min-width: 0;
}

.google-input-label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.google-search input {
  min-height: 50px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #202124;
  font-size: 19px;
  box-shadow: none;
}

.google-search input:focus {
  box-shadow: none;
}

.google-search input::placeholder {
  color: #9aa0a6;
}

.google-icon-button,
.google-ai-button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #202124;
  cursor: pointer;
  font-weight: 700;
}

.google-icon-button {
  width: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.google-icon-button:hover,
.google-ai-button:hover {
  background: #f1f3f4;
}

.google-ai-button {
  padding: 0 14px;
  background: #f1f3f4;
  font-size: 15px;
}

.admin-hero {
  grid-template-columns: minmax(0, 1fr) auto;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.command-title h1,
.admin-hero h1 {
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0;
}

.command-title p,
.admin-hero p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 230px);
  gap: 10px;
  align-items: end;
}

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

.field span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

input,
select {
  min-height: 44px;
  padding: 0 13px;
  font-size: 16px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 12px 13px;
  font-size: 16px;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: #9aa2ad;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--focus);
}

.category-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease, color .18s ease;
}

.category-pill strong {
  min-width: 20px;
  color: var(--accent);
  font-size: 12px;
  text-align: right;
}

.category-pill:hover,
.category-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.category-pill:hover strong,
.category-pill.active strong {
  color: #f8d68b;
}

.status-line {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.system-groups {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.category-section {
  display: grid;
  gap: 8px;
}

.category-heading {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.category-heading h2 {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.category-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.system-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .86) inset;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.system-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
}

.system-card:hover {
  border-color: rgba(17, 19, 21, .45);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.system-card-link {
  display: grid;
  min-height: 78px;
  padding: 9px 9px 8px 13px;
  gap: 5px;
  text-decoration: none;
}

.system-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.system-title {
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(16px, 1.15vw, 20px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-desc,
.system-url {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-url {
  color: #315f78;
}

.system-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  align-self: end;
}

.system-category,
.system-action {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.system-category {
  border: 1px solid #ebd39f;
  background: var(--accent-soft);
  color: #71470d;
}

.system-action {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.empty-state {
  padding: 44px 16px;
  border-style: dashed;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 22px;
}

.admin-metric {
  display: grid;
  gap: 4px;
  min-width: 116px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
}

.admin-metric span {
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  font-weight: 800;
}

.admin-metric strong {
  font-size: 31px;
  line-height: 1;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.form-panel,
.list-panel {
  min-width: 0;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.form-panel {
  position: sticky;
  top: 68px;
}

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

.content-head h2 {
  font-size: 22px;
  line-height: 1.15;
}

.content-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.system-form {
  display: grid;
  gap: 12px;
}

.order-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.category-order-list {
  display: grid;
  gap: 8px;
}

.category-order-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: grab;
  user-select: none;
}

.category-order-item:active {
  cursor: grabbing;
}

.category-order-item.dragging {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
  opacity: .72;
}

.category-order-item strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-order-item > span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.drag-handle {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background:
    radial-gradient(circle, #8d96a1 1.3px, transparent 1.4px) 0 0 / 6px 6px;
}

.order-empty {
  color: var(--muted);
  font-size: 14px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

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

.primary-button:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: .7;
}

.secondary-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.secondary-button:hover {
  border-color: var(--primary);
}

.message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.message[data-type="success"] {
  color: var(--success);
}

.message[data-type="error"] {
  color: var(--danger);
}

.admin-list {
  display: grid;
  gap: 16px;
}

.list-hint {
  margin: -8px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.admin-category-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.admin-category-heading h3 {
  font-size: 18px;
  line-height: 1.1;
}

.admin-category-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.admin-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: grab;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.admin-item:active {
  cursor: grabbing;
}

.admin-item.dragging {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
  opacity: .72;
}

.admin-item:hover {
  border-color: rgba(17, 19, 21, .45);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.admin-item-main {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.admin-item h3 {
  margin-bottom: 5px;
  font-size: 22px;
  line-height: 1.1;
}

.admin-item p,
.admin-item a {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-item a {
  margin-top: 2px;
  color: var(--teal);
  text-decoration: none;
}

.admin-item-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.admin-item-side span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #ebd39f;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: #71470d;
  font-size: 12px;
  font-weight: 800;
}

.item-actions {
  display: flex;
  gap: 8px;
}

.item-actions button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 800;
}

.item-actions button:hover {
  border-color: var(--primary);
}

.item-actions button[data-action="delete"] {
  color: var(--danger);
}

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

@media (max-width: 860px) {
  .launchpad,
  .admin-shell {
    width: min(100% - 24px, var(--max));
    padding-top: 14px;
  }

  .command-panel,
  .admin-hero,
  .filters,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .command-panel,
  .admin-hero {
    gap: 12px;
    padding: 14px;
  }

  .category-rail {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .category-pill {
    flex: 0 0 auto;
  }

  .admin-metric {
    min-width: 0;
    width: 100%;
  }

  .form-panel {
    position: static;
  }

  .button-row {
    flex-direction: column;
  }

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

  .admin-item-main {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .admin-item-side {
    justify-items: start;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 50px;
    padding-inline: 12px;
  }

  .brand-mark {
    font-size: 16px;
  }

  .topbar-action {
    min-height: 34px;
    padding-inline: 10px;
  }

  .command-title h1,
  .admin-hero h1 {
    font-size: 32px;
  }

  .google-panel {
    gap: 12px;
    padding-top: 12px;
  }

  .google-logo {
    font-size: 58px;
  }

  .google-search {
    grid-template-columns: 34px minmax(0, 1fr) 32px 32px;
    min-height: 54px;
    padding-inline: 12px;
  }

  .google-ai-button {
    display: none;
  }

  .command-title p,
  .admin-hero p {
    font-size: 13px;
  }

  .system-grid {
    grid-template-columns: 1fr;
  }

  .system-groups {
    gap: 16px;
    margin-top: 12px;
  }

  .category-heading h2 {
    font-size: 19px;
  }

  .system-card-link {
    min-height: 88px;
    padding: 10px 10px 9px 14px;
  }

  .system-title {
    font-size: 21px;
  }

  .system-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}
