/* Tamir & Cari Takip — tek stil dosyası, mobil öncelikli */
:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --ink: #161A22;
  --muted: #5A6170;
  --line: #E2E5EA;
  --line-2: #EEF0F3;
  --field: #C9CED6;
  --brand: #1F3A5C;
  --brand-ink: #FFFFFF;
  --brand-soft: #EEF2F7;
  --dark: #161A22;
  --green-bg: #DDF3E4; --green: #14532D;
  --amber-bg: #FCEFD6; --amber: #7A4508;
  --red-bg: #FDE7E7; --red: #8F1D1D; --red-line: #F3B4B4;
  --blue-bg: #E3ECF7; --blue: #1F3A5C;
  --gray-bg: #ECEEF1; --gray: #4A5160;
  --radius: 14px;
  --tap: 46px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
a:hover { color: #142840; }
h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h2, .h2 { font-size: 17px; margin: 0 0 12px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.ic { vertical-align: -4px; flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------- Yerleşim ---------------- */
.shell { min-height: 100vh; }
.side { display: none; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 8px 12px 8px 16px; min-height: 56px;
}
.topbar-title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topmenu { position: relative; }
.topmenu > summary {
  list-style: none; cursor: pointer; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--muted);
}
.topmenu > summary::-webkit-details-marker { display: none; }
.topmenu-pop {
  position: absolute; right: 0; top: 50px; min-width: 240px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12);
  display: flex; flex-direction: column; padding: 6px; z-index: 30;
}
.topmenu-pop a, .topmenu-pop .linkbtn { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 15px; }
.topmenu-pop a:hover, .topmenu-pop .linkbtn:hover { background: var(--surface-2); }
.topmenu-pop .who { padding: 10px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.linkbtn { background: none; border: 0; font: inherit; color: var(--brand); cursor: pointer; padding: 0; width: 100%; text-align: left; }

.content { padding: 16px 16px 110px; max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; color: var(--muted); text-decoration: none;
}
.tabbar a.on { color: var(--brand); font-weight: 600; }

@media (min-width: 960px) {
  .shell { display: flex; }
  .side {
    display: flex; flex-direction: column; gap: 4px; width: 248px; flex-shrink: 0;
    background: var(--dark); color: #E6E8EC; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  }
  .main { flex: 1; }
  .tabbar { display: none; }
  .topbar { display: none; }
  .content { padding: 28px 32px 48px; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: #2A3140; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .04em;
}
.brand-mark.big { width: 64px; height: 64px; border-radius: 18px; font-size: 20px; background: var(--brand); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { color: #B9BFCA; font-size: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 8px;
  color: #C7CCD5; text-decoration: none; font-size: 14px;
}
.side-nav a:hover { background: #20262F; color: #fff; }
.side-nav a.on { background: #2A3140; color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 10px 0; border-top: 1px solid #2A3140; font-size: 13px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot a, .side-foot .linkbtn { color: #C7CCD5; font-size: 13px; text-decoration: none; }
.side-foot a:hover, .side-foot .linkbtn:hover { color: #fff; }

/* ---------------- Giriş sayfası ---------------- */
body.guest { min-height: 100vh; }
.guest-wrap { max-width: 420px; margin: 0 auto; padding: 56px 20px 32px; display: flex; flex-direction: column; gap: 16px; }
.guest-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-bottom: 8px; }
.guest-head p { color: var(--muted); margin: 0; }

/* ---------------- Kartlar, başlıklar ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.narrow, .narrow { max-width: 620px; width: 100%; }
.card.notice { border-color: #E9D29A; background: #FFFBEF; }
.card.empty { color: var(--muted); text-align: center; padding: 28px 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: #8C5A12; margin: 0 0 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; text-decoration: none; margin-bottom: 6px; min-height: 32px; }
.sec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head .h2 { margin: 0; }

/* ---------------- Uyarılar ---------------- */
.flash { border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.45; border: 1px solid; }
.flash-success { background: #E7F5EC; border-color: #B7E0C4; color: var(--green); }
.flash-error { background: #FDECEC; border-color: var(--red-line); color: var(--red); }
.flash-info { background: var(--blue-bg); border-color: #C3D3E8; color: var(--blue); }

/* ---------------- Düğmeler ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #18304D; color: #fff; }
.btn-ghost { background: var(--surface); color: var(--brand); border-color: var(--field); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { background: var(--surface); color: var(--red); border-color: var(--red-line); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 16px; }
.btn-xl { min-height: 62px; font-size: 17px; border-radius: 14px; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.is-busy { position: relative; }

/* ---------------- Formlar ---------------- */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-stack h2 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .f-label { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hint { font-size: 12px; color: var(--muted); }
.req { font-weight: 400; color: var(--muted); }
.step {
  width: 22px; height: 22px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-off { background: #9AA1AD; }
input[type=text], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 50px; border: 1px solid var(--field); border-radius: 10px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
}
textarea { padding: 12px 14px; resize: vertical; min-height: 0; }
select { padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.is-invalid > input, input.is-invalid, textarea.is-invalid, .money.is-invalid { border-color: var(--red) !important; background: #FFF8F8; }
.money { display: flex; align-items: center; gap: 8px; border: 1px solid var(--field); border-radius: 10px; padding-left: 14px; background: var(--surface); }
.money span { font-size: 18px; font-weight: 600; color: var(--muted); }
.money input { border: 0; min-height: 48px; font-size: 18px; font-weight: 600; padding-left: 0; font-variant-numeric: tabular-nums; }
.money input:focus { outline: none; }
.money:focus-within { outline: 2px solid var(--brand); border-color: var(--brand); }

.form-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-inline .f-label { width: 100%; }
.form-inline input { flex: 1 1 220px; min-width: 0; }
.form-inline .hint { width: 100%; }
.form-inline.tight { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.form-grid .end { justify-content: flex-end; }

/* Aranabilir liste */
.combo { position: relative; }
.combo-input { padding-right: 36px !important; background-image: linear-gradient(45deg, transparent 50%, #9AA1AD 50%), linear-gradient(135deg, #9AA1AD 50%, transparent 50%); background-position: calc(100% - 18px) 22px, calc(100% - 13px) 22px; background-size: 5px 5px; background-repeat: no-repeat; }
.combo.is-disabled .combo-input { background-color: #ECEEF1; color: var(--muted); }
.combo.has-value .combo-input { font-weight: 600; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 15; margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--field); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.12);
  max-height: 260px; overflow-y: auto; overscroll-behavior: contain;
}
.combo-list li[data-value] { min-height: 46px; display: flex; align-items: center; padding: 0 14px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.combo-list li[data-value]:last-child { border-bottom: 0; }
.combo-list li.is-active, .combo-list li[data-value]:hover { background: var(--brand-soft); }
.combo-list li[aria-selected=true] { font-weight: 600; }
.combo-empty { padding: 12px 14px; color: var(--muted); font-size: 14px; }

/* ---------------- Filtreler ---------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; }
.filters .f { display: flex; flex-direction: column; gap: 4px; flex: 1 1 170px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.filters select { min-height: 44px; font-size: 15px; }
.search { display: flex; }
.searchbox { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--field); border-radius: 10px; padding: 0 12px; background: var(--surface); color: var(--muted); margin-bottom: 10px; }
.searchbox input { border: 0; min-height: 46px; padding: 0; }
.searchbox input:focus { outline: none; }
.searchbox:focus-within { outline: 2px solid var(--brand); }
.sumline { margin: 0; font-size: 14px; color: var(--muted); }
.sumline strong { color: var(--ink); }

/* ---------------- Listeler ---------------- */
.rlist { list-style: none; margin: 0; padding: 0; }
.rlist.card { padding: 0; overflow: hidden; }
.rlist li + li { border-top: 1px solid var(--line-2); }
.rlist a { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; text-decoration: none; color: var(--ink); min-height: 60px; }
.rlist a:hover { background: var(--surface-2); }
.rl-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rl-title { font-weight: 600; font-size: 15px; }
.rl-sub { font-size: 13px; color: var(--muted); }
.rl-note { font-size: 12px; color: var(--muted); font-style: italic; }
.rl-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.is-cancelled .rl-title, .is-cancelled .rl-money { text-decoration: line-through; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows.card { padding: 0; }
.rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.rows li:last-child { border-bottom: 0; }
.rows li.pad, .navlist li.pad { padding: 14px 16px; }
.row-main { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-main small { font-size: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.is-off .row-main strong, a.is-off strong { color: var(--muted); }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill .ic { width: 14px; height: 14px; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-gray { background: var(--gray-bg); color: var(--gray); }

.dl { margin: 0; display: grid; gap: 12px; }
.dl > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; min-width: 0; }
.dl .amt { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.strike { text-decoration: line-through; color: var(--muted); }
@media (max-width: 480px) { .dl > div { grid-template-columns: 1fr; gap: 2px; } }

.fold > summary, .fold-inline > summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; gap: 8px; color: var(--brand); }
.fold[open] > summary { margin-bottom: 12px; }
.fold.danger > summary { color: var(--red); }
.fold-inline { margin-top: 12px; }
.fold-inline[open] > summary { margin-bottom: 10px; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline.card { padding: 4px 16px; }
.timeline > li { padding: 12px 0 12px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline > li::before { content: ""; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 5px; background: var(--brand); }
.tl-head { font-size: 14px; margin-bottom: 2px; }
.diff { margin: 4px 0 0; padding: 0; list-style: none; font-size: 14px; }
.diff del { color: var(--red); }
.diff ins { color: var(--green); text-decoration: none; font-weight: 600; }

.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split-side { flex: 1 1 300px; min-width: 0; padding: 16px 0 16px; }
.split-side > .h2, .split-side > .searchbox, .split-side > form { margin-left: 16px; margin-right: 16px; width: auto; }
.split-main { flex: 999 1 480px; min-width: 0; }
.navlist { list-style: none; margin: 0 0 4px; padding: 0; max-height: 520px; overflow-y: auto; border-top: 1px solid var(--line-2); }
.navlist a { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 16px; min-height: 52px; text-decoration: none; color: var(--ink); border-left: 3px solid transparent; border-bottom: 1px solid var(--line-2); }
.navlist a span { display: flex; flex-direction: column; }
.navlist a small { font-size: 12px; }
.navlist a.on { background: var(--brand-soft); border-left-color: var(--brand); }
.addbox { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pop { position: relative; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; right: 0; top: 44px; z-index: 10; width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.12); gap: 8px; }
.pop-body input { min-height: 44px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat strong { font-size: 21px; font-variant-numeric: tabular-nums; }
.stat.dark { background: var(--dark); border-color: var(--dark); }
.stat.dark span { color: #C7CCD5; }
.stat.dark strong { color: #fff; }

.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.tbl thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.tbl tfoot th { border-bottom: 0; background: var(--surface-2); }
.tbl .num { text-align: right; white-space: nowrap; }
.pager { display: flex; justify-content: space-between; gap: 10px; }

/* ---------------- Onay penceresi ---------------- */
.dlg { border: 0; border-radius: 16px; padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(22,26,34,.45); }
.dlg p { margin: 0 0 18px; display: flex; flex-direction: column; gap: 10px; font-size: 16px; }
.dlg-detail { font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; word-break: break-word; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dlg-actions .btn { flex: 1 1 140px; }
