:root {
  --bg: #fefefe;
  --surface: #ffffff;
  --surface-soft: #f6f6f6;
  --ink: #151515;
  --muted: #737373;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.16);
  --danger: #c62828;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Google Sans", "Segoe UI", Arial, sans-serif;
}

[hidden] {
  display: none !important;
}

body {
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
}

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

button,
select {
  cursor: pointer;
}

.filework-shell,
.workspace {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.workspace {
  padding: 0;
}

.filework-app {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  background: var(--bg);
}

.project-sidebar {
  min-height: 0;
  border-right: 1px solid #ededed;
  background: #fefefe;
  display: flex;
  flex-direction: column;
  padding: 14px 10px 12px;
  gap: 12px;
}

.sidebar-head,
.sidebar-title-row,
.task-head,
.task-left,
.task-toolbar,
.file-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  color: #111111;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.035em;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  display: inline-grid;
  place-items: center;
}

.icon-btn:hover {
  background: #f0f0f0;
}

.sidebar-title-row h1 {
  font-size: 0.95rem;
  font-weight: 620;
  letter-spacing: 0;
}

.sidebar-title-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 520;
}

.project-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  padding-right: 2px;
}

.project-item {
  min-height: 42px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  text-align: left;
}

.project-item:hover,
.project-item.active {
  background: #f2f2f2;
}

.project-item .material-symbols-rounded {
  font-size: 22px;
}

.project-item strong,
.project-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 540;
}

.project-item small,
.status-message {
  color: var(--muted);
  font-size: 0.78rem;
}

.work-panel {
  min-width: 0;
  min-height: 0;
  padding: 20px;
  display: grid;
  overflow: hidden;
}

.empty-state {
  height: 100%;
  display: grid;
  align-content: start;
  gap: 18px;
  text-align: left;
  color: var(--muted);
  padding: 28px;
}

.empty-state .material-symbols-rounded {
  margin: 0 auto 6px;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: #f2f2f2;
  color: #111111;
  display: inline-grid;
  place-items: center;
  font-size: 30px;
}

.empty-state h2 {
  color: var(--ink);
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.project-dashboard {
  width: min(980px, 100%);
  display: grid;
  gap: 18px;
}

.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-kicker,
.dashboard-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 620;
}

.dashboard-head h2 {
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.dashboard-card {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 14px;
  color: var(--ink);
  text-align: left;
  display: grid;
  align-content: space-between;
  gap: 14px;
}

.dashboard-card:hover {
  border-color: var(--line-strong);
  background: #fafafa;
}

.dashboard-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 620;
}

.dashboard-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 22px;
  background: #ffffff;
}

.folder-workspace {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.task-head {
  min-height: 42px;
  align-items: flex-start;
}

.task-left {
  align-items: flex-start;
}

.project-exit-btn {
  flex: 0 0 auto;
  margin-top: 1px;
}

.task-title {
  display: grid;
  gap: 2px;
}

.task-title span,
.file-editor-head span,
.task-toolbar label span,
.section-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.task-title strong,
.file-editor-head strong {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 620;
  letter-spacing: -0.025em;
}

.task-card,
.project-editor,
.file-sidebar,
.file-editor,
.plan-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.task-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
}

textarea:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.04);
}

#fileContentInput {
  min-height: 92px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.45;
  font-size: 0.98rem;
}

.task-toolbar {
  align-items: end;
  justify-content: flex-start;
}

.task-toolbar label {
  min-width: 180px;
  display: grid;
  gap: 5px;
}

select {
  height: 42px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.primary-btn,
.secondary-btn,
.context-menu button {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 650;
}

.primary-btn {
  min-width: 112px;
  padding: 0 16px;
  background: #111111;
  color: #ffffff;
}

.secondary-btn {
  padding: 0 14px;
  background: #f3f3f3;
  color: var(--ink);
}

.compact {
  min-height: 36px;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.run-estimate {
  color: var(--muted);
  font-size: 0.82rem;
}

.project-editor {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.file-sidebar {
  min-height: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.file-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tree-folder-row,
.file-row {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  align-items: center;
}

.tree-folder-row {
  padding: 5px 7px 5px calc(7px + (var(--depth, 0) * 15px));
  display: grid;
  grid-template-columns: 18px 20px minmax(0, 1fr) auto;
  gap: 6px;
}

.file-row {
  padding: 5px 7px 5px calc(7px + (var(--depth, 0) * 15px));
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto auto;
  gap: 7px;
}

.tree-folder-row:hover,
.file-row:hover,
.file-row.active {
  background: #f2f2f2;
}

.tree-folder-row .material-symbols-rounded,
.file-row .material-symbols-rounded {
  font-size: 20px;
}

.tree-name,
.file-row strong,
.file-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-name,
.file-row strong {
  font-size: 0.86rem;
  font-weight: 560;
}

.file-row small,
.tree-folder-row em,
.file-row em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
}

.file-menu-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  display: inline-grid;
  place-items: center;
}

.file-menu-btn:hover,
.file-menu-btn[aria-expanded="true"] {
  background: #e9e9e9;
}

.file-menu-btn .material-symbols-rounded {
  font-size: 19px;
}

.pin-marker {
  color: var(--muted);
  font-size: 18px !important;
}

.file-editor {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.selected-file-content {
  min-height: 0;
  resize: none;
  padding: 16px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.58;
}

.plan-panel {
  width: min(390px, 44vw);
  padding: 10px;
}

.plan-topline,
.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-topline span,
.progress-copy span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  text-transform: uppercase;
}

.plan-topline strong,
.progress-copy strong {
  font-size: 0.78rem;
  white-space: nowrap;
}

.plan-steps {
  margin-top: 8px;
  list-style: none;
  display: grid;
  gap: 5px;
}

.plan-steps li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  font-size: 0.78rem;
  line-height: 1.25;
}

.plan-steps li span {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #eeeeee;
  display: inline-grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
}

.progress-panel {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.progress-track {
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  background: #eeeeee;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: #111111;
  transition: width 0.35s ease;
}

.context-menu {
  position: fixed;
  z-index: 60000;
  width: 184px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.14);
}

.context-menu button {
  width: 100%;
  min-height: 38px;
  justify-content: flex-start;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
}

.context-menu button:hover {
  background: #f2f2f2;
}

.context-menu button.danger {
  color: var(--danger);
}

.empty-list {
  padding: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 860px) {
  .filework-app {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .project-sidebar {
    padding-inline: 8px;
  }

  .brand,
  .sidebar-title-row h1,
  .sidebar-title-row span,
  .project-item strong,
  .project-item small {
    display: none;
  }

  .project-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .project-editor {
    grid-template-columns: 1fr;
  }

  .file-sidebar {
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .task-toolbar label,
  .primary-btn {
    width: 100%;
  }

  .plan-panel {
    width: 100%;
  }
}
