:root {
  --ink: #1a1f24;
  --ink-soft: #3a4450;
  --muted: #6a7580;
  --line: #d3dae2;
  --paper: #f2f5f8;
  --panel: #ffffff;
  --accent: #0d5c7a;
  --accent-deep: #084358;
  --accent-soft: #e2f0f5;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #0f6b46;
  --shadow: 0 12px 40px rgba(26, 31, 36, 0.08);
  --radius: 10px;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 8% -8%, #d7e8f0 0%, transparent 55%),
    radial-gradient(800px 420px at 100% 0%, #e8e2d4 0%, transparent 50%),
    linear-gradient(180deg, #eef2f5 0%, #e6ebf0 100%);
}

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

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(15, 30, 40, 0.45);
  backdrop-filter: blur(4px);
}

.login-overlay[hidden] { display: none; }

.login-card {
  width: min(400px, calc(100vw - 32px));
  background: var(--panel);
  border-radius: 14px;
  padding: 28px 28px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.login-brand {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.field { margin: 14px 0; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; margin: 8px 0; }
.login-hint { margin-top: 14px; }

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.app[hidden] { display: none; }

.sidebar {
  background: #0c3a4d;
  color: #e8f2f6;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-toggle {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: grid;
  place-items: center;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-toggle-ico,
.sidebar-reopen-ico,
.nav-ico,
.logout-ico {
  display: block;
  background: currentColor;
}

.sidebar-toggle-ico {
  width: 14px;
  height: 14px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.brand { min-width: 0; }

.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.1em;
  opacity: 0.75;
  font-weight: 600;
}

.brand h1 {
  margin: 4px 0;
  font-size: 18px;
  font-weight: 700;
}

.brand p {
  margin: 0;
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.4;
}

.nav { display: flex; flex-direction: column; gap: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: none;
  background: transparent;
  color: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  opacity: 0.85;
}

.nav-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.92;
}

.nav-item[data-nav-ico="dash"] .nav-ico {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.nav-item[data-nav-ico="list"] .nav-ico {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.nav-item[data-nav-ico="gantt"] .nav-ico {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.nav-item:hover:not(:disabled) { background: rgba(255,255,255,0.08); }
.nav-item.active { background: rgba(255,255,255,0.14); font-weight: 600; opacity: 1; }
.nav-item:disabled { opacity: 0.35; cursor: not-allowed; }

.role-box {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
}

.role-box label { opacity: 0.65; display: block; margin-bottom: 6px; }
.role-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-user { font-weight: 600; }
.role-meta { margin-top: 6px; opacity: 0.7; }

#btnLogout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.logout-ico {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.app.is-sidebar-collapsed {
  grid-template-columns: 56px 1fr;
}

.app.is-sidebar-collapsed .sidebar {
  padding: 14px 8px;
  align-items: center;
}

.app.is-sidebar-collapsed .sidebar-head {
  flex-direction: column;
  align-items: center;
}

.app.is-sidebar-collapsed .brand,
.app.is-sidebar-collapsed .nav-label,
.app.is-sidebar-collapsed .role-box label,
.app.is-sidebar-collapsed .role-user,
.app.is-sidebar-collapsed .role-meta,
.app.is-sidebar-collapsed .logout-label {
  display: none;
}

.app.is-sidebar-collapsed .sidebar-toggle-ico {
  transform: rotate(180deg);
}

.app.is-sidebar-collapsed .nav,
.app.is-sidebar-collapsed .role-box,
.app.is-sidebar-collapsed .role-row {
  align-items: center;
  justify-content: center;
}

.app.is-sidebar-collapsed .nav-item {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  gap: 0;
}

.app.is-sidebar-collapsed .role-box {
  width: 100%;
}

.app.is-sidebar-collapsed #btnLogout {
  width: 40px;
  height: 40px;
  padding: 0;
}

.main { padding: 22px 28px 40px; min-width: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.sidebar-reopen {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin-top: 2px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}

.sidebar-reopen[hidden] { display: none; }

.sidebar-reopen:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.sidebar-reopen-ico {
  width: 18px;
  height: 18px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.topbar h2 { margin: 0; font-size: 22px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.badge-row { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--ink-soft);
}

.btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
}
.btn:hover { background: var(--accent-deep); }
.btn.secondary {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 6px 10px;
  font-size: 12px;
}
.btn.secondary:hover { background: rgba(255,255,255,0.1); }
.btn.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th,
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

table.data th {
  background: #f6f8fa;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

table.data tr:hover td { background: #fafbfc; }
table.data tr.clickable { cursor: pointer; }

.progress-bar {
  height: 8px;
  background: #e8eef2;
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}
.progress-bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.status-pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f4;
  color: var(--ink-soft);
  white-space: nowrap;
}
.status-pill.in_progress { background: #dceef6; color: var(--accent-deep); }
.status-pill.done { background: #d9f0e5; color: var(--ok); }
.status-pill.delayed { background: #fde8e6; color: var(--danger); }
.status-pill.on_hold { background: #f5edd9; color: var(--warn); }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar .search {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-list-count { font-size: 12px; white-space: nowrap; }
.project-page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.project-page-size select {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.project-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}
.project-pager .btn.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}
.project-pager .btn.secondary:hover {
  background: #f3f6f4;
}
.project-pager .project-page-num {
  min-width: 36px;
  padding-left: 8px;
  padding-right: 8px;
}
.project-pager-info { margin-left: 4px; font-size: 12px; }

.project-info {
  margin-bottom: 14px;
  padding: 0;
}

.project-info-toggle {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 12px 16px;
}

.project-info-toggle:hover {
  background: #f7fafc;
}

.project-info-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 2px;
}

.project-info-summary {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.project-info-toggle-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 2px;
}

.project-info-body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--line);
}

.project-info-areas {
  margin: 12px 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 16px;
}

.info-item label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.info-item .val {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.info-item .val.muted {
  font-weight: 400;
  color: var(--ink-soft);
}

.remarks-view {
  margin-top: 12px;
}

.project-info-hint {
  margin: 10px 0 0;
  font-size: 12px;
}

.section-title {
  margin: 22px 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.gantt-board {
  margin-bottom: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-width: 100%;
}

.gantt-split {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 22px;
  align-items: stretch;
  height: min(72vh, 820px);
  max-height: min(72vh, 820px);
  min-height: 240px;
}

.gantt-frozen {
  grid-column: 1;
  grid-row: 1;
  z-index: 3;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border-right: 2px solid var(--line);
  box-shadow: 8px 0 14px rgba(20, 30, 40, 0.12);
  scrollbar-width: none;
}

.gantt-frozen::-webkit-scrollbar {
  display: none;
}

.gantt-scroll {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  cursor: grab;
  scrollbar-width: none;
}

.gantt-scroll::-webkit-scrollbar {
  width: 10px;
  height: 0 !important;
}

.gantt-scroll::-webkit-scrollbar:horizontal {
  height: 0 !important;
  display: none !important;
}

.gantt-scroll::-webkit-scrollbar:vertical {
  width: 10px;
}

.gantt-scroll input,
.gantt-scroll select,
.gantt-scroll button,
.gantt-scroll .ev-chip {
  cursor: pointer;
}

.gantt-scroll.is-panning {
  cursor: grabbing;
  user-select: none;
}

.gantt-scroll.is-panning * {
  cursor: grabbing !important;
}

.gantt-hscroll-corner {
  grid-column: 1;
  grid-row: 2;
  height: 22px;
  background: #e8eef2;
  border-top: 1px solid #9aadb8;
  border-right: 2px solid var(--line);
}

.gantt-hscroll {
  grid-column: 2;
  grid-row: 2;
  height: 22px;
  min-height: 22px;
  position: relative;
  z-index: 30;
  overflow: hidden;
  background: #c5d0d8;
  border-top: 1px solid #9aadb8;
  cursor: pointer;
  user-select: none;
}

.gantt-hscroll-thumb {
  position: absolute;
  top: 4px;
  left: 0;
  height: 14px;
  min-width: 48px;
  background: #3d5564;
  border-radius: 7px;
  cursor: grab;
  box-sizing: border-box;
  pointer-events: none;
}

.gantt-hscroll-thumb:hover,
.gantt-hscroll.is-dragging .gantt-hscroll-thumb {
  background: #2c3f4a;
}

.gantt-inner {
  width: max-content;
  min-width: 100%;
}

.gantt-frozen .gantt-head,
.gantt-frozen .gantt-row {
  display: grid;
  grid-template-columns: 280px;
  width: 280px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}

.gantt-scroll .gantt-head,
.gantt-scroll .gantt-row {
  display: grid;
  grid-template-columns: 636px max-content;
  width: max-content;
  min-width: 100%;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}

.gantt-head,
.gantt-row {
  min-height: 40px;
  height: 40px;
}

.gantt-head {
  position: sticky;
  top: 0;
  z-index: 12;
  background: #f4f7f9;
  height: 52px;
  min-height: 52px;
}

.gantt-name-col {
  display: flex;
  align-items: center;
  width: 280px;
  max-width: 280px;
  padding: 4px 10px;
  background: #fff;
  border-right: 1px solid var(--line);
  box-sizing: border-box;
  overflow: hidden;
}

.gantt-head .gantt-name-col {
  background: #f4f7f9;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  z-index: 14;
  align-items: end;
  padding-bottom: 8px;
}

.gantt-meta-col {
  display: grid;
  grid-template-columns: 108px 108px 108px 108px 96px 72px;
  gap: 4px;
  align-items: center;
  width: 636px;
  max-width: 636px;
  padding: 4px 8px;
  background: #fff;
  border-right: 1px solid var(--line);
  box-sizing: border-box;
}

.gantt-head .gantt-meta-col {
  background: #f4f7f9;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  z-index: 13;
  align-items: end;
  padding-bottom: 8px;
}

.gantt-scroll .gantt-track-wrap,
.gantt-scroll .gantt-track {
  height: 39px;
  box-sizing: border-box;
}
.gantt-row.tree-root-row {
  border-bottom: none;
}
.gantt-row.tree-root-row .gantt-name-col,
.gantt-row.tree-root-row .gantt-meta-col,
.gantt-row.tree-root-row .gantt-track {
  background: #e8892d;
}
.gantt-row.tree-root-row .gantt-track-bar-only {
  background: #f0a14a;
}
.gantt-row.tree-root-row .muted {
  color: rgba(255, 255, 255, 0.85);
}
.gantt-row.process .gantt-name-col,
.gantt-row.process .gantt-meta-col {
  background: #fff;
}
.gantt-row.work .gantt-name-col,
.gantt-row.work .gantt-meta-col {
  background: #fafbfc;
}
.gantt-row.line .gantt-name-col,
.gantt-row.line .gantt-meta-col {
  background: #f7f1e4;
}
.gantt-row.line .gantt-track {
  background-color: #fbf8f1;
}

/* tree nodes */
.gantt-col-tree,
.tree-node {
  min-width: 0;
  width: 100%;
}
.tree-node {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  position: relative;
}
.tree-toggle {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #5a6570;
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  font-family: var(--mono), ui-monospace, monospace;
  cursor: pointer;
  z-index: 2;
}
.tree-toggle:hover { color: var(--accent-deep); background: rgba(13, 92, 122, 0.08); }
.tree-toggle.is-empty {
  border: none;
  background: transparent;
  cursor: default;
  visibility: hidden;
}
.tree-root .tree-toggle {
  color: #fff;
  background: transparent;
}
.tree-root .tree-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.tree-count {
  flex: 0 0 auto;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.tree-root .tree-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.tree-process .tree-count { background: #e8f5ef; color: #1f6b4a; }
.tree-vendor {
  flex: 0 1 auto;
  max-width: 88px;
  margin-left: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef4f8;
  color: #3d4a56;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-vendor.is-empty {
  background: transparent;
  color: #9aa3ad;
  font-weight: 500;
  padding-left: 2px;
  padding-right: 2px;
}
.tree-line .tree-vendor { max-width: 110px; }
.gantt-row.is-tree-hidden { display: none !important; }
.tree-folder-ico {
  flex: 0 0 16px;
  width: 16px;
  height: 14px;
  display: inline-block;
  background-color: #5a6570;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tree-label {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.tree-root {
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 2px;
}
.tree-root .tree-label { color: #fff; }
.tree-process {
  border: 1.5px solid #1f6b4a;
  border-radius: 6px;
  background: #fff;
  padding: 4px 8px;
  color: #1a1a1a;
  font-weight: 700;
}
.tree-root .tree-folder-ico { background-color: #fff; }
.tree-process .tree-folder-ico { background-color: #c9852d; }
.tree-work {
  padding-left: 18px;
  font-weight: 600;
}
.tree-line {
  padding-left: 36px;
  font-weight: 500;
}
.tree-line.depth-1 { padding-left: 22px; }
.tree-guide {
  position: absolute;
  left: 8px;
  top: -10px;
  bottom: 50%;
  width: 16px;
  border-left: 1.5px solid #c5c0b4;
  border-bottom: 1.5px solid #c5c0b4;
  pointer-events: none;
}
.tree-work .tree-guide { left: 10px; width: 14px; }
.tree-line .tree-guide { left: 28px; width: 14px; }
.tree-line.depth-1 .tree-guide { left: 12px; }
.tree-node:not(.is-last) .tree-guide::after {
  content: "";
  position: absolute;
  left: -1.5px;
  top: 100%;
  height: 22px;
  border-left: 1.5px solid #c5c0b4;
}
.tree-label.process-link,
.tree-label.line-link {
  color: var(--accent-deep);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tree-process .tree-label.process-link { color: #14352a; text-decoration: none; }
.tree-process .tree-label.process-link:hover { color: var(--accent); text-decoration: underline; }
.tree-label.line-link:hover,
.tree-label.process-link:hover { color: var(--accent); }

.gantt-row.is-done .gantt-name-col,
.gantt-row.is-done .gantt-meta-col,
.gantt-row.is-done .gantt-track {
  opacity: 0.78;
}
.gantt-row.is-done .gantt-bar.planned { background: #9aa3ad; }
.gantt-row.is-done .gantt-bar.actual { background: #7a8a82; }

/* 予定より実績遅れ */
.gantt-row.is-delayed .gantt-name-col,
.gantt-row.is-delayed .gantt-meta-col {
  background: #fde8e6 !important;
}
.gantt-row.is-delayed .gantt-name-col {
  box-shadow: inset 3px 0 0 var(--danger);
}
.gantt-row.is-delayed .gantt-meta-col {
  box-shadow: inset 3px 0 0 transparent;
}
.gantt-row.is-delayed .gantt-track {
  background-color: #fff1ef !important;
}
.gantt-row.is-delayed.line .gantt-track-clickable {
  background-color: #fff1ef;
}
.gantt-row.is-delayed .gantt-bar.actual {
  background: #c23b2e;
}
.gantt-row.is-delayed .tree-label {
  color: var(--danger);
  font-weight: 700;
}

.gantt-col-ev {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  overflow: visible;
}
.gantt-meta-col input[type="date"],
.gantt-meta-col select {
  width: 100%;
  box-sizing: border-box;
  padding: 3px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  color: var(--ink);
}
.gantt-meta-col input[type="date"] {
  font-family: var(--mono);
}
.gantt-head .gantt-col-date,
.gantt-head .gantt-col-status,
.gantt-head .gantt-col-ev,
.gantt-head .gantt-col-tree {
  font-size: 11px;
  color: var(--muted);
}

.modal-card.wide {
  width: min(96vw, 1600px);
  max-height: 94vh;
  height: 94vh;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
}
.modal-card.wide .panel.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
tr.is-done-row td { background: #e8eaed !important; color: #6b7280; }
tr.is-sub-vendor td { background: #f4f8f6; }
.sub-vendor-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 999px;
  background: #d9ebe2;
  color: #1f5c45;
  margin-right: 6px;
  vertical-align: middle;
}
.line-memo-input {
  width: 140px;
  min-width: 110px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.sub-vendor-code {
  width: 110px;
  min-width: 88px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--mono);
}
.sub-vendor-pick {
  display: block;
  width: 100%;
  min-width: 140px;
  margin-bottom: 4px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
}
.sub-vendor-name {
  width: 100%;
  min-width: 120px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.line-table input[type="date"] {
  width: 100%;
  min-width: 118px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
/* flex trên <td> phá table layout → nền trắng lệch / border đứt */
.line-ev-cell {
  white-space: nowrap;
  vertical-align: middle;
}
.line-ev-cell .ev-chip,
.line-ev-cell label.btn {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 2px 4px 2px 0;
}

.bulk-status-select,
.line-status-select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  min-width: 100px;
}

.line-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.ev-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  height: 22px;
  min-width: 44px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: #f6f8fa;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
  box-sizing: border-box;
}
.ev-chip-ico {
  width: 12px;
  height: 11px;
  flex: 0 0 12px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ev-chip-n {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.ev-chip.has {
  background: var(--accent-soft);
  border-color: #b7d4e0;
  color: var(--accent-deep);
  font-weight: 600;
}

.gantt-timeline-head,
.gantt-track-wrap {
  position: relative;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
}

.gantt-months {
  position: relative;
  height: 22px;
}
.gantt-month {
  position: absolute;
  top: 0;
  height: 22px;
  border-right: 1px solid #d0d8e0;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 2px 6px;
  box-sizing: border-box;
}
.gantt-ticks {
  position: relative;
  height: 20px;
  border-top: 1px solid #e4e9ee;
}
.gantt-tick {
  position: absolute;
  top: 0;
  font-size: 10px;
  color: var(--muted);
  transform: translateX(2px);
  white-space: nowrap;
}

.gantt-track {
  position: relative;
  height: 36px;
  border-left: 1px solid #eef2f5;
}
/* 大工程・工程: バーのみ（マス分割なし） */
.gantt-track-bar-only {
  background: #f3f6f8;
  cursor: default;
}
.gantt-track-bar-only .gantt-bar {
  pointer-events: none;
}
.gantt-bar-span.planned {
  top: 10px;
  height: 14px;
  border-radius: 7px;
  opacity: 0.92;
}
.gantt-bar-span.actual {
  top: 16px;
  height: 6px;
  border-radius: 4px;
}
/* 明細のみ: 日マス分割＋クリック */
.gantt-track-clickable {
  cursor: cell;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 35px,
      #eef2f5 35px,
      #eef2f5 36px
    );
}
.gantt-track-clickable:hover {
  background-color: rgba(42, 120, 160, 0.04);
}
.gantt-track-clickable .gantt-bar,
.gantt-track-clickable .gantt-note-dot,
.gantt-track-clickable .gantt-cell-note,
.gantt-track-clickable .gantt-cell-hl {
  pointer-events: none;
}
.gantt-cell-note {
  position: absolute;
  top: 1px;
  bottom: 1px;
  z-index: 2;
  background: #f4e2c4;
  border: 2px solid #c9852d;
  border-radius: 3px;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}
.gantt-cell-note.has-file {
  background: #efe0c0;
  border-color: #b7791f;
}
.gantt-cell-hl {
  position: absolute;
  top: 1px;
  bottom: 1px;
  z-index: 3;
  background: rgba(230, 168, 23, 0.22);
  border: 2px solid #d4920a;
  border-radius: 3px;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  animation: gantt-cell-pulse 0.35s ease-out;
}
@keyframes gantt-cell-pulse {
  from { background: rgba(230, 168, 23, 0.7); }
  to { background: rgba(230, 168, 23, 0.35); }
}

.gantt-bar {
  position: absolute;
  border-radius: 4px;
  min-width: 4px;
}
.gantt-bar.planned {
  top: 6px;
  height: 14px;
  background: var(--accent);
  opacity: 0.88;
}
.gantt-bar.actual {
  top: 22px;
  height: 8px;
  background: #2a9d6e;
  opacity: 0.95;
}

.gantt-note-dot.has-file {
  background: #0d5c7a;
  border-radius: 2px;
}

.day-note-files {
  margin-top: 14px;
}
.day-note-files h4 {
  margin: 0 0 8px;
  font-size: 13px;
}
.ev-thumb.is-pdf {
  display: grid;
  place-items: center;
  background: #f3f6f8;
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.modal-card.day-note-card {
  width: min(92vw, 560px);
  max-height: 90vh;
  overflow: auto;
}

.gantt-legend { margin: 8px 12px 12px; }

#dayNoteBody {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  min-height: 120px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(15, 30, 40, 0.45);
  padding: 12px;
}
#dayNoteModal,
#historyModal,
#evidenceModal {
  z-index: 90;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(720px, 100%);
  max-height: min(85vh, 800px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 17px; }

.ev-upload {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}
.ev-upload input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ev-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.ev-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fafbfc;
  position: relative;
}
.ev-thumb {
  height: 110px;
  background: #e8eef2 center/cover no-repeat;
  cursor: zoom-in;
}
.ev-thumb.broken {
  display: grid;
  place-items: center;
  color: var(--danger);
  font-size: 22px;
}
.ev-item figcaption {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-del {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}

.edit-table input[type="date"],
.edit-table input[type="number"],
.edit-table select,
.edit-table input[type="text"] {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.edit-table input[type="number"] { width: 72px; font-family: var(--mono); }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}
.flash.ok { background: #d9f0e5; color: var(--ok); }
.flash.err { background: #fde8e6; color: var(--danger); }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

/* Dashboard */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dash-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.dash-card.warn { border-color: #f0c9a0; background: #fff8f0; }
.dash-card.danger { border-color: #f0b4ae; background: #fff5f4; }
.dash-card-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.dash-card-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1.2;
  margin-top: 4px;
}
.dash-card-value small { font-size: 14px; margin-left: 2px; }
.dash-card-value-sm { font-size: 20px; word-break: break-all; }
.dash-card-sub { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.dash-headline {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #eef6f4;
  border: 1px solid #cfe0d8;
  font-size: 13px;
  font-weight: 700;
}
.dash-headline.is-alert {
  background: #fff8f0;
  border-color: #f0c9a0;
  color: #8a4b12;
}
.dash-toolbar { margin-bottom: 10px; }
.dash-head-wrap {
  align-items: flex-start;
  flex-wrap: wrap;
}
.dash-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dash-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--ink-soft);
}
.dash-chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.dash-table { min-width: 720px; }
.dash-table tr.is-watch td { background: #fffaf5; }
.dash-proj-name { font-weight: 600; margin-top: 2px; }
.dash-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.dash-td-meta { font-size: 12px; }
.dash-td-yen { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.dash-dual { min-width: 140px; }
.dash-dual-row {
  display: grid;
  grid-template-columns: 52px 1fr 36px;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}
.dash-dual-row + .dash-dual-row { margin-top: 4px; }
.dash-dual-k { color: var(--muted); }
.dash-dual b { font-variant-numeric: tabular-nums; text-align: right; }
.dash-prog.is-plan > span { background: #c5ced6; }
.dash-group {
  list-style: none;
  margin: 0;
  padding: 0 16px 10px;
  display: grid;
  gap: 10px;
}
.dash-group-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}
.dash-group-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  margin-top: 3px;
}
.dash-upcoming { cursor: pointer; }
.dash-upcoming:hover { background: #f7fafc; }
.pill-warn {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff4d6;
  color: #8a4b12;
  font-size: 10px;
  font-weight: 700;
}
.pill-mute {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.dash-panel { padding: 0 0 12px; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px 8px;
}
.panel-head h3 { margin: 0; font-size: 14px; }
.dash-status-bar {
  display: flex;
  height: 14px;
  margin: 4px 16px 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #eef2f5;
}
.dash-seg { display: block; height: 100%; }
.dash-seg.done { background: #2a9d6e; }
.dash-seg.in_progress { background: var(--accent); }
.dash-seg.not_started { background: #c5ced6; }
.dash-seg.delayed { background: var(--danger); }
.dash-seg.on_hold { background: #d4a017; }
.dash-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 0 16px 4px;
  font-size: 12px;
  color: var(--ink-soft);
}
.dash-status-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.dash-status-legend .dot.done { background: #2a9d6e; }
.dash-status-legend .dot.in_progress { background: var(--accent); }
.dash-status-legend .dot.not_started { background: #c5ced6; }
.dash-status-legend .dot.delayed { background: var(--danger); }
.dash-status-legend .dot.on_hold { background: #d4a017; }
.dash-prog {
  height: 6px;
  background: #eef2f5;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
  min-width: 72px;
}
.dash-prog > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.num-danger { color: var(--danger); font-weight: 700; }
.pill-danger {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fde8e6;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
}
.dash-feed {
  list-style: none;
  margin: 0;
  padding: 0 16px 8px;
  max-height: 420px;
  overflow: auto;
}
.dash-feed li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.dash-feed li:last-child { border-bottom: none; }
.feed-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.feed-body { font-size: 12px; margin-top: 2px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { padding: 14px; }
  .main { padding: 16px; }
  .dash-grid { grid-template-columns: 1fr; }
  .app.is-sidebar-collapsed { grid-template-columns: 1fr; }
  .app.is-sidebar-collapsed .sidebar { display: none; }
  .info-grid { grid-template-columns: 1fr; }
}
