/* Çınarlar Fatura Onay — web. Masaüstü app/theme.py STYLE ile aynı ölçüler (pt) ve renkler. */
:root {
  --primary: #174244; --primary-d: #0F2F31; --green: #1D8B5D; --green-d: #136B47; --green-l: #3FBF86;
  --bg: #F2F5F5; --card: #FFFFFF; --text: #13292B; --muted: #6A7C7D; --line: #E2E9E9; --select: #DDF1E8;
  --red-bg: #FDECEA; --red: #B42318; --yel-bg: #FEF3D7; --amber: #9A5B06; --grn-bg: #E3F4EC;
  --shadow: 0 3px 18px rgba(16, 42, 44, .09);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 10pt "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; display: block; }
[hidden] { display: none !important; }

/* ---------------- iskelet ---------------- */
.shell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: 1fr auto; height: 100vh; }
.side { grid-row: 1; background: linear-gradient(180deg, var(--primary), var(--primary-d)); display: flex; flex-direction: column;
  padding: 26px 0 18px; min-height: 0; }
.side .logo { padding-left: 26px; }
.side .logo img { width: 170px; display: block; }
.side .app-sub { color: #7FB39F; letter-spacing: 3px; font-size: 8pt; font-weight: 600; padding: 10px 0 22px 28px; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav a { position: relative; display: flex; align-items: center; height: 40px; margin: 3px 10px; padding: 0 8px 0 12px; border-radius: 9px;
  text-decoration: none; color: #D3E3E1; font-size: 10pt; }
.nav a .ic { color: #A8C4C2; margin-right: 12px; }
.nav a:hover { background: rgba(255, 255, 255, .063); }
.nav a.on { background: rgba(255, 255, 255, .133); color: #fff; font-weight: 600; }
.nav a.on .ic { color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -4px; top: 9px; bottom: 9px; width: 4px; border-radius: 2px; background: var(--green-l); }
.nav a .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a .badge { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--green); color: #fff; font-size: 8pt;
  font-weight: 700; display: flex; align-items: center; justify-content: center; margin-right: 0; }
.ucard { margin: 0 14px; background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 10px 10px 10px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; font-size: 11pt;
  display: flex; align-items: center; justify-content: center; flex: none; }
.ucard .nm { flex: 1; min-width: 0; text-decoration: none; }
.ucard .nm b { display: block; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucard .nm span, .side .ver { color: #8FB2AF; font-size: 8.5pt; }
.ucard form { margin: 0; }
.sidebtn { background: rgba(255, 255, 255, .08); color: #D3E3E1; border: 0; border-radius: 8px; padding: 7px; cursor: pointer; display: flex; }
.sidebtn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.side .ver { padding: 12px 0 0 28px; }
.side .pwlink { color: #8FB2AF; font-size: 8.5pt; padding: 8px 0 0 28px; text-decoration: none; }
.side .pwlink:hover { color: #fff; }

.main { grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { flex: none; height: 78px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
  padding: 12px 24px 12px 28px; }
.topbar .tt { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 16pt; font-weight: 700; line-height: 1.3; }
.topbar .sub { color: var(--muted); font-size: 9.5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsearch { position: relative; }
.gsearch .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.gsearch input { background: var(--bg); border: 1px solid var(--bg); border-radius: 3px; padding: 7px 14px 7px 62px; width: 290px; height: 34px; outline: 0; }
.gsearch input:focus { background: #fff; border-color: var(--green); }
.topbar .btn { min-height: 38px; }
.menu { display: none; }
.body { flex: 1; min-height: 0; padding: 22px 28px 18px; display: flex; flex-direction: column; }
.statusbar { grid-column: 1 / 3; background: var(--card); color: var(--muted); border-top: 1px solid var(--line); font-size: 8.8pt; padding: 3px 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* sayfa gövdesi: üstte araç çubuğu, altta kalan yüksekliği dolduran tablo */
.page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.page.g12 { gap: 12px; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 8px; }

/* ---------------- düğmeler ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary); color: #fff; padding: 8px 16px;
  border-radius: 9px; border: 0; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.25; }
.btn:hover { background: #1F5557; }
.btn:active { background: var(--primary-d); }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.btn.primary, .btn.big { background: linear-gradient(90deg, var(--green), #22A06B); }
.btn.primary:hover, .btn.big:hover { background: var(--green-d); }
.btn.big { font-size: 11pt; padding: 11px 22px; border-radius: 11px; }
.btn.ghost { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .28); }
.btn.ghost:hover { background: rgba(255, 255, 255, .24); }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { background: #F1F5F5; border-color: #C9D5D5; }
.btn.danger { background: var(--card); color: var(--red); border: 1px solid #F3C4BE; }
.btn.danger:hover { background: var(--red-bg); }
.btn.white { background: #fff; color: var(--primary); padding: 9px 18px; border-radius: 10px; font-weight: 700; }
.btn.white:hover { background: #E8F4EF; }

/* ---------------- girdiler ---------------- */
.inp, select.inp, textarea.inp { padding: 7px 10px; border: 1px solid #D3DEDE; border-radius: 9px; background: #fff; outline: 0; min-height: 34px; }
.inp:focus { border-color: var(--green); }
select.inp { padding-right: 28px; appearance: none; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236A7C7D' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; }
.inp:disabled { background: #F4F7F7; color: var(--muted); }
.search-inp { position: relative; display: inline-flex; }
.search-inp .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-inp .inp { padding-left: 36px; }
.muted { color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 10px; flex: none; }
.toolbar .stretch { flex: 1 1 0; min-width: 0; }
.toolbar > .inp, .toolbar > .search-inp, .toolbar > select { flex-shrink: 6; min-width: 90px; }
.toolbar > .search-inp .inp { width: 100%; min-width: 0; }
.toolbar > .btn { flex-shrink: 1; min-width: 0; overflow: hidden; }
.toolbar > .count { flex-shrink: 3; }
.toolbar .count { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
label.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
label.chk input { width: 16px; height: 16px; accent-color: var(--green); margin: 0; }

/* ---------------- tablo (QTableWidget) ---------------- */
.tbl { position: relative; flex: 1; min-height: 120px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
.tbl table { border-collapse: separate; border-spacing: 0; width: 100%; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--card); color: var(--muted); padding: 10px 8px; border-bottom: 2px solid var(--line);
  font-weight: 600; font-size: 8.8pt; text-align: left; white-space: nowrap; cursor: pointer; user-select: none; width: 1%; }
.tbl th:last-child { width: auto; }
.tbl th .arr { display: inline-block; margin-left: 6px; font-size: 7pt; color: var(--muted); }
.tbl td { height: 40px; padding: 4px 8px; border-bottom: 1px solid #EEF2F2; white-space: nowrap; max-width: 360px; overflow: hidden;
  text-overflow: ellipsis; vertical-align: middle; cursor: default; }
.tbl td.num { text-align: right; }
.tbl tbody tr:nth-child(even of :not([hidden])) td { background: #F8FAFA; }
.tbl tbody tr.sel td { background: var(--select) !important; }
.tbl td.b { font-weight: 700; }
.tbl .empty { position: absolute; inset: 44px 0 0 0; display: flex; align-items: center; justify-content: center; color: var(--muted); pointer-events: none;
  text-align: center; padding: 0 20px; }
.tbl.loose td { height: 44px; }
.pill { display: inline-flex; align-items: center; max-width: 100%; height: 22px; padding: 0 9px 0 6px; border-radius: 11px; font-weight: 600; font-size: 8.5pt;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.pill::before { content: ""; flex: none; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-right: 4px; }
.pill.green { background: var(--grn-bg); color: var(--green-d); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--yel-bg); color: var(--amber); }
.pill.gray { background: #EEF2F2; color: var(--muted); }
.pill.blue { background: #E7F0FE; color: #1E4FB4; }
.pill span { overflow: hidden; text-overflow: ellipsis; }

/* ---------------- sekmeler (QTabBar) ---------------- */
.tabs { display: flex; flex: none; }
.tabs a { padding: 8px 18px; color: var(--muted); border-bottom: 2px solid transparent; margin-right: 6px; font-weight: 600; text-decoration: none; cursor: pointer; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--primary); border-bottom-color: var(--green); }
.tabpane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }

/* ---------------- kartlar ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 18px rgba(16, 42, 44, .063); padding: 16px 20px;
  display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; }
.card-h .ic { color: var(--green); }
.card-title { font-size: 11pt; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 9pt; }
.banner { background: var(--yel-bg); border: 1px solid #F3D48A; border-radius: 12px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 10px;
  color: var(--amber); }
.banner .t { flex: 1; }
.hero { position: relative; overflow: hidden; min-height: 150px; border-radius: 16px; padding: 22px 28px; color: #fff; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(120deg, var(--primary) 0%, #1B5A56 65%, var(--green) 100%); box-shadow: 0 8px 30px rgba(16, 42, 44, .235); }
.hero::after { content: ""; position: absolute; right: -40px; top: 50%; width: 210px; height: 210px; transform: translateY(-50%); opacity: .09;
  background: url(/assets/mark_white.png) no-repeat center / contain; pointer-events: none; }
.hero::before { content: ""; position: absolute; right: 230px; bottom: -110px; width: 210px; height: 210px; opacity: .06;
  background: url(/assets/mark_white.png) no-repeat center / contain; pointer-events: none; }
.hero .hello { font-size: 19pt; font-weight: 700; }
.hero .line { color: #D6EDE6; font-size: 10.5pt; }
.hero .line b { color: #fff; }
.hero .line b.r { color: #FFD4CC; }
.hero .line b.a { color: #FFE3A3; }
.hero .grow { flex: 1; }
.hero .meta { color: #A9CFC4; font-size: 9pt; white-space: pre-wrap; }
.hero .row { display: flex; gap: 10px; position: relative; z-index: 1; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-height: 112px; padding: 16px 18px; display: flex; gap: 14px;
  align-items: flex-start; text-decoration: none; color: inherit; box-shadow: 0 3px 18px rgba(16, 42, 44, .086); transition: box-shadow .16s, transform .16s; cursor: pointer; }
.kpi:hover { box-shadow: 0 8px 36px rgba(16, 42, 44, .19); }
.kbadge { width: 46px; height: 46px; border-radius: 23px; display: flex; align-items: center; justify-content: center; flex: none; }
.kpi .num { font-size: 22pt; font-weight: 700; line-height: 1.15; }
.kpi .cap { color: var(--muted); font-size: 9pt; }
.t-teal { background: #E4EEEE; color: var(--primary); } .t-green { background: var(--grn-bg); color: var(--green-d); }
.t-red { background: var(--red-bg); color: var(--red); } .t-amber { background: var(--yel-bg); color: var(--amber); }
.t-blue { background: #E7F0FE; color: #1E4FB4; } .t-gray { background: #EEF2F2; color: var(--muted); }
.n-red { color: var(--red); } .n-amber { color: var(--amber); }
.charts { display: grid; grid-template-columns: 5fr 4fr 3fr; gap: 16px; }
.bars { height: 190px; padding: 16px 8px 26px; }
.bars .plot { position: relative; height: 100%; }
.bars .gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.bars .cols { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.bars .col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bars .bar { position: relative; width: 56%; min-width: 6px; border-radius: 5px; background: linear-gradient(#2E7F77, var(--primary)); animation: grow .8s cubic-bezier(.22,1,.36,1); transform-origin: bottom; }
.bars .col.last .bar, .bars .col:hover .bar { background: linear-gradient(var(--green), var(--primary)); }
.bars .v { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); padding-bottom: 2px; font-size: 8pt; font-weight: 700; display: none; }
.bars .col:hover .v, .bars .cols:not(:hover) .col.peak .v { display: block; }
.bars .lab { position: absolute; top: 100%; margin-top: 5px; color: var(--muted); font-size: 8pt; }
@keyframes grow { from { transform: scaleY(0); } }
.bars svg, .donut svg { display: block; width: 100%; height: 100%; overflow: visible; }
.donut { height: 190px; display: flex; align-items: center; gap: 22px; padding-left: 12px; }
.donut .ring { position: relative; flex: none; }
.donut .ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut .ring b { font-size: 18pt; }
.donut .ring span { color: var(--muted); font-size: 8.5pt; margin-top: 4px; }
.legend { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 9pt; }
.legend div { display: flex; align-items: center; gap: 8px; height: 20px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend span { flex: 1; }
.legend b { padding-right: 8px; }
.month { display: grid; grid-template-columns: 1fr 1fr; row-gap: 14px; column-gap: 10px; padding-top: 4px; }
.month b { display: block; font-size: 15pt; font-weight: 700; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 18px rgba(16, 42, 44, .063); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; cursor: pointer; text-decoration: none; color: inherit; text-align: left; width: 100%; font: inherit; }
.tile:hover { box-shadow: 0 8px 30px rgba(16, 42, 44, .14); }
.tile .tb { width: 44px; height: 44px; border-radius: 22px; background: var(--grn-bg); color: var(--green-d); display: flex; align-items: center; justify-content: center; flex: none; }
.tile .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tile .tx .card-sub { white-space: normal; }
.tile > .ic { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 18px rgba(16, 42, 44, .063); padding: 14px 18px; }
.metric b { display: block; font-size: 17pt; font-weight: 700; }
.metric b.bad { color: var(--red); }
.metric span { color: var(--muted); font-size: 9pt; }
.home { display: flex; flex-direction: column; gap: 18px; }
.home .card .tbl { min-height: 280px; flex: none; max-height: 520px; }

/* ---------------- pencere (QDialog) ---------------- */
.dlg-back { position: fixed; inset: 0; z-index: 50; background: rgba(15, 47, 49, .38); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { background: var(--bg); border-radius: 10px; box-shadow: 0 24px 80px rgba(0, 0, 0, .35); display: flex; flex-direction: column; overflow: hidden;
  max-width: 100%; max-height: 100%; }
.dlg-bar { flex: none; height: 34px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 6px 0 12px; gap: 8px;
  font-size: 9pt; user-select: none; }
.dlg-bar img { width: 16px; height: 16px; }
.dlg-bar .t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-bar button { border: 0; background: transparent; width: 36px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 15px; color: var(--muted); }
.dlg-bar button:hover { background: #E81123; color: #fff; }
.dlg iframe { border: 0; flex: 1; width: 100%; background: var(--bg); }
.dlg .inner { padding: 22px 26px 20px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.msg { display: flex; gap: 14px; align-items: flex-start; }
.msg .mi { flex: none; }
.msg .mt { white-space: pre-wrap; line-height: 1.45; }
.msg .mt b { display: block; margin-bottom: 4px; }
.dlg .btns, .dlgbody .btns { display: flex; justify-content: flex-end; gap: 10px; }
.btns .btn { min-width: 84px; }
.res-row { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 600; text-decoration: none; }
.res-row.r { background: var(--red-bg); color: var(--red); }
.res-row.a { background: var(--yel-bg); color: var(--amber); }
.res-row .x { flex: 1; }
.res-row .go { font-weight: 400; }

/* pencere içi sayfa (iframe) */
body.dlgbody { background: var(--bg); }
.dlgbody .dbody { height: 100vh; display: flex; flex-direction: column; gap: 10px; padding: 11px; }
.dlgbody .dbody.pad { padding: 20px 20px 14px; }
.dlgbody .dbody.pad2 { padding: 20px 22px 18px; gap: 14px; }
.dlgbody .row { display: flex; align-items: center; gap: 10px; flex: none; }
.dlgbody .row .stretch { flex: 1; }
.form { display: grid; grid-template-columns: max-content 1fr; column-gap: 16px; row-gap: 10px; align-items: center; }
.form > label { white-space: nowrap; }
.form .fr { display: flex; gap: 8px; align-items: center; }
.form .fr .inp { flex: 1; }
.form .full { grid-column: 1 / 3; }
.note-l { color: var(--text); line-height: 1.45; }
.alert { padding: 8px 12px; border-radius: 8px; font-weight: 600; flex: none; }
.alert.red { background: var(--red-bg); color: var(--red); }
.alert.green { background: var(--grn-bg); color: var(--green-d); }
.alert.amber { background: var(--yel-bg); color: var(--amber); }
.dtabs-pane { flex: 1; min-height: 0; overflow: auto; padding: 14px 4px 4px; }
.browser { flex: 1; min-height: 0; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; }
.inv-head { flex: none; background: linear-gradient(135deg, #174244, #1D6B55); border-radius: 14px; color: #fff; padding: 16px 22px; display: flex; gap: 16px; }
.inv-head .l { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inv-head .no { font-size: 16pt; font-weight: 700; }
.inv-head .sp { font-size: 11pt; color: #D6EDE6; }
.inv-head .mt { color: #A9CFC4; }
.inv-head .r { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.inv-head .amt { font-size: 19pt; font-weight: 700; }
.inv-head .pl { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hp { border-radius: 10px; padding: 3px 10px; font-weight: 600; font-size: 8.8pt; white-space: nowrap; max-width: 330px; overflow: hidden; text-overflow: ellipsis; }
.hp.g { background: #DFF3EA; color: #136B47; } .hp.r { background: #FDECEA; color: #B42318; } .hp.a { background: #FEF3D7; color: #9A5B06; }
.hp.n { background: rgba(255, 255, 255, .18); color: #fff; }
.sec { margin: 14px 0 6px; color: var(--green); font-weight: 700; font-size: 10pt; letter-spacing: 1px; }
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 5px; vertical-align: top; }
.kv td.k { width: 170px; color: var(--muted); }
.qt { width: 100%; border-collapse: collapse; }
.qt th { background: #F2F5F5; color: var(--muted); text-align: left; padding: 7px; }
.qt td { padding: 7px; border-bottom: 1px solid #EEF2F2; }
.qt .r { text-align: right; }
.tag { padding: 0 4px; font-weight: 700; }
.tag.red { background: var(--red-bg); color: var(--red); } .tag.green { background: var(--grn-bg); color: var(--green-d); } .tag.gray { background: #EEF2F2; color: var(--muted); }
.mailframe { flex: 1; min-height: 200px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
.edit-tbl td { padding: 3px 4px; max-width: none; }
.edit-tbl td .inp { width: 100%; min-height: 30px; padding: 3px 8px; border-radius: 6px; }
.edit-tbl td select.inp { padding-right: 24px; }
.drop { border: 2px dashed #C9D5D5; border-radius: 12px; background: #fff; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.drop.over { border-color: var(--green); background: #F3FBF7; }
.flist { max-height: 140px; overflow: auto; font-size: 9pt; color: var(--muted); }
.flist div { display: flex; gap: 8px; padding: 2px 0; }
.flist .ok { color: var(--green-d); }

/* ---------------- yükleniyor katmanı (BusyOverlay) ---------------- */
.busy { position: fixed; inset: 0; z-index: 60; background: rgba(243, 246, 246, .745); display: flex; align-items: center; justify-content: center; }
.busy .bc { width: 380px; min-height: 180px; background: #fff; border-radius: 16px; display: flex; flex-direction: column; align-items: center; padding: 22px 16px 16px;
  margin-top: -40px; }
.busy .ring { position: relative; width: 68px; height: 68px; }
.busy .ring::before { content: ""; position: absolute; inset: 0; border: 5px solid #E4EEEE; border-radius: 50%; }
.busy .ring::after { content: ""; position: absolute; inset: 0; border: 5px solid transparent; border-top-color: var(--green); border-right-color: var(--green);
  border-radius: 50%; animation: spin .9s linear infinite; }
.busy .ring img { position: absolute; left: 50%; top: 50%; height: 44px; transform: translate(-50%, -50%); }
.busy b { margin-top: 14px; font-size: 10.5pt; }
.busy .bt { color: var(--muted); font-size: 9pt; text-align: center; margin-top: 6px; max-width: 348px; overflow-wrap: anywhere; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- köşe bildirimi (Toast) ---------------- */
.toast { position: fixed; right: 24px; bottom: 44px; z-index: 70; max-width: 470px; border-radius: 12px; padding: 12px 18px 12px 16px; display: flex; gap: 10px;
  align-items: center; color: #fff; box-shadow: 0 8px 30px rgba(16, 42, 44, .31); animation: tin .26s ease-out; }
.toast.green { background: var(--primary); } .toast.red { background: var(--red); } .toast.amber { background: #8A4B06; }
.toast.out { opacity: 0; transition: opacity .26s; }
@keyframes tin { from { opacity: 0; } }

/* ---------------- giriş (LoginDialog) ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.login { width: 920px; max-width: 100%; min-height: 580px; display: flex; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 24px 80px rgba(16, 42, 44, .18); }
.brand { position: relative; width: 420px; flex: none; padding: 44px 40px 36px; color: #fff; display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(135deg, var(--primary) 0%, #184E4E 70%, var(--green-d) 100%); }
.brand::after { content: ""; position: absolute; width: 360px; height: 360px; right: -90px; bottom: -54px; opacity: .07;
  background: url(/assets/mark_white.png) no-repeat center / contain; }
.brand img { width: 250px; }
.brand h2 { margin: 46px 0 14px; font-size: 20pt; line-height: 1.3; }
.brand .f { display: flex; gap: 10px; align-items: center; color: #CFE5DF; font-size: 9.5pt; margin-bottom: 9px; }
.brand .f .ic { color: var(--green-l); }
.brand .foot { margin-top: auto; color: #7FA7A2; font-size: 8.5pt; }
.lform { flex: 1; padding: 60px 64px 48px; display: flex; flex-direction: column; }
.lform h1 { margin: 0; font-size: 22pt; }
.lform .s { margin: 4px 0 30px; }
.lform label.l { color: var(--muted); font-size: 9pt; font-weight: 600; margin-bottom: 6px; }
.lform .fi { position: relative; margin-bottom: 16px; }
.lform .fi .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.lform .fi .inp { width: 100%; min-height: 42px; padding-left: 38px; }
.lform .btn.big { margin-top: 22px; min-height: 46px; width: 100%; }
.lform .foot { margin-top: auto; padding-top: 20px; font-size: 8.5pt; }

/* ---------------- yalnız telefonda görünenler ---------------- */
.mob-only, .nav a.mob, .side-back, .mlogo { display: none; }

/* ---------------- dar ekran (tablet) ---------------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 268px; max-width: 84vw; transform: translateX(-100%); transition: transform .22s ease;
    padding-top: max(26px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .side.open ~ .side-back, .side-back:has(~ .side.open) { display: block; }
  .side-back { position: fixed; inset: 0; z-index: 39; background: rgba(15, 47, 49, .45); }
  .menu { display: flex; align-items: center; justify-content: center; border: 0; background: transparent; font-size: 22px; cursor: pointer;
    width: 40px; height: 40px; margin-left: -8px; border-radius: 9px; color: var(--primary); }
  .menu:active { background: var(--bg); }
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; padding: 10px 16px; }
  .gsearch input { width: 100%; }
  .gsearch { order: 5; flex-basis: 100%; }
  .body { padding: 14px 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts, .tiles, .metrics { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
  .statusbar { grid-column: 1; }
  .brand { display: none; }
  .lform { padding: 36px 24px; }
  .page { min-height: 70vh; }
}

/* ---------------- telefon ---------------- */
@media (max-width: 760px) {
  html, body { height: auto; }
  body { font-size: 10.5pt; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
  .mob-only { display: inline-flex; }
  .nav a.mob { display: flex; }
  .nav a { height: 46px; }
  /* sayfa doğal kayar; üst bar yapışık */
  .shell { display: block; height: auto; min-height: 100vh; min-height: 100dvh; }
  .main { min-height: 100vh; min-height: 100dvh; }
  .topbar { position: sticky; top: 0; z-index: 30; flex-wrap: nowrap; gap: 6px; min-height: 0; padding: 8px 10px 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top)); box-shadow: 0 1px 0 var(--line); }
  .topbar h1 { font-size: 13.5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .sub { display: none; }
  .topbar .btn { min-height: 40px; width: 40px; padding: 0; border-radius: 10px; flex: none; }
  .topbar .btn .bl { display: none; }
  .gsearch { display: none; }
  .topbar.srch { flex-wrap: wrap; }
  .topbar.srch .gsearch { display: block; order: 9; flex-basis: 100%; margin-top: 4px; }
  .gsearch input { height: 42px; font-size: 16px; padding-left: 40px; }
  .body { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); display: block; }
  .statusbar { display: none; }
  .page, .page.g12 { min-height: 0; gap: 10px; }
  .scroll { overflow: visible; padding-right: 0; }
  .tabpane { padding-top: 10px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs a { white-space: nowrap; padding: 10px 14px; }

  /* araç çubukları: sarılır, düğmeler parmak boyutunda */
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .toolbar > .btn { flex: 1 1 auto; min-height: 42px; overflow: visible; }
  .toolbar > .inp, .toolbar > select, .toolbar > .search-inp { flex: 1 1 100%; min-width: 0; }
  .toolbar > .stretch { display: none; }
  .toolbar .count { flex-basis: 100%; order: 20; font-size: 9pt; }
  .inp, select.inp, textarea.inp { min-height: 42px; font-size: 16px; }   /* iOS yakınlaştırmasın */
  .btn { min-height: 40px; }

  /* tablolar → kartlar (her hücrenin başlığı data-l) */
  .tbl { overflow: visible; border: 0; background: transparent; min-height: 0; flex: none; border-radius: 0; }
  .tbl table, .tbl tbody { display: block; }
  .tbl thead { display: none; }
  .tbl tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; row-gap: 6px; background: var(--card);
    border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 2px 10px rgba(16, 42, 44, .05);
    position: relative; touch-action: manipulation; }
  .tbl tbody tr:nth-child(even of :not([hidden])) td { background: transparent; }
  .tbl tbody tr.sel { border-color: var(--green); box-shadow: 0 0 0 2px var(--green) inset; background: #F3FBF7; }
  .tbl tbody tr.sel td { background: transparent !important; }
  .tbl td { display: block; height: auto; min-width: 0; max-width: none; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; font-size: 10pt; }
  .tbl td.num { text-align: left; }
  .tbl td::before { content: attr(data-l); display: block; color: var(--muted); font-size: 8pt; font-weight: 600; margin-bottom: 1px; }
  .tbl td:first-child { grid-column: 1 / -1; font-weight: 700; font-size: 11pt; }
  .tbl td:first-child::before { display: none; }
  .tbl td.e { display: none; }   /* boş hücre */
  .tbl td[style*="background"] { border-radius: 6px; padding: 2px 6px; }
  .tbl[data-dbl]::before { content: "Seçmek için dokunun · açmak için çift dokunun"; display: block; color: var(--muted); font-size: 8.5pt; margin: 0 2px 8px; }
  .tbl[data-multi="1"]::before { content: "Dokunarak bir veya birkaç satır seçin"; display: block; color: var(--muted); font-size: 8.5pt; margin: 0 2px 8px; }
  .tbl[data-multi="1"][data-dbl]::before { content: "Dokunarak satır seçin (birden fazla olabilir) · açmak için çift dokunun"; }
  .tbl.isempty::before { display: none !important; }
  .tbl .empty { position: static; padding: 36px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
  .tbl .pill { height: auto; min-height: 22px; white-space: normal; }
  .home .card .tbl { min-height: 0; max-height: none; }
  .edit-tbl td .inp { min-height: 40px; }

  /* ana sayfa */
  .hero { padding: 18px; min-height: 0; }
  .hero .hello { font-size: 16pt; }
  .hero .row { flex-wrap: wrap; }
  .hero .row .btn { flex: 1 1 auto; }
  .kpis { gap: 10px; }
  .kpi { min-height: 0; padding: 12px; gap: 10px; }
  .kbadge { width: 38px; height: 38px; }
  .kpi .num { font-size: 18pt; }
  .charts, .tiles, .metrics { gap: 10px; }
  .card { padding: 14px; }
  .donut { padding-left: 0; gap: 14px; }
  .banner { flex-wrap: wrap; }

  /* pencereler tam ekran */
  .dlg-back { padding: 0; align-items: stretch; }
  .dlg { width: 100% !important; height: 100% !important; max-height: none; border-radius: 0; }
  .dlg-bar { height: calc(48px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); font-size: 11pt; font-weight: 600; }
  .dlg-bar button { width: 44px; height: 40px; font-size: 18px; }
  .dlg .inner { padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .dlg-back:has(.msg) { align-items: center; padding: 16px; }
  .dlg-back:has(.msg) .dlg { height: auto !important; border-radius: 14px; }
  .dlg-back:has(.msg) .dlg-bar { height: 40px; padding-top: 0; }
  .dlg .btns, .dlgbody .btns { flex-wrap: wrap; }
  .dlg .btns .btn, .dlgbody .btns .btn { flex: 1 1 auto; min-height: 44px; }
  .dlgbody .dbody { height: auto; min-height: 100vh; padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); }
  .dlgbody .dbody.pad, .dlgbody .dbody.pad2 { padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  .dlgbody .row { flex-wrap: wrap; }
  .dlgbody .row > .btn { flex: 1 1 auto; min-height: 42px; }
  .dlgbody .tbl { flex: none; }
  .form { grid-template-columns: 1fr; row-gap: 4px; }
  .form > label { white-space: normal; color: var(--muted); font-size: 9pt; font-weight: 600; margin-top: 8px; }
  .form .full { grid-column: 1; }
  .form .fr { flex-wrap: wrap; }
  .inv-head { flex-direction: column; padding: 14px 16px; gap: 8px; }
  .inv-head .r { align-items: flex-start; }
  .inv-head .pl { justify-content: flex-start; }
  .inv-head .no { font-size: 13pt; overflow-wrap: anywhere; }
  .kv td.k { width: 38%; }
  .qt { display: block; overflow-x: auto; }
  .dtabs-pane { overflow: visible; }
  .browser, .mailframe { min-height: 50vh; }

  /* yükleniyor / bildirim */
  .busy .bc { width: calc(100vw - 40px); }
  .toast { left: 12px; right: 12px; top: calc(64px + env(safe-area-inset-top)); bottom: auto; max-width: none; }

  /* giriş */
  .login-wrap { padding: 0; align-items: stretch; }
  .login { min-height: 100vh; min-height: 100dvh; border-radius: 0; box-shadow: none; }
  .lform { padding: 0 22px 28px; }
  .mlogo { padding-top: calc(18px + env(safe-area-inset-top)) !important; }
  .mlogo { display: flex !important; align-items: center; gap: 12px; margin: 0 -22px 28px; padding: 18px 22px; background: linear-gradient(135deg, var(--primary), var(--green-d)); }
  .mlogo img { width: 150px; }
  .lform .fi .inp { font-size: 16px; min-height: 48px; }
}

/* ---------------- belge tara (kamera + OCR) ---------------- */
.scan { max-width: 560px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.scan > section { display: none; flex-direction: column; gap: 12px; }
.scan[data-state="cam"] .sc-cam, .scan[data-state="busy"] .sc-busy, .scan[data-state="form"] .sc-form, .scan[data-state="done"] .sc-done { display: flex; }
.sc-cam { background: #0B1F20; border-radius: 16px; overflow: hidden; gap: 0 !important; }
.cam { position: relative; height: min(68vh, 720px); background: #000; overflow: hidden; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mask { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.frame { position: relative; width: 84%; aspect-ratio: 1 / 1.414; max-height: 86%; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(5, 20, 21, .55);
  border: 1.5px solid rgba(255, 255, 255, .55); }
.frame .c { position: absolute; width: 34px; height: 34px; border: 4px solid var(--green-l); }
.frame .tl { left: -4px; top: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.frame .tr { right: -4px; top: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.frame .bl { left: -4px; bottom: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.frame .br { right: -4px; bottom: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.cam .hint { position: absolute; left: 12px; right: 12px; top: 12px; text-align: center; color: #fff; font-weight: 600; font-size: 10pt;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.nocam { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff;
  text-align: center; padding: 24px; background: #0B1F20; }
.nocam span { color: #A9CFC4; max-width: 340px; line-height: 1.45; }
.nocam .btn { margin-top: 10px; }
.cam-bar { display: flex; align-items: center; justify-content: space-around; padding: 14px 10px calc(14px + env(safe-area-inset-bottom)); }
.cam-bar .cb { width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #D3E3E1; font-size: 8.5pt; background: none; border: 0;
  cursor: pointer; padding: 6px 0; border-radius: 10px; }
.cam-bar .cb.on { color: #FFE3A3; } .cam-bar .cb.on .ic path { fill: #FFE3A3; }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 4px; cursor: pointer; }
.shutter i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active i { transform: scale(.88); background: var(--green-l); }
.shutter:disabled { opacity: .35; }
.scan.flash .cam::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: .7; }
.sc-busy .busy-in { background: #fff; border-radius: 16px; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  border: 1px solid var(--line); }
.sc-busy .ring { position: relative; width: 68px; height: 68px; }
.sc-busy .ring::before { content: ""; position: absolute; inset: 0; border: 5px solid #E4EEEE; border-radius: 50%; }
.sc-busy .ring::after { content: ""; position: absolute; inset: 0; border: 5px solid transparent; border-top-color: var(--green); border-right-color: var(--green);
  border-radius: 50%; animation: spin .9s linear infinite; }
.sc-busy .ring img { position: absolute; left: 50%; top: 50%; height: 44px; transform: translate(-50%, -50%); }
.sc-prev { padding: 10px; }
.sc-prev img { width: 100%; max-height: 46vh; object-fit: contain; background: #F4F7F7; border-radius: 8px; }
.sc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.sc-fields { gap: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 11px; padding: 4px; gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--primary); box-shadow: 0 1px 6px rgba(16, 42, 44, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--green); }
.fl { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 9pt; font-weight: 600; min-width: 0; }
.fl .inp { color: var(--text); font-weight: 400; width: 100%; }
.fl .inp.miss { border-color: #F3D48A; background: #FFFBEF; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scan[data-kind="fatura"] .k-irsaliye, .scan[data-kind="irsaliye"] .k-fatura { display: none; }
.ocrtext summary { cursor: pointer; color: var(--muted); font-size: 9pt; font-weight: 600; }
.ocrtext pre { white-space: pre-wrap; font: 9pt ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; }
.sc-btns { display: flex; gap: 10px; }
.sc-btns .btn { flex: 1; min-height: 46px; }
.done-card { align-items: center; text-align: center; padding: 28px 18px; gap: 8px; }
.done-card b { font-size: 14pt; }
.done-ic { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.done-ic.green { background: var(--grn-bg); color: var(--green-d); } .done-ic.amber { background: var(--yel-bg); color: var(--amber); }
.done-ic svg { width: 32px; height: 32px; }
.done-card .sc-btns { width: 100%; margin-top: 12px; flex-direction: column; }
@media (max-width: 760px) {
  .scan { gap: 10px; }
  .sc-cam { margin: -12px -12px 0; border-radius: 0; }
  .cam { height: calc(100dvh - 64px - 108px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 360px; }
  .two { grid-template-columns: 1fr; }
}

/* tarama: okunan alanlar elle düzeltilir */
.sc-hint { margin: 0; color: var(--muted); font-size: 9pt; }
.fl .inp.fixed, .it-ed .inp.fixed { border-color: #8FC9AE; background: #F1FAF5; }
.it-ed td { padding: 4px; vertical-align: middle; }
.it-ed td:nth-child(2) { width: 90px; } .it-ed td:nth-child(3) { width: 74px; } .it-ed td.x { width: 34px; text-align: center; }
.it-ed .inp { width: 100%; min-width: 0; }
.it-ed td.r .inp { text-align: right; }
.it-del { border: 0; background: transparent; color: #B23B3B; font-size: 20px; line-height: 1; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; }
.it-del:hover { background: #FBECEC; }
.it-empty { margin: 6px 0; font-size: 9pt; }
#it-add { margin-top: 8px; }
#scan[data-kind="fatura"] .items.k-irsaliye { display: none; }
@media (max-width: 760px) {
  .it-ed, .it-ed tbody { display: block; } .it-ed thead { display: none; }
  .it-ed tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid #EEF2F2; }
  .it-ed td:first-child { grid-column: 1 / -1; }
  .it-ed td { display: block; padding: 0; border: 0; width: auto !important; }
  .it-ed td::before { display: none !important; }
}
