/* WM Rapor — kurumsal lacivert #154170, yeşil #40a518. Okunaklılık önce: 16px taban, 4.5:1 kontrast. */
:root {
  --navy: #154170;
  --navy-700: #0f3157;
  --navy-50: #eef3f9;
  --green: #40a518;
  --green-700: #2e7a10;   /* beyaz zemin üzerinde yeşil yazı için yeterli kontrast */
  --green-50: #eff8ea;
  --text: #17202c;
  --muted: #566173;
  --line: #dde3eb;
  --line-strong: #c3ccd8;
  --zebra: #f7f9fb;
  --bg: #f2f4f7;
  --surface: #fff;
  --error: #b42318;
  --error-50: #fef3f2;
  --warn-50: #fff8e6;
  --warn-line: #e0a800;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 32, 56, 0.06), 0 1px 3px rgba(16, 32, 56, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); font-size: 16px; line-height: 1.5; }
[hidden] { display: none !important; }
h1 { font-size: 1.375rem; line-height: 1.3; margin: 0; color: var(--navy); font-weight: 700; }
small { font-weight: 400; color: var(--muted); }

/* ---------- Üst bant ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--navy); color: #fff; padding: 0 1.25rem; height: 60px;
  border-bottom: 4px solid var(--green); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 600; font-size: 1.125rem; display: flex; align-items: center; gap: 0.625rem; letter-spacing: 0.01em; }
.brand-mark { background: var(--green); color: #fff; font-weight: 800; padding: 0.125rem 0.5rem; border-radius: var(--radius-sm); }
/* ---------- Kartlar ve formlar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.narrow { max-width: 440px; margin: 4rem auto; padding: 2rem; }
.narrow h1 { margin-bottom: 0.5rem; }
.narrow form > button.primary { margin-top: 1.5rem; width: 100%; justify-content: center; }
.page-head { margin-bottom: 0.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.desc { margin: 0.375rem 0 0; color: var(--muted); font-size: 0.9375rem; max-width: 75ch; }

label, legend { display: block; font-weight: 600; font-size: 0.875rem; margin: 0.875rem 0 0.375rem; padding: 0; color: var(--text); }
input, select, textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 0.5625rem 0.75rem; min-height: 44px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input::placeholder, textarea::placeholder { color: #7d8796; }
input:hover, select:hover, textarea:hover { border-color: #9aa6b6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(64, 165, 24, 0.25); }
button:focus-visible { outline: 3px solid rgba(64, 165, 24, 0.55); outline-offset: 2px; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 1.5rem; }
.fields.inline { align-items: end; }
.field-wide { grid-column: 1 / -1; }
.field.end { display: flex; align-items: flex-end; margin-top: 1rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.daterange { display: flex; gap: 0.5rem; align-items: center; }
.daterange input { flex: 1; min-width: 0; }
.daterange span { color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.checks label {
  display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; font-weight: 500; font-size: 0.9375rem;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.5rem 0.875rem; min-height: 44px; cursor: pointer; background: #fff;
}
.checks label:has(input:checked) { border-color: var(--green-700); background: var(--green-50); color: var(--navy); }
.checks input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--green-700); }

/* Grup düğmeleri */
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.625rem; }
.chip {
  font: inherit; font-size: 0.8125rem; font-weight: 500; background: #fff; color: var(--navy);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.375rem 0.875rem; cursor: pointer; min-height: 34px;
}
.chip:hover { border-color: var(--green-700); background: var(--green-50); }
.chip-nav { background: var(--navy-50); border-color: transparent; font-weight: 700; }
.chips .hint { margin: 0.375rem 0; }

/* Düğmeler */
.actions { display: flex; gap: 0.625rem; margin-top: 1.25rem; flex-wrap: wrap; align-items: center; }
button.primary, button.secondary, button.danger {
  font: inherit; font-weight: 600; border-radius: var(--radius-sm); padding: 0.625rem 1.375rem; min-height: 44px;
  cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 0.5rem;
  transition: background 120ms ease, border-color 120ms ease;
}
button.primary { background: var(--navy); color: #fff; }
button.primary:hover { background: var(--navy-700); }
button.secondary { background: #fff; color: var(--green-700); border-color: var(--green-700); }
button.secondary:hover { background: var(--green-50); }
button.danger { background: #fff; color: var(--error); border-color: #f0b5ae; padding: 0.375rem 0.75rem; min-height: 36px; font-size: 0.8125rem; }
button.danger:hover { background: var(--error-50); }
button.small { padding: 0.375rem 0.75rem; min-height: 36px; font-size: 0.8125rem; }
button:disabled { opacity: 0.6; cursor: progress; }
button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.error { color: var(--error); margin: 0.75rem 0 0; font-weight: 600; background: var(--error-50); border-radius: var(--radius-sm); padding: 0.625rem 0.875rem; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 0.5rem 0; }

/* ---------- Sonuç ---------- */
.result .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin: 0 0.25rem 0.625rem; }
.result .meta strong { color: var(--navy); font-size: 1rem; }
.result .meta span { color: var(--muted); font-size: 0.875rem; }
.notice { background: var(--warn-50); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); padding: 0.625rem 0.875rem; margin-bottom: 0.75rem; }
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.info { color: var(--muted); font-size: 0.875rem; margin: 0.75rem 0.25rem 0; line-height: 1.55; }
.loading { color: var(--muted); padding: 1.25rem 0.25rem; display: flex; align-items: center; gap: 0.625rem; margin: 0; }
.loading::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.table-wrap { overflow: auto; max-height: 70vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.9375rem; }
th, td { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th {
  background: var(--navy); color: #fff; text-align: left; font-weight: 600; font-size: 0.8125rem;
  letter-spacing: 0.02em; position: sticky; top: 0; z-index: 2;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) td { background: var(--zebra); }
tbody tr:hover td { background: var(--green-50); }
td.neg { color: var(--error); }
tfoot td { font-weight: 700; color: var(--navy); border-top: 2px solid var(--navy); border-bottom: 0; background: var(--navy-50); position: sticky; bottom: 0; z-index: 2; }
td.wrap { white-space: normal; min-width: 16rem; }

@media (max-width: 600px) {
  .container { padding: 0.75rem; }
  .topbar { padding: 0 0.75rem; }
  .card { padding: 1rem; }
  .narrow { margin: 1.5rem auto; padding: 1.25rem; }
  .actions button { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
td.alert, tbody tr:nth-child(even) td.alert, tbody tr:hover td.alert { color: var(--error); background: #fdeaea; font-weight: 700; }

/* Çoklu seçim: seçilen gruplar ve seç/bırak düğmeleri */
textarea { resize: vertical; font-family: inherit; line-height: 1.5; }
.picked { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.625rem; }
.picked:empty { display: none; }
.pick {
  font: inherit; font-size: 0.8125rem; font-weight: 600; color: #fff; background: var(--navy);
  border: 0; border-radius: 999px; padding: 0.375rem 0.75rem; min-height: 34px; cursor: pointer;
}
.pick:hover { background: var(--green-700); }
.chip-wrap { display: inline-flex; }
.chip-wrap .chip:first-child:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.chip-down { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; padding: 0.375rem 0.625rem; font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--green-50); border-color: var(--green-700); font-weight: 700; }

/* Geniş tablolarda ilk sütun (şube/ürün/kasiyer) yana kaydırırken sabit kalır */
.result th.stick, .result td.stick { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.result th.stick { z-index: 3; background: var(--navy); }
.result tbody tr:nth-child(even) td.stick { background: var(--zebra); }
.result tbody tr:hover td.stick { background: var(--green-50); }
.result tfoot td.stick { z-index: 3; background: var(--navy-50); }
.result td.stick.wrap { min-width: 12rem; max-width: 16rem; }

@media (max-width: 600px) {
  th, td { padding: 0.5rem 0.625rem; }
  .chip, .pick { min-height: 40px; }
  .field.end button { width: 100%; justify-content: center; }
  .result td.stick { white-space: normal; min-width: 8rem; max-width: 10rem; }
  td.wrap { min-width: 11rem; }
  .table-wrap { max-height: 75vh; }
}
/* Geniş ekranda (form en az 2 sütun) üç şube tek satıra sığsın */
@media (min-width: 1100px) { .field-branches { grid-column: span 2; } }

/* ---------- Uygulama iskeleti: lacivert sol menü + içerik ---------- */
.container { max-width: 1480px; margin: 0 auto; padding: 1.5rem; }
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.5rem; width: 100%; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--navy); color: #fff; border-right: 4px solid var(--green);
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 1rem 0 1.25rem; height: 64px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); flex: none; }
.side-nav { flex: 1; overflow-y: auto; padding: 0.75rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent; }
.side-foot { flex: none; padding: 0.75rem; border-top: 1px solid rgba(255, 255, 255, 0.12); }

.side-section {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  font: inherit; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7); background: none; border: 0; cursor: pointer;
  padding: 1rem 0.75rem 0.5rem; border-radius: var(--radius-sm);
}
.side-section:hover { color: #fff; }
.side-section svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; transition: transform 150ms ease; }
.side-section[aria-expanded="false"] svg { transform: rotate(-90deg); }
.side-group { display: flex; flex-direction: column; gap: 2px; }

.side-item, .side-link {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left; min-height: 44px;
  font: inherit; font-size: 0.9375rem; font-weight: 500; color: rgba(255, 255, 255, 0.88);
  background: none; border: 0; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.side-item:hover, .side-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side-item[aria-current="page"] { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 var(--green); }
.side-item svg, .side-link svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-item:focus-visible, .side-link:focus-visible, .side-section:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }

/* Üst bilgi çubuğu */
.page-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 0.75rem;
  height: 64px; padding: 0 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.crumb { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-size: 0.9375rem; color: var(--muted); }
.crumb strong { color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip { margin-left: auto; display: flex; align-items: center; gap: 0.625rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-meta strong { font-size: 0.9375rem; color: var(--text); }
.user-meta small { font-size: 0.75rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; font-size: 0.875rem; display: grid; place-items: center; flex: none; }

.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm); border: 0; background: none; color: inherit; cursor: pointer; flex: none; }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.menu-btn { color: var(--navy); margin-left: -0.5rem; }
.menu-btn:hover { background: var(--navy-50); }
.side-close { color: #fff; }
.side-close:hover { background: rgba(255, 255, 255, 0.1); }
.menu-btn, .side-close, .backdrop { display: none; }

/* Tablet / telefon: menü soldan açılan çekmece */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30; transform: translateX(-105%); visibility: hidden; transition: transform 200ms ease, visibility 0s linear 200ms; box-shadow: 4px 0 24px rgba(16, 32, 56, 0.25); }
  .shell.menu-open .sidebar { transform: none; visibility: visible; transition: transform 200ms ease; }
  .shell.menu-open .backdrop { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(16, 32, 56, 0.45); }
  .menu-btn, .side-close { display: inline-grid; }
  .page-bar { padding: 0 1rem; border-bottom: 3px solid var(--green); }
  .content { padding: 1rem; }
}
@media (max-width: 600px) {
  .content { padding: 0.75rem; }
  .user-meta { display: none; }
  .crumb span { display: none; }
}
