:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #14181f;
  --muted: #667085;
  --line: #e4e7ec;
  --line-soft: #eef0f3;
  --accent: #c62828;
  --accent-ink: #a51f1f;
  --ok-ink: #067647;
  --ok-bg: #ecfdf3;
  --ok-line: #abefc6;
  --bad-ink: #b42318;
  --bad-bg: #fef3f2;
  --bad-line: #fecdca;
  --top: #171b26;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- üst çubuk + sekmeler ---------- */
.chrome { position: sticky; top: 0; z-index: 20; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  height: 48px;
  background: var(--top);
  color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brick {
  position: relative;
  width: 22px;
  height: 13px;
  border-radius: 3px;
  background: var(--accent);
  align-self: center;
}
.brick::before, .brick::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 6px;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.brick::before { left: 3px; }
.brick::after { right: 3px; }
.brand-name { font-weight: 800; letter-spacing: 0.04em; font-size: 15px; }
.brand-sub { color: #8b93a7; font-size: 12px; font-variant-numeric: tabular-nums; }

.pinbtn {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #333a4d;
  background: #20263566;
  color: #cdd3e0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
}
.pinbtn:hover { border-color: #4a5268; color: #fff; }
.pinbtn .dot { width: 7px; height: 7px; border-radius: 50%; background: #8b93a7; }
.pinbtn.on .dot { background: #3ccb7f; }
.pinbtn.on { color: #fff; }

.tabstrip {
  display: flex;
  gap: 2px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabstrip::-webkit-scrollbar { display: none; }
.tabstrip button {
  border: 0;
  background: none;
  padding: 10px 11px 8px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}
.tabstrip button:hover { color: var(--ink); }
.tabstrip button.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ---------- genel yerleşim ---------- */
main { padding: 18px 16px 60px; max-width: 1340px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.card > h2 { margin: 0 0 2px; font-size: 16px; font-weight: 700; }
.card > h2 small { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 4px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 2px 0 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; align-items: start; }

/* ---------- tablolar ---------- */
table { border-collapse: collapse; width: 100%; }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--card);
}
td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  font-size: 13.5px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8f9fb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.strong { font-weight: 700; }
.empty-row td { color: var(--muted); text-align: center; padding: 18px; }

/* skorbord */
.statline {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin: 6px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stat span { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
tr.clickable { cursor: pointer; }
.rank {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  border-radius: 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 4px;
}
.rank.r1 { background: #fdf0c2; color: #7a5c00; }
.rank.r2 { background: #eceef2; color: #4a5262; }
.rank.r3 { background: #f6e3d3; color: #8a4b17; }
td.final { font-weight: 700; font-size: 14.5px; }

/* grup çipi */
.g-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  border: 1px solid;
}
.g-name { color: var(--muted); margin-left: 7px; font-size: 12.5px; }

/* rozetler */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok-ink); background: var(--ok-bg); border-color: var(--ok-line); }
.badge.bad { color: var(--bad-ink); background: var(--bad-bg); border-color: var(--bad-line); }
.pos { color: var(--ok-ink); }
.neg { color: var(--bad-ink); }
.check-num { font-variant-numeric: tabular-nums; }
.check-num.miss { color: var(--bad-ink); font-weight: 700; }
.check-num.done { color: var(--ok-ink); }

/* problemli satır */
tr.problem-row td { background: #fef6f5; }
tr.problem-row:hover td { background: #fdeeec; }
.warn-mark { color: var(--bad-ink); font-weight: 700; margin-left: 4px; cursor: help; }

/* ---------- slotlar ---------- */
.slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 7px;
  margin: 1px 2px 1px 0;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  border: 1px solid;
  vertical-align: middle;
}
.slot.empty {
  border-style: dashed;
  border-color: #c9cfd9;
  background: transparent;
  color: #9aa2b1;
  font-weight: 400;
}
.slot.empty:hover { border-color: var(--accent); color: var(--accent); }
.slot.readonly { cursor: default; }
.slot.readonly.empty:hover { border-color: #c9cfd9; color: #9aa2b1; }
.slot-amt { font-weight: 400; color: inherit; opacity: 0.75; margin-left: 4px; font-size: 11.5px; }

/* ---------- form elemanları ---------- */
input[type="number"], input[type="text"], input[type="password"], select {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid #c6282833; border-color: var(--accent); }
input.mini { width: 78px; text-align: right; font-variant-numeric: tabular-nums; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
label { font-size: 13.5px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: var(--accent-ink); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { border-color: #c9cfd9; background: #fafbfc; }
.btn.danger { background: #fff; color: var(--bad-ink); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filterbar input[type="text"] { width: 220px; }
.filterbar label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }

/* ---------- görevler ---------- */
.gorev-list { max-height: 62vh; overflow: auto; border-top: 1px solid var(--line-soft); }
.gorev-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.gorev-item span { white-space: normal; }
.gorev-item.used { opacity: 0.45; }
.gorev-item.used .gorev-metin { text-decoration: line-through; }
.gorev-item input { margin-top: 2px; flex-shrink: 0; }

/* ---------- popover / modal ---------- */
.popover {
  position: absolute;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 24, 31, 0.13);
  padding: 12px;
  min-width: 210px;
  max-width: 300px;
}
.popover h4 { margin: 0 0 9px; font-size: 13px; font-weight: 700; }
.popover .sub { color: var(--muted); font-size: 12px; margin: -5px 0 9px; }
.g-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.g-grid button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 5px 0;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.g-grid button:hover { border-color: var(--accent); color: var(--accent); }
.pop-row { display: flex; gap: 8px; margin-top: 10px; }
.pop-row input { flex: 1; min-width: 0; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 19, 26, 0.45);
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 14px 14px;
}
.modal {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 20px;
  width: 100%;
  max-width: 560px;
  max-height: 84vh;
  overflow: auto;
  box-shadow: 0 16px 48px rgba(20, 24, 31, 0.25);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-close {
  border: 0;
  background: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}
.modal-close:hover { color: var(--ink); }
.modal table td { font-size: 13px; }
.modal .cat-label { color: var(--muted); font-size: 12px; }
.modal tfoot td { border-top: 1px solid var(--line); font-weight: 700; border-bottom: 0; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--top);
  color: #fff;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 100;
  max-width: 90vw;
}
#toast.show { opacity: 0.97; transform: translateX(-50%) translateY(0); }

/* ---------- düzenleme kontrolleri ---------- */
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.icon-btn:hover { border-color: #c9cfd9; color: var(--ink); }
.icon-btn.danger:hover { border-color: var(--bad-line); background: var(--bad-bg); }
.gorev-item .gorev-metin { flex: 1; }
.row-actions { display: flex; gap: 4px; flex-shrink: 0; margin-left: auto; }
.gorev-input { flex: 1; min-width: 0; }
.table-scroll { overflow-x: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12.5px; }
.form-grid input[type="text"], .form-grid input[type="number"] { width: 100%; color: var(--ink); }
.form-grid .form-check { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.uye-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.uye-input { width: 150px; }
table.narrow { width: auto; min-width: 280px; }
textarea {
  width: 100%;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  resize: vertical;
}
textarea:focus { outline: 2px solid #c6282833; border-color: var(--accent); }
.reset-list { display: grid; gap: 8px; }
.reset-opt { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.reset-opt input { margin-top: 2px; flex-shrink: 0; }
.reset-opt small { display: block; color: var(--muted); font-size: 12px; }
.reset-opt:has(input:disabled) { cursor: default; opacity: 0.7; }
.reset-confirm {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--bad-line);
  background: var(--bad-bg);
  border-radius: var(--radius);
}
.reset-confirm p { margin: 0; font-size: 13px; }
#reset-yazi { font-weight: 700; letter-spacing: 0.06em; }

@media (max-width: 700px) {
  main { padding: 10px 8px 50px; }
  .card { padding: 12px; border-radius: 10px; }
  td { font-size: 12.5px; padding: 5px 7px; }
  .brand-sub { display: none; }
}
