:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #fff;
  --text: #182033;
  --muted: #67728a;
  --line: #e3e7ef;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --danger: #c0262d;
  --shadow: 0 12px 32px rgba(25, 35, 60, .09);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); margin: .25rem 0; }
.topbar { height: 64px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: white; font-size: 1.5rem; font-weight: 800; box-shadow: 0 8px 20px rgba(79, 70, 229, .28); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; }
.workspace { display: grid; grid-template-columns: 290px 1fr; min-height: calc(100vh - 64px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-head h2 { margin: 0; font-size: 1.05rem; }
.icon-button { border: 0; background: #eef0ff; color: var(--primary); width: 34px; height: 34px; border-radius: 10px; font-size: 1.35rem; }
.project-list { display: grid; gap: 7px; margin-top: 18px; }
.project-item { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; padding: 12px; border-radius: 10px; }
.project-item:hover { background: #f7f7ff; }
.project-item.active { background: #eef0ff; border-color: #d8d9ff; }
.project-item strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.project-item span { color: var(--muted); font-size: .8rem; }
.content { padding: 38px clamp(24px, 5vw, 72px); max-width: 1250px; width: 100%; }
.empty-state { display: grid; place-items: center; color: var(--muted); text-align: center; }
.project-header { display: flex; justify-content: space-between; align-items: start; gap: 30px; }
.project-header h1 { margin: .25rem 0 .5rem; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.description { max-width: 760px; color: #4b556c; line-height: 1.55; white-space: pre-wrap; }
.eyebrow { color: var(--primary); text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; font-weight: 800; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .9rem; }
.header-actions { display: flex; gap: 8px; }
button.primary, button.secondary, button.ghost { border-radius: 9px; padding: 9px 14px; border: 1px solid transparent; }
button.primary { background: var(--primary); color: white; }
button.primary:hover { background: var(--primary-dark); }
button.secondary { background: white; border-color: var(--line); color: var(--text); }
button.ghost { background: transparent; color: var(--muted); }
button.danger { color: var(--danger); }
.progress-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 28px 0; box-shadow: var(--shadow); }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-track { height: 10px; border-radius: 99px; background: #e9ecf3; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #4f46e5, #8b5cf6); width: 0; transition: width .25s; }
.task-section { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.task-tree { margin-top: 18px; }
.task-children { margin-left: 27px; border-left: 1px solid #dfe3ec; padding-left: 12px; }
.task-row { display: grid; grid-template-columns: auto minmax(180px, 1fr) 120px 90px 105px 65px auto; gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid #edf0f5; }
.task-row:hover { background: #fafbfe; }
.task-title { min-width: 0; }
.task-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-title small { color: var(--muted); }
.toggle { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); }
.toggle.placeholder { visibility: hidden; }
.badge { display: inline-flex; border-radius: 99px; padding: 4px 8px; font-size: .72rem; font-weight: 700; background: #eef0f5; color: #4e5870; }
.badge.DONE { background: #dcfce7; color: #166534; }
.badge.BLOCKED, .badge.CRITICAL { background: #fee2e2; color: #991b1b; }
.badge.IN_PROGRESS { background: #e0e7ff; color: #3730a3; }
.badge.HIGH { background: #ffedd5; color: #9a3412; }
.task-progress { font-variant-numeric: tabular-nums; font-weight: 700; }
.overdue { color: var(--danger); font-weight: 700; }
.row-actions { display: flex; gap: 2px; }
.row-actions button { border: 0; background: transparent; padding: 6px; color: var(--muted); border-radius: 6px; }
.row-actions button:hover { background: #eef0f5; color: var(--text); }
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top, #ecebff, var(--bg) 50%); }
.login-card { width: min(400px, calc(100% - 32px)); background: white; border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: var(--shadow); }
.login-card h1 { margin: 20px 0 0; }
.stack, .dialog-form { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-size: .85rem; font-weight: 650; color: #465069; }
input, textarea, select { width: 100%; border: 1px solid #cfd5e1; border-radius: 8px; padding: 9px 10px; color: var(--text); background: white; }
input:focus, textarea:focus, select:focus { outline: 3px solid #dddfff; border-color: var(--primary); }
.alert { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 8px; margin: 16px 0; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(650px, calc(100% - 30px)); box-shadow: 0 30px 70px rgba(20, 26, 45, .28); }
dialog::backdrop { background: rgba(18, 25, 43, .45); }
.dialog-form { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { margin: 0; }
.close { border: 0; background: transparent; font-size: 1.8rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 5px; }
.hint { background: #eef0ff; color: #3730a3; padding: 10px; border-radius: 8px; font-size: .85rem; }
.toast { position: fixed; right: 22px; bottom: 22px; background: #192033; color: white; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 20; }
@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .project-list { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .task-row { grid-template-columns: auto 1fr auto; }
  .task-row > :nth-child(3), .task-row > :nth-child(4), .task-row > :nth-child(5) { display: none; }
}
@media (max-width: 560px) {
  .content { padding: 22px 12px; }
  .project-header { display: block; }
  .header-actions { margin-top: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .task-section { padding: 14px; }
  .task-children { margin-left: 12px; padding-left: 5px; }
}
