html,
body {
  height: 100%;
  margin: 0;
}

.container-of-ol-map {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 10;
}

body.map-active .app-shell {
  pointer-events: none;
}

body.map-active .mainpage-sidebar:not(.is-hidden),
body.map-active .mainpage-sidebar:not(.is-hidden) * {
  pointer-events: auto;
}

body.map-active .mainpage-sidebar-controls.is-floating,
body.map-active .mainpage-sidebar-controls.is-floating * {
  pointer-events: auto;
}

body.map-active .app-toolbar-container,
body.map-active .app-toolbar-container * {
  pointer-events: auto;
}

.app-toolbar-container {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px;
  display: flex;
  justify-content: flex-start;
}

.mainpage-sidebar {
  position: fixed;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: var(--mainpage-sidebar-width, 320px);
  min-width: 220px;
  max-width: 100vw;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #cfd8dc;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 15;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mainpage-sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  background: rgba(255, 255, 255, 0.96);
}

.mainpage-sidebar.is-hidden {
  transform: translateX(calc(-100% - 16px));
  opacity: 0;
  pointer-events: none;
}

.mainpage-sidebar-content {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mainpage-sidebar-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  margin-left: auto;
}

.mainpage-sidebar-controls.is-floating {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 25;
  margin-left: 0;
}


.mainpage-sidebar-control-button {
  padding: 0px 0px;
  border: 3px solid #cfd8dc;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.mainpage-sidebar-control-button:hover {
  background: #f5f7f9;
}

.mainpage-sidebar-control-button.is-drag {
  cursor: ew-resize;
}

.mainpage-sidebar-toggle {
  font-size: 48px;
}

.mainpage-sidebar-drag-edge {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 14px;
  cursor: ew-resize;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(55, 71, 79, 0.15) 100%);
  touch-action: none;
  user-select: none;
}

.mainpage-sidebar-toggle {
  position: absolute;
  top: 20px;
  transform: translate(-50%, -50%);
  z-index: 2;
  background: #eef2f6;
  border: 1px solid #cfd8dc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.mainpage-sidebar-toggle.is-show {
  border-style: solid;
  left: 10px;
}

.mainpage-sidebar-drag-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 48px;
  border-radius: 12px;
  background: #eef2f6;
  border: 1px solid #cfd8dc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}

.mainpage-sidebar-drag-indicator::before,
.mainpage-sidebar-drag-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  opacity: 0.85;
  transform: translateY(-50%);
}

.mainpage-sidebar-drag-indicator::before {
  left: 2px;
  border-right: 6px solid #6b7a88;
}

.mainpage-sidebar-drag-indicator::after {
  right: 2px;
  border-left: 6px solid #6b7a88;
}

.mainpage-sidebar-drag-edge:hover {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(55, 71, 79, 0.25) 100%);
}

.mainpage-sidebar-drag-edge:hover .mainpage-sidebar-drag-indicator {
  background: #e3e9ef;
  border-color: #c1ccd6;
}

.ol-map-wrapper {
  width: 100%;
  height: 100%;
}

.ol-map {
  width: 100%;
  height: 100%;
  border: 1px solid #cfd8dc;
  border-radius: 4px;
}

.map-draw-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 6;
  pointer-events: none;
}

.map-draw-controls {
  pointer-events: auto;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #cfd8dc;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
  max-width: min(240px, 38vw);
}

.map-draw-input {
  width: 100%;
  box-sizing: border-box;
}

.map-draw-input[type="color"] {
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
}

.map-draw-input[type="range"] {
  height: 24px;
}

.map-draw-input[type="text"] {
  padding: 6px 8px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
}

.map-draw-button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.map-draw-button:hover {
  background: #f5f7f9;
}

.ol-zoom {
  display: none;
}

.app-toolbar {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cfd8dc;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}

.mainpage-sidebar .app-toolbar {
  position: static;
  transform: none;
  display: flex;
  max-width: 100%;
  width: 100%;
  flex-direction: row;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cfd8dc;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  flex: 1 1 auto;
  min-width: 0;
}

.mainpage-sidebar .app-toolbar-elements {
  justify-content: flex-start;
}

.app-toolbar-elements {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-toolbar-elements>div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mainpage-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-toolbar button {
  padding: 6px 10px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 32px;
}

.app-toolbar button:hover {
  background: #f5f7f9;
}

.toolbar-icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar-toggle-button {
  font-size: 1.05rem;
}

.app-toolbar-message {
  color: #37474f;
  font-size: 0.9rem;
  min-height: 1em;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.app-toolbar-message-active {
  background: linear-gradient(120deg, #e8f2ff 0%, #f6fbff 100%);
  border: 1px solid #c8d9f2;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #1f3b59;
  box-shadow: 0 2px 8px rgba(31, 59, 89, 0.14);
}

.projectlist-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.projectlist-outer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.projectlist-action-button {
  display: inline-flex;
  align-items: center;
  width: auto;
  padding: 8px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
}

.projectlist-create-button {
  background: #2f80ed;
  border-color: #2f80ed;
  color: #fff;
}

.projectlist-create-button:hover {
  background: #2368c7;
  border-color: #2368c7;
}

.projectlist-loadmore-button {
  background: #f5f7f9;
  align-self: flex-start;
}

.projectlist-loadmore-button:hover {
  background: #e8edf2;
}

.projectlist-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.projectlist-search {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  box-sizing: border-box;
}

.projectlist-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}

.projectlist-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #37474f;
}

.projectlist-message {
  font-size: 0.85rem;
}

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

.projectlist-item-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid #d6dde3;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.projectlist-item-button:hover {
  background: #f5f7f9;
  border-color: #cfd8dc;
}

.projectlist-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
}

.projectlist-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.projectlist-item-text {
  flex: 1 1 auto;
  min-width: 0;
  color: #37474f;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projectlist-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 5px;
  background: #eef2f6;
  border: 1px solid #d7dee6;
  color: #5a6a78;
  font-size: 0.82rem;
  max-width: 180px;
}

.user-chip-name {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-avatar {
  border-radius: 8px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.user-toolbar,
.user-toolbar-auth,
.user-toolbar-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-toolbar-chip {
  padding: 2px 6px;
  border-radius: 8px;
  background: #f3f6f9;
  border: 1px solid #d7dee6;
}

.user-toolbar-chip .user-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.user-toolbar-button img {
  display: block;
}

button.user-toolbar-user-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 1px 1px;
  margin: 0px 0px;
}


.user-toolbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}

.user-toolbar-user-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-toolbar-settings-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.user-avatar-upload-button {
  position: relative;
  width: 180px;
  height: 180px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #d7dee6;
  background: #f5f7f9;
  cursor: pointer;
  overflow: hidden;
  align-self: flex-start;
}

.user-avatar-upload-button:hover .user-avatar-upload-overlay {
  background: rgba(38, 50, 56, 0.78);
}

.user-avatar-upload-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-upload-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 10px;
  background: rgba(38, 50, 56, 0.6);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.user-avatar-upload-input {
  display: none;
}

.project-avatar-upload-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-avatar-upload-button {
  position: relative;
  width: 120px;
  height: 120px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #d7dee6;
  background: #f5f7f9;
  cursor: pointer;
  overflow: hidden;
  align-self: flex-start;
}

.project-avatar-upload-button:hover .project-avatar-upload-overlay {
  background: rgba(38, 50, 56, 0.78);
}

.project-avatar-upload-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-avatar-upload-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 10px;
  background: rgba(38, 50, 56, 0.6);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.project-avatar-upload-input {
  display: none;
}

.project-avatar-upload-help {
  font-size: 0.8rem;
  color: #546e7a;
}

.votes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.votes-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #cfd8dc;
  background: #f5f7f9;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.votes-button:hover {
  background: #e8edf2;
}

.votes-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.votes-button.is-selected.votes-button-up {
  background: #e6f4ff;
  border-color: #90caf9;
}

.votes-button.is-selected.votes-button-down {
  background: #ffebee;
  border-color: #ef9a9a;
}

.votes-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.votes-count {
  font-size: 0.75rem;
  color: #546e7a;
  min-width: 16px;
  text-align: center;
}

.app-content {
  padding: 16px;
  box-sizing: border-box;
}

body.map-active .app-content {
  padding: 0;
}

.app-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  color: #263238;
}

.app-page-title {
  margin: 0;
  font-size: 1.25rem;
  color: #263238;
}

.user-page-title {
  display: none;
}

.app-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e0e6eb;
  background: #fff;
}

.app-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #60707f;
}

.app-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.app-field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #546e7a;
}

.app-input,
.app-select,
.app-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  box-sizing: border-box;
  background: #fff;
  font: inherit;
}

.app-input[type="file"] {
  padding: 6px 8px;
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.app-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.app-inline .app-input,
.app-inline .app-select {
  flex: 1 1 220px;
  width: auto;
  min-width: 160px;
}

.app-status {
  margin: 0;
  font-size: 0.85rem;
  color: #546e7a;
}

.user-settings-username {
  font-size: 2rem;
  font-weight: 600;
  color: #263238;
  text-align: center;
}

.app-status.is-error {
  color: #c62828;
}

.app-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-list-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d6dde3;
  border-radius: 10px;
  background: #fff;
}

.app-list-item.is-empty {
  background: #f7f9fb;
  border-style: dashed;
  color: #60707f;
}

.app-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #546e7a;
}

.app-checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: #2f80ed;
}

.user-captcha-image {
  max-width: 160px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #f5f7f9;
  object-fit: contain;
}

.user-list-controls {
  justify-content: flex-start;
}

.user-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.user-list-roles,
.admin-user-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-role-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f6;
  border: 1px solid #d7dee6;
  color: #546e7a;
  font-size: 0.75rem;
}

.user-role-pill.is-empty {
  background: #f7f9fb;
  color: #78909c;
}

.user-list-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.user-list-actions,
.admin-user-actions {
  justify-content: flex-start;
}

.project-admin-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-admin-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-admin-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-role-perms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 12px;
}

.admin-role-title {
  font-weight: 600;
  color: #263238;
}

.admin-delete {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e0e6eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.membership-item-header,
.admin-user-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.user-id-pill {
  background: #e8eef4;
  color: #455a64;
}

.membership-requested-at {
  margin-left: auto;
  font-size: 0.78rem;
  color: #60707f;
}

.pending-item-button {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.project-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.project-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.project-detail-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.project-detail-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.project-detail-owner .user-chip {
  background: #f3f6f9;
}

.project-detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #cfd8dc;
  background: #f5f7f9;
  object-fit: cover;
}

.project-detail-title-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.project-detail-title {
  margin: 0;
  font-size: 1.1rem;
  color: #263238;
}

.project-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.8rem;
  color: #546e7a;
}

.project-detail-meta>*:empty {
  display: none;
}

.project-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8eef4;
  border: 1px solid #d0d9e2;
  font-weight: 600;
}

.project-approval-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  background: #fff4cf;
  border: 1px solid #ffe3a3;
  color: #7a5b00;
}

.project-detail-actions,
.project-detail-membership-actions,
.project-detail-admin-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.project-detail-actions {
  padding-top: 4px;
}

.project-detail-membership {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e0e6eb;
  background: #f7f9fb;
}

.project-detail-membership .membership-status {
  font-size: 0.85rem;
  color: #37474f;
}

.project-detail-admin-actions {
  padding-top: 6px;
  border-top: 1px solid #e0e6eb;
}

.project-action {
  padding: 6px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.project-action:hover {
  background: #f5f7f9;
}

.project-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.project-action-primary {
  background: #2f80ed;
  border-color: #2f80ed;
  color: #fff;
}

.project-action-primary:hover {
  background: #2368c7;
  border-color: #2368c7;
}

.project-action-secondary {
  background: #f5f7f9;
}

.project-action-muted {
  background: #fff;
  color: #546e7a;
}

.project-action-danger {
  background: #fff5f5;
  border-color: #f2b4b4;
  color: #c62828;
}

.project-detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #e0e6eb;
  background: #fff;
}

.project-detail-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #60707f;
}

.project-detail-content {
  gap: 12px;
}

.project-detail-description {
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #e0e6eb;
  background: #fafbfc;
}

.project-detail-description .wysiwyg-display {
  margin: 0;
}

.project-detail-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #e0e6eb;
  background: #f9fbfd;
}

.project-detail-files>div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-detail-files button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #fff;
  cursor: pointer;
}

.project-detail-files a {
  color: #1e5cc0;
  text-decoration: none;
  word-break: break-word;
}

.project-detail-files a:hover {
  text-decoration: underline;
}

.project-detail-threads {
  gap: 12px;
}

.project-detail-threads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.project-detail-thread-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#messageThreadListContainer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#messageThreadListContainer .message-thread-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #d6dde3;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#messageThreadListContainer .message-thread-list-item:hover {
  background: #f5f7f9;
  border-color: #cfd8dc;
}

#messageThreadListContainer .message-thread-list-button {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
  color: #263238;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#messageThreadListContainer .message-thread-list-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

#messageThreadListContainer .message-thread-list-author {
  display: flex;
  align-items: center;
}

#messageThreadListContainer .message-thread-list-votes {
  display: flex;
  align-items: center;
  gap: 6px;
}

#messageThreadListPagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#messageThreadListPagination button {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #fff;
  cursor: pointer;
}

#messageThreadListPagination button.active {
  background: #2f80ed;
  border-color: #2f80ed;
  color: #fff;
}

.thread-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.thread-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.thread-detail-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.thread-detail-title {
  margin: 0;
  font-size: 1.05rem;
  color: #263238;
}

.thread-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: #546e7a;
}

.thread-detail-meta>*:empty {
  display: none;
}

.thread-detail-meta-user {
  display: flex;
  align-items: center;
}

.thread-detail-meta-time {
  font-size: 0.78rem;
  color: #60707f;
}

.thread-detail-meta-fallback {
  font-size: 0.82rem;
  color: #78909c;
}

.thread-detail-header-right {
  display: flex;
  align-items: center;
}

.thread-detail-votes {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thread-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.thread-detail-description {
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #e0e6eb;
  background: #fafbfc;
}

.thread-detail-description .wysiwyg-display {
  margin: 0;
}

.thread-detail-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #e0e6eb;
  background: #f9fbfd;
}

.thread-detail-files>div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thread-detail-files button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #fff;
  cursor: pointer;
}

.thread-detail-files a {
  color: #1e5cc0;
  text-decoration: none;
  word-break: break-word;
}

.thread-detail-files a:hover {
  text-decoration: underline;
}

.thread-detail-edit {
  background: #f9fbfd;
}

.thread-edit-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #546e7a;
}

.thread-edit-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  box-sizing: border-box;
}

.thread-edit-draw {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thread-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thread-edit-status {
  font-size: 0.82rem;
  color: #546e7a;
}

.thread-detail-poll {
  gap: 10px;
}

.thread-detail-poll-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thread-detail-poll-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thread-detail-messages {
  gap: 12px;
}

.thread-detail-messages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.thread-messages-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thread-messages-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.thread-messages-pagination button {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #fff;
  cursor: pointer;
}

.thread-messages-pagination button.active {
  background: #2f80ed;
  border-color: #2f80ed;
  color: #fff;
}

.message-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d6dde3;
  border-radius: 10px;
  background: #fff;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.message-author {
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #60707f;
}

.message-status {
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff4cf;
  border: 1px solid #ffe3a3;
  color: #7a5b00;
  font-weight: 600;
}

.message-body {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #e0e6eb;
  background: #fafbfc;
}

.message-body .wysiwyg-display {
  margin: 0;
}

.message-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #e0e6eb;
  background: #f9fbfd;
}

.message-files button {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #fff;
  cursor: pointer;
}

.message-files a {
  color: #1e5cc0;
  text-decoration: none;
  word-break: break-word;
}

.message-files a:hover {
  text-decoration: underline;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.message-votes {
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-edit-container {
  padding: 8px;
  border-radius: 8px;
  border: 1px dashed #cfd8dc;
  background: #f7f9fb;
}

.message-edit-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #546e7a;
}

.message-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.message-edit-status {
  font-size: 0.8rem;
  color: #546e7a;
}

.compose-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compose-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compose-title {
  margin-bottom: 2px;
}

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

.compose-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  box-sizing: border-box;
}

.compose-textarea {
  min-height: 160px;
  resize: vertical;
}

.compose-wysiwyg .wysiwyg-editor {
  margin: 0;
}

.compose-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.compose-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #546e7a;
}

.compose-checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: #2f80ed;
}

.project-detail-edit {
  background: #f9fbfd;
}

.project-edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-edit-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  box-sizing: border-box;
}

.project-edit-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-edit-row-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #546e7a;
}

.project-edit-file {
  width: 100%;
}

.project-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-edit-status,
.project-edit-geometry-status {
  font-size: 0.82rem;
  color: #546e7a;
}

.wysiwyg-editor {
  padding: 10px;
  margin: 10px 0;
  max-width: 100%;
  box-sizing: border-box;
}

.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  max-width: 100%;
}

.wysiwyg-toolbar button,
.wysiwyg-toolbar select,
.wysiwyg-toolbar input {
  padding: 4px 8px;
  cursor: pointer;
  min-height: 30px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
  box-sizing: border-box;
}

.wysiwyg-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
}

.wysiwyg-toolbar select {
  max-width: 120px;
}

.wysiwyg-toolbar button:hover,
.wysiwyg-toolbar select:hover,
.wysiwyg-toolbar input:hover {
  background-color: #e0e0e0;
}

.wysiwyg-toolbar button.active {
  background-color: #ccc;
}

.smiley-modal,
.symbols-modal,
.icons-modal,
.color-modal {
  position: absolute;
  padding: 8px;
  z-index: 10000;
  max-width: min(360px, 90vw);
  max-height: min(280px, 45vh);
  overflow: auto;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

.smiley-close,
.symbols-close,
.icons-close,
.color-close {
  display: block;
  margin-bottom: 10px;
  padding: 5px;
  cursor: pointer;
}

.smiley-grid,
.symbols-grid,
.icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
  gap: 6px;
}

.smiley-grid button,
.symbols-grid button,
.icons-grid button {
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icons-grid button:hover {
  background-color: #f0f0f0;
}

.color-close {
  display: block;
  margin-bottom: 10px;
  padding: 5px;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  cursor: pointer;
}

.color-close:hover {
  background-color: #e0e0e0;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: 6px;
}

.color-grid button {
  width: 40px;
  height: 40px;
  border: 1px solid #ccc;
  cursor: pointer;
  border-radius: 3px;
}

.color-grid button:hover {
  border-color: #000;
}

.wysiwyg-content {
  min-height: 200px;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 4px;
  background-color: #fff;
}

.wysiwyg-display {
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 4px;
  background-color: #f9f9f9;
  margin: 10px 0;
}

.wysiwyg-content img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  cursor: pointer;
}

.wysiwyg-image-selected {
  outline: 2px solid #4a90e2;
}

.wysiwyg-image-overlay {
  position: absolute;
  border: 1px dashed #4a90e2;
  pointer-events: none;
  box-sizing: border-box;
  z-index: 5;
}

.wysiwyg-image-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #4a90e2;
  border-radius: 50%;
  right: -6px;
  bottom: -6px;
  cursor: se-resize;
  pointer-events: auto;
}
