:root {
  --bg: #F4F2EC;
  --panel: #FFFFFF;
  --ink: #1B1F1D;
  --ink-2: #3D4440;
  --muted: #6B726E;
  --line: #E3E1DA;
  --line-2: #EFEDE7;
  --accent: #C2410C;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCEBDD;
  --side: #17191A;
  --side-ink: #C9CCCA;
  --pos: #15803D;
  --neg: #B91C1C;
  --warn: #B45309;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1 { font-size: 26px; line-height: 1.2; margin: 2px 0 4px; letter-spacing: -0.02em; font-weight: 800; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); font-weight: 600; }
.pre { white-space: pre-wrap; margin: 0; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: #fff; text-decoration: none; padding: 0 8px 22px; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }
.brand.big { color: var(--ink); font-size: 20px; padding: 0 0 4px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { text-decoration: none; padding: 8px 10px; border-radius: 7px; font-weight: 600; font-size: 13.5px; }
.side nav a:hover { background: #24272A; color: #fff; }
.side nav a.on { background: #2B2F32; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: #7C8280; padding: 18px 10px 6px; font-weight: 700; }
.side-foot { border-top: 1px solid #2B2F32; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { text-decoration: none; color: #fff; font-weight: 700; font-size: 13px; display: flex; flex-direction: column; }
.me small { color: #7C8280; font-weight: 500; }
.side .link { color: var(--side-ink); }
.main { padding: 28px 36px 60px; max-width: 1280px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.crumb { font-size: 12.5px; color: var(--muted); text-decoration: none; font-weight: 600; }
.crumb:hover { color: var(--accent); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 460px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head.pad { padding: 16px 20px 4px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #A8370A; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.link:hover { color: var(--accent); }
.danger { color: var(--neg) !important; }
form.inline { display: inline; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: #FDFCFA; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; background: var(--bg); padding: 10px 12px; border-radius: 7px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: start; }
legend { font-weight: 800; font-size: 15px; padding: 0 0 12px; }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.item-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { padding: 5px 8px; font-size: 12.5px; max-width: 170px; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters input { flex: 1; max-width: 420px; }
.filters select { width: auto; }

/* flash */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; font-size: 13.5px; background: #E7F4EC; color: #14532D; border: 1px solid #BFE3CC; }
.flash.err { background: #FCECEC; color: #7F1D1D; border-color: #F3C6C6; }
.flash a { font-weight: 800; }
.flash.floating { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 10; }

/* tables */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAF9F6; white-space: nowrap; }
.tbl th.r { text-align: right; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.card:not(.flush) .tbl th, .card:not(.flush) .tbl td { padding-left: 0; }
.card:not(.flush) .tbl th { background: none; }
.tbl a { text-decoration: none; }
.tbl tr.clickrow { cursor: pointer; }
.tbl tr.clickrow:hover td { background: #FBFAF7; }
.tbl tr.off td { opacity: 0.5; }
.items .sec-row td { background: #FAF9F6; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); padding-top: 14px; }
.items tfoot td { border: 0; padding-top: 6px; padding-bottom: 6px; color: var(--ink-2); }
.items tfoot tr:first-child td { padding-top: 14px; border-top: 1px solid var(--line); }
.items tfoot .grand td { font-weight: 800; color: var(--ink); font-size: 15px; padding-bottom: 16px; }
.items tr.rate-missing td { background: #FFF7ED; }
.row-actions { text-align: right; font-size: 12.5px; }
.row-actions a, .row-actions .link { margin-left: 10px; font-weight: 600; color: var(--muted); }
.row-actions a:hover { color: var(--accent); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty a { color: var(--accent); font-weight: 700; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: flex; flex-direction: column; border-top: 3px solid var(--line); }
.kpi:hover { border-color: var(--ink-2); }
.kpi-num { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.sum { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.sum span { font-size: 12px; color: var(--muted); font-weight: 600; }
.sum span i { font-style: normal; cursor: help; }
.sum b { font-size: 17px; font-family: var(--mono); letter-spacing: -0.02em; }
.sum.pos b { color: var(--pos); }
.sum.neg b { color: var(--neg); }
.sum.dark { background: var(--ink); border-color: var(--ink); }
.sum.dark span { color: #A6ACA9; }
.sum.dark b { color: #fff; }

/* status colours */
.badge, .badge-select { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge-select { width: auto; border: 0; padding: 7px 12px; font-size: 12.5px; cursor: pointer; }
.status-taslak { --c: #6B726E; --cs: #EFEDE7; }
.status-gonderildi { --c: #1D4ED8; --cs: #E3EBFD; }
.status-onaylandi { --c: #15803D; --cs: #E2F3E8; }
.status-uretimde { --c: #B45309; --cs: #FDF0DD; }
.status-tamamlandi { --c: #0F766E; --cs: #DDF2EF; }
.status-iptal { --c: #9F1239; --cs: #FBE4EA; }
.badge[class*="status-"], .badge-select[class*="status-"] { background: var(--cs); color: var(--c); }
.kpi[class*="status-"] { border-top-color: var(--c); }
.kpi[class*="status-"] .kpi-num { color: var(--c); }

/* list */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.list li a { text-decoration: none; display: flex; flex-direction: column; }
.list .date { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* menu */
details.menu { position: relative; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 12px 30px rgba(0,0,0,.12); min-width: 230px; padding: 6px; z-index: 5; display: flex; flex-direction: column; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font: inherit; font-weight: 600; font-size: 13px; background: none; border: 0; text-decoration: none; cursor: pointer; color: var(--ink); }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }

.live-calc { grid-column: 1 / -1; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); background: var(--bg); padding: 9px 12px; border-radius: 7px; min-height: 37px; }
.live-calc:empty { display: none; }

/* auth */
body.auth { background: var(--side); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { background: var(--panel); border-radius: 14px; padding: 32px; width: 100%; max-width: 380px; }
.auth-card .muted { margin: 0 0 22px; }
.err-code { font-size: 44px; font-weight: 800; color: var(--accent); }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .summary .sum.dark { grid-column: span 2; }
  .grid2, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 8px; }
  .brand { padding: 0; }
  .side nav { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; order: 3; }
  .nav-label { display: none; }
  .side-foot { border: 0; padding: 0; margin-left: auto; }
  .main { padding: 18px 16px 48px; }
  .item-form, fieldset { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-wrap: wrap; }
}

/* içe aktarma */
.kpis.four { grid-template-columns: repeat(4, 1fr); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; }
.grid2.plain { gap: 24px; margin-bottom: 14px; }
h3 { font-size: 13.5px; margin: 0 0 6px; }
input[type="file"] { padding: 10px; background: var(--bg); border-style: dashed; cursor: pointer; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) { .kpis.four { grid-template-columns: repeat(2, 1fr); } }

/* toplu ekleme */
.bullets { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; }
.bullets li { margin-bottom: 6px; }
.sticky-head { position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 12px 0; margin-top: -12px; }
.bulk-search { width: 240px; }
.num-in { width: 84px; text-align: right; padding: 5px 8px; font-family: var(--mono); font-size: 12.5px; }
.tbl.bulk td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
.tbl.bulk tr.picked td { background: var(--accent-soft); }
.tbl.bulk tr.hidden, .tbl.bulk tbody.hidden { display: none; }
.pill { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 99px; background: rgba(255,255,255,.25); font-size: 12px; text-align: center; }
.card-head .actions .btn { margin-left: 2px; }
@media (max-width: 760px) { .bulk-search { width: 100%; } }
