:root {
  color-scheme: light;
  --bg: #f4f5f0;
  --ink: #1b2421;
  --muted: #65716c;
  --line: #d8ddd4;
  --panel: #ffffff;
  --panel-2: #eef2ec;
  --accent: #0b6b57;
  --accent-2: #d55527;
  --good: #127a4a;
  --warn: #b56a13;
  --bad: #b3261e;
  --shadow: 0 16px 50px rgba(27, 36, 33, 0.1);
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --body: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(11, 107, 87, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(11, 107, 87, 0.06) 1px, transparent 1px),
    var(--bg);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: var(--body);
}

button,
input {
  font: inherit;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid var(--ink);
  background: #f6c95f;
  box-shadow: 5px 5px 0 var(--ink);
  font-family: var(--mono);
  font-weight: 800;
}

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

.brand small,
.eyebrow,
.rail-foot,
.status-strip small,
.project-path,
.project-desc,
.project-url,
.meta {
  color: var(--muted);
}

.rail-nav {
  display: grid;
  gap: 8px;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  color: var(--ink);
  text-decoration: none;
}

.rail-link:hover,
.rail-link.active {
  border-color: var(--ink);
  background: var(--panel-2);
}

.rail-foot {
  margin-top: auto;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 42vw);
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button,
.text-button,
.project-actions button,
.password-row button {
  min-height: 40px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.icon-button {
  width: 44px;
  font-size: 20px;
}

.text-button,
.project-actions button,
.password-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
}

.icon-button:hover,
.text-button:hover,
.project-actions button:hover,
.password-row button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.hidden {
  display: none !important;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: end;
  padding: 28px;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-copy p:last-child {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 10px;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.login-form > input,
.password-row input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  outline: 0;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--bad);
  font-size: 14px;
}

.app-panel {
  display: grid;
  gap: 22px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.status-strip div {
  min-height: 78px;
  display: grid;
  align-content: center;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.status-strip div:last-child {
  border-right: 0;
}

.status-strip span {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 800;
}

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

.project-card {
  position: relative;
  display: grid;
  gap: 16px;
  min-height: 268px;
  padding: 18px;
  border: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: 0 0 0 rgba(27, 36, 33, 0);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.project-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink);
}

.project-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.project-title {
  margin: 0 0 8px;
  font-size: 24px;
}

.project-path,
.project-url {
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.project-desc {
  margin: 0;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 12px;
  white-space: nowrap;
}

.badge.online {
  border-color: rgba(18, 122, 74, 0.32);
  background: rgba(18, 122, 74, 0.1);
  color: var(--good);
}

.badge.offline {
  border-color: rgba(181, 106, 19, 0.28);
  background: rgba(181, 106, 19, 0.1);
  color: var(--warn);
}

.badge.missing {
  border-color: rgba(179, 38, 30, 0.28);
  background: rgba(179, 38, 30, 0.1);
  color: var(--bad);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 4px 7px;
  background: #f6c95f;
  font-family: var(--mono);
  font-size: 11px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

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

.project-actions button.danger {
  border-color: var(--bad);
  color: var(--bad);
}

.project-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

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

.log-output {
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--ink);
  background: #131815;
  color: #d7e7dc;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.site-records {
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.site-records a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.site-records a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.site-records img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.record-divider {
  color: var(--line);
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .rail-nav {
    grid-auto-flow: column;
    margin-left: auto;
  }

  .rail-foot {
    width: 100%;
    margin-top: 0;
  }

  .workspace {
    padding: 20px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .search {
    width: 100%;
  }

  .login-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 14px;
  }

  .rail {
    padding: 16px 14px;
  }

  .rail-nav {
    width: 100%;
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rail-link {
    justify-content: center;
  }

  .status-strip,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .status-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-strip div:last-child {
    border-bottom: 0;
  }

  .password-row {
    grid-template-columns: 1fr;
  }
}

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