:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #687386;
  --panel: #ffffff;
  --panel-soft: #f6f8fb;
  --surface: #f3f6f9;
  --line: #dbe2ea;
  --line-strong: #c8d2dd;
  --accent: #176b87;
  --accent-strong: #114f63;
  --accent-warm: #8a5a1d;
  --amber: #b15b12;
  --green: #19714d;
  --red: #a33d3d;
  --blue-soft: #e7f4f7;
  --amber-soft: #fff4df;
  --green-soft: #e8f6ef;
  --red-soft: #fdecec;
  --shadow: 0 18px 45px rgba(24, 33, 47, 0.12);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: inherit;
  background: var(--surface);
}

.auth-gate {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(23, 107, 135, 0.12), rgba(25, 113, 77, 0.1)),
    var(--surface);
}

.auth-gate.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.auth-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.auth-message {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

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

button,
input,
select {
  text-align: center;
}

select {
  text-align-last: center;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1760px, calc(100vw - 20px));
  min-height: calc(100vh - 20px);
  margin: 10px auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(24, 33, 47, 0.08);
}

.app-header {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(0, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.app-header h1,
.pane-header h2,
.project-title h2,
.dialog-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.app-header p,
.pane-header p,
.project-title p,
.dialog-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  align-items: stretch;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown summary {
  list-style: none;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown-summary {
  width: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
}

.nav-dropdown-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  gap: 6px;
  min-width: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(24, 33, 47, 0.14);
}

.nav-separator {
  width: 1px;
  min-height: 36px;
  margin: 0 4px;
  background: var(--line);
}

.tab-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

#migrateButton {
  min-width: 58px;
  padding: 0 10px;
}

.tab-button.active {
  color: var(--accent-strong);
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(24, 33, 47, 0.08);
}

.nav-dropdown.active .nav-dropdown-summary {
  color: var(--accent-strong);
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(24, 33, 47, 0.08);
}

.sub-tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 0 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.sub-tab-button.active {
  color: var(--accent-strong);
  background: var(--panel);
}

.language-switch {
  display: inline-grid;
  gap: 5px;
  justify-self: end;
  width: max-content;
  color: var(--muted);
  font-size: 12px;
}

.language-switch select {
  width: 76px;
  min-width: 76px;
  padding: 0 8px;
}

.cloud-account {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-content: stretch;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.cloud-account span,
.cloud-account button {
  text-align: center;
}

.app-header > .cloud-account,
.app-header > #resetButton {
  display: none !important;
}

.view {
  display: none;
  min-height: 0;
}

.view.active {
  display: grid;
}

#projectsView {
  grid-template-columns: minmax(172px, 204px) minmax(0, 1fr);
}

#projectsView.projects-collapsed {
  grid-template-columns: 58px minmax(0, 1fr);
}

.chat-layout.active {
  display: grid;
  place-items: stretch center;
  padding: 14px;
  overflow: auto;
}

.summary-layout.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.project-pane,
.table-pane,
.chat-card {
  min-width: 0;
  background: var(--panel);
}

.project-pane {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

#projectsView.projects-collapsed .project-pane {
  display: flex;
  align-items: stretch;
  padding: 0;
}

#projectsView.projects-collapsed .project-form,
#projectsView.projects-collapsed .project-list {
  display: none;
}

.project-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.triangle-toggle {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.triangle-toggle::before {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid var(--accent-strong);
  content: "";
}

.triangle-toggle:hover {
  border-color: var(--accent);
  background: var(--blue-soft);
}

#projectsView.projects-collapsed .project-pane-header {
  justify-content: center;
  min-height: 57px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

#projectsView.projects-collapsed .project-pane-header span {
  display: none;
}

#projectsView.projects-collapsed .triangle-toggle {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

#projectsView.projects-collapsed .triangle-toggle::before {
  border-right: 0;
  border-left: 8px solid var(--accent-strong);
}

.project-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.library-project-form {
  width: min(420px, 100%);
  padding: 0;
  border-bottom: 0;
}

.project-form input,
.table-input,
.dialog-grid input,
.dialog-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  outline: none;
  color: var(--ink);
  background: var(--panel-soft);
  text-align: center;
}

.project-form input {
  height: 40px;
}

.project-form input:focus,
.table-input:focus,
.composer textarea:focus,
.dialog-grid input:focus,
.dialog-grid textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.14);
}

.project-library-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.project-list {
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
  padding: 12px;
}

.project-item {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  text-align: center;
  color: var(--ink);
  background: var(--panel);
}

.project-item:hover {
  border-color: rgba(23, 107, 135, 0.42);
  background: #fbfdff;
}

.project-item.dragging {
  opacity: 0.55;
}

.project-item.drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(23, 107, 135, 0.22);
}

.project-item.all-project-item {
  border-color: #8fa3b8;
  color: #182635;
  background: #e4ebf2;
}

.project-item.all-project-item:hover {
  border-color: #6f879f;
  background: #dce6ef;
}

.project-item.active {
  border-color: var(--accent);
  background: #eef8fb;
  box-shadow: inset 3px 0 0 var(--accent);
}

.project-item.all-project-item.active {
  border-color: var(--accent-strong);
  background: #d3e4ec;
}

.project-item.unfiled-project-item {
  border-color: #c7d4df;
  background: #f3f7fa;
}

.project-item.unfiled-project-item.active {
  border-color: var(--accent);
  background: #e8f5f8;
}

.project-name {
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.project-stats {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.icon-button:hover {
  border-color: var(--accent);
  background: var(--blue-soft);
}

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

.table-pane {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.toolbar,
.pane-header {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.toolbar {
  flex-wrap: wrap;
}

.project-title {
  min-width: 220px;
  flex: 1 1 300px;
}

.project-title h2 {
  margin-top: 6px;
}

#projectSourceBadge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--accent-strong);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 750;
}

.metrics {
  display: flex;
  gap: 8px;
}

.metric-card {
  min-width: 86px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--ink);
  background: #f9fbfd;
}

.metric-card:hover,
.metric-card.active {
  border-color: var(--accent);
  background: var(--blue-soft);
}

.metrics span {
  display: block;
  font-size: 20px;
  font-weight: 750;
  line-height: 1;
}

.metrics small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.controls,
.composer-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: flex-end;
}

.controls label,
.context-select {
  display: grid;
  gap: 5px;
  min-width: 132px;
  color: var(--muted);
  font-size: 12px;
}

.controls input[type="search"] {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--panel);
}

.gantt-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 14px;
  background: #fbfcfd;
}

.gantt-panel.gantt-hidden .gantt-chart,
.gantt-panel.gantt-hidden .gantt-controls label,
.gantt-panel.gantt-hidden #refreshGanttButton {
  display: none;
}

.gantt-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.gantt-header h3 {
  margin: 0;
  font-size: 15px;
}

.gantt-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.gantt-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.gantt-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.gantt-controls input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--panel);
}

.gantt-controls input:disabled {
  color: #9aa4b2;
  background: #eef2f6;
}

.gantt-chart {
  display: grid;
  gap: 7px;
  max-height: 276px;
  overflow: auto;
}

.gantt-scale {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding-left: 230px;
  color: var(--muted);
  font-size: 11px;
}

.gantt-project {
  padding-top: 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
}

.gantt-row {
  display: grid;
  grid-template-columns: 210px minmax(260px, 1fr);
  gap: 10px;
  align-items: center;
}

.gantt-row-clickable {
  cursor: pointer;
}

.gantt-row-clickable:hover .gantt-label strong {
  color: var(--accent-strong);
  text-decoration: underline;
}

.gantt-label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.gantt-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.gantt-label span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.gantt-track {
  position: relative;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: repeating-linear-gradient(
    to right,
    #eef3f8 0,
    #eef3f8 1px,
    transparent 1px,
    transparent 10%
  );
}

.gantt-chart.has-today-line .gantt-track::after {
  content: "";
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: var(--gantt-today-left);
  z-index: 3;
  width: 2px;
  border-radius: 2px;
  background: #d53d3d;
  box-shadow: 0 0 0 1px rgba(213, 61, 61, 0.18);
  pointer-events: none;
}

.gantt-bar {
  position: absolute;
  top: 4px;
  height: 12px;
  border-radius: 5px;
  background: var(--accent);
}

.gantt-man,
.gantt-method {
  background: #5e8c61;
}

.gantt-machine,
.gantt-measurement {
  background: #2f74bd;
}

.gantt-material,
.gantt-environment {
  background: #c47a36;
}

.gantt-other {
  background: #707987;
}

.gantt-project-plan {
  background: #1b8a7a;
}

.gantt-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
}

.action-menu {
  position: relative;
}

.action-menu summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu-panel {
  position: absolute;
  z-index: 5;
  right: 0;
  display: grid;
  gap: 6px;
  min-width: 150px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(24, 33, 47, 0.14);
}

.column-menu-panel {
  max-height: 340px;
  min-width: 220px;
  overflow: auto;
}

.column-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  border-radius: 6px;
  padding: 4px 6px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.column-toggle:hover {
  background: var(--blue-soft);
}

.column-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.menu-action {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  text-align: left;
  color: var(--accent-strong);
  background: transparent;
  font-weight: 650;
}

.menu-action:hover {
  background: var(--blue-soft);
}

select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  outline: none;
  color: var(--ink);
  background: var(--panel);
}

.table-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  background: #ffffff;
}

.table-level-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  background: #fbfdff;
}

table {
  min-width: 1900px;
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

th,
td {
  border: 1px solid var(--line-strong);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  z-index: 4;
  top: 0;
  color: #2f3b4b;
  background: #f3f7fa;
  box-shadow:
    inset 0 -1px 0 var(--line-strong),
    0 2px 7px rgba(24, 38, 53, 0.05);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
  overflow: visible;
  resize: horizontal;
}

th .th-label {
  display: block;
  margin: 0 auto;
  text-align: center;
}

.th-tools {
  display: flex;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin-top: 5px;
}

.filter-button,
.sort-button {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
  line-height: 1;
  overflow: hidden;
}

.filter-button::before {
  width: 8px;
  height: 8px;
  background: currentColor;
  clip-path: polygon(8% 12%, 92% 12%, 60% 48%, 60% 88%, 40% 88%, 40% 48%);
  content: "";
}

.sort-button {
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  padding: 3px 4px;
}

.sort-triangle {
  display: block;
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}

.sort-up {
  align-self: end;
  border-bottom: 5px solid currentColor;
}

.sort-down {
  align-self: start;
  border-top: 5px solid currentColor;
}

.sort-button.sort-asc .sort-down,
.sort-button.sort-desc .sort-up {
  opacity: 0.28;
}

.filter-button:hover,
.sort-button:hover,
.filter-button.active,
.sort-button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--blue-soft);
}

.filter-button.active {
  box-shadow: 0 0 0 2px rgba(23, 107, 135, 0.12);
}

.column-filter-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% - 4px);
  left: 50%;
  display: none;
  width: min(240px, 92vw);
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px;
  text-align: left;
  background: #fff;
  box-shadow: 0 12px 28px rgba(24, 38, 53, 0.16);
}

.column-filter-menu.open {
  display: grid;
  gap: 8px;
}

.column-filter-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.column-filter-actions button {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--accent-strong);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 700;
}

.column-filter-options {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.column-filter-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 26px;
  border-radius: 6px;
  padding: 3px 5px;
  color: var(--ink);
  font-size: 12px;
}

.column-filter-option:hover {
  background: var(--blue-soft);
}

.column-filter-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.column-filter-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-hidden {
  display: none;
}

th[data-column-key="project"],
th[data-column-key="startAt"],
th[data-column-key="endAt"] {
  width: 104px;
  min-width: 88px;
}

th[data-column-key="project"] {
  width: 82px;
  min-width: 70px;
}

th[data-column-key="type"],
th[data-column-key="r"],
th[data-column-key="a"],
th[data-column-key="c"],
th[data-column-key="i"] {
  width: 78px;
  min-width: 64px;
}

td {
  background: var(--panel);
  font-size: 13px;
  min-height: 78px;
  overflow: auto;
  resize: vertical;
  text-align: center;
}

tbody tr:nth-child(even) td {
  background: #fcfdff;
}

tbody tr:hover td {
  background: #f7fbfd;
}

tbody tr.event-row-dragging td {
  opacity: 0.55;
}

tbody tr.event-row-drag-over td {
  border-top-color: var(--accent);
  box-shadow: inset 0 2px 0 rgba(23, 107, 135, 0.35);
}

tbody tr.event-row-closed td {
  background: #eef8ef;
}

tbody tr.event-row-closed:nth-child(even) td {
  background: #e8f5ea;
}

tbody tr.event-row-closed:hover td {
  background: #dff0e2;
}

.add-event-row td {
  padding: 10px;
  text-align: center;
  background: #ffffff;
  resize: none;
}

.closed-events-toggle-row td {
  padding: 8px 10px;
  text-align: center;
  background: #f2faf3;
  resize: none;
}

.closed-events-toggle {
  min-height: 30px;
  border: 1px solid #b9d8bd;
  border-radius: 999px;
  padding: 0 14px;
  color: #2f6d39;
  background: #ffffff;
  font-weight: 750;
}

.closed-events-toggle:hover {
  border-color: #7db486;
  background: #e9f7eb;
}

.add-event-button {
  width: 40px;
  height: 40px;
  border: 1px dashed var(--accent);
  border-radius: 50%;
  color: var(--accent-strong);
  background: var(--blue-soft);
  font-size: 24px;
  font-weight: 750;
  line-height: 1;
}

.add-event-button:hover {
  background: #dff2f7;
}

.event-title-input {
  min-width: 220px;
  text-align: left;
}

.event-title-cell {
  position: relative;
  padding-left: 44px;
}

.gantt-visibility-button {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 7px;
}

.gantt-visibility-button::before {
  width: 16px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
}

.gantt-visibility-button::after {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.gantt-visibility-button.is-off {
  color: var(--muted);
  background: #f4f6f8;
}

.gantt-visibility-button.is-off::after {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-35deg);
}

.event-jump-highlight td {
  animation: event-jump-highlight 1.2s ease;
}

@keyframes event-jump-highlight {
  0%,
  100% {
    background: var(--panel);
  }
  20%,
  70% {
    background: #fff0cf;
  }
}

.log-input,
.next-action-input {
  min-width: 300px;
  min-height: 76px;
  text-align: left;
}

.table-input {
  padding: 6px 8px;
  resize: both;
  line-height: 1.4;
}

.event-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.search-hit-field {
  border-color: #c48812;
  background: #fffaf0;
}

.search-highlight-preview {
  max-width: 360px;
  max-height: 74px;
  margin-top: 4px;
  overflow: auto;
  border-left: 3px solid #d59a20;
  padding: 3px 6px;
  color: #4f3b10;
  background: #fff8de;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.search-hit-mark {
  border-radius: 3px;
  padding: 0 2px;
  color: #2f2100;
  background: #ffd85a;
}

.project-cell {
  min-width: 74px;
  text-align: center;
  white-space: nowrap;
}

.event-project-select {
  width: 90px;
  max-width: 100%;
}

.type-select {
  width: 64px;
}

.date-input {
  min-width: 0;
}

.date-cell {
  position: relative;
  min-width: 96px;
  text-align: center;
}

.date-display {
  display: grid;
  gap: 2px;
  min-height: 34px;
  place-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 3px;
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.date-cell .date-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.date-cell.date-editing .date-input {
  position: static;
  width: 100%;
  min-width: 128px;
  min-height: 30px;
  margin-top: 4px;
  padding: 4px 5px;
  font-size: 11px;
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  resize: horizontal;
}

.date-picker-button {
  position: relative;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin: 4px auto 0;
  border-radius: 7px;
}

.date-picker-button::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.date-picker-button::after {
  position: absolute;
  top: 9px;
  left: 13px;
  width: 5px;
  height: 6px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  content: "";
}

.due-soon-input {
  width: 64px;
  min-height: 24px;
  margin-top: 4px;
  padding: 0 4px;
  font-size: 11px;
}

@keyframes dueSoonRowPulse {
  from {
    background-color: rgba(238, 137, 24, 0.38);
  }

  to {
    background-color: transparent;
  }
}

.row-due-soon-pulse td {
  animation: dueSoonRowPulse 0.25s ease-out;
}

.workdays-cell {
  min-width: 72px;
  color: var(--accent-strong);
  font-weight: 750;
  text-align: center;
}

.raci-input {
  min-width: 70px;
  width: 78px;
}

.status-select {
  width: 98px;
}

.weekly-summary-button {
  min-height: 32px;
  margin-right: 6px;
  white-space: nowrap;
}

.related-logs {
  display: none;
  gap: 4px;
  margin-top: 5px;
  text-align: left;
}

.log-item {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  color: #384457;
  line-height: 1.4;
  font-size: 12px;
}

.log-empty {
  color: var(--muted);
  font-size: 12px;
}

.next-action-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.next-action-tools .secondary-button {
  min-height: 32px;
  padding: 0 10px;
}

.next-action-refresh-time {
  color: var(--muted);
  font-size: 12px;
}

.delete-button {
  color: var(--red);
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 260px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.empty-state.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.due-overdue {
  color: #7c4a03;
  font-weight: 750;
}

.due-soon {
  color: var(--amber);
  font-weight: 750;
}

.date-cell.due-soon {
  color: var(--red);
  font-weight: 750;
}

.date-cell.due-overdue {
  color: #7c4a03;
  font-weight: 750;
  background: #fff1bf !important;
  box-shadow: inset 0 0 0 2px rgba(217, 149, 26, 0.48);
}

.date-cell.due-soon .date-display {
  color: var(--red);
}

.date-cell.due-overdue .date-display {
  color: #7c4a03;
  background: #fff7d6;
}

.chat-card {
  display: flex;
  width: min(920px, 100%);
  min-height: min(760px, calc(100vh - 108px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.summary-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.summary-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 16px;
}

.project-data-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 190px));
  justify-content: center;
  gap: 12px;
  overflow: auto;
  padding: 18px;
}

.weekly-project-list {
  display: grid;
  gap: 8px;
  max-height: min(54vh, 460px);
  overflow: auto;
  padding: 18px;
}

.weekly-project-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 650;
  text-align: center;
}

.weekly-project-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.project-library {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding: 12px;
}

.project-library-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
}

.project-library-card.collapsed {
  padding: 6px 8px;
}

.project-library-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  border-radius: 6px;
  padding: 3px 5px;
  background: #f8fbfd;
}

.project-library-card-actions,
.trash-event-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.project-library-card-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-toggle-button {
  min-width: 58px;
  min-height: 28px;
  padding: 0 10px;
}

.library-delete-project-button {
  min-width: 72px;
  min-height: 28px;
  padding: 0 10px;
}

.project-library-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 1fr));
  gap: 8px;
}

.project-library-card.collapsed .project-library-details {
  display: none;
}

.project-library-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.project-library-card input,
.project-library-card textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  text-align: center;
}

.project-library-card textarea {
  text-align: left;
}

.project-library-card span small {
  display: inline;
  margin-left: 4px;
}

.project-library-card .wide-field {
  grid-column: 1 / -1;
}

.customer-table-field {
  display: grid;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fbfdff;
}

.project-customer-table {
  width: max-content;
  max-width: none;
  border-collapse: collapse;
  table-layout: auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-customer-table th,
.project-customer-table td {
  width: auto;
  min-width: 30px;
  min-height: 0;
  border: 1px solid var(--line);
  padding: 4px;
  overflow: auto;
  resize: both;
  text-align: center;
  background: #fff;
}

.project-customer-table .customer-delete-heading,
.project-customer-table .customer-delete-cell {
  width: 28px;
  min-width: 28px;
  padding: 2px;
  resize: none;
}

.project-customer-table .customer-empty-cell {
  width: 26px;
  min-width: 26px;
  padding: 2px;
}

.project-customer-table .customer-row-empty td:not(.customer-delete-cell) {
  height: 28px;
  min-height: 28px;
}

.project-customer-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.project-customer-table input {
  width: auto;
  min-width: 2ch;
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  padding: 4px 5px;
  background: #fff;
}

.project-customer-table input.is-empty {
  width: 1ch;
  min-width: 1ch;
  min-height: 24px;
  padding: 2px;
}

.customer-delete-button {
  width: 22px;
  height: 22px;
  min-height: 22px;
  border: 1px solid #e4b6b6;
  border-radius: 50%;
  color: var(--red);
  background: #fff7f7;
  font-weight: 750;
  line-height: 1;
}

.customer-delete-button:hover {
  border-color: var(--red);
  background: #ffeaea;
}

.project-log-field textarea[readonly] {
  color: var(--muted);
  background: #f8fafc;
}

.add-customer-row-button {
  width: 32px;
  height: 32px;
  justify-self: center;
  border: 1px dashed var(--accent);
  border-radius: 50%;
  color: var(--accent-strong);
  background: var(--blue-soft);
  font-size: 20px;
  font-weight: 750;
  line-height: 1;
}

.summary-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  background: var(--panel);
}

.summary-card header {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.summary-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.summary-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-events {
  display: grid;
  gap: 8px;
}

.summary-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  text-align: center;
  background: var(--panel-soft);
}

.summary-event-title {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.summary-event-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.jump-project-button {
  min-height: 34px;
  text-align: center;
  white-space: nowrap;
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 12px 16px 0;
}

.quick-prompts button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--blue-soft);
  font-size: 13px;
}

.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 320px;
  overflow: auto;
  padding: 16px;
}

.message {
  max-width: 88%;
}

.message.user {
  align-self: flex-end;
}

.message-role {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--panel-soft);
  line-height: 1.55;
  font-size: 14px;
}

.message.user .message-text {
  border-color: rgba(23, 107, 135, 0.28);
  color: #062a35;
  background: var(--blue-soft);
}

.message.ai .message-text {
  border-color: rgba(25, 113, 77, 0.22);
  background: #fbfdfb;
}

.composer {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.composer textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  outline: none;
  color: var(--ink);
  background: var(--panel-soft);
  line-height: 1.5;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  border: 1px solid transparent;
  font-weight: 650;
  text-align: center;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
}

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

.primary-button:active,
.secondary-button:active,
.tab-button:active,
.sub-tab-button:active,
.metric-card:active {
  transform: translateY(1px);
}

.danger-button {
  background: var(--red);
}

.danger-button:hover {
  background: #7d2929;
}

.secondary-button {
  color: var(--accent-strong);
  border-color: var(--line);
  background: var(--panel);
}

.secondary-button:hover {
  border-color: var(--accent);
  background: var(--blue-soft);
}

.analysis-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.analysis-dialog::backdrop {
  background: rgba(24, 33, 47, 0.42);
}

.advanced-dialog {
  width: min(980px, calc(100vw - 28px));
}

.dialog-panel {
  display: grid;
  max-height: calc(100vh - 28px);
}

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

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  overflow: auto;
  padding: 18px;
}

.dialog-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.dialog-grid input,
.dialog-grid textarea {
  color: var(--ink);
  font-size: 14px;
}

.dialog-grid textarea {
  resize: vertical;
  line-height: 1.45;
}

.weekly-summary-output {
  min-height: 240px;
  max-height: min(58vh, 560px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 18px;
  padding: 14px;
  background: var(--panel-soft);
  white-space: pre-wrap;
  line-height: 1.6;
}

.advanced-content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  overflow: auto;
  padding: 18px;
}

.advanced-section {
  min-width: 0;
}

.advanced-section h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  text-align: center;
}

.advanced-account-slot {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.advanced-account-slot .cloud-account {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.advanced-account-slot .cloud-account.hidden {
  display: none !important;
}

.advanced-account-slot .secondary-button {
  width: 100%;
}

.manual-output {
  max-height: min(58vh, 560px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
  color: #283446;
  font-size: 13px;
  line-height: 1.58;
  white-space: pre-wrap;
}

.advanced-links {
  display: grid;
  gap: 10px;
}

.advanced-link-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.advanced-link-item strong {
  color: var(--ink);
  font-size: 13px;
}

.advanced-link-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.advanced-link-item a,
.advanced-link-item code {
  overflow-wrap: anywhere;
  color: var(--accent-strong);
  font-size: 12px;
}

.advanced-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.wide-field {
  grid-column: 1 / -1;
}

.dialog-actions {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}

@media (max-width: 980px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .app-header {
    grid-template-columns: 1fr auto;
  }

  .view-tabs {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #projectsView {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .project-pane {
    max-height: 290px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #projectsView.projects-collapsed .project-pane {
    display: flex;
    max-height: none;
  }

  .project-list {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 720px) {
  .app-header,
  .toolbar,
  .pane-header,
  .dialog-header {
    padding: 14px;
  }

  .toolbar,
  .pane-header {
    align-items: stretch;
  }

  .advanced-content {
    grid-template-columns: 1fr;
  }

  .quick-prompts {
    grid-template-columns: 1fr;
    padding: 12px 14px 0;
  }

  .messages,
  .composer {
    padding: 14px;
  }

  .composer-actions,
  .metrics,
  .controls,
  .dialog-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .metrics,
  .controls label,
  .controls button,
  .context-select,
  .dialog-actions button {
    width: 100%;
  }

  .chat-layout.active {
    padding: 0;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .summary-event {
    grid-template-columns: 1fr;
  }

  .chat-card {
    min-height: calc(100vh - 104px);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .dialog-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}
