/* GUA Coffee Yaşam Vadisi — panel stilleri
   Renkler guacoffeecompany.com temasından alınmıştır. */

:root {
  --espresso: #32281a;      /* ana metin / birincil */
  --espresso-80: #4a3d2b;
  --rust: #7e3205;          /* vurgu */
  --rust-dark: #531003;     /* hover / koyu vurgu */
  --cream: #f5eee3;         /* sidebar zemini */
  --cream-strong: #ebdfcc;
  --bg: #faf7f2;            /* içerik zemini */
  --surface: #ffffff;
  --border: #e7dccb;
  --muted: #8a7b66;
  --danger: #a3261a;
  --danger-bg: #fbeae7;
  --success: #2f6b3a;
  --success-bg: #e8f3ea;

  --radius: 10px;
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --font: "Liter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--espresso);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; }
.icon { flex-shrink: 0; }

/* ---------- Ortak bileşenler ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--espresso); color: var(--cream); }
.btn-primary:hover { background: var(--rust); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--espresso);
  cursor: pointer;
}
.icon-btn:hover { background: var(--cream-strong); }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }

/* ---------- Giriş ekranı ---------- */

body.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #efe3d0 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #eadbc4 0%, transparent 55%),
    var(--cream);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 32px;
  box-shadow: 0 20px 50px -20px rgba(50, 40, 26, .25);
  text-align: center;
}

.auth-logo { width: 190px; height: auto; margin: 0 auto 8px; display: block; }

/* logo.png'de görünür kısım (maske + GUA) resmin ortasından %4.24 sağda;
   sola kaydırıp alttaki yazıyla aynı eksene oturtuyoruz. */
.auth-logo,
.sidebar-brand img { translate: -4.24% 0; }

.auth-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .08em;
  padding-left: .08em; /* son harften sonraki harf aralığını dengeler */
  text-transform: uppercase;
  color: var(--rust);
}

.auth-sub { margin: 4px 0 24px; color: var(--muted); font-size: 14px; }

.auth-form { text-align: left; display: grid; gap: 16px; }
.auth-form .btn { margin-top: 8px; }

.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fdfbf8;
  color: var(--muted);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap:focus-within {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(126, 50, 5, .12);
  color: var(--rust);
}
.input-wrap input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--espresso);
}

.auth-footer { margin-top: 24px; font-size: 12px; color: var(--muted); }

/* ---------- Panel iskeleti ---------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-right: 1px solid var(--border);
  z-index: 40;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img { width: 140px; height: auto; display: block; }
.sidebar-brand-sub {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .22em;
  padding-left: .22em; /* son harften sonraki harf aralığını dengeler */
  text-transform: uppercase;
  color: var(--rust);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 16px;
}

.nav-group + .nav-group { margin-top: 14px; }

.nav-group-title {
  padding: 8px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14.5px;
  color: var(--espresso-80);
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--cream-strong); color: var(--espresso); }
.nav-link.is-active {
  background: var(--espresso);
  color: var(--cream);
}
.nav-link.is-active .icon { color: #e9b98f; }
.nav-link.is-disabled { opacity: .55; cursor: default; }
.nav-link.is-disabled:hover { background: transparent; color: var(--espresso-80); }

.nav-badge {
  margin-left: auto;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--cream-strong);
  color: var(--muted);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-user form { margin-left: auto; }

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--rust);
  color: var(--cream);
  font-weight: 600;
}

.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar-user-info strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small { font-size: 12px; color: var(--muted); }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  background: rgba(250, 247, 242, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { margin: 0; font-size: 19px; font-weight: 600; }
.topbar-date { margin-left: auto; font-size: 13px; color: var(--muted); }

.menu-toggle { display: none; }

.content { flex: 1; padding: 28px; }

.blank-state {
  min-height: calc(100vh - var(--topbar-h) - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}
.blank-state .icon { color: var(--cream-strong); margin-bottom: 8px; }
.blank-state p { margin: 0; font-size: 16px; color: var(--espresso-80); }

.sidebar-backdrop { display: none; }

/* ---------- Mobil ---------- */

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(50, 40, 26, .35);
    z-index: 30;
  }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .topbar-date { display: none; }
  .content { padding: 20px 16px; }
}

/* ---------- Sayfa içi bileşenler ---------- */

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.01em; }
.upper { text-transform: uppercase; }
.upper::placeholder { text-transform: none; }
.push-right { margin-left: auto; }
form.inline { display: inline-flex; margin: 0; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-title { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.card-head .card-title { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 16px; }

.count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  margin-left: 4px;
  border-radius: 99px;
  background: var(--cream-strong);
  color: var(--espresso-80);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}

/* Butonlar */
.btn { text-decoration: none; white-space: nowrap; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: var(--surface); color: var(--espresso); border: 1px solid var(--border); font-weight: 500; }
.btn-ghost:hover { background: var(--cream); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f6d7d2; }
.icon-btn-sm { width: 28px; height: 28px; color: var(--muted); }
.icon-btn-sm:hover { color: var(--espresso); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn.good:hover { background: var(--success-bg); color: var(--success); }

/* Uyarılar */
.alert { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-warn { background: #fbf0dc; color: #7a4a05; }
.alert .btn { margin-left: auto; }

/* Ay gezinme */
.month-nav { display: inline-flex; align-items: center; gap: 4px; }
.month-nav form { position: relative; margin: 0; }
.month-nav strong {
  display: inline-block;
  min-width: 132px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
  font-weight: 600;
  pointer-events: none;
}
.month-nav input[type="month"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.month-nav .btn { margin-left: 6px; }

/* Sekmeler */
.tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--cream); border: 1px solid var(--border); border-radius: 10px; }
.tab { padding: 6px 14px; border-radius: 7px; text-decoration: none; font-size: 13.5px; color: var(--espresso-80); white-space: nowrap; }
.tab:hover { background: var(--cream-strong); }
.tab.is-active { background: var(--espresso); color: var(--cream); }
.tab.is-active .count { background: rgba(255, 255, 255, .18); color: var(--cream); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); font-size: 12.5px; text-decoration: none; color: var(--espresso-80); }
.chip:hover { background: var(--cream-strong); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.quick-actions .btn { height: 40px; }

/* Özet kutuları */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { margin-top: 4px; font-size: 24px; font-weight: 600; line-height: 1.2; color: var(--espresso); overflow-wrap: anywhere; }
.tile-sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.tile-danger { border-left: 4px solid var(--danger); }
.tile-good { border-left: 4px solid var(--success); }

/* Formlar */
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fdfbf8;
  color: var(--espresso);
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { outline: 0; border-color: var(--rust); box-shadow: 0 0 0 3px rgba(126, 50, 5, .12); }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input-sm { height: 32px; width: 130px; font-size: 13px; }
select.input { padding-right: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; align-items: end; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: block; min-width: 0; }
.field-wide { grid-column: span 2; }
.form-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.form-actions .btn { height: 40px; }
.form-hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.card > .form-hint { margin-top: 12px; }
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-inline .input { width: auto; flex: 1 1 180px; }
.form-inline .input-sm { flex: 0 0 130px; }
.form-inline .btn { height: 40px; }
.form-inline .btn-sm { height: 32px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-row .form-inline { flex: 1 1 320px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--rust); }

/* Tablolar */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.card > .table-wrap:last-child { margin-bottom: -6px; }
.form-grid + .table-wrap { margin-top: 18px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th a { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.table td { padding: 6px 10px; border-bottom: 1px solid #f1e9dc; vertical-align: middle; }
.table tbody tr:hover { background: #fcf9f4; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { padding: 11px 10px; font-weight: 600; border-top: 2px solid var(--border); border-bottom: 0; background: #fbf7f0; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .actions > * { vertical-align: middle; }
.table .empty, .empty { padding: 28px 10px; text-align: center; color: var(--muted); }
.table tr.dim td { color: #a39887; }
.table tr.dim .row-link { color: var(--espresso-80); }
.table .debt { color: var(--danger); }
.table .warn { color: #a45a06; font-weight: 600; }
.table .out { color: #b9ad9b; }
.table tr.group-row td { background: var(--cream); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); }
.row-link { text-decoration: none; }
.row-link:hover { color: var(--rust); text-decoration: underline; }
.table-stock td:first-child, .table-stock th:first-child { position: sticky; left: 0; background: var(--surface); min-width: 220px; }
.table-stock tbody tr:hover td:first-child { background: #fcf9f4; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--cream-strong); color: var(--espresso-80); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-warn { background: #fbe9cf; color: #8a4b04; }
.badge-good { background: var(--success-bg); color: var(--success); }

/* Stok sayım formu */
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 24px; }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; align-items: center; gap: 10px; padding: 3px 0; font-size: 14px; }
.stock-row .input { height: 36px; }
.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 20px;
  margin: 0 -28px -28px;
  background: rgba(250, 247, 242, .95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

/* Sütun grafik */
.chart { padding: 8px 0 0 52px; }
.chart-plot { position: relative; height: 220px; margin-bottom: 22px; }
.chart-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid #efe6d8; }
.chart-grid span { position: absolute; right: 100%; top: -8px; margin-right: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart-col { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; outline: 0; cursor: default; }
.chart-bar { width: 100%; max-width: 24px; min-height: 1px; background: var(--rust); border-radius: 4px 4px 0 0; transition: background .1s ease; }
.chart-col:hover .chart-bar, .chart-col:focus-visible .chart-bar { background: var(--espresso); }
.chart-col:hover::before, .chart-col:focus-visible::before { content: ""; position: absolute; inset: 0; background: rgba(50, 40, 26, .05); border-radius: 4px; }
.chart-x { position: absolute; top: 100%; margin-top: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-tip {
  position: fixed;
  z-index: 60;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--espresso);
  color: var(--cream);
  font-size: 12.5px;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(50, 40, 26, .25);
}
.chart-tip b { display: block; font-size: 14px; }

@media (max-width: 960px) {
  .sticky-actions { margin: 0 -16px -20px; padding: 12px 16px; }
  .field-wide { grid-column: 1 / -1; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .tile-value { font-size: 21px; }
  .chart { padding-left: 44px; }
  .chart-plot { height: 170px; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* Dar ekranda hücreler alt satıra kırılmasın; tablo yatay kayar. Not sütunu kırılabilir. */
.table td, .table th { white-space: nowrap; }
.table td.small { white-space: normal; min-width: 170px; }
.table-stock td:first-child { white-space: normal; }

/* =====================================================================
   v2 — seçim kutuları, öneri listesi, mobil pop-up, kart tablolar, uyarılar
   ===================================================================== */

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
.good { color: var(--success); }
.only-mobile, .mobile-actions { display: none; }
.page-note { margin: -6px 0 16px; font-size: 13px; color: var(--muted); }
.page-note strong { color: var(--espresso-80); }

/* --- Seçim kutusu ve tarih alanı --- */
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237e3205' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  text-overflow: ellipsis;
}
select.input:hover { border-color: #d8c9b2; }
input[type="date"].input, input[type="number"].input { -webkit-appearance: none; appearance: none; min-width: 0; display: block; }
input[type="date"].input { cursor: pointer; }
input[type="date"].input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
input[type="date"].input::-webkit-date-and-time-value { text-align: left; }

/* --- Yan yana seçim düğmeleri --- */
.segmented {
  display: flex;
  padding: 3px;
  gap: 2px;
  min-height: 40px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.segmented label { flex: 1 1 0; min-width: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--espresso-80);
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.segmented label:hover span { background: var(--cream-strong); }
.segmented input:checked + span { background: var(--espresso); color: var(--cream); }
.segmented input:focus-visible + span { outline: 2px solid var(--rust); outline-offset: 1px; }

/* --- Yazarken öneri --- */
.suggest { position: relative; }
.suggest > label { display: block; }
.suggest-list {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 34px -10px rgba(50, 40, 26, .32);
}
.suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--espresso);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.suggest-item small { flex-shrink: 0; font-size: 12px; color: var(--muted); }
.suggest-item.has-debt small { color: var(--danger); font-weight: 600; }
.suggest-item.is-active, .suggest-item:hover { background: var(--cream); }
.suggest-hint { margin-top: 6px; padding: 7px 10px; border-radius: 8px; background: #fbf0dc; color: #7a4a05; font-size: 12.5px; line-height: 1.4; }

/* --- Form kutusu başlığı (mobilde pop-up) --- */
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-head .card-title { margin: 0; }
.sheet-close, .fab, .sheet-backdrop { display: none; }

/* --- Ay / dönem gezinme --- */
.month-nav strong { line-height: 1.2; padding: 6px 14px; min-width: 150px; }
.month-nav strong small { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 400; color: var(--muted); }

/* --- Rozetler --- */
.badge-danger { background: var(--danger-bg); color: var(--danger); }
a.badge { text-decoration: none; }
.badge-link { margin-left: 6px; }
.nav-badge-urgent { background: var(--danger); color: #fff; }
.nav-link.is-active .nav-badge-urgent { background: #fff; color: var(--danger); }
.urgent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.urgent-pill + .topbar-date { margin-left: 12px; }
.table tr.row-mark td { background: #fbf7f0; }
.table-stock th small { display: block; font-size: 11px; font-weight: 400; letter-spacing: 0; }
.table-stock td .badge { margin-left: 6px; }

details.details-card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
details.details-card > summary::-webkit-details-marker { display: none; }
details.details-card > summary::before { content: "›"; display: inline-block; width: 14px; font-size: 18px; line-height: 1; color: var(--muted); transition: transform .15s ease; }
details.details-card[open] > summary::before { transform: rotate(90deg); }
details.details-card[open] > summary { margin-bottom: 12px; }

/* --- Stok uyarı paneli --- */
.stock-alert {
  margin-bottom: 16px;
  border: 1px solid #efc7bf;
  border-radius: 14px;
  background: #fff8f5;
  overflow: hidden;
}
.stock-alert-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 18px;
  background: linear-gradient(0deg, #fdeee9, #fbe5de);
  border-bottom: 1px solid #efc7bf;
}
.stock-alert-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--danger); color: #fff; }
.stock-alert-title { flex: 1 1 200px; min-width: 0; }
.stock-alert-title strong { display: block; font-size: 16px; color: #7c1d13; }
.stock-alert-title span { font-size: 13px; color: #8b5148; }
.stock-alert-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 4px 24px;
  max-height: 360px;
  overflow-y: auto;
  padding: 10px 18px 14px;
  overscroll-behavior: contain;
}
.stock-alert-group h3 { margin: 8px 0 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; color: #8b5148; }
.stock-alert-group ul { margin: 0; padding: 0; list-style: none; }
.stock-alert-group li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f6e1dc; }
.stock-alert-group li:last-child { border-bottom: 0; }
.sa-name { min-width: 0; }
.sa-name > span { display: block; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.sa-name small { font-size: 12px; color: var(--muted); }
.sa-name small b { color: var(--espresso); font-weight: 600; }
.sa-name small b.sa-out { color: var(--danger); }
.sa-action { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #861d13; }

/* --- Personelin acil bildirimi (yönetici görür) --- */
.urgent-panel { margin-bottom: 16px; border-radius: 14px; background: #7c1d13; color: #fff; overflow: hidden; }
.urgent-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 18px; }
.urgent-head > div { flex: 1 1 200px; min-width: 0; }
.urgent-head strong { display: block; font-size: 16px; letter-spacing: .02em; }
.urgent-head span { font-size: 13px; opacity: .85; }
.urgent-head .btn { background: #fff; color: #7c1d13; }
.urgent-list { margin: 0; padding: 0 18px 12px; list-style: none; }
.urgent-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .18); }
.urgent-list li .muted { color: rgba(255, 255, 255, .75); font-size: 13px; flex: 1 1 180px; }
.urgent-list .btn-primary { background: #fff; color: #7c1d13; }

/* --- Personel ana sayfası / sayım başlığı --- */
.week-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.week-card > div { flex: 1 1 220px; }
.week-card .card-title { margin-bottom: 2px; }
.week-card p { margin: 0; }
.week-head { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.week-head strong { font-size: 17px; }
.week-head span { font-size: 13px; }

/* --- Kullanıcı kartları --- */
.user-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.user-card { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.user-card.is-off { opacity: .65; }
.user-card-head { display: flex; align-items: center; gap: 10px; }
.user-card-head > div:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-card-head .avatar { flex-shrink: 0; }
.access-form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.access-form .field { width: 100%; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fdfbf8; }
.check.is-fixed { color: var(--muted); }
.access-form:has(input[name="role"][value="admin"]:checked) .perm-field { display: none; }
.user-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.user-card-foot .form-inline { flex: 1 1 220px; }

/* =====================================================================
   Mobil (≤ 760px): kayıt formları pop-up, tablolar kart
   ===================================================================== */
@media (max-width: 760px) {
  .only-mobile { display: inline-flex; }
  .mobile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .content { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 12px; padding-left: max(12px, env(safe-area-inset-left)); height: 56px; }
  .topbar-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .urgent-pill { padding: 6px 10px; font-size: 12px; }
  :root { --topbar-h: 56px; }

  .page-head { gap: 8px; }
  .month-nav { width: 100%; }
  .month-nav form { flex: 1; }
  .month-nav strong { display: block; min-width: 0; }
  .tabs { max-width: 100%; overflow-x: auto; }
  .page-head .tabs.push-right { margin-left: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 14px; padding: 0 14px 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px 14px; border-radius: 12px; }
  .tile-value { font-size: 18px; }
  .tile-label { font-size: 12px; }
  .tile-sub { font-size: 11.5px; }
  .tiles > .tile:first-child:nth-last-child(odd) { grid-column: 1 / -1; }

  .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions .btn { padding: 0 10px; font-size: 14px; }
  .quick-actions .btn:first-child:nth-last-child(odd) { grid-column: 1 / -1; }

  .card { padding: 14px; border-radius: 12px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .input { height: 46px; font-size: 16px; }          /* 16px: iOS odaklanınca yakınlaştırmasın */
  .input-sm { height: 40px; font-size: 16px; width: 100%; }
  .segmented { min-height: 46px; }
  .segmented span { height: 38px; font-size: 14px; }
  .btn { height: 46px; }
  .btn-sm { height: 36px; }
  .form-grid, .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .form-grid > .field-wide, .form-grid > .suggest, .form-grid > .field:has(.segmented), .form-grid > div.field-wide { grid-column: 1 / -1; }
  .form-actions .btn-primary { flex: 1 1 100%; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .input, .form-inline .input-sm { flex: none; width: 100%; }
  .form-inline .btn { width: 100%; }
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row .form-inline { flex: none; }

  /* Pop-up form */
  .sheet {
    display: none;
    position: fixed;
    z-index: 80;
    top: max(10px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    max-height: calc(100dvh - 20px - env(safe-area-inset-top));
    overflow-y: auto;
    margin: 0;
    padding: 0 16px 18px;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(50, 40, 26, .4);
    overscroll-behavior: contain;
  }
  .sheet.is-open { display: block; animation: sheet-in .18s ease-out; }
  .sheet-head { position: sticky; top: 0; z-index: 2; margin: 0 -16px 14px; padding: 14px 10px 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); border-radius: 18px 18px 0 0; }
  .sheet-head .card-title { font-size: 17px; }
  .sheet-close { display: inline-grid; width: 40px; height: 40px; }
  .sheet-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(50, 40, 26, .5); }
  body.sheet-lock { overflow: hidden; }
  .suggest-list { position: static; margin-top: 4px; max-height: 232px; box-shadow: none; }
  .sheet .form-hint { display: block; }

  .fab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    z-index: 30;
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    height: 52px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 99px;
    background: var(--espresso);
    color: var(--cream);
    font: inherit;
    font-weight: 600;
    box-shadow: 0 10px 26px rgba(50, 40, 26, .38);
    cursor: pointer;
  }
  .fab:active { transform: translateY(1px); }

  /* Kart tablolar */
  .card:has(> .table-wrap > .table-cards):not(:has(> .card-head)):not(:has(> .card-title)) { padding: 0; border: 0; background: transparent; }
  .table-wrap:has(> .table-cards) { overflow: visible; margin: 0; padding: 0; }
  .table-cards, .table-cards tbody, .table-cards tfoot { display: block; }
  .table-cards thead { display: none; }
  .table-cards tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
  }
  .table-cards tbody tr:hover { background: var(--surface); }
  .table-cards td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; text-align: left; overflow-wrap: anywhere; font-size: 14.5px; }
  .table-cards td.small { min-width: 0; font-size: 13px; }
  .table-cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 400; letter-spacing: .02em; color: var(--muted); }
  .table-cards td:empty { display: none; }
  .table-cards td.cell-title { grid-column: 1 / -1; order: -1; font-size: 15.5px; font-weight: 600; }
  .table-cards td.cell-title::before, .table-cards td.actions::before { content: none; }
  .table-cards td.cell-wide { grid-column: 1 / -1; }
  .table-cards td.actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; width: auto; margin-top: 2px; padding-top: 8px; border-top: 1px solid #f1e9dc; }
  .table-cards td.actions .icon-btn-sm { width: 38px; height: 38px; border: 1px solid var(--border); }
  .table-cards tr.group-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: var(--cream-strong); border: 0; margin-top: 14px; }
  .table-cards tr.group-row td { background: transparent; font-size: 13.5px; }
  .table-cards tr.group-row td::before { content: none; }
  .table-cards tr.empty-row { display: block; }
  .table-cards tr.row-mark { background: #fbf7f0; }
  .table-cards tr.row-mark td { background: transparent; }
  .table-cards tfoot tr { border: 2px solid var(--border); background: #fbf7f0; }
  .table-cards tfoot td { padding: 0; border: 0; background: transparent; }

  /* Stok matrisi yatay kayar; ürün adı solda sabit kalır */
  .table-stock { font-size: 13px; }
  .table-stock td:first-child, .table-stock th:first-child { min-width: 0; width: 44vw; max-width: 44vw; padding-left: 0; box-shadow: 6px 0 8px -6px rgba(50, 40, 26, .18); }
  .table-stock td, .table-stock th { padding: 8px 8px; }
  .table-wrap:has(> .table-stock) { margin: 0 -14px; padding: 0 14px; }

  .stock-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .stock-row { grid-template-columns: minmax(0, 1fr) 124px; padding: 6px 0; border-bottom: 1px solid #f1e9dc; }
  .stock-row:last-child { border-bottom: 0; }
  .stock-row .input { height: 42px; }
  .sticky-actions { margin: 0 -14px calc(-96px - env(safe-area-inset-bottom)); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); z-index: 20; }
  .sticky-actions .btn { width: 100%; }
  .sticky-actions .form-hint { display: none; }

  .stock-alert-head { padding: 12px 14px; }
  .stock-alert-head form, .stock-alert-head .btn { width: 100%; }
  .stock-alert-body { grid-template-columns: minmax(0, 1fr); max-height: 52vh; padding: 6px 14px 10px; }
  .urgent-head, .urgent-list { padding-left: 14px; padding-right: 14px; }
  .urgent-head form, .urgent-head .btn { width: 100%; }
  .week-card .btn { flex: 1 1 100%; }
  .week-head span { font-size: 12.5px; }
  .user-cards { grid-template-columns: minmax(0, 1fr); }
  .perm-list { grid-template-columns: minmax(0, 1fr); }
  .chart { padding-left: 40px; }
  .auth-card { padding: 28px 22px 24px; }
}

@keyframes sheet-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet.is-open { animation: none; } }
@media (max-width: 760px) {
  .table-cards td.num { text-align: left; }
  .table-cards .debt, .table-cards .strong { font-weight: 600; }
}

.suggest > label > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

@media (max-width: 760px) {
  /* Çok alanlı kartlar (kasa, rapor): 3 sütun, işlem butonları sağ üstte */
  .table-cards tr { position: relative; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
  .table-cards td.actions { position: absolute; top: 8px; right: 8px; margin: 0; padding: 0; border: 0; }
  .table-cards td.actions .icon-btn-sm { width: 34px; height: 34px; border: 0; background: var(--cream); }
  .table-cards tr:has(> td.actions:not(:empty)) > td.cell-title { padding-right: 84px; }
  .table-cards tr:has(> td.actions > :nth-child(3)) > td.cell-title { padding-right: 122px; }

  /* Sade kartlar: başlık solda, tutar sağda, ayrıntılar altta küçük */
  .table-cards tr:has(> td.cell-main) { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; align-items: start; }
  .table-cards tr:has(> td.cell-main) > td { grid-column: 1; font-size: 13px; color: var(--muted); }
  .table-cards tr:has(> td.cell-main) > td.cell-title { grid-row: 1; font-size: 15px; color: var(--espresso); padding-right: 0; }
  .table-cards tr:has(> td.cell-main) > td.cell-main { grid-column: 2; grid-row: 1; text-align: right; font-size: 15.5px; font-weight: 600; color: var(--espresso); white-space: nowrap; }
  .table-cards tr:has(> td.cell-main) > td.cell-main.debt { color: var(--danger); }
  .table-cards tr:has(> td.cell-main) > td.cell-main.good { color: var(--success); }
  .table-cards td.cell-main::before, .table-cards td.cell-sub::before { content: none; }
  .table-cards td.cell-kv::before { display: inline; content: attr(data-label) ": "; font-size: inherit; }
  .table-cards tr:has(> td.cell-main) > td.actions { position: static; grid-column: 2; grid-row: 2 / span 5; align-self: end; justify-content: flex-end; margin-top: 4px; }
  .table-cards tr.dim > td.cell-title { color: var(--espresso-80); }
  .table-cards tfoot tr:has(> td.cell-main) > td { color: var(--espresso-80); }
}
@media (max-width: 760px) {
  .table-cards tr:has(> td.cell-main) > td.cell-title { padding-right: 0 !important; }
}
@media (max-width: 760px) {
  .table-stock td:first-child, .table-stock th:first-child { min-width: 168px; width: 168px; max-width: 168px; }
  .table-stock td:first-child { font-size: 13px; line-height: 1.35; }
}
@media (min-width: 761px) {
  .form-grid > .field:has(> .segmented > label:nth-child(3)) { grid-column: span 2; }
}

/* Stok uyarısı: gizle / göster (yukarı doğru küçülür) */
.stock-alert-collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .28s ease; }
.stock-alert-collapse > .stock-alert-body { min-height: 0; }
.stock-alert.is-collapsed .stock-alert-collapse { grid-template-rows: 0fr; }
.stock-alert.is-collapsed .stock-alert-body { overflow: hidden; padding-top: 0; padding-bottom: 0; }
.stock-alert .stock-alert-body { transition: padding .28s ease; }
.stock-alert.is-collapsed .stock-alert-head { border-bottom-color: transparent; }
.stock-alert-toggle .icon { transition: transform .28s ease; }
.stock-alert.is-collapsed .stock-alert-toggle .icon { transform: rotate(180deg); }
.stock-alert.no-anim .stock-alert-collapse, .stock-alert.no-anim .stock-alert-body, .stock-alert.no-anim .stock-alert-toggle .icon { transition: none; }
.sa-action:empty { display: none; }
@media (max-width: 760px) {
  .stock-alert-head .stock-alert-toggle { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .stock-alert-collapse, .stock-alert .stock-alert-body { transition: none; }
}

/* --- Onay penceresi --- */
.confirm {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(50, 40, 26, .55);
  animation: confirm-fade .14s ease-out;
}
.confirm[hidden] { display: none; }
.confirm-box {
  width: 100%;
  max-width: 400px;
  padding: 26px 24px 20px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(50, 40, 26, .45);
  text-align: center;
  animation: confirm-pop .16s ease-out;
}
.confirm-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; background: var(--cream-strong); color: var(--espresso); }
.confirm.is-danger .confirm-icon { background: var(--danger-bg); color: var(--danger); }
.confirm-box h2 { margin: 0 0 6px; font-size: 19px; font-weight: 600; }
.confirm-box p { margin: 0 0 20px; font-size: 14.5px; line-height: 1.5; color: var(--espresso-80); overflow-wrap: anywhere; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions .btn { height: 46px; }
body.confirm-lock { overflow: hidden; }
@keyframes confirm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes confirm-pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* --- Filtre çubuğu: ay / dönem + özel tarih aralığı --- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.range-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.range-filter.is-active { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(126, 50, 5, .12); }
.range-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.range-filter.is-active .range-label { color: var(--rust); font-weight: 600; }
.range-filter input[type="date"] {
  height: 32px;
  width: 138px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--cream);
  color: var(--espresso);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
.range-filter input[type="date"]:focus { outline: 0; border-color: var(--rust); }
.range-sep { color: var(--muted); }
.filter-bar.has-range .month-nav strong { color: var(--muted); background: transparent; }
.card-head .range-filter { margin-left: auto; }

@media (max-width: 760px) {
  .filter-bar { width: 100%; }
  .range-filter { width: 100%; flex-wrap: wrap; padding: 8px; gap: 6px; }
  .range-label { width: 100%; }
  .range-filter input[type="date"] { flex: 1 1 0; min-width: 0; width: auto; height: 40px; font-size: 16px; -webkit-appearance: none; appearance: none; }
  .range-filter .btn { height: 40px; flex: 1 1 auto; }
  .range-filter .icon-btn { width: 40px; height: 40px; border: 1px solid var(--border); }
  .card-head .range-filter { margin-left: 0; }
  .confirm-actions .btn { height: 50px; }
}
@media (prefers-reduced-motion: reduce) { .confirm, .confirm-box { animation: none; } }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.page-head + .page-head { margin-top: -6px; }
@media (max-width: 760px) {
  .range-filter input[type="date"] { flex: 1 1 calc(50% - 14px); }
  .range-filter .btn { flex: 1 1 0; }
}
