:root {
  --bg: #f3f6ff;
  --text: #1b2440;
  --muted: #5d6c9f;
  --card: #ffffff;
  --primary: #4065ff;
  --primary-dark: #2f4fe0;
  --shadow: 0 12px 30px rgba(52, 71, 143, 0.14);
}

* { box-sizing: border-box; }

body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #edf2ff, var(--bg));
  color: var(--text);
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e5ebff;
  z-index: 10;
}

.brand { font-weight: 700; font-size: 2rem; }
.container { max-width: 1500px; width: min(96vw, 1500px); margin: 0 auto; padding: 1.3rem 1rem 2rem; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.hero h1 { margin: 0 0 .45rem; }
.hero p { margin: 0; color: var(--muted); }
.cta-create-task {
  margin-top: .9rem;
  padding: .75rem 1rem;
  width: auto;
  box-shadow: 0 8px 20px rgba(64, 101, 255, 0.28);
  transition: transform .18s ease, box-shadow .18s ease;
}

.cta-create-task:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(64, 101, 255, 0.32);
}

.task-card h3 { margin-top: 0; }
.task-card h3,
.task-card h1 {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.task-app-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: cover;
}

.main-logo {
  width: 35px;
  height: 35px;
  border-radius: 5px;
  object-fit: cover;
}

.task-app-emoji {
  display: inline-flex;
}
.task-link {
  color: inherit;
  text-decoration: none;
}
.task-link:hover { text-decoration: underline; }
.empty-state p { margin: .3rem 0; }

label { display: block; margin-bottom: .7rem; font-weight: 500; }

.custom-app-select {
  position: relative;
  margin-bottom: .7rem;
}

.custom-app-select-trigger {
  margin-top: .35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  background: #fff;
  color: var(--text);
  border: 1px solid #d4defa;
}

.custom-app-select-current {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.custom-app-select-options {
  position: absolute;
  z-index: 30;
  width: 100%;
  list-style: none;
  padding: .4rem;
  margin: .35rem 0 0;
  border: 1px solid #d4defa;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
}

.custom-app-select-option {
  width: 100%;
  margin-top: 0;
  padding: .5rem .6rem;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: .45rem;
  text-align: left;
}

.custom-app-select-option:hover,
.custom-app-select-option[aria-selected="true"] {
  background: #edf2ff;
}

.custom-app-select-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}

.custom-app-select-emoji {
  width: 20px;
  display: inline-flex;
  justify-content: center;
}

input, textarea, button {
  width: 100%;
  padding: .65rem;
  margin-top: .35rem;
  border-radius: 9px;
  border: 1px solid #d4defa;
  font: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64, 101, 255, .15);
}

button, .button {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
}

.button.small { width: auto; padding: .5rem .8rem; }
.secondary { background: #566080; margin-top: .6rem; }
.inline-form { margin-top: .5rem; }
.hidden { display: none !important; }
.add-amount-toggle {
  width: auto;
  margin-top: .2rem;
}
.amount-row {
  display: flex;
  align-items: end;
  gap: .5rem;
}
.amount-row input {
  flex: 1;
}
.amount-row button {
  width: auto;
  min-width: 2.6rem;
  padding: .55rem .75rem;
}
.error { color: #b00020; font-weight: 700; }

.profile-menu { position: relative; }
.profile-icon {
  display: inline-flex;
}

.profile-icon.disconnected {
  filter: grayscale(1);
  opacity: .65;
}

.profile-icon.connected {
  color: var(--primary);
}
.profile-trigger {
  list-style: none;
  cursor: pointer;
  background: #eef2ff;
  padding: .45rem .7rem;
  border-radius: 999px;
  font-weight: 600;
}
.profile-trigger::-webkit-details-marker { display: none; }
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  width: min(350px, 90vw);
  background: white;
  border-radius: 12px;
  border: 1px solid #dfe6ff;
  box-shadow: var(--shadow);
  padding: .9rem;
}

.menu-title { margin-top: 0; color: var(--muted); }
.menu-form h2 { font-size: 1rem; margin: .2rem 0 .6rem; }
.menu-form.compact { margin-top: .8rem; }
.secondary-link {
  width: 100%;
  margin-top: .6rem;
  background: #eef2ff;
  color: #34457e;
}


.tasks-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.task-description {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: .7rem;
}

.read-more-link {
  margin-bottom: .8rem;
}

.tasks-grid .task-card {
  margin-bottom: 0;
}

.comment-form,
.comment-edit-form {
  margin-top: .8rem;
}


.participants-section {
  margin-top: 1rem;
}

.participants-list {
  list-style: none;
  padding: 0;
  margin: .7rem 0;
  display: grid;
  gap: .5rem;
}

.participant-row {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  border: 1px solid #dfe6ff;
  border-radius: 10px;
  padding: .55rem .7rem;
}

.see-more-participants {
  width: auto;
}

.comments-list {
  margin-top: 1rem;
  display: grid;
  gap: .8rem;
}

.comment-item {
  border: 1px solid #dfe6ff;
  border-radius: 10px;
  padding: .75rem;
}

.commitment-dialog {
  border: 0;
  border-radius: 14px;
  padding: 1rem;
  width: min(500px, 92vw);
  box-shadow: var(--shadow);
}

.commitment-dialog::backdrop {
  background: rgba(22, 34, 69, 0.55);
  backdrop-filter: blur(2px);
}

.commitment-dialog h2 {
  margin: 0 0 .5rem;
}

.commitment-dialog p {
  margin: 0;
  color: var(--muted);
}

.dialog-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}

.dialog-actions button {
  width: auto;
  min-width: 130px;
}

@media (max-width: 1100px) {
  .tasks-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .tasks-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .profile-trigger span { display: none; }
}

.auth-container { max-width: 620px; padding-top: 2rem; }

.auth-required-banner {
  border: 1px solid #ffd37a;
  background: #fff6df;
  border-radius: 10px;
  padding: .8rem;
  margin-bottom: 1rem;
}

.auth-required-banner p {
  margin: 0 0 .5rem;
}

.auth-banner-login-toggle {
  width: auto;
}

.tasks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 .85rem;
}

.tasks-count {
  margin: 0;
  background: linear-gradient(145deg, #f8faff, #eef3ff);
  color: #44527f;
  border: 1px solid #d9e2ff;
  border-radius: 999px;
  padding: .5rem .9rem;
  font-size: .92rem;
}

.pagination {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
}

.pagination-link {
  width: 2.45rem;
  height: 2.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  color: #39519a;
  background: #f4f7ff;
  border: 1px solid #d9e2ff;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, color .16s ease;
}

.pagination-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(66, 94, 182, 0.2);
  background: #e9efff;
}

.pagination-link.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 22px rgba(64, 101, 255, 0.34);
}


.tasks-filters {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.tasks-filters input,
.tasks-filters select {
  border: 1px solid #d9e2ff;
  border-radius: 10px;
  padding: .45rem .6rem;
  background: #fff;
}


.tasks-filters .custom-app-select {
  margin-bottom: 0;
  min-width: 220px;
}

.tasks-filters .custom-app-select-trigger,
.tasks-filters .button {
  width: auto;
  margin-top: 0;
}

.tasks-filters input {
  margin-top: 0;
}

.task-state-tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: 999px;
  padding: .2rem .65rem;
  font-size: .86rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.task-state-tag.state-new {
  background: #e8f0ff;
  color: #1f4fc4;
  border-color: #c8dafd;
}

.task-state-tag.state-doable {
  background: #e8f8ee;
  color: #18794b;
  border-color: #bfe8cd;
}

.task-state-tag.state-undoable {
  background: #ffecee;
  color: #b4233c;
  border-color: #ffc8d0;
}

.task-state-tag.state-working {
  background: #fff4e5;
  color: #a35408;
  border-color: #ffd9ad;
}

.task-state-tag.state-done {
  background: #ede9ff;
  color: #5f3dc4;
  border-color: #d3c8ff;
}
