* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #f3f4f6;
  color: #111827;
  font-family: Arial, sans-serif;
}

.hidden {
  display: none !important;
}

header {
  background: #152238;
  color: DimGray;
  padding: 30px 20px 24px;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "logo actions";
  align-items: center;
  gap: 10px 24px;
}

header h1 {
  font-size: 52px;
  font-weight: 900;
  margin-bottom: 14px;
}

.header-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0;
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  transform: scale(1.03);
}

.admin-btn {
  background: #f59e0b;
  color: #111827;
}

.archive-btn {
  background: #2563eb;
  color: white;
}

.db-btn {
  background: #7c3aed;
  color: white;
}

.excel-btn {
  background: #15803d;
  color: white;
}

.secondary {
  background: #4b5563;
  color: white;
}

.danger {
  background: #dc2626;
  color: white;
}

.archive-action {
  background: #2563eb;
  color: white;
}

.unarchive-action {
  background: #10b981;
  color: white;
}

.priority-action {
  background: #dc2626;
  color: white;
}

.priority-action.active {
  background: #991b1b;
}

main {
  max-width: 1400px;
  margin: 30px auto;
  padding: 0 20px;
}

.project-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.project-tab {
  background: #e5e7eb;
  color: #374151;
  border-radius: 8px 8px 0 0;
  padding: 12px 18px;
  white-space: nowrap;
}

.project-tab.active {
  background: white;
  color: #111827;
  box-shadow: 0 -2px 14px rgba(0,0,0,0.06);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  background: #f3f4f6;
}

.icon-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.documentation-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.documentation-edit-btn {
  flex: 0 0 auto;
}

.panel {
  background: white;
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.panel h2 {
  margin-bottom: 22px;
  font-size: 36px;
}

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

input,
textarea,
select {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
}

input[type="text"],
input[type="password"],
input[type="date"] {
  flex: 1;
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
}

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

.project-card {
  position: relative;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 18px;
  padding: 20px;
  padding-bottom: 70px;
  min-height: 250px;
  cursor: pointer;
  transition: 0.2s;
}

.project-card:hover {
  transform: translateY(-3px);
}

.priority-project {
  border: 3px solid #dc2626;
  background: #fff5f5;
}

.project-card-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title title"
    "tasks statuses";
  gap: 14px;
  align-items: flex-start;
}

.project-left {
  min-width: 0;
  width: 100%;
  display: contents;
}

.project-title {
  font-weight: 800;
  line-height: 1.1;
  width: 100%;
}

.single-line-title {
  grid-area: title;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(15px, 2vw, 24px);
}

.project-status-column {
  grid-area: statuses;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: 210px;
}

.project-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.priority-badge {
  background: #fee2e2;
  color: #b91c1c;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.deadline-badge {
  background: #fee2e2;
  color: #991b1b;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.project-progress-tasks {
  margin-top: 10px;
  color: #374151;
}

.project-progress-tasks strong {
  display: block;
  margin-bottom: 6px;
  color: #b45309;
}

.project-progress-tasks.compact {
  grid-area: tasks;
  margin-top: 0;
  font-size: 13px;
  min-width: 0;
}

.project-progress-tasks.compact strong {
  font-size: 13px;
  margin-bottom: 4px;
}

.progress-task-line {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-bottom: 3px;
}

.compact-muted {
  grid-area: tasks;
  font-size: 13px;
  margin-top: 0;
}

.project-settings-btn {
  position: absolute;
  right: 16px;
  bottom: 16px;
  background: #111827;
  color: white;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 22px;
}

.project-settings-panel {
  position: absolute;
  right: 16px;
  bottom: 72px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
}

.project-settings-panel button {
  width: 180px;
}

.muted {
  color: #6b7280;
  margin-bottom: 10px;
}

.status {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.status-new {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-progress {
  background: #fef3c7;
  color: #b45309;
}

.status-done {
  background: #dcfce7;
  color: #15803d;
}

.status-archived {
  background: #e5e7eb;
  color: #374151;
}

.task-card {
  background: #f9fafb;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid #e5e7eb;
}

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

.task-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.task-title {
  font-size: 18px;
  font-weight: 700;
  word-break: break-word;
}

.task-workers-btn {
  background: #6366f1;
  color: white;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 16px;
}

.task-comments-btn {
  width: 38px;
  height: 38px;
  background: #eef2ff;
}

.task-comments-btn img {
  width: 22px;
  height: 22px;
}

.task-workers-list {
  margin-top: 12px;
  color: #4b5563;
  line-height: 1.4;
  white-space: pre-line;
}

.task-workers-list strong {
  color: #111827;
}

.task-delete-x {
  background: transparent;
  color: #dc2626;
  border: none;
  padding: 0 4px;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.task-delete-x:hover {
  color: #991b1b;
  transform: scale(1.15);
}

.status-select {
  min-width: 180px;
}

.notes-save-info {
  margin-top: 10px;
  color: #16a34a;
  font-size: 14px;
}

.db-preview {
  background: #111827;
  color: #d1fae5;
  border-radius: 14px;
  padding: 18px;
  margin-top: 16px;
  margin-bottom: 22px;
  max-height: 400px;
  overflow: auto;
  font-size: 13px;
  white-space: pre-wrap;
}

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

.admin-status {
  margin: 8px 0 18px;
  color: #6b7280;
  font-weight: 700;
}

.priority-title-panel {
  border: 3px solid #dc2626;
  background: #fff5f5;
}

.project-title-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-title-content h2 {
  margin-bottom: 0;
}

.project-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.project-status-line .priority-title-badge {
  margin-left: 0;
}

.project-created-at {
  color: #4b5563;
  font-weight: 800;
}

.project-home-actions {
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
}

.project-home-actions button {
  min-width: 170px;
}

.priority-title-badge {
  display: inline-block;
  margin-left: 12px;
  background: #dc2626;
  color: white;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  vertical-align: middle;
}

.field-label {
  display: block;
  margin: 16px 0 8px;
  font-weight: 800;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.modal-box {
  background: white;
  width: min(620px, 100%);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 45px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 26px;
}

.modal-close {
  background: transparent;
  color: #dc2626;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.task-panel-header {
  align-items: center;
}

.task-edit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.task-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}

.task-edit-title {
  font-weight: 800;
  min-width: 0;
}

.task-edit-status {
  color: #6b7280;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.task-edit-row button {
  min-width: 92px;
}

.task-choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.task-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
}

.task-choice input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

#loginModal input {
  width: 100%;
  margin-bottom: 12px;
}

#documentationModal input {
  width: 100%;
}

.login-error {
  margin-top: 12px;
  color: #dc2626;
  font-weight: 800;
  min-height: 20px;
}

@media (max-width: 700px) {
  header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "actions";
    padding-top: 30px;
  }

  header h1 {
    font-size: 34px;
  }

  .header-actions {
    justify-content: flex-end;
    margin-top: 8px;
  }

  .task-choice-list {
    grid-template-columns: 1fr;
  }

  .task-edit-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .project-card-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "statuses"
      "tasks";
  }

  .project-status-column {
    align-items: flex-start;
    max-width: 100%;
  }

  .task-header,
  .project-header,
  .top-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-title-row {
    width: 100%;
  }

  .status-select {
    width: 100%;
  }

  .project-badges {
    justify-content: flex-start;
  }
}
.main-logo {
  grid-area: logo;
  width: min(640px, 100%);
  height: auto;
  display: block;
  margin: 0;
  object-fit: contain;
}
.documentation-link {
  display: inline-block;
  margin-top: 14px;
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
  word-break: break-word;
}

.documentation-link:hover {
  text-decoration: underline;
}
