:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1a1e24;
  --line: #2c323b;
  --text: #f4f6f8;
  --muted: #929ba7;
  --accent: #7c5cff;
  --accent-2: #a998ff;
  --accent-soft: rgba(124, 92, 255, .1);
  --accent-border: rgba(124, 92, 255, .3);
  --accent-text: #c4b8ff;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% 0, #1c1835 0, var(--bg) 35%); color: var(--text); }
button, input, select { font: inherit; }
.project-shell { min-height: 100vh; }
.project-header { min-height: 84px; padding: 15px 26px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 22px; align-items: center; background: rgba(11, 13, 16, .9); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(18px); }
.header-copy { min-width: 0; }
.project-header h1 { margin: 5px 0 2px; font-size: 24px; line-height: 1.15; }
.project-header p, .scope-note, .dialog-hint { margin: 0; color: var(--muted); line-height: 1.55; }
.project-header p { font-size: 12px; }
.back-link { color: #b9aaff; text-decoration: none; font-size: 13px; }
.header-actions, .content-toolbar, .dialog-heading, .dialog-actions { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.header-actions { flex: 0 0 auto; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(20, 23, 28, .92); box-shadow: 0 8px 22px rgba(0, 0, 0, .18); }
.header-actions .role-chip { max-width: 190px; min-height: 32px; display: inline-flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; color: #e3e7ec; font-weight: 680; }
.header-action-button { height: 32px; display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: #aeb6c1; cursor: pointer; }
.header-action-button:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.header-action-button > span:first-child { color: #9f8cff; font-size: 15px; }
.button { border: 1px solid var(--line); border-radius: 10px; min-height: 40px; padding: 0 16px; color: var(--text); background: var(--panel-2); cursor: pointer; }
.button:hover { border-color: #5c6470; }
.button.primary { background: linear-gradient(135deg, var(--accent), #9d54ff); border-color: transparent; font-weight: 700; }
.button.danger { color: #ff9bad; border-color: rgba(255, 88, 110, .38); background: rgba(255, 88, 110, .08); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.role-chip, .count-chip, .status-chip { padding: 7px 11px; border-radius: 999px; background: #242a32; color: #c8d0d9; font-size: 12px; }
.project-layout { display: grid; grid-template-columns: minmax(300px, 390px) 1fr; gap: 22px; padding: 24px 34px 44px; }
.project-layout.participation-layout { grid-template-columns: minmax(0, 1fr); }
.project-layout.participation-layout .project-content { width: 100%; min-width: 0; }
.project-layout.participation-layout .project-grid:not(.compact) { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.control-panel, .project-content { border: 1px solid var(--line); border-radius: 18px; background: rgba(20, 23, 28, .9); }
.control-panel { padding: 22px; align-self: start; position: sticky; top: 108px; }
.project-content { padding: 24px; min-height: 500px; }
.panel-heading h2, .content-toolbar h2, .dialog-heading h2 { margin: 4px 0 18px; }
.eyebrow { color: var(--accent-2); font-size: 11px; letter-spacing: .14em; font-weight: 800; }
form label { display: grid; gap: 7px; margin: 0 0 15px; color: #c4cbd4; font-size: 13px; }
input, select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #0f1216; color: var(--text); padding: 0 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .15); }
.two-columns { display: grid; grid-template-columns: 1.2fr .8fr; gap: 10px; }
#createButton { width: 100%; margin: 4px 0 14px; }
.budget-hint { margin: -6px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.budget-hint.warning { color: #ffc36b; }
.project-list-controls { display: grid; grid-template-columns: minmax(140px, .7fr) minmax(140px, .7fr) minmax(220px, 1.2fr); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #101318; }
.project-list-controls label { display: grid; gap: 6px; margin: 0; color: var(--muted); font-size: 11px; }
.project-list-controls input, .project-list-controls select { min-height: 38px; border-radius: 9px; }
.project-folders { display: grid; gap: 12px; margin-top: 16px; }
.project-folder { border: 1px solid var(--line); border-radius: 14px; background: rgba(15, 18, 22, .72); overflow: hidden; }
.project-folder > summary { min-height: 50px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; cursor: pointer; color: var(--muted); font-size: 12px; }
.project-folder > summary::-webkit-details-marker { display: none; }
.project-folder > summary::after { content: '⌄'; margin-left: 4px; color: #747f8c; font-size: 17px; transition: transform 160ms ease; }
.project-folder[open] > summary::after { transform: rotate(180deg); }
.project-folder[open] > summary { color: #dce1e7; border-bottom: 1px solid var(--line); }
.project-folder-title { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.project-folder-icon { color: #9f8cff; font-size: 12px; }
.project-folder > .project-grid { margin: 0; padding: 12px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); align-items: start; gap: 14px; }
.project-grid.compact { grid-template-columns: 1fr; }
.project-card { align-self: start; border: 1px solid var(--line); background: var(--panel-2); border-radius: 14px; overflow: hidden; }
.project-card-summary { min-height: 82px; display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 18px 50px 18px 18px; position: relative; cursor: pointer; list-style: none; }
.project-card-summary::-webkit-details-marker { display: none; }
.project-card-summary::after { content: '⌄'; position: absolute; right: 18px; top: 50%; color: var(--muted); font-size: 20px; line-height: 1; transform: translateY(-55%); transition: transform 160ms ease; }
.project-card[open] .project-card-summary::after { transform: translateY(-45%) rotate(180deg); }
.project-card[open] .project-card-summary { border-bottom: 1px solid var(--line); }
.project-card-title { min-width: 0; display: grid; gap: 5px; }
.project-card-title strong { overflow: hidden; color: var(--text); font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }
.project-card-summary-side { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.project-card-summary-side .status-chip { white-space: nowrap; }
.project-grid:not(.compact) .project-summary-meta { display: none; }
.project-summary-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.project-card-body { display: grid; gap: 14px; padding: 16px 18px 18px; }
.project-code { color: #a998ff; font-size: 12px; font-weight: 800; letter-spacing: .07em; }
.project-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; color: var(--muted); font-size: 12px; }
.project-meta strong { color: #dce1e7; display: block; margin-top: 3px; font-size: 13px; }
.avatar-stack { display: flex; flex-wrap: wrap; gap: 7px; }
.member-pill { padding: 6px 9px; border-radius: 8px; background: #101318; color: #cbd2dc; font-size: 12px; }
.member-pill.leader { color: var(--accent-text); border: 1px solid var(--accent-border); }
.project-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.project-card-actions.three { grid-template-columns: repeat(3, 1fr); }
.project-card-actions.three .button { min-width: 0; padding-inline: 10px; font-size: 13px; white-space: nowrap; }
.project-card-actions.single { grid-template-columns: 1fr; }
.button.unit-button { color: var(--accent-text); border-color: var(--accent-border); background: var(--accent-soft); }
.notice { margin: 18px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent-text); }
.notice.error { background: rgba(255, 88, 110, .1); border-color: rgba(255, 88, 110, .35); color: #ff9bad; }
.empty-state { min-height: 330px; display: grid; place-content: center; text-align: center; gap: 8px; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 18px; }
dialog { width: min(680px, calc(100vw - 30px)); border: 1px solid var(--line); border-radius: 18px; padding: 0; background: #15191f; color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.55); }
dialog.wide-dialog { width: min(1060px, calc(100vw - 30px)); max-height: calc(100vh - 34px); overflow: hidden; }
dialog.wide-dialog .dialog-card { max-height: calc(100vh - 36px); overflow: auto; }
dialog::backdrop { background: rgba(2, 4, 7, .76); backdrop-filter: blur(3px); }
.dialog-card { padding: 20px; }
.dialog-actions-danger { margin-top: 20px; justify-content: flex-start; }
.dialog-actions-spacer { flex: 1; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 9px; background: #242a32; color: white; font-size: 23px; cursor: pointer; }
.member-list { display: grid; gap: 8px; max-height: 420px; overflow: auto; margin: 18px 0; }
.member-row { display: grid; grid-template-columns: auto 1fr 145px; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.member-row input[type="checkbox"] { width: 18px; min-height: 18px; }
.member-name { font-weight: 700; }
.member-detail { color: var(--muted); font-size: 12px; margin-top: 3px; }
.dialog-notice { margin: 10px 0 0; padding: 9px 11px; font-size: 12px; }
.unit-editor { margin: 12px 0 15px; }
.unit-editor fieldset { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #101318; }
.unit-editor-heading, .unit-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.unit-editor-heading span { color: var(--muted); font-size: 12px; }
.unit-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
.unit-form-grid label { gap: 5px; margin-bottom: 9px; font-size: 12px; }
.unit-form-grid input, .unit-form-grid select { min-height: 38px; border-radius: 9px; }
.unit-editor-actions { justify-content: flex-end; }
.unit-editor-actions .button { min-height: 34px; padding: 0 13px; }
.unit-list-heading { padding-top: 2px; }
.unit-list { display: grid; gap: 7px; max-height: 350px; overflow: auto; padding-right: 4px; }
.unit-row { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); overflow: hidden; }
.unit-row > summary { min-height: 50px; padding: 8px 13px 8px 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; position: relative; }
.unit-row > summary::-webkit-details-marker { display: none; }
.unit-row > summary::before { content: '›'; position: absolute; left: 14px; color: var(--muted); font-size: 22px; line-height: 1; transition: transform 150ms ease; }
.unit-row[open] > summary::before { transform: rotate(90deg); }
.unit-row > summary span:first-child { min-width: 0; display: grid; gap: 4px; }
.unit-row > summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-row > summary small, .unit-range { color: var(--muted); }
.unit-row-body { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(180px, 2fr) auto; align-items: center; gap: 10px; padding: 9px 13px 11px; border-top: 1px solid var(--line); }
.unit-row-actions { display: flex; gap: 6px; }
.unit-row-actions .button { min-height: 32px; padding: 0 11px; }
.unit-empty-state, .dialog-loading { min-height: 68px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
@media (max-width: 900px) {
  .project-header { align-items: flex-start; }
  .project-layout { grid-template-columns: 1fr; padding: 16px; }
  .control-panel { position: static; }
  .project-card-summary { align-items: flex-start; }
  .project-card-summary-side { align-items: flex-end; flex-direction: column-reverse; }
  .project-summary-meta { white-space: normal; text-align: right; }
  .project-list-controls { grid-template-columns: 1fr 1fr; }
  .project-search-field { grid-column: 1 / -1; }
  .unit-form-grid { grid-template-columns: 1fr; }
  .unit-row-body { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .project-header { padding: 12px 14px; }
  .project-header p, .header-action-button span:last-child { display: none; }
  .header-actions .role-chip { max-width: 130px; }
  .project-list-controls { grid-template-columns: 1fr; }
  .project-card-actions.three { grid-template-columns: 1fr; }
  .project-search-field { grid-column: auto; }
}
