.system-projects-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 auto;
  max-width: var(--system-admin-page-max-width, 1320px);
  padding: 18px 20px 96px;
}

.system-projects-workbar {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8e1e7;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}

.system-projects-filters,
.system-projects-actions,
.system-projects-summary {
  align-items: end;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.system-projects-filters {
  flex-wrap: wrap;
}

.system-projects-actions {
  margin-left: auto;
}

.system-projects-summary {
  align-items: center;
  flex: 0 0 auto;
}

.system-projects-metric {
  align-items: center;
  background: #f5f8fa;
  border: 1px solid #d8e1e7;
  border-radius: 6px;
  display: flex;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
}

.system-projects-metric span,
.system-projects-search span,
.system-projects-filter span {
  color: #5b6b76;
  font-size: 12px;
  font-weight: 700;
}

.system-projects-metric strong {
  color: #1d2b34;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.system-projects-search,
.system-projects-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.system-projects-search input,
.system-projects-filter select {
  background: #ffffff;
  border: 1px solid #c8d3db;
  border-radius: 6px;
  color: #1f2d36;
  font-size: 14px;
  min-height: 38px;
  padding: 8px 10px;
}

.system-projects-search input {
  width: 280px;
}

.system-projects-search input:focus,
.system-projects-filter select:focus,
.system-projects-field input:focus,
.system-projects-field select:focus,
.system-projects-field textarea:focus,
.system-projects-toggle:focus-within {
  border-color: #1f7a6c;
  box-shadow: 0 0 0 3px rgba(31, 122, 108, 0.16);
  outline: none;
}

.system-projects-icon-button {
  flex: 0 0 auto;
  font-size: 18px;
  height: 38px;
  min-height: 38px;
  width: 38px;
}

.system-projects-icon-button svg {
  height: 18px;
  width: 18px;
}

.system-projects-table-section {
  background: #ffffff;
  border: 1px solid #c8d3db;
  border-radius: 8px;
  overflow: hidden;
}

.system-projects-section-header {
  align-items: center;
  background: #eef6f3;
  border-bottom: 1px solid #c4d7d1;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.system-projects-section-header h2,
.system-projects-dialog-header h2 {
  align-items: center;
  color: #173f38;
  display: flex;
  font-size: 17px;
  gap: 8px;
  margin: 0;
}

.system-projects-section-header h2::before,
.system-projects-dialog-header h2::before {
  background: #1f7a6c;
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 18px;
  width: 4px;
}

.system-projects-section-header .status,
.system-projects-dialog-footer .status {
  align-items: center;
  background: #eef3f6;
  border: 1px solid #cfdbe3;
  border-radius: 999px;
  color: #41525e;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  max-width: min(360px, 48vw);
  min-height: 28px;
  overflow: hidden;
  padding: 6px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-projects-section-header .status.error,
.system-projects-dialog-footer .status.error {
  background: #fff0ed;
  border-color: #e0aaa2;
  color: #9a3027;
}

.system-projects-grid {
  height: clamp(360px, calc(100vh - 320px), 660px);
  width: 100%;
}

.system-projects-page .tabulator {
  background: #ffffff;
  border: 0;
  color: #22313b;
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 12px;
}

.system-projects-page .tabulator .tabulator-header {
  background: #f5f8fa;
  border-bottom: 1px solid #d4dee5;
  color: #4f606c;
  font-weight: 800;
}

.system-projects-page .tabulator .tabulator-header .tabulator-col {
  background: #f5f8fa;
  border-right: 1px solid #d4dee5;
}

.system-projects-page .tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  padding: 7px 8px;
}

.system-projects-page .tabulator .tabulator-col-title {
  text-align: center;
}

.system-projects-page .tabulator .tabulator-tableholder {
  overflow-x: hidden;
}

.system-projects-page .tabulator-row {
  border-bottom: 1px solid #d4dee5;
}

.system-projects-page .tabulator-row .tabulator-cell {
  align-items: center;
  border-right: 1px solid #d4dee5;
  box-sizing: border-box;
  display: inline-flex;
  justify-content: center;
  line-height: 1.35;
  padding: 7px 8px;
  text-align: center;
  white-space: nowrap;
}

.system-projects-page .tabulator-row .tabulator-cell.system-projects-truncate-cell {
  justify-content: flex-start;
  text-align: left;
}

.system-projects-page .tabulator-row .tabulator-cell.system-projects-truncate-cell span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.system-projects-page .tabulator-placeholder {
  color: #6a7882;
  font-weight: 700;
}

.system-projects-truncate-cell {
  text-align: left;
}

.system-projects-date-cell {
  font-variant-numeric: tabular-nums;
}

.system-projects-code-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.system-projects-code {
  color: #173f38;
  font-weight: 800;
  white-space: nowrap;
}

.system-projects-subtext {
  color: #667681;
  display: block;
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-projects-chip {
  background: #eef3f6;
  border: 1px solid #cfdbe3;
  border-radius: 999px;
  box-sizing: border-box;
  color: #41525e;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  padding: 5px 8px;
  white-space: nowrap;
}

.system-projects-chip.is-active,
.system-projects-chip.is-confirmed,
.system-projects-chip.is-client-project {
  background: #e8f5f1;
  border-color: #9ccfc0;
  color: #166657;
}

.system-projects-chip.is-inactive,
.system-projects-chip.is-needs-review {
  background: #f6eeee;
  border-color: #e1bcbc;
  color: #8b3434;
}

.system-projects-chip.is-not-required,
.system-projects-chip.is-company-shared {
  background: #eef3f8;
  border-color: #b8c8da;
  color: #41576f;
}

.system-projects-chip.is-organization-internal {
  background: #f5f1ea;
  border-color: #d9c7a9;
  color: #6d542b;
}

.system-projects-row-actions {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: center;
}

.system-projects-action-empty {
  color: #7a8790;
  font-weight: 700;
}

.system-projects-row-button {
  align-items: center;
  background: #2c7892;
  border: 1px solid #25677d;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.system-projects-row-button:hover:not(:disabled) {
  background: #24677d;
  border-color: #205d72;
  color: #ffffff;
}

.system-projects-row-button.is-danger {
  background: #a84a3f;
  border-color: #913d34;
}

.system-projects-row-button.is-danger:hover:not(:disabled) {
  background: #913d34;
  border-color: #7f352d;
}

.system-projects-row-button:disabled {
  background: #d7e0e5;
  border-color: #c3ced6;
  color: #6b7a84;
  cursor: not-allowed;
  opacity: 0.72;
}

.system-projects-row-button svg {
  height: 14px;
  width: 14px;
}

.system-projects-dialog {
  border: 1px solid #c8d3db;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(24, 36, 44, 0.28);
  color: #22313b;
  max-width: 880px;
  padding: 0;
  width: min(880px, calc(100vw - 28px));
}

.system-projects-merge-dialog {
  max-width: 640px;
  width: min(640px, calc(100vw - 28px));
}

.system-projects-dialog::backdrop {
  background: rgba(18, 28, 35, 0.42);
}

.system-projects-dialog form {
  display: flex;
  flex-direction: column;
  max-height: min(780px, calc(100vh - 40px));
}

.system-projects-dialog-header,
.system-projects-dialog-footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.system-projects-dialog-header {
  background: #eef6f3;
  border-bottom: 1px solid #d3e4df;
  border-radius: 8px 8px 0 0;
}

.system-projects-dialog-close {
  align-items: center;
  background: #2c7892;
  border: 1px solid #25677d;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.system-projects-dialog-close svg {
  height: 17px;
  width: 17px;
}

.system-projects-dialog-close:hover {
  background: #24677d;
  border-color: #205d72;
  color: #ffffff;
}

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

.system-projects-field,
.system-projects-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.system-projects-merge-project,
.system-projects-merge-summary {
  background: #f5f8fa;
  border: 1px solid #d8e1e7;
  border-radius: 6px;
  box-sizing: border-box;
  display: flex;
  gap: 8px;
  min-height: 38px;
  padding: 10px;
}

.system-projects-merge-project {
  flex-direction: column;
}

.system-projects-merge-project strong {
  color: #173f38;
  font-size: 14px;
}

.system-projects-merge-summary {
  align-items: center;
  flex-wrap: wrap;
}

.system-projects-merge-empty {
  color: #667681;
  font-size: 13px;
}

.system-projects-field span,
.system-projects-toggle span,
.system-projects-merge-project span {
  color: #50616d;
  font-size: 12px;
  font-weight: 700;
}

.system-projects-field input,
.system-projects-field select,
.system-projects-field textarea {
  background: #ffffff;
  border: 1px solid #c8d3db;
  border-radius: 6px;
  color: #1f2d36;
  font-size: 14px;
  min-height: 38px;
  padding: 8px 10px;
}

.system-projects-field textarea {
  min-height: 72px;
  resize: vertical;
}

.system-projects-field input[readonly] {
  background: #f5f8fa;
  color: #63727d;
}

.system-projects-toggle {
  align-items: center;
  align-self: end;
  background: #f5f8fa;
  border: 1px solid #d8e1e7;
  border-radius: 6px;
  box-sizing: border-box;
  flex-direction: row;
  height: 38px;
  min-height: 38px;
  padding: 8px 10px;
}

.system-projects-toggle input {
  height: 16px;
  margin: 0;
  width: 16px;
}

.system-projects-dialog-footer {
  border-top: 1px solid #edf1f4;
  justify-content: flex-end;
}

.system-projects-dialog-footer button[type="submit"] {
  min-width: 96px;
}

@media (max-width: 1000px) {
  .system-projects-workbar {
    align-items: stretch;
    flex-direction: column;
  }

  .system-projects-actions {
    align-items: stretch;
    flex-wrap: wrap;
    margin-left: 0;
  }

  .system-projects-summary {
    flex-wrap: wrap;
  }

  .system-projects-search {
    flex: 1 1 260px;
  }

  .system-projects-search input {
    width: 100%;
  }
}

@media (max-width: 800px) {
  .system-projects-main {
    padding: 12px 12px 84px;
  }

  .system-projects-metric,
  .system-projects-filter {
    flex: 1 1 128px;
  }

  .system-projects-dialog-grid {
    grid-template-columns: 1fr;
  }
}
