:root {
  --bg: #131313;
  --surface: #1c1c1c;
  --surface-alt: #232323;
  --surface-soft: #191919;
  --border: #303030;
  --border-strong: #414141;
  --text: #f1eee8;
  --text-2: #bdb6aa;
  --text-3: #8c857a;
  --accent: #c6a36f;
  --accent-soft: rgba(198, 163, 111, 0.12);
  --green: #78a97a;
  --green-soft: rgba(120, 169, 122, 0.14);
  --red: #cc6b6b;
  --red-soft: rgba(204, 107, 107, 0.14);
  --blue: #7fa2d6;
  --blue-soft: rgba(127, 162, 214, 0.14);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --radius-sm: 12px;
  --max-width: 1360px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

html[data-theme='light'] {
  --bg: #f4f0e8;
  --surface: #fffdf9;
  --surface-alt: #f7f2ea;
  --surface-soft: #fffaf3;
  --border: #ddd3c5;
  --border-strong: #cdbda7;
  --text: #2c2a27;
  --text-2: #6f685f;
  --text-3: #978d80;
  --accent: #8f6d3f;
  --accent-soft: rgba(143, 109, 63, 0.1);
  --green: #5e8c69;
  --green-soft: rgba(94, 140, 105, 0.12);
  --red: #b66060;
  --red-soft: rgba(182, 96, 96, 0.12);
  --blue: #698bc2;
  --blue-soft: rgba(105, 139, 194, 0.12);
  --shadow: 0 20px 40px rgba(68, 53, 31, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top right, rgba(198, 163, 111, 0.12), transparent 24%),
    radial-gradient(circle at top left, rgba(127, 162, 214, 0.08), transparent 18%),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.projects-shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.screen {
  display: none;
}

.screen.is-visible {
  display: block;
}

.login-card,
.panel,
.hero-card,
.modal-card,
.project-card,
.toast {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 520px);
  margin: 14vh auto 0;
  padding: 28px;
  border-radius: 24px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.login-title,
.hero-title,
.panel-title {
  margin: 10px 0 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

.login-copy,
.hero-copy,
.panel-copy {
  margin: 14px 0 0;
  color: var(--text-2);
  line-height: 1.75;
}

.login-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-row {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link,
.ghost-button,
.button,
.danger-button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: 160ms ease;
}

.nav-link,
.ghost-button {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-2);
}

.nav-link:hover,
.ghost-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.nav-link.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.button {
  background: var(--accent);
  border-color: transparent;
  color: #111;
  font-weight: 700;
}

.button:hover {
  transform: translateY(-1px);
}

.danger-button {
  background: var(--red-soft);
  border-color: rgba(204, 107, 107, 0.28);
  color: var(--red);
}

.button[disabled],
.ghost-button[disabled],
.danger-button[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.hero-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.hero-card,
.panel,
.project-card,
.modal-card {
  border-radius: 24px;
}

.hero-card,
.panel,
.modal-card {
  padding: 20px;
}

.hero-card {
  min-height: 100%;
}

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

.stat-card {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.stat-label {
  color: var(--text-3);
  font-size: 11px;
}

.stat-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
}

.stat-sub {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.summary-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.summary-name {
  font-size: 18px;
  font-weight: 700;
}

.summary-meta {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 13px;
}

.search-row {
  display: grid;
  gap: 12px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-group {
  display: grid;
  gap: 8px;
}

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

.field-label {
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-input,
.field-select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}

.field-input:focus,
.field-select:focus {
  border-color: var(--accent);
}

.field-hint {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

.toggle {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.workspace {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.projects-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.project-card {
  padding: 18px;
}

.project-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.project-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
}

.project-meta,
.project-footnote {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
}

.badge-row,
.card-actions,
.metric-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.badge {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.type-paid {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.type-personal {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.type-team {
  background: var(--green-soft);
  color: var(--green);
}

.badge.status-active {
  background: rgba(120, 169, 122, 0.1);
  color: var(--green);
}

.badge.status-paused {
  background: rgba(127, 162, 214, 0.1);
  color: var(--blue);
}

.badge.status-done {
  background: rgba(204, 107, 107, 0.1);
  color: var(--red);
}

.progress-wrap {
  margin-top: 16px;
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-2);
  font-size: 13px;
}

.progress-bar {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, white));
}

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

.metric-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.metric-key {
  color: var(--text-3);
  font-size: 11px;
}

.metric-value {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 700;
}

.metric-note {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.empty-state {
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed var(--border-strong);
  color: var(--text-2);
  line-height: 1.8;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.is-visible {
  display: flex;
}

.modal-card {
  width: min(100%, 760px);
  max-height: min(90vh, 960px);
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.modal-title {
  margin: 6px 0 0;
  font-size: 26px;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.helper-row {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.helper-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-2);
}

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
}

.toast.error {
  border-color: rgba(204, 107, 107, 0.4);
  color: var(--red);
}

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

@media (max-width: 1080px) {
  .hero-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .projects-shell {
    padding: 20px 14px 42px;
  }

  .field-grid.two,
  .field-grid.three {
    grid-template-columns: 1fr;
  }

  .hero-stats,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .project-card-top,
  .app-header {
    grid-template-columns: 1fr;
  }

  .card-actions,
  .header-actions {
    justify-content: flex-start;
  }

  .modal {
    padding: 12px;
  }
}
