:root {
  --bg: #faf6f1; --surface: #fff; --text: #1c1c1c; --muted: #7c726a; --line: #ebe3da; --line-soft: #f3ede6;
  --brand: #7b2233; --brand-dark: #5e1826; --brand-tint: #f7ecea; --gold: #b08d57;
  --ok: #3f6c50; --ok-bg: #e9f1ea; --warn: #8a6417; --warn-bg: #f9f0dd; --danger: #a12a2a; --danger-bg: #f9e6e3;
  --radius: 12px; --shadow: 0 1px 2px rgb(60 40 30 / .05), 0 8px 24px -16px rgb(60 40 30 / .18);
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --serif: "Amiri", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; }
h3 { font-size: 21px; margin-bottom: 14px; }
button, input, select { font: inherit; color: inherit; }
button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 14px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; letter-spacing: .04em; }
button.primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
button.link { border: 0; background: none; color: var(--muted); padding: 2px 4px; text-decoration: underline; text-underline-offset: 2px; }
input, select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 11px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
label { display: block; margin: 0 0 14px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
label input, label select { margin-top: 5px; color: var(--text); font-size: 15px; letter-spacing: 0; text-transform: none; }
.muted { color: var(--muted); } .error { color: var(--danger); margin: 0 0 12px; }

/* Giriş */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-art { background: radial-gradient(120% 90% at 20% 10%, #8f2c3f 0%, var(--brand) 45%, var(--brand-dark) 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 40px; }
.login-logo { width: 260px; max-width: 70%; filter: invert(1) brightness(2); }
.login-tag { font-family: var(--serif); font-style: italic; color: #f3e3dc; font-size: 24px; margin: 0; }
.login-side { display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 36px; }
.login-card .muted { margin: 4px 0 26px; }
.login-card button { width: 100%; padding: 11px; margin-top: 4px; }
.login-logo-sm { display: none; }

/* İskelet */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 26px 16px 18px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-logo { width: 116px; margin: 0 auto 34px; display: block; }
#nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
#nav button { display: flex; align-items: center; gap: 11px; border: 0; background: none; border-radius: 9px; padding: 10px 12px; color: var(--muted); text-align: left; width: 100%; }
#nav button:hover { color: var(--brand); background: var(--line-soft); }
#nav button[aria-current="page"] { background: var(--brand-tint); color: var(--brand); font-weight: 500; }
#nav svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#nav span { flex: 1; }
.pill { background: var(--brand); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-style: normal; font-weight: 500; line-height: 18px; }
.pill:empty { display: none; }
.me { display: flex; gap: 9px; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; font-family: var(--serif); font-size: 16px; flex: none; }
.me-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.content { min-width: 0; padding: 28px 32px 48px; max-width: 1320px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 38px; line-height: 1.1; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head time { color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }

/* Özet kartları */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px; text-align: left; box-shadow: var(--shadow); display: block; width: 100%; }
button.kpi:hover:not(:disabled) { color: inherit; }
.kpi small { display: block; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi b { display: block; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.25; font-variant-numeric: lining-nums; }
.kpi.warn b { color: var(--warn); } .kpi.danger b { color: var(--danger); }
.kpi.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 300px; width: auto; }
.toolbar select { width: auto; }
.stats { display: flex; gap: 20px; margin-bottom: 12px; color: var(--muted); flex-wrap: wrap; font-size: 14px; }
.stats b { color: var(--text); font-weight: 500; }

/* Tablo */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fdfaf7; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.code { font-size: 12.5px; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

.prod { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--line-soft); overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-lg { width: 62px; height: 62px; }
.prod-text { min-width: 0; }
.prod-name { line-height: 1.25; }
.review { color: var(--warn); font-size: 12px; cursor: help; white-space: nowrap; }

.badge { display: inline-block; min-width: 42px; text-align: center; border-radius: 20px; padding: 2px 10px; font-weight: 500; font-variant-numeric: tabular-nums; background: var(--ok-bg); color: var(--ok); }
.badge.low { background: var(--warn-bg); color: var(--warn); }
.badge.zero { background: var(--danger-bg); color: var(--danger); }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { border: 0; border-radius: 0; min-width: 36px; padding: 5px 0; font-size: 17px; line-height: 1.2; }
.stepper button + button { border-left: 1px solid var(--line); }
.stepper button:hover:not(:disabled) { background: var(--brand-tint); }
.more { padding: 5px 12px; }
.only-sm { display: none; }
.th-input { width: 76px; padding: 5px 8px; text-align: right; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.nowrap { white-space: nowrap; }
.section-title { margin: 28px 0 12px; }

.settings { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card .note { color: var(--muted); font-size: 14px; }
.user-add { margin-top: 18px; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.user-row:last-child { border-bottom: 0; }
.user-row small { display: block; color: var(--muted); }

dialog { border: 0; border-radius: 16px; padding: 24px; width: min(440px, calc(100vw - 32px)); color: var(--text); box-shadow: 0 24px 60px -20px rgb(40 20 15 / .45); }
dialog::backdrop { background: rgb(50 25 20 / .4); backdrop-filter: blur(2px); }
.dlg-head { display: flex; gap: 14px; align-items: center; }
.dlg-head h2 { font-family: var(--sans); font-size: 14px; font-weight: 500; letter-spacing: .05em; color: var(--muted); }
.dlg-head p { margin: 1px 0 0; color: var(--text); font-family: var(--serif); font-size: 19px; line-height: 1.25; }
.seg { display: flex; margin: 18px 0 16px; background: var(--line-soft); border-radius: 9px; padding: 3px; }
.seg label { flex: 1; margin: 0; letter-spacing: 0; text-transform: none; }
.seg input { position: absolute; opacity: 0; width: 0; }
.seg span { display: block; text-align: center; padding: 7px; cursor: pointer; color: var(--text); font-size: 15px; border-radius: 7px; }
.seg input:checked + span { background: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.preview { background: var(--bg); border-radius: 8px; padding: 9px 12px; margin: 2px 0 14px; color: var(--muted); }
.actions { display: flex; justify-content: flex-end; gap: 8px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 20; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px -12px rgb(0 0 0 / .5); }
#toast.bad { background: var(--danger); }

/* Telefon: üstte logo, altta sekme çubuğu */
@media (max-width: 760px) {
  body { font-size: 15px; }
  /* iPhone 16 pikselden küçük kutulara dokununca ekranı büyütür. */
  input, select, label input, label select { font-size: 16px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-logo-sm { display: block; width: 120px; margin: 0 auto 28px; }
  .login-card h1, .login-card > .muted { text-align: center; }

  .shell { display: block; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-logo { width: 74px; margin: 0; }
  .me { border: 0; padding: 0; }
  .me-name { display: none; }
  #nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; flex-direction: row; gap: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); }
  #nav button { position: relative; flex: 1; flex-direction: column; gap: 2px; padding: 5px 2px; font-size: 11.5px; text-align: center; }
  #nav button[aria-current="page"] { background: none; }
  #nav span { flex: none; }
  .pill { position: absolute; top: 0; left: 52%; font-size: 10.5px; line-height: 15px; padding: 0 5px; }

  .content { padding: 16px 16px 24px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 30px; }
  .page-head time { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 10px 13px; }
  .kpi b { font-size: 27px; }
  .toolbar select { flex: 1 1 40%; min-width: 0; }
  .hide-sm { display: none; }
  .only-sm { display: inline; }
  th, td { padding-left: 9px; padding-right: 9px; }
  .prod { gap: 9px; }
  .thumb { width: 38px; height: 38px; }
  .thumb-lg { width: 58px; height: 58px; }
  /* Ürün satırı: üstte ürün ve stok, altta düğmeler */
  .cards thead { display: none; }
  .cards, .cards tbody { display: block; }
  .cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
  .cards tbody tr:last-child { border-bottom: 0; }
  .cards td { padding: 0; border: 0; background: none !important; }
  .cards td.empty { grid-column: 1 / -1; padding: 28px; }
  .cards td:last-child:not(.empty) { grid-column: 1 / -1; margin-top: 8px; }
  .stepper button { min-width: 46px; padding: 8px 0; }
  .more { padding: 8px 14px; }
}
