:root {
  --pink: #e879a0;
  --purple: #a855f7;
  --grad: linear-gradient(135deg, #e879a0 0%, #a855f7 100%);
  --bg: #fdf4f9;
  --ink: #111827;
  --ink2: #374151;
  --mute: #6b7280;
  --mute2: #9ca3af;
  --line: #e5e7eb;
  --red: #ef4444;
  --green: #16a34a;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ink); overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--ink); }
::-webkit-scrollbar { display: none; }
#app { max-width: 560px; margin: 0 auto; }

/* HEADER */
.header { background: var(--grad); color: #fff; padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 26px; }
.header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.header h1 { font-size: 22px; font-weight: 800; }
.sync-line { font-size: 12px; opacity: .8; margin-top: 3px; }
.icon-btn { background: rgba(255,255,255,.2); border: none; border-radius: 12px; width: 40px; height: 40px; font-size: 19px; flex-shrink: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; padding: 9px 4px; text-align: center; }
.stat.alert { background: rgba(255,255,255,.3); border-color: rgba(255,255,255,.55); }
.stat-val { font-size: 23px; font-weight: 800; line-height: 1; }
.stat-lbl { font-size: 10px; opacity: .9; margin-top: 4px; }

/* SEARCH & TABS */
.search-wrap { padding: 0 12px; margin-top: -16px; position: relative; }
.search-wrap input { width: 100%; background: #fff; border: 1.5px solid #fce7f3; border-radius: 18px; padding: 13px 16px; outline: none; box-shadow: 0 5px 16px rgba(232,121,160,.18); -webkit-appearance: none; appearance: none; }
.tabs { display: flex; gap: 7px; padding: 12px 12px 4px; overflow-x: auto; scrollbar-width: none; }
.tab { white-space: nowrap; flex-shrink: 0; padding: 8px 13px; border-radius: 22px; font-size: 13px; font-weight: 600; border: none; background: #fff; color: var(--mute); box-shadow: 0 1px 4px rgba(0,0,0,.09); position: relative; }
.tab .n { opacity: .55; font-weight: 700; margin-left: 3px; }
.tab.active { background: var(--grad); color: #fff; box-shadow: 0 3px 10px rgba(232,121,160,.45); }
.tab.active .n { opacity: .8; }
.tab.takviye { color: #0f766e; }
.tab.takviye.active { background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; box-shadow: 0 3px 10px rgba(20,184,166,.4); }
.tab.biten.active { background: linear-gradient(135deg, #6b7280, #374151); box-shadow: 0 3px 10px rgba(107,114,128,.4); }
.tab.shop.active { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 3px 10px rgba(245,158,11,.4); }
.tab-badge { position: absolute; top: -5px; right: -4px; background: var(--red); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 800; padding: 1px 5px; min-width: 17px; text-align: center; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 16px 6px; font-size: 12px; color: var(--mute2); min-height: 30px; }
.chips { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--mute); }
.chip.on { background: var(--ink2); border-color: var(--ink2); color: #fff; }

.list { padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 110px); display: flex; flex-direction: column; gap: 9px; }

/* CARDS */
.card { background: #fff; border-radius: 17px; border-left: 4.5px solid #22c55e; box-shadow: 0 2px 10px rgba(0,0,0,.06); padding: 12px 12px 11px; }
.card.out { background: #fff7f7; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-main { flex: 1; min-width: 0; }
.card-name { font-weight: 700; font-size: 14.5px; color: var(--ink); line-height: 1.35; word-break: break-word; }
.card-sub { font-size: 12px; color: var(--mute2); margin-top: 2px; }
.card-sub b { color: var(--mute); }
.card-btns { display: flex; gap: 6px; flex-shrink: 0; }
.btn-icon { border: none; border-radius: 10px; width: 36px; height: 34px; font-size: 15px; line-height: 1; }
.btn-edit { background: #f3f4f6; }
.btn-del { background: #fef2f2; }
.btn-cart { background: #fffbeb; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 9px; padding: 5px 9px; flex-wrap: wrap; min-width: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.badge-text { font-size: 12px; font-weight: 700; }
.badge-date { font-size: 11px; color: var(--mute2); }
.opened-line { font-size: 11.5px; color: var(--mute); margin-top: 7px; }
.out-pill { background: var(--red); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .5px; padding: 4px 9px; border-radius: 8px; }
.qty { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.qty-btn { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--mute); line-height: 1; }
.qty-btn.plus { border: none; background: var(--grad); color: #fff; }
.qty-btn:disabled { opacity: .3; }
.qty-val { min-width: 22px; text-align: center; font-weight: 800; font-size: 17px; }

.card.biten { border-left-color: var(--mute2); }
.stars-line { display: flex; gap: 2px; align-items: center; margin-top: 9px; }
.star { color: #d1d5db; font-size: 17px; line-height: 1; }
.star.on { color: #f59e0b; }
.stars-lbl { font-size: 12px; color: var(--mute2); margin-left: 6px; }
.meta-line { font-size: 11px; color: var(--mute2); margin-top: 4px; }
.yorum { background: #f3f4f6; border-radius: 9px; padding: 6px 10px; font-size: 12.5px; color: var(--mute); font-style: italic; word-break: break-word; line-height: 1.45; margin-top: 8px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.act { border: none; border-radius: 10px; padding: 9px 6px; font-size: 13px; font-weight: 700; }
.act.rate { background: #fdf4f9; color: #db2777; }
.act.shop { background: #fffbeb; color: #b45309; }
.act.shop[disabled] { opacity: .55; }
.act.restore { background: #f0fdf4; color: var(--green); }
.act.del { background: #fef2f2; color: #dc2626; }
.act.bought { background: #f0fdf4; color: var(--green); }

.card.shopitem { border-left-color: #f59e0b; }

.empty { text-align: center; padding: 56px 24px; color: var(--mute2); }
.empty-ico { font-size: 44px; }
.empty-txt { margin-top: 10px; font-size: 15px; font-weight: 600; }
.empty-sub { margin-top: 6px; font-size: 13px; }

.fab { position: fixed; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); right: 22px; width: 60px; height: 60px; border-radius: 50%; background: var(--grad); border: none; font-size: 32px; color: #fff; box-shadow: 0 5px 22px rgba(232,121,160,.55); display: flex; align-items: center; justify-content: center; z-index: 40; }

/* SHEETS / MODALS */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.overlay.center { align-items: center; padding: 24px; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 8px 20px calc(env(safe-area-inset-bottom, 0px) + 26px); max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.handle { width: 38px; height: 4px; background: var(--line); border-radius: 2px; margin: 10px auto 16px; }
.sheet h2 { font-size: 19px; font-weight: 800; margin-bottom: 16px; }
.field { margin-bottom: 13px; }
.field > label { font-size: 12px; color: var(--mute); font-weight: 700; display: block; margin-bottom: 5px; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; background: #fff; -webkit-appearance: none; appearance: none; min-height: 46px; }
.field select { background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field textarea { resize: none; min-height: 84px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--pink); }
.field input:disabled { background: #f9fafb; color: var(--mute2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; color: var(--ink2); }
.check input { width: 20px; height: 20px; accent-color: var(--pink); }
.link-btn { background: none; border: none; color: #db2777; font-size: 13px; font-weight: 700; padding: 6px 0 0; }
.hint { font-size: 12px; color: var(--mute2); margin-top: 5px; line-height: 1.4; }
.section { border-top: 1px solid #f3f4f6; padding-top: 14px; margin-top: 4px; }
.section-title { font-size: 13px; font-weight: 800; color: var(--ink2); margin-bottom: 10px; }
.modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.btn-primary, .btn-secondary, .btn-danger { flex: 1; padding: 14px; border-radius: 14px; font-size: 15px; font-weight: 700; border: none; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-secondary { background: #fff; border: 1.5px solid var(--line); color: var(--mute); }
.btn-danger { background: var(--red); color: #fff; }
.box { background: #fff; border-radius: 22px; padding: 26px 22px; width: 100%; max-width: 340px; text-align: center; }
.box-ico { font-size: 38px; }
.box h3 { margin: 12px 0 6px; font-size: 17px; font-weight: 800; }
.box p { color: var(--mute); font-size: 14px; line-height: 1.45; }
.stars-big { display: flex; gap: 8px; justify-content: center; margin: 6px 0 8px; }
.star-big { font-size: 40px; color: #d1d5db; background: none; border: none; line-height: 1; }
.star-big.on { color: #f59e0b; }
.rate-lbl { text-align: center; font-size: 14px; font-weight: 700; color: #f59e0b; margin-bottom: 14px; min-height: 20px; }
.rate-product { font-size: 14px; color: var(--mute); margin: -8px 0 14px; font-weight: 600; }

.menu-btn { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: #f9fafb; border: none; border-radius: 14px; padding: 14px 14px; font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.menu-btn small { display: block; font-size: 12px; color: var(--mute2); font-weight: 500; margin-top: 2px; }
.menu-btn .mi { font-size: 20px; width: 26px; text-align: center; }
.menu-btn.danger { color: #dc2626; }
.who { font-size: 13px; color: var(--mute); margin-bottom: 14px; }

/* LOGIN */
.login { position: fixed; inset: 0; background: var(--grad); z-index: 999; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { background: #fff; border-radius: 28px; padding: 36px 26px 30px; width: 100%; max-width: 360px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-ico { font-size: 50px; margin-bottom: 12px; }
.login-title { font-size: 22px; font-weight: 800; }
.login-sub { font-size: 13px; color: var(--mute2); margin: 6px 0 22px; }
.login-input { width: 100%; border: 2px solid #fce7f3; border-radius: 14px; padding: 13px 15px; outline: none; background: var(--bg); margin-bottom: 10px; }
.login-input:focus { border-color: var(--pink); }
.login-btn { width: 100%; margin-top: 6px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; font-weight: 600; min-height: 18px; }

/* TOAST */
#toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); display: flex; justify-content: center; z-index: 70; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 10px 10px 16px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: up .2s ease; max-width: 100%; }
.toast.plain { padding-right: 16px; }
.toast-undo { background: rgba(255,255,255,.16); border: none; color: #fbcfe8; font-weight: 800; font-size: 14px; padding: 7px 12px; border-radius: 10px; white-space: nowrap; }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }
