:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #172033;
  --muted: #637083;
  --line: #dce3ec;
  --primary: #176b87;
  --primary-2: #0f4f68;
  --accent: #d98b3a;
  --green: #2c7a5b;
  --red: #b74343;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(220, 227, 236, 0.8);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 50px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark img {
  width: 37px;
  height: 49px;
  display: block;
  object-fit: contain;
}

.brand-name {
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button,
.primary-button,
.icon-button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  font-weight: 650;
  text-decoration: none;
}

.ghost-button:hover {
  border-color: #aebaca;
  background: #fafbfd;
}

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

.primary-button:hover {
  background: var(--primary-2);
}

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

.icon-button {
  width: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 25px;
  line-height: 1;
}

.main {
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.hero {
  min-height: 224px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 34px;
  border-radius: 8px;
  color: #fff;
  background:
    radial-gradient(circle at 78% 22%, rgba(217, 139, 58, 0.28), transparent 24%),
    linear-gradient(120deg, #0e2f40 0%, #176b87 68%, #155c74 100%);
  box-shadow: var(--shadow);
}

.hero > div {
  max-width: 720px;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.eyebrow {
  color: rgba(255, 255, 255, 0.68);
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.08;
}

.hero-copy {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  line-height: 1.75;
}

.hero-action {
  min-width: 152px;
  height: 46px;
  border-color: #fff;
  background: #fff;
  color: var(--primary-2);
}

.hero-action:hover {
  border-color: #f2f4f7;
  background: #f2f4f7;
}

.hero-action span {
  font-size: 21px;
  font-weight: 400;
}

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

.stat-card {
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.05);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

.requests-section {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-label {
  color: var(--primary);
}

.section-heading h2,
.dialog-head h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.25;
}

.view-tools {
  display: flex;
  gap: 8px;
}

.search-field input {
  width: min(330px, 42vw);
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--text);
}

.search-field input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.12);
}

.compact {
  height: 40px;
}

.status-filters {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filter-button {
  min-width: max-content;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.filter-button:hover,
.filter-button.active {
  border-color: rgba(23, 107, 135, 0.45);
  background: #e7f2f5;
  color: var(--primary-2);
}

.request-list {
  display: grid;
  gap: 12px;
}

.request-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.045);
}

.request-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
}

.request-meta,
.request-tags,
.request-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.request-meta {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}

.request-id {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.request-card h3 {
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1.4;
}

.request-owner {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.request-tags {
  justify-content: flex-end;
  align-content: flex-start;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #46566b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.status {
  background: #e7f2f5;
  color: var(--primary-2);
}

.tag.status[data-tone="active"] {
  background: #e8f3ed;
  color: #226747;
}

.tag.status[data-tone="done"] {
  background: #edf1f5;
  color: #536275;
}

.tag.status[data-tone="paused"] {
  background: #f2edf7;
  color: #76588f;
}

.tag.priority[data-priority="紧急"] {
  background: #f9eaea;
  color: #a33d3d;
}

.tag.priority[data-priority="较高"] {
  background: #fbf1e5;
  color: #9a6426;
}

.request-problem {
  margin: 16px 0 0;
  padding-top: 15px;
  border-top: 1px solid #edf0f4;
  color: #425066;
  line-height: 1.75;
  white-space: pre-wrap;
}

.deliverable {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.deliverable strong {
  color: var(--text);
}

.request-footer {
  justify-content: space-between;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

.loading-state,
.empty-state,
.error-state {
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 34px;
  border: 1px dashed #bdc8d6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.error-state {
  color: var(--red);
}

.request-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(880px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(16, 29, 43, 0.25);
}

.request-dialog::backdrop {
  background: rgba(18, 28, 40, 0.55);
  backdrop-filter: blur(3px);
}

.request-form {
  max-height: min(880px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.form-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.field {
  display: grid;
  align-content: start;
  gap: 7px;
}

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

.field label {
  font-size: 13px;
  font-weight: 750;
}

.field label span {
  color: var(--red);
}

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

.field input,
.field select {
  height: 42px;
  padding: 0 11px;
}

.field textarea {
  min-height: 92px;
  padding: 10px 11px;
  line-height: 1.55;
  resize: vertical;
}

.field small {
  color: var(--muted);
  line-height: 1.5;
}

.form-message {
  min-height: 0;
  padding: 0 24px;
  color: var(--red);
  font-size: 13px;
}

.form-message:not(:empty) {
  min-height: 34px;
  padding-top: 8px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
}

.dialog-actions > div {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.draft-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(390px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  background: #173b49;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .view-tools,
  .search-field,
  .search-field input {
    width: 100%;
  }

  .request-card-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .request-tags {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .topbar {
    height: auto;
    padding: 12px 14px;
  }

  .brand-name {
    white-space: normal;
  }

  .topbar > .ghost-button {
    display: none;
  }

  .main {
    width: min(100vw - 28px, 1180px);
    padding-top: 18px;
  }

  .hero {
    min-height: 280px;
    padding: 24px;
  }

  .hero-action {
    width: 100%;
  }

  .stats {
    gap: 10px;
  }

  .stat-card {
    min-height: 96px;
    padding: 15px;
  }

  .stat-card strong {
    font-size: 29px;
  }

  .request-card {
    padding: 16px;
  }

  .request-dialog {
    width: 100vw;
    max-width: none;
    max-height: 100vh;
    margin: auto 0 0;
    border-radius: 12px 12px 0 0;
  }

  .request-form {
    max-height: 100vh;
  }

  .dialog-head,
  .form-body,
  .dialog-actions {
    padding-left: 18px;
    padding-right: 18px;
  }

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

  .field.full-width {
    grid-column: auto;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions > div,
  .dialog-actions button {
    width: 100%;
  }
}

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