/* styles.css */

:root {
  --border: #ddd;
  --border2: #eee;
  --text-muted: #666;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
}

header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

#authBar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#turnstileBox {
  display: flex;
  align-items: center;
}

h1 {
  margin: 0 0 10px 0;
}

.grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 12px;
  padding: 12px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Details layout (5 rows x 2 columns) */
.detailsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Partner list: show open/done counts next to name */
.titleRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.taskCounts {
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--text-muted);
  white-space: nowrap;
}


/* --- Details form --- */
.detailsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field label {
  font-size: 12px;
  color: var(--text-muted);
}

.field .inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.field .inline input {
  flex: 1 1 220px;
  min-width: 180px;
}

.field.span2 {
  grid-column: 1 / -1;
}

.btnrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* --- Status-based task templates (e.g., onboarding checklist) --- */
.statusTasks {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0 10px;
  background: #fafafa;
}

.statusTasksHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.statusTasksTitle {
  font-weight: 700;
}

.checkRow {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--border2);
}

.checkRow:first-child {
  border-top: none;
}

.checkRow.done .checkText {
  text-decoration: line-through;
  color: var(--text-muted);
}

.checkMeta {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: lowercase;
}

.badge {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 6px;
}


.list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item {
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
}

/* Partners: multi-select */
.partnerRow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.partnerSelect {
  margin-top: 2px;
}

.partnerMain {
  flex: 1 1 auto;
  min-width: 0;
}

.partnerItem.selected {
  border-color: #bbb;
  background: #fafafa;
}

/* Bulk actions */
.bulk {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  background: #fafafa;
}

.bulkHeader {
  justify-content: space-between;
}

.bulkTitle {
  font-weight: 700;
}

.bulkSection {
  margin-top: 10px;
}

.bulkSection textarea,
.bulkSection input,
.bulkSection select {
  width: 100%;
  box-sizing: border-box;
}

.bulkSection .row select {
  flex: 1 1 auto;
}

.item .title {
  font-weight: 700;
}

.item .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

input, select, button {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

#search, #sortPartners, #filterStage {
  width: 100%;
  box-sizing: border-box;
}

.controlsCard {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controlsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 520px) {
  .controlsGrid { grid-template-columns: 1fr; }
}

.checksRow {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.chk input { margin: 0; }

button {
  cursor: pointer;
}

button:hover {
  background: #f6f6f6;
}


.hidden {
  display: none !important;
}

.unsaved {
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid #c00;
  background: #fff3f3;
  color: #900;
  border-radius: 8px;
  font-size: 13px;
}


.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  border: 1px solid #aaa;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  cursor: pointer;
}

.tag.on {
  border-color: #4CAF50;
  background: #DFF7DF;
  font-weight: 700;
}

button.danger {
  background: #fff;
  border: 1px solid #c00;
  color: #c00;
}

button.small {
  padding: 2px 8px;
}

a.btnlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  text-decoration: none;
  color: inherit;
  font-weight: 600;
  line-height: 1;

  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #cfcfcf;
  background: #f7f7f7;

  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
  transition: transform 0.05s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

a.btnlink:hover {
  background: #efefef;
  border-color: #bdbdbd;
}

a.btnlink:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 rgba(0,0,0,0);
}

a.btnlink:focus-visible {
  outline: 2px solid #999;
  outline-offset: 2px;
}

a.btnlink.disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(20%);
}


@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.h3tight { margin: 0; }

.titleRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.taskCounts {
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--text-muted);
  white-space: nowrap;
}

textarea {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  resize: vertical;
  background: #fff;
}

.muted {
  font-size: 12px;
  color: var(--text-muted);
}

.taskNotes {
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
  margin-top: 10px;
}

.taskNotesHeader {
  justify-content: space-between;
  align-items: flex-start;
}

.taskNotesTitle {
  font-weight: 700;
}

.taskItem.selected {
  border-color: #bbb;
}

/* Task card styling when status = done */
.taskItem.done {
  background: #e9f7e9;          /* light green */
  border-color: #bfe5bf;
  opacity: 0.78;                /* slightly muted */
}

.taskItem.done .title {
  color: #245a24;               /* optional: darker green title */
}

.taskItem.done .meta {
  color: #5f7a5f;               /* optional: muted meta text */
}


/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
}

.modalCard {
  position: relative;
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.bulkModalCard {
  width: min(560px, calc(100vw - 24px));
}

.modalHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modalTitle {
  font-weight: 800;
  font-size: 18px;
}

.modalSub {
  font-size: 12px;
  color: var(--text-muted);
}

.modalGrid {
  display: grid;
  grid-template-columns: 1fr 180px 180px;
  gap: 10px;
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .modalGrid { grid-template-columns: 1fr; }
}

.helpBox {
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
  margin-top: 10px;
}

.helpTitle {
  font-weight: 700;
  margin-bottom: 6px;
}

.row.end {
  justify-content: flex-end;
}
