/* ===== Dağıtım Takip — arayüz ===== */
:root {
  --brand: #b8341b;
  --brand-600: #9f2c16;
  --brand-50: #fbeee9;
  --brand-100: #f6d9cf;
  --cocoa: #3a1716;
  --cocoa-900: #241010;
  --bg: #f6f3f0;
  --card: #ffffff;
  --text: #261817;
  --muted: #7d6c69;
  --border: #ebe3df;
  --border-strong: #dccfca;
  --ok: #18915f;
  --ok-50: #e6f5ee;
  --warn: #d97f12;
  --warn-50: #fdf1e1;
  --danger: #d0362a;
  --danger-50: #fceae8;
  --info: #2c68d4;
  --info-50: #e8effc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(58, 23, 22, .05), 0 4px 16px rgba(58, 23, 22, .05);
  --shadow-lg: 0 10px 40px rgba(36, 16, 16, .18);
  --sidebar-w: 256px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
.ic { width: 20px; height: 20px; flex-shrink: 0; }
.ic.ic-xs { width: 13px; height: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.text-ok { color: var(--ok); } .text-danger { color: var(--danger); } .text-warn { color: var(--warn); }
[hidden] { display: none !important; }

/* ===== Yerleşim ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 40;
  background: linear-gradient(180deg, var(--cocoa) 0%, var(--cocoa-900) 100%);
  color: #f3e6e2; display: flex; flex-direction: column;
}
.sb-head { padding: 18px 18px 10px; display: flex; align-items: center; justify-content: space-between; }
.sb-logo img { max-width: 150px; max-height: 64px; display: block; }
.sidebar .sb-close { display: none; color: #f3e6e2; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sb-group { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: rgba(243,230,226,.42); padding: 16px 10px 6px; }
.sb-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: rgba(243,230,226,.82); font-weight: 500; transition: background .15s, color .15s; }
.sb-link .ic { width: 18px; height: 18px; opacity: .85; }
.sb-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-link.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(184, 52, 27, .35); }
.sb-link.active .ic { opacity: 1; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sb-user .icon-btn { color: rgba(243,230,226,.7); }
.sb-user-info { flex: 1; min-width: 0; line-height: 1.25; }
.sb-user-info strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-info small { color: rgba(243,230,226,.55); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.sb-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(246, 243, 240, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.tb-title { font-size: 20px; font-weight: 750; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tb-logo img { height: 30px; display: block; }
.content { padding: 8px 28px 40px; max-width: 1400px; width: 100%; }
.only-mobile { display: none !important; }

/* ===== Kart ===== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .ic { color: var(--brand); width: 18px; height: 18px; }
.card-body { padding: 16px 20px; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid > .card { margin-top: 0 !important; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

/* KPI */
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; position: relative; overflow: hidden; }
.kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex-shrink: 0; }
.kpi-ic.ok { background: var(--ok-50); color: var(--ok); }
.kpi-ic.info { background: var(--info-50); color: var(--info); }
.kpi-ic.warn { background: var(--warn-50); color: var(--warn); }
.kpi-ic.danger { background: var(--danger-50); color: var(--danger); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hero { background: linear-gradient(135deg, var(--brand) 0%, #8c2412 100%); color: #fff; border: 0; }
.kpi.hero .kpi-label, .kpi.hero .kpi-sub { color: rgba(255,255,255,.78); }
.kpi.hero .kpi-ic { background: rgba(255,255,255,.16); color: #fff; }

/* Hızlı işlemler */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); font-weight: 600; font-size: 13px; text-align: center; transition: transform .12s, box-shadow .12s; }
.quick a:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(58,23,22,.09); }
.quick a .q-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.quick a:nth-child(2) .q-ic { background: var(--ok-50); color: var(--ok); }
.quick a:nth-child(3) .q-ic { background: var(--info-50); color: var(--info); }
.quick a:nth-child(4) .q-ic { background: var(--warn-50); color: var(--warn); }

/* İlerleme */
.progress { height: 9px; border-radius: 99px; background: #f0e8e4; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #e0603f); transition: width .6s; }
.progress.ok > span { background: linear-gradient(90deg, #13a067, #3cc48b); }
.target-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.target-row:last-child { border-bottom: 0; }
.target-row .row { margin-bottom: 7px; }

/* ===== Liste ===== */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .li-main { flex: 1; min-width: 0; }
.list .li-main strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .li-main small { color: var(--muted); font-size: 12.5px; }
.list a.li-link { color: inherit; display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--border-strong); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); }

/* ===== Tablo ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 11px 14px; background: #faf7f5; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fcfaf8; }
.tbl .num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: #faf7f5; border-top: 1px solid var(--border-strong); }
.tbl tr.row-warn td { background: var(--warn-50); }
.tbl tr.row-danger td { background: var(--danger-50); }
.tbl tr.cancelled td { color: var(--muted); text-decoration: line-through; }
.tbl tr.cancelled td .badge { text-decoration: none; }
.tbl a.strong { color: var(--text); }
.tbl a.strong:hover { color: var(--brand); }

/* Rozet */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #f1ebe8; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.danger { background: var(--danger-50); color: var(--danger); }
.badge.info { background: var(--info-50); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand); }

/* ===== Buton ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; background: var(--brand); color: #fff; text-decoration: none; }
.btn:hover { background: var(--brand-600); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: #faf6f4; color: var(--text); border-color: #cdbdb7; }
.btn-ok { background: var(--ok); } .btn-ok:hover { background: #127a4f; }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #b12a20; }
.btn-soft-danger { background: var(--danger-50); color: var(--danger); } .btn-soft-danger:hover { background: #f8d8d4; color: var(--danger); }
.btn-wa { background: #1fae54; } .btn-wa:hover { background: #178a42; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 50px; font-size: 15.5px; padding: 0 22px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(0,0,0,.05); }

/* ===== Form ===== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #4a3633; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 15px; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d6c69' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(184, 52, 27, .14); }
.input-sm { height: 36px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { display: inline-flex; }
.days input { display: none; }
.days span { padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border-strong); font-size: 13px; font-weight: 600; cursor: pointer; background: #fff; }
.days input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; }
.filters .field { min-width: 150px; }
.filters .field label { font-size: 12px; margin-bottom: 4px; }
.search-box { position: relative; flex: 1; min-width: 180px; }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search-box .input, .search-box input { padding-left: 38px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.seg { display: inline-flex; background: #efe8e4; border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg label { padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg a.active, .seg input:checked + span { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg input { display: none; }
.seg label span { display: block; padding: 7px 14px; border-radius: 9px; margin: -7px -14px; }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pay-methods label { cursor: pointer; }
.pay-methods input { display: none; }
.pay-methods span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border: 1.5px solid var(--border-strong); border-radius: 12px; font-weight: 600; font-size: 13px; text-align: center; background: #fff; transition: all .15s; }
.pay-methods input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.upload-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: #fcfaf8; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; position: relative; transition: border-color .15s, background .15s; }
.upload-box:hover { border-color: var(--brand); background: var(--brand-50); }
.upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload-box .ic { width: 26px; height: 26px; color: var(--brand); }
.upload-box.has-file { border-style: solid; border-color: var(--ok); background: var(--ok-50); color: #0f6a44; }
.upload-box.has-file .ic { color: var(--ok); }
.upload-box img.up-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.att-preview { display: block; max-width: 100%; max-height: 520px; border-radius: 12px; border: 1px solid var(--border); margin: 0 auto; }
.big-amount { font-size: 28px !important; height: 60px !important; font-weight: 700; text-align: center; letter-spacing: -.02em; }

/* Seçili cari kartı */
.cust-pick { position: relative; }
.cust-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; }
.cust-results div, .le-results div { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.cust-results div:last-child, .le-results div:last-child { border-bottom: 0; }
.cust-results div:hover, .cust-results div.hl, .le-results div:hover, .le-results div.hl { background: var(--brand-50); }
.cust-results small, .le-results small { color: var(--muted); display: block; font-size: 12px; }
.cust-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fcfaf8; }
.cust-card .cc-main { flex: 1; min-width: 0; }
.cust-card strong { display: block; }
.info-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Satır editörü */
.le-search { display: flex; gap: 8px; position: relative; }
.le-search .search-box input { width: 100%; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; font-size: 15px; padding-right: 12px; }
.le-search .search-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(184,52,27,.14); }
.le-search .btn { height: 44px; }
.le-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 340px; overflow-y: auto; }
.le-results .stk { float: right; font-size: 12px; font-weight: 600; color: var(--ok); }
.le-results .stk.zero { color: var(--danger); }
.le-lines { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.le-line { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px 120px 110px 36px; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.le-line.no-price { grid-template-columns: minmax(0, 1fr) 90px 90px 36px; }
.le-line.with-cond { grid-template-columns: minmax(0, 1fr) 80px 80px 120px 110px 110px 36px; }
.le-line.no-price.with-cond { grid-template-columns: minmax(0, 1fr) 90px 90px 120px 36px; }
.le-line.with-cost { grid-template-columns: minmax(0, 1fr) 80px 80px 130px 36px; }
.le-line.no-price.with-skt { grid-template-columns: minmax(0, 1fr) 90px 90px 150px 36px; }
.le-line.with-cost.with-skt { grid-template-columns: minmax(0, 1fr) 80px 80px 120px 150px 36px; }
.le-line .ln-skt input { text-align: left; font-size: 14px; }
.le-line .ln-name strong { display: block; font-size: 14px; line-height: 1.3; }
.le-line .ln-name small { color: var(--muted); font-size: 12px; }
.le-line .ln-name small.over { color: var(--danger); font-weight: 600; }
.le-line label { display: none; }
.le-line input, .le-line select { width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: 9px; font: inherit; font-size: 15px; padding: 0 8px; text-align: center; background: #fff; }
.le-line select { text-align: left; }
.le-line input:focus, .le-line select:focus { outline: none; border-color: var(--brand); }
.le-line .ln-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.le-head { display: grid; gap: 8px; padding: 0 12px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 14px; }
.le-empty { padding: 26px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: 12px; margin-top: 12px; font-size: 13.5px; }
.le-total { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 14px 16px; background: var(--cocoa); color: #fff; border-radius: 12px; }
.le-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }

/* Dar kutuda (telefon veya yan panelli düzen) satırlar kart görünümüne geçer */
.line-editor { container-type: inline-size; }
@container (max-width: 620px) {
  .le-line, .le-line.no-price, .le-line.with-cond, .le-line.no-price.with-cond, .le-line.with-cost { grid-template-columns: 1fr 1fr 1fr; grid-template-areas: "n n x" "a b c" "d d t"; row-gap: 8px; }
  .le-line .ln-name { grid-area: n; }
  .le-line .ln-del { grid-area: x; justify-self: end; }
  .le-line label { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .le-line .ln-c { grid-area: a; } .le-line .ln-u { grid-area: b; } .le-line .ln-p { grid-area: c; }
  .le-line .ln-cond { grid-area: d; }
  .le-line .ln-total { grid-area: t; align-self: end; }
  .le-line.no-price .ln-cond { grid-area: c; }
  .le-line.with-cost .ln-cost { grid-area: c; }
  .le-line .ln-skt { grid-area: d; }
  .le-line.no-price .ln-skt { grid-area: c; }
}
.card .le-total strong { white-space: nowrap; }
.card-body > .le-total strong { font-size: 20px; }

/* Uyarı kutusu */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; align-items: flex-start; }
.alert .ic { width: 18px; height: 18px; margin-top: 1px; }
.alert.warn { background: var(--warn-50); color: #8a520b; }
.alert.danger { background: var(--danger-50); color: #9b2219; }
.alert.info { background: var(--info-50); color: #1f4c9c; }
.alert.ok { background: var(--ok-50); color: #0f6a44; }

/* Boş durum */
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; opacity: .45; margin-bottom: 6px; }
.empty p { margin: 0; }

/* Sayfalama */
.pager { display: flex; gap: 6px; justify-content: center; padding: 14px; }
.pager a { min-width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #fff; border: 1px solid var(--border); color: var(--text); font-weight: 600; }
.pager a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Toast */
.toast-data { display: none; }
.toasts { position: fixed; z-index: 100; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; border-radius: 12px; background: var(--cocoa-900); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2); }
.toast .t-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); }
.toast .t-ic .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.toast.error .t-ic { background: var(--danger); }
.toast.warn .t-ic { background: var(--warn); }
.toast.out { animation: toastOut .25s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(36, 16, 16, .55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal-card { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; }
.scan-reader { width: 100%; min-height: 260px; background: #111; }
.scan-reader video { width: 100% !important; display: block; }
@keyframes fade { from { opacity: 0; } }

/* Fotoğraf ızgarası */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-grid .ph { margin: 0; position: relative; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.photo-grid .ph img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #f1ebe8; }
.photo-grid .ph-type { position: absolute; top: 8px; left: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.photo-grid figcaption { padding: 8px 10px; font-size: 11.5px; line-height: 1.4; position: relative; padding-right: 34px; }
.photo-grid .ph-del { position: absolute; right: 2px; bottom: 2px; }
.photo-grid .ph-del .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.thumbs { display: flex; gap: 4px; }
.thumbs img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* Detay listesi */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; font-weight: 500; }

/* Harita */
.map { height: 520px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); z-index: 1; }
.map.sm { height: 280px; }
.leaflet-popup-content { font-family: var(--font); font-size: 13px; }
.map-num { background: var(--brand); color: #fff; border-radius: 50%; width: 28px !important; height: 28px !important; display: grid !important; place-items: center; font-weight: 700; font-size: 12px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.map-num.done { background: var(--ok); }

/* Rota kartları */
.stop { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.stop:last-child { border-bottom: 0; }
.stop-num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.stop.done .stop-num { background: var(--ok); color: #fff; }
.stop-main { flex: 1; min-width: 0; }
.stop-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* Belge (fiş / ekstre) */
.doc-wrap { display: flex; justify-content: center; }
.doc { background: #fff; width: 100%; max-width: 760px; padding: 34px 38px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); color: #1f1414; font-size: 13.5px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 18px; border-bottom: 2px solid var(--cocoa); }
.doc-head img { max-height: 70px; max-width: 220px; }
.doc-company { text-align: right; font-size: 12.5px; color: #4a3633; line-height: 1.5; }
.doc-company strong { font-size: 15px; color: #1f1414; display: block; }
.doc-title { display: flex; justify-content: space-between; align-items: flex-end; margin: 20px 0 14px; gap: 12px; flex-wrap: wrap; }
.doc-title h2 { font-size: 22px; font-weight: 800; color: var(--cocoa); letter-spacing: .02em; }
.doc-meta { font-size: 13px; text-align: right; }
.doc-box { background: #faf6f4; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.doc th { background: var(--cocoa); color: #fff; font-weight: 600; text-align: left; padding: 8px 10px; font-size: 12px; }
.doc td { padding: 8px 10px; border-bottom: 1px solid #eee4e0; }
.doc .num { text-align: right; white-space: nowrap; }
.doc tfoot td { font-weight: 700; border-top: 2px solid var(--cocoa); border-bottom: 0; }
.doc-amount { text-align: center; padding: 20px; border: 2px dashed var(--brand-100); border-radius: 14px; margin: 16px 0; }
.doc-amount .v { font-size: 32px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.doc-sign { display: flex; justify-content: space-between; margin-top: 40px; gap: 30px; }
.doc-sign div { flex: 1; text-align: center; border-top: 1px solid #bba9a3; padding-top: 6px; font-size: 12px; color: #6b5752; }
.doc-foot { margin-top: 22px; font-size: 11px; color: #9a8782; text-align: center; }
.doc-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }

/* Giriş */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 80% -10%, #5a231d 0%, transparent 60%), linear-gradient(160deg, var(--cocoa) 0%, var(--cocoa-900) 100%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 34px 30px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth-card img { display: block; max-width: 210px; max-height: 90px; margin: 0 auto 10px; }
.auth-card h1 { text-align: center; font-size: 18px; margin-bottom: 4px; }
.auth-card p.sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }

/* Alt menü (mobil) */
.bottom-nav { display: none; }

/* Grafik */
.chart-box { position: relative; height: 240px; }

/* ===== Duyarlı ===== */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); width: 280px; }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(36,16,16,.5); }
  .sidebar .sb-close { display: inline-grid; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-flex !important; }
  .topbar { padding: 10px 16px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border); }
  .tb-title { font-size: 16.5px; }
  .tb-logo { display: none !important; }
  .content { padding: 14px 16px 100px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .bottom-nav { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(58,23,22,.06); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 4px 0; }
  .bottom-nav a .ic { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .bn-fab { width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(184,52,27,.4); border: 3px solid #fff; }
  .bottom-nav .bn-main { color: var(--text); }
  .doc { padding: 22px 18px; }
  .dl { grid-template-columns: 120px 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid { gap: 12px; }
  .card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 12px; }
  .kpi { padding: 13px 14px; gap: 10px; flex-direction: column; }
  .kpi-ic { width: 36px; height: 36px; border-radius: 10px; }
  .kpi-ic .ic { width: 18px; height: 18px; }
  .kpi-value { font-size: 18px; }
  .quick { gap: 8px; }
  .quick a { padding: 12px 4px; font-size: 12px; }
  .quick a .q-ic { width: 40px; height: 40px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head, .card-body, .card-pad { padding-left: 16px; padding-right: 16px; }
  .list li { padding: 11px 16px; }
  .hide-sm { display: none; }
  .tb-actions .btn span { display: none; }
  .tb-actions .btn { padding: 0 11px; }
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
  .filters { padding: 12px; }
  .filters .field { min-width: calc(50% - 5px); flex: 1; }
  .tbl th, .tbl td { padding: 10px 10px; }
  .doc-head { flex-direction: column; align-items: center; text-align: center; }
  .doc-company { text-align: center; }
  .doc-title { flex-direction: column; align-items: flex-start; }
  .doc-meta { text-align: left; }
  .map { height: 420px; }
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .tbl.stack td { border: 0; padding: 2px 0; text-align: left !important; }
  .tbl.stack td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  .tbl.stack tfoot td { padding: 4px 0; }
}

/* Yazdırma */
@media print {
  .sidebar, .topbar, .bottom-nav, .doc-actions, .no-print { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .doc { box-shadow: none; border: 0; max-width: none; padding: 0; }
}
