/* Renkler Telegram temasından gelir (--tg-theme-*); tarayıcıda açılırsa açık tema varsayılanları. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --section: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --sep: var(--tg-theme-section-separator-color, rgba(127, 127, 127, 0.2));
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --done: #2e9d4f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--sep);
}

.title-row { display: flex; align-items: center; gap: 8px; min-height: 28px; }
h1 { font-size: 18px; margin: 0; flex: 1; overflow-wrap: anywhere; }

.chip {
  border: 0;
  border-radius: 14px;
  padding: 4px 10px;
  background: var(--section);
  color: var(--text);
  font-size: 13px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 8px;
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--section);
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  padding: 4px 2px;
}

.tab .n { display: block; font-weight: 600; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }

.search-row { display: flex; gap: 8px; }

.excel {
  flex: 0 0 auto;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  background: var(--section);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.excel:disabled { opacity: 0.5; }

#search {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--section);
  color: var(--text);
  font-size: 16px; /* iOS yakınlaştırmasın */
}

.list { list-style: none; margin: 0; padding: 0; }

.row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 8px 12px 16px;
  border-bottom: 1px solid var(--sep);
  min-height: 56px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
}

.row.changed { box-shadow: inset 4px 0 0 var(--accent); }
.row:active { background: var(--section); }

.box {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  border: 2px solid var(--hint);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.row[data-status="done"] .box { background: var(--done); border-color: var(--done); }
.row[data-status="done"] .box::after { content: "✓"; }
.row[data-status="cancelled"] .box { background: var(--danger); border-color: var(--danger); }
.row[data-status="cancelled"] .box::after { content: "✕"; }

.body { flex: 1; min-width: 0; }
.text { overflow-wrap: anywhere; white-space: pre-wrap; }
.no { color: var(--hint); font-variant-numeric: tabular-nums; margin-right: 4px; }
.row[data-status="done"] .text, .row[data-status="cancelled"] .text { color: var(--hint); text-decoration: line-through; }
.meta { color: var(--hint); font-size: 13px; margin-top: 2px; }
.meta .overdue { color: var(--danger); }

.more {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -8px 0;
  border: 0;
  background: transparent;
  color: var(--hint);
  font-size: 22px;
}

.sentinel { height: 1px; }
.empty { text-align: center; color: var(--hint); padding: 32px 16px; }
.error { color: var(--danger); }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 10;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  text-align: center;
  font-size: 15px;
}
