:root {
  color-scheme: light;
  --bg: #f6f5ef;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #64707d;
  --line: #d9ded6;
  --green: #256f5a;
  --green-dark: #174b3d;
  --coral: #d86545;
  --ink: #172026;
  --shadow: 0 18px 50px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    sans-serif;
  background:
    linear-gradient(135deg, rgba(216, 101, 69, 0.09), transparent 30%),
    linear-gradient(220deg, rgba(37, 111, 90, 0.13), transparent 36%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  pointer-events: none;
}

body::before {
  background-image:
    linear-gradient(rgba(37, 111, 90, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 111, 90, 0.08) 1px, transparent 1px);
  background-position: 0 0;
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.86), transparent 88%);
  animation: grid-drift 18s linear infinite;
}

body::after {
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 8%, rgba(255, 255, 255, 0.58) 18%, transparent 28%),
    linear-gradient(115deg, transparent 55%, rgba(216, 101, 69, 0.12) 64%, transparent 72%),
    linear-gradient(115deg, transparent 70%, rgba(37, 111, 90, 0.12) 78%, transparent 86%);
  background-size: 220% 220%;
  animation: light-sweep 14s ease-in-out infinite alternate;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 24px 0 36px;
}

.site-header,
.site-footer,
.project-section,
.config-view {
  border: 1px solid rgba(31, 41, 51, 0.09);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.site-header {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(23, 32, 38, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 245, 239, 0.74);
}

.top-nav a {
  min-width: 72px;
  padding: 9px 14px;
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}

.top-nav a.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(23, 32, 38, 0.08);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.project-section,
.config-view {
  margin-top: 22px;
  padding: 28px;
  border-radius: 8px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
}

.ghost-link,
.empty-state a,
.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.ghost-link,
.empty-state a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.project-card {
  display: flex;
  min-height: 178px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.06);
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.project-card:hover,
.project-card:focus-visible {
  border-color: rgba(37, 111, 90, 0.45);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  outline: none;
}

.project-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 1.18rem;
}

.project-card p {
  color: var(--muted);
  line-height: 1.65;
}

.project-card span {
  color: var(--green);
  font-weight: 800;
}

.empty-state {
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  text-align: center;
}

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

.config-view[hidden],
.empty-state[hidden],
.project-section[hidden] {
  display: none;
}

.config-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 245, 239, 0.62);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(37, 111, 90, 0.14);
}

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

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 0 18px;
  font-weight: 800;
}

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

.primary-button {
  grid-column: 1 / -1;
  background: var(--green);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
}

.config-list-wrap {
  margin-top: 24px;
}

.config-list-wrap h3 {
  font-size: 1.1rem;
}

.config-list {
  display: grid;
  gap: 10px;
}

.config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.config-row strong,
.config-row small {
  display: block;
}

.config-row small {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.icon-button.danger {
  color: #a03925;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border-width: 1px 0 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--green-dark);
  text-decoration: underline;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1120px);
  }

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

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    flex: 1;
  }

  .project-section,
  .config-view {
    padding: 20px;
  }

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

  .row-actions {
    justify-content: flex-end;
  }
}

@keyframes grid-drift {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 44px 44px;
  }
}

@keyframes light-sweep {
  from {
    background-position: 0% 30%;
  }

  to {
    background-position: 100% 70%;
  }
}

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