:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-strong: #f0f4f8;
  --text: #172033;
  --muted: #617086;
  --line: #dce3ec;
  --primary: #2454d6;
  --primary-dark: #163d9c;
  --green: #117865;
  --amber: #a96300;
  --red: #b12a34;
  --shadow: 0 14px 40px rgba(23, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f7;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: 30px;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
}

h3 {
  margin-bottom: 0;
  font-size: 22px;
}

.login-subtitle {
  color: var(--muted);
  margin-bottom: 28px;
}

.login-form,
.project-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 84, 214, 0.12);
}

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

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 38px;
  padding: 9px 14px;
  font-weight: 700;
  transition: background 0.15s ease, border 0.15s ease, transform 0.15s ease;
}

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

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

.ghost-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.ghost-button:hover,
.icon-button:hover {
  background: var(--surface-strong);
}

.danger-button {
  background: #fff3f3;
  border-color: #f3c6c9;
  color: var(--red);
}

.danger-button:hover {
  background: #ffe5e7;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: #182236;
  color: white;
  padding: 22px;
  min-height: 100vh;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #34b3a0;
  color: #061311;
  font-weight: 900;
}

.brand p {
  margin-bottom: 3px;
  font-weight: 800;
}

.brand span {
  color: #aebbd0;
  font-size: 13px;
}

.quick-stats {
  display: grid;
  gap: 10px;
}

.stat-button {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  text-align: left;
  padding: 10px;
}

.stat-button strong {
  font-size: 24px;
}

.stat-button span {
  color: #c7d2e3;
}

.stat-button.active,
.stat-button:hover {
  border-color: rgba(52, 179, 160, 0.8);
  background: rgba(52, 179, 160, 0.14);
}

.sidebar .ghost-button {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

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

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, 180px));
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 18px;
  align-items: start;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.05);
}

.project-card:hover {
  border-color: #b6c6dd;
}

.project-main {
  min-width: 0;
}

.project-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.project-heading h3 {
  font-size: 18px;
  margin: 0;
}

.badge-row,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-strong);
  color: var(--muted);
}

.badge.waiting {
  background: #fff4de;
  color: var(--amber);
}

.badge.active {
  background: #e7f5f2;
  color: var(--green);
}

.badge.meeting {
  background: #e9efff;
  color: var(--primary);
}

.badge.high {
  background: #ffe7e9;
  color: var(--red);
}

.project-text {
  margin: 10px 0;
  color: var(--text);
  line-height: 1.55;
}

.meta-row {
  color: var(--muted);
  font-size: 13px;
}

.project-side {
  display: grid;
  gap: 12px;
}

.progress-box {
  display: grid;
  gap: 7px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #dfe6f0;
}

.progress-bar {
  height: 100%;
  background: var(--green);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.detail-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(760px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: auto;
  z-index: 10;
}

.project-form {
  padding: 24px;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.section-title {
  margin-bottom: 8px;
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.history-list li {
  padding: 9px 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.attachment-block {
  display: grid;
  gap: 10px;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.attachment-hint {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-progress {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #dfe6f0;
}

.upload-progress-bar {
  width: 0;
  height: 100%;
  background: var(--primary);
  transition: width 0.18s ease;
}

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

.attachment-empty,
.attachment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 10px;
}

.attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.attachment-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.attachment-info strong,
.attachment-info span {
  overflow-wrap: anywhere;
}

.attachment-info span,
.attachment-empty {
  color: var(--muted);
  font-size: 13px;
}

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

.attachment-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.detail-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.detail-actions div {
  display: flex;
  gap: 10px;
}

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

  .sidebar {
    min-height: auto;
  }

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

  .sidebar .ghost-button {
    margin-top: 0;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .detail-actions,
  .project-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .primary-button {
    flex: 1;
  }

  .quick-stats,
  .controls,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-actions,
  .upload-row,
  .attachment-item,
  .detail-actions div {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-row,
  .attachment-item {
    grid-template-columns: 1fr;
  }

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

  .detail-panel {
    width: 100vw;
  }
}
