.list-header {
  display: flex;
  align-items: center;
}

.list-header .list-title {
  flex: 1;
  padding-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-title-input {
  font: inherit;
  font-weight: bold;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: #fff;
  padding: 4px 6px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px #0079bf;
  outline: none;
}

.list-actions {
  display: none;
  gap: 2px;
  padding-right: 8px;
  flex-shrink: 0;
}

.list:hover .list-actions,
.list .list-actions.visible {
  display: flex;
}

.list-action {
  border: 0;
  background: transparent;
  color: #8a8a8a;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 5px;
  border-radius: 3px;
  line-height: 1;
}

.list-action:hover {
  background: rgba(9, 30, 66, 0.08);
  color: #172b4d;
}

.list-action.confirm-danger {
  color: #eb5a46;
}

.add-card-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #8a8a8a;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 8px 10px;
  margin-top: 2px;
  border-radius: 3px;
  cursor: pointer;
}

.add-card-btn:hover {
  background-color: rgba(9, 30, 66, 0.08);
  color: #172b4d;
}

.add-list-wrap {
  min-width: 300px;
  max-width: 300px;
  margin-left: 20px;
  align-self: flex-start;
}

.add-list-trigger {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 3px;
  background-color: rgba(255, 255, 255, 0.24);
  color: #fff;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  text-align: left;
  padding: 12px 16px;
  cursor: pointer;
}

.add-list-trigger:hover {
  background-color: rgba(255, 255, 255, 0.32);
}

.add-list-form {
  background: #f5f5f5;
  border-radius: 3px;
  padding: 10px;
}

.add-list-form input {
  box-sizing: border-box;
  width: 100%;
  border: 2px solid #0079bf;
  border-radius: 3px;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 8px;
  outline: none;
}

.add-list-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-primary {
  border: 0;
  border-radius: 3px;
  background-color: #0079bf;
  color: #fff;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 8px 14px;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #026aa7;
}

.card {
  position: relative;
}

.card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  gap: 4px;
  z-index: 3;
}

.card:hover .card-actions {
  display: flex;
}

.card-action {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 3px;
  background-color: rgba(9, 30, 66, 0.06);
  color: #42526e;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-action:hover {
  background-color: rgba(9, 30, 66, 0.16);
  color: #172b4d;
}

.card-action.delete {
  color: #eb5a46;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background-color: #fff;
  border-radius: 5px;
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e6e6e6;
  font-size: 16px;
  font-weight: 700;
  color: #172b4d;
}

.modal-close {
  border: 0;
  background: transparent;
  color: #8a8a8a;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
}

.modal-close:hover {
  color: #172b4d;
  background: rgba(9, 30, 66, 0.08);
}

.modal form {
  padding: 16px;
}

.field {
  margin-bottom: 14px;
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row .field {
  flex: 1;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #5e6c84;
  margin-bottom: 5px;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  box-sizing: border-box;
  width: 100%;
  border: 2px solid #dfe1e6;
  border-radius: 3px;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 8px;
  outline: none;
  background-color: #fff;
  color: #172b4d;
}

.field input:focus,
.field select:focus {
  border-color: #0079bf;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 16px;
}

.btn-delete {
  border: 0;
  border-radius: 3px;
  background-color: #eb5a46;
  color: #fff;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 8px 14px;
  cursor: pointer;
  margin-right: auto;
}

.btn-delete:hover {
  background-color: #cf513d;
}

.btn-secondary {
  border: 0;
  border-radius: 3px;
  background-color: rgba(9, 30, 66, 0.08);
  color: #172b4d;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 8px 14px;
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: rgba(9, 30, 66, 0.16);
}

.add-list-cancel {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 3px;
  background-color: transparent;
  color: #8a8a8a;
  font-size: 16px;
  font-family: "Roboto", sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.add-list-cancel:hover {
  color: #172b4d;
  background-color: rgba(9, 30, 66, 0.08);
}

.modal-sm {
  width: min(420px, 92vw);
}

.modal-body {
  padding: 16px;
  font-size: 14px;
  color: #42526e;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.card .card-content .card-details .due-date {
  background-color: #e2e4e8;
  color: #42526e;
}

.card .card-content .card-details .due-date.close {
  background-color: #f2d600;
  color: #fff;
}

.card .card-content .card-details .due-date.overdue {
  background-color: #eb5a46;
  color: #fff;
}

.card .card-content .card-details .due-date.complete {
  background-color: #61bd4f;
  color: #fff;
}

.modal-wide {
  width: min(900px, 95vw);
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
}

.modal-grid .modal-main {
  padding: 16px;
}

.modal-side {
  border-left: 1px solid #e6e6e6;
  background-color: #f4f5f7;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-title {
  font-size: 15px;
  font-weight: 700;
  color: #172b4d;
}

.panel-hint {
  margin: 0;
  font-size: 13px;
  color: #8a8a8a;
}

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

.side-empty {
  font-size: 13px;
  color: #8a8a8a;
}

.side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background-color: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 3px;
  padding: 8px 10px;
}

.side-item-body {
  flex: 1;
  min-width: 0;
}

.side-item-text {
  font-size: 14px;
  color: #172b4d;
  white-space: pre-wrap;
  word-break: break-word;
}

.side-item-meta {
  font-size: 12px;
  color: #8a8a8a;
  margin-top: 3px;
}

.attachment-link {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #0079bf;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.attachment-size {
  font-size: 12px;
  color: #8a8a8a;
  white-space: nowrap;
}

.side-remove {
  border: 0;
  background: transparent;
  color: #8a8a8a;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.side-remove:hover {
  color: #eb5a46;
  background: rgba(9, 30, 66, 0.08);
}

.side-add-row {
  display: flex;
  align-items: center;
}

.side-add-row .attach-input {
  display: none;
}

.side-section textarea {
  box-sizing: border-box;
  width: 100%;
  border: 2px solid #dfe1e6;
  border-radius: 3px;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 8px;
  outline: none;
  background-color: #fff;
  color: #172b4d;
  resize: vertical;
}

.side-section textarea:focus {
  border-color: #0079bf;
}

.side-section textarea:disabled,
.side-section .btn-primary:disabled,
.side-section .btn-secondary:disabled,
.attach-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.duedate-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.due-complete-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #5e6c84;
  cursor: pointer;
}

.due-complete-check input {
  cursor: pointer;
}

.due-hint {
  font-size: 13px;
  color: #8a8a8a;
}

.due-hint.overdue {
  color: #eb5a46;
  font-weight: 600;
}

.due-hint.close {
  color: #9b7a00;
  font-weight: 600;
}

.due-hint.complete {
  color: #4aa63c;
  font-weight: 600;
}

#f-due-date {
  cursor: pointer;
  width: 100%;
}

.datepicker {
  font-family: "Roboto", sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 3001;
}

.datepicker-cell.selected,
.datepicker-cell.selected:hover {
  background: #0079bf;
  color: #fff;
}

.datepicker-cell:not(.disabled):hover {
  background: #e4f0f6;
}

.datepicker-controls .button {
  color: #0079bf;
}

@media (max-width: 720px) {

  .list,
  .add-list-wrap {
    min-width: 260px;
    max-width: 260px;
  }

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

  .modal-side {
    border-left: 0;
    border-top: 1px solid #e6e6e6;
  }
}

/* --- Auth (Firebase email/password) --- */
.header {
  position: relative;
}

.header-user {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.header-user .user-email {
  color: #fff;
  opacity: 0.9;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-signout {
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}

.btn-signout:hover {
  background: rgba(255, 255, 255, 0.36);
}

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(160deg, #0079bf, #026aa7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 5000;
}

.auth-card {
  background: #fff;
  border-radius: 6px;
  width: min(380px, 100%);
  padding: 28px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.auth-logo {
  text-align: center;
  color: #0079bf;
  font-size: 24px;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  color: #5e6c84;
  font-size: 14px;
  margin: 0 0 20px;
}

.auth-card .field input {
  box-sizing: border-box;
  width: 100%;
  border: 2px solid #dfe1e6;
  border-radius: 3px;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 9px;
  outline: none;
  background-color: #fff;
  color: #172b4d;
}

.auth-card .field input:focus {
  border-color: #0079bf;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.auth-actions .btn-primary,
.auth-actions .btn-secondary {
  width: 100%;
  padding: 10px;
}

.auth-error {
  background: #fbedeb;
  color: #eb5a46;
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.auth-status {
  text-align: center;
  color: #5e6c84;
  font-size: 14px;
  padding: 10px 0;
}

/* --- Toast notifications --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(23, 43, 77, 0.94);
  color: #fff;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  padding: 10px 16px;
  border-radius: 4px;
  max-width: 90vw;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 6000;
  pointer-events: none;
}