:root {
  color-scheme: light;
  --bg: #f3efe6;
  --surface: #fffdf8;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e0d4;
  --header: #1e293b;
  --accent: #c2410c;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.06), 0 10px 28px rgba(28, 25, 23, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
}

button, input, textarea { font: inherit; color: inherit; }
button, a, input, textarea { touch-action: manipulation; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #fdba74;
  outline-offset: 2px;
}

.app {
  width: min(720px, 100%);
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  z-index: 5;
  background: var(--header);
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
  background: var(--header);
  color: #f8fafc;
}
.menu {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 12px;
  scrollbar-width: none;
}
.menu::-webkit-scrollbar { display: none; }
.menu button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  font-weight: 800;
}
.menu button.is-on { background: #fff; color: var(--header); border-color: #fff; }
.top h1 { margin: 0; font-size: 1.25rem; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.people { display: flex; flex-direction: column; gap: 10px; }
.who { margin: 2px 0 0; color: #cbd5e1; font-size: 0.85rem; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.ghost, .icon-btn {
  flex: 0 0 auto;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: inherit;
  font-weight: 700;
}
.ghost { padding: 0 14px; }
.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; display: block; }
.icon-btn.is-on { background: #fff; color: var(--header); }

.main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}
.main > * { flex: 0 0 auto; }

.page-title { margin: 0; font-size: 1.45rem; }
.muted { color: var(--muted); margin: 0; }
.lead { margin-top: -6px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card h2, .block-title { margin: 0 0 12px; font-size: 1.05rem; }

.field { display: flex; flex-direction: column; gap: 6px; }
label { font-weight: 700; }
.req { color: var(--accent); }

input, textarea, select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid #d6d3d1;
  border-radius: 12px;
  background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
button:disabled, input:disabled, select:disabled { opacity: 0.55; }

form { display: flex; flex-direction: column; gap: 12px; }

.primary, .secondary {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.05rem;
}
.primary { border: 0; background: var(--accent); color: #fff; }
.primary:active, .secondary:active { transform: translateY(1px); }
.secondary { border: 1.5px solid #d6d3d1; background: #fff; }

.back {
  align-self: flex-start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--header);
  font-weight: 800;
}

details:not([open]) > :not(summary) { display: none; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips-wrap { flex-wrap: wrap; overflow: visible; }
.card .chips, .pair + .chips { margin-top: 12px; }
.chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid #d6d3d1;
  background: #fff;
  font-weight: 700;
}
.chip.is-on { background: var(--header); color: #fff; border-color: var(--header); }

#kartlar { display: flex; flex-direction: column; gap: 10px; }
.job {
  width: 100%;
  min-height: 104px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.job .name { font-size: 1.12rem; font-weight: 800; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.no { font-weight: 800; letter-spacing: 0.02em; }
.owe { margin-top: 6px; font-weight: 800; }
.owe.debt { color: #9a3412; }
.owe.ok { color: #047857; }

.badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-geldi, .durum-geldi.is-on { background: #fef3c7; color: #92400e; }
.badge-islemde, .durum-islemde.is-on { background: #dbeafe; color: #1e40af; }
.badge-hazir, .durum-hazir.is-on { background: #d1fae5; color: #065f46; }
.badge-teslim, .durum-teslim.is-on { background: #e7e5e4; color: #44403c; }

.jobno { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: 0.02em; }

.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-grid button {
  min-height: 56px;
  border-radius: 12px;
  border: 1.5px solid #d6d3d1;
  background: #fff;
  font-weight: 800;
}
.status-grid button.is-on { border-color: transparent; }

.warn {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fdba74;
}
.warn p { margin: 0 0 12px; font-weight: 800; }
.warn .secondary { margin-top: 8px; }

.kv { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { margin: 0; color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; white-space: pre-wrap; }
.kv a { color: var(--accent); font-weight: 800; text-decoration: none; }

.sums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sum {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.sum span { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.sum strong { display: block; margin-top: 4px; font-size: 1.05rem; }
.sum.kalan { grid-column: 1 / -1; background: #fff7ed; border-color: #fdba74; }
.sum.kalan.ok { background: #ecfdf5; border-color: #a7f3d0; }
.sum.kalan.over { background: #fef2f2; border-color: #fecaca; }
.sum.kalan strong { font-size: 1.7rem; }

.list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.note { white-space: pre-wrap; margin: 0 0 4px; }

.alert {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-weight: 700;
}
.notice {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 700;
}
.empty { margin: 8px 0; color: var(--muted); }

.dock {
  flex: 0 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 2rem; }
.eyebrow { margin: 0; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); font-size: 0.8rem; }

.main { scroll-padding-top: 12px; }
.pick, .line, .sub {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.results { display: flex; flex-direction: column; gap: 8px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.badge-pasif { background: #e7e5e4; color: #44403c; }
.badge-gelir { background: #d1fae5; color: #065f46; }
.badge-gider { background: #fee2e2; color: #991b1b; }
details.card summary {
  font-weight: 800;
  min-height: 44px;
  cursor: pointer;
}
details.card[open] summary { margin-bottom: 12px; }
