/* ==========================================================================
   Sayfa bileşenleri: gösterge şeridi, proje başlığı, ekip ağacı, listeler
   ========================================================================== */

/* ---------- Gösterge şeridi (KPI) ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.kpi {
  position: relative;
  padding: 18px 20px 18px;
  min-width: 0;
  text-decoration: none !important;
  color: inherit;
}
.kpi + .kpi {
  border-left: 1px solid var(--line);
}
a.kpi:hover {
  background: var(--surface-hover);
}
.kpi-label {
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  font-variation-settings: "opsz" 144;
}
.kpi-foot {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.kpi-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

/* ---------- Proje küçük görseli ---------- */
.thumb {
  flex: none;
  width: 52px;
  height: 40px;
  border-radius: 5px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-lg {
  width: 72px;
  height: 56px;
  border-radius: 8px;
}
.project-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}
.project-cell a {
  color: var(--text);
  font-weight: 500;
}
.mini-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}
.mini-progress .progress {
  flex: 1;
}

/* ---------- Etkinlik akışı ---------- */
.feed {
  padding: 6px 0;
}
.feed-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 20px;
}
.feed-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.feed-text {
  font-size: 13.5px;
  line-height: 1.45;
}
.feed-text strong {
  font-weight: 600;
}
.feed-time {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------- Proje detay başlığı (yönetim) ---------- */
.detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.detail-head .grow {
  min-width: 220px;
}
.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.trash-banner {
  margin-bottom: 20px;
}

/* Bilgi listesi */
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.fact {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.fact:nth-child(odd) {
  border-right: 1px solid var(--line);
}
.fact dt {
  font-size: 12px;
  color: var(--text-3);
}
.fact dd {
  margin: 4px 0 0;
  font-size: 14.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* Tehlikeli işlemler */
.danger-zone {
  border-color: var(--red-100);
}
.danger-zone .panel-head {
  border-bottom-color: var(--red-100);
}
.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  flex-wrap: wrap;
}
.danger-row + .danger-row {
  border-top: 1px solid var(--line);
}
.danger-row p {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
  max-width: 60ch;
}

/* Durum seçici kartları */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.choice {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.choice:hover {
  border-color: #b4ab96;
}
.choice input {
  position: absolute;
  opacity: 0;
}
.choice-radio {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.choice input:checked ~ .choice-radio {
  border-color: var(--green-600);
}
.choice input:checked ~ .choice-radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-600);
}
.choice:has(input:checked) {
  border-color: var(--green-600);
  background: var(--green-50);
  box-shadow: inset 0 0 0 1px var(--green-600);
}
.choice:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}
.choice-title {
  font-size: 14px;
  font-weight: 600;
}
.choice-desc {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.45;
}

/* Kapak görseli yükleme */
.cover-edit {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.cover-preview {
  width: 200px;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-sunken);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Üye: proje listesi ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  color: inherit;
  text-decoration: none !important;
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.18s var(--ease), border-color 0.18s, transform 0.18s var(--ease);
}
a.project-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.project-card.is-locked {
  opacity: 0.82;
}
.project-card.is-locked .project-card-cover img {
  filter: grayscale(0.85);
}
.project-card-cover {
  position: relative;
  aspect-ratio: 16 / 8;
  background: var(--ink-900);
  overflow: hidden;
}
.project-card-cover img,
.project-card-cover svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.project-card-cover .badge {
  position: absolute;
  top: 12px;
  left: 12px;
}
.project-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.project-card-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.2;
  font-variation-settings: "opsz" 60;
}
.project-card-loc {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-3);
}
.project-card-stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-2);
}
.project-card-stats strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Üye: proje sayfası ---------- */
.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}
.project-hero .page-title {
  font-size: 36px;
}
.land {
  display: grid;
  grid-template-columns: 1.1fr 0.7fr 1.2fr 1.3fr;
  background: var(--ink-900);
  color: var(--text-inverse);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.land-cell {
  padding: 18px 22px 20px;
  min-width: 0;
}
.land-cell + .land-cell {
  border-left: 1px solid var(--ink-700);
}
.land-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.land-value {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.land-value.is-price {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  color: var(--leaf);
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144;
  font-variant-numeric: lining-nums;
}
.land-value small {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink-300);
  font-weight: 400;
}
.shares {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  border-top: 1px solid var(--ink-700);
  grid-column: 1 / -1;
}
.shares-count {
  flex: none;
  font-size: 13px;
  color: var(--ink-300);
}
.shares-count strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: #fff;
  font-variant-numeric: tabular-nums lining-nums;
}
.shares .progress {
  flex: 1;
  background: var(--ink-700);
}
.shares .progress-fill {
  background: var(--leaf);
}
.shares .progress-target {
  background: #f2b38f;
}
.shares-target {
  flex: none;
  font-size: 12.5px;
  color: var(--ink-300);
}

.member-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}
.side-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.me-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.me-row:last-child {
  border-bottom: 0;
}
.me-row dt {
  color: var(--text-3);
}
.me-row dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ---------- Ekip ağacı ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.state-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--state-ring, transparent);
}
.state-invited {
  --state: #c8372b;
  --state-bg: var(--red-50);
  --state-ring: var(--red-100);
}
.state-verified {
  --state: #c98a14;
  --state-bg: var(--amber-50);
  --state-ring: var(--amber-100);
}
.state-growing {
  --state: #1f8a4f;
  --state-bg: var(--green-50);
  --state-ring: var(--green-100);
}
.state-exit_requested {
  --state: #c2367b;
  --state-bg: var(--pink-50);
  --state-ring: var(--pink-100);
}
.state-exited {
  --state: #8b928d;
  --state-bg: var(--slate-50);
  --state-ring: var(--slate-100);
}
.state-suspended {
  --state: #5b6a8a;
  --state-bg: var(--blue-50);
  --state-ring: var(--blue-100);
}
.state-dot {
  background: var(--state);
}
.tree {
  padding: 10px 12px 14px;
}
.tree-children {
  position: relative;
  margin-left: 21px;
  padding-left: 14px;
  border-left: 1px dashed var(--line-strong);
}
.node {
  position: relative;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--state);
  border-radius: 8px;
  background: var(--surface);
  transition: background-color 0.12s, border-color 0.12s;
}
.tree-children > .tree-branch > .node::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 22px;
  width: 15px;
  border-top: 1px dashed var(--line-strong);
}
.node:hover {
  background: var(--surface-hover);
}
.node.state-exited {
  background: var(--surface-sunken);
}
.node.state-exited .node-name {
  color: var(--text-3);
}
.node-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.node-toggle {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-3);
  transition: transform 0.15s var(--ease);
}
.node-toggle:hover {
  background: var(--paper-2);
  color: var(--text);
}
.node-toggle.is-open {
  transform: rotate(90deg);
}
.node-toggle.is-leaf {
  visibility: hidden;
}
.node-id {
  flex: 1;
  min-width: 0;
}
.node-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
}
.node-phone {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
}
.node-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-2);
}
.node-sub .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}
.rank {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 4px;
  background: #faf3e2;
  box-shadow: inset 0 0 0 1px #eedcae;
  color: #7a4d06;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.rank b {
  font-weight: 600;
}
.node-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 12px 10px 46px;
  margin-top: -2px;
}
.deposit-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
.deposit-state.is-paid {
  color: var(--green-700);
}
.tree-root {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 4px;
  font-size: 12.5px;
  color: var(--text-3);
}
.tree-root svg {
  color: var(--amber-500);
}

/* ---------- Slider yönetimi ---------- */
.slides-list {
  display: flex;
  flex-direction: column;
}
.slide-row {
  display: grid;
  grid-template-columns: 28px 168px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color 0.12s, box-shadow 0.12s;
}
.slide-row:last-child {
  border-bottom: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.slide-row.is-dragging {
  opacity: 0.5;
}
.slide-row.is-drop-target {
  box-shadow: inset 0 2px 0 var(--green-600);
}
.slide-row.is-inactive .slide-thumb {
  filter: grayscale(1);
  opacity: 0.6;
}
.drag-handle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 36px;
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: grab;
  border-radius: 4px;
}
.drag-handle:hover {
  background: var(--paper-2);
}
.slide-thumb {
  width: 168px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--ink-900);
  border: 1px solid var(--line);
}
.slide-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.order-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---------- Duyuru yönetimi ---------- */
.ann-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.ann-row:last-child {
  border-bottom: 0;
}
.ann-row.is-important {
  box-shadow: inset 3px 0 0 var(--clay-600);
}
.ann-row h3 {
  font-size: 14.5px;
  font-weight: 600;
}
.ann-row p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

/* ---------- Duyarlı ---------- */
@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi:nth-child(4) {
    border-left: 0;
  }
  .kpi:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .member-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .land {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .land-cell:nth-child(3) {
    border-left: 0;
  }
  .land-cell:nth-child(n + 3) {
    border-top: 1px solid var(--ink-700);
  }
}

@media (max-width: 720px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi {
    padding: 14px 16px;
  }
  .kpi:nth-child(odd) {
    border-left: 0;
  }
  .kpi:nth-child(4) {
    border-left: 1px solid var(--line);
  }
  .kpi:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .kpi-value {
    font-size: 26px;
  }
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }
  .fact:nth-child(odd) {
    border-right: 0;
  }
  .choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .project-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .project-hero .page-title {
    font-size: 28px;
  }
  .land-cell {
    padding: 14px 16px;
  }
  .land-value.is-price {
    font-size: 24px;
  }
  .shares {
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 16px;
  }
  .shares .progress {
    flex-basis: 100%;
    order: 3;
  }
  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .slide-row {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 16px;
  }
  .slide-row .drag-handle {
    display: none;
  }
  .slide-thumb {
    width: 96px;
  }
  .slide-row .slide-actions {
    grid-column: 1 / -1;
  }
  .ann-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 16px;
  }
  .tree {
    padding: 8px 8px 12px;
  }
  .tree-children {
    margin-left: 10px;
    padding-left: 10px;
  }
  .tree-children > .tree-branch > .node::before {
    left: -11px;
    width: 9px;
  }
  .node-main {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 8px;
    padding: 10px;
  }
  .node-id {
    flex-basis: calc(100% - 34px);
  }
  .node-sub {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .node-sub .sep {
    display: none;
  }
  .node-phone {
    flex-basis: 100%;
  }
  .rank {
    height: 22px;
    margin-left: 32px;
    font-size: 10.5px;
  }
  .node-actions {
    padding-left: 42px;
  }

  /* Tablolar mobilde kart düzenine dönüşür */
  .table-cards thead {
    display: none;
  }
  .table-cards,
  .table-cards tbody,
  .table-cards tr,
  .table-cards td {
    display: block;
    width: 100%;
  }
  .table-cards tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }
  .table-cards tbody tr:last-child {
    border-bottom: 0;
  }
  .table-cards td {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 12px;
    justify-items: end;
    align-items: center;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }
  .table-cards td::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1 / span 3;
    justify-self: start;
    align-self: start;
    padding-top: 1px;
    font-size: 12px;
    color: var(--text-3);
    text-align: left;
  }
  .table-cards td > * {
    grid-column: 2;
    max-width: 100%;
  }
  .table-cards td.cell-primary {
    display: block;
    justify-items: start;
    text-align: left;
    padding-bottom: 8px;
  }
  .table-cards td.cell-primary::before {
    display: none;
  }
  .table-cards td.col-actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    padding-top: 8px;
  }
  .table-cards td.col-actions:empty {
    display: none;
  }
  .table-cards td.col-actions::before {
    display: none;
  }
  .table-cards .project-cell {
    min-width: 0;
  }
  .table-cards .mini-progress {
    min-width: 0;
    width: 60%;
  }
}
