/* ============ Админ-панель «От души» ============ */
:root {
  --wine: #6e2440; --wine-700: #571a31; --wine-900: #3f1123; --wine-300: #a85e78;
  --blush: #f7e9ec; --cream: #fbf6f1; --ink: #2c2129; --muted: #857078; --line: #e7dade;
  --ok: #4f8a5b; --warn: #d98a2b; --danger: #c0392b; --info: #3a6ea5;
  --shadow-sm: 0 2px 10px rgba(80,30,50,.06); --shadow: 0 12px 34px rgba(80,30,50,.12);
  --r: 14px;
  --font-body: 'Montserrat', system-ui, sans-serif; --font-head: 'Playfair Display', Georgia, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--cream); color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
input, select, textarea { font-family: inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 14px; transition: .18s; }
.btn--primary { background: var(--wine); color: #fff; }
.btn--primary:hover { background: var(--wine-700); }
.btn--ghost { background: #fff; color: var(--wine); border: 1.5px solid var(--line); }
.btn--ghost:hover { border-color: var(--wine-300); }
.btn--danger { background: #fdecea; color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--sm { padding: 7px 13px; font-size: 12.5px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* -------- Login -------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--wine-900), var(--wine)); }
.login__card { background: var(--cream); border-radius: 20px; padding: 44px 38px; width: 100%; max-width: 400px; box-shadow: var(--shadow); text-align: center; }
.login__logo { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px; object-fit: cover; box-shadow: var(--shadow-sm); }
.login__card h1 { font-family: var(--font-head); font-size: 26px; color: var(--wine-900); }
.login__card p { color: var(--muted); font-size: 14px; margin: 6px 0 24px; }
.login__err { color: var(--danger); font-size: 13.5px; min-height: 20px; margin-top: 10px; }

/* -------- Layout -------- */
.app { display: none; min-height: 100vh; grid-template-columns: 244px 1fr; }
.app.show { display: grid; }
.sidebar { background: var(--wine-900); color: #e9d3d9; padding: 24px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 16px; }
.sidebar__brand img { width: 42px; height: 42px; border-radius: 50%; }
.sidebar__brand b { font-family: var(--font-head); font-size: 20px; color: #fff; display: block; }
.sidebar__brand span { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: #c99aa6; }
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar__nav button { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 10px; color: #e9d3d9; font-size: 15px; font-weight: 500; text-align: left; transition: .18s; position: relative; }
.sidebar__nav button:hover { background: rgba(255,255,255,.08); }
.sidebar__nav button.active { background: #fff; color: var(--wine); font-weight: 600; }
.sidebar__nav .pill { margin-left: auto; background: var(--wine); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }
.sidebar__nav button.active .pill { background: var(--wine); color: #fff; }
.sidebar__foot { border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px; }
.sidebar__foot a, .sidebar__foot button { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #c99aa6; font-size: 14px; width: 100%; border-radius: 8px; }
.sidebar__foot a:hover, .sidebar__foot button:hover { color: #fff; background: rgba(255,255,255,.06); }

.main { padding: 30px 34px; overflow-x: hidden; }
.page { display: none; }
.page.show { display: block; animation: fade .25s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.page__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page__head h2 { font-family: var(--font-head); font-size: 30px; color: var(--wine-900); }
.page__head .sub { color: var(--muted); font-size: 14px; }

/* -------- Stats -------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat { background: #fff; border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat b { font-family: var(--font-head); font-size: 30px; color: var(--wine-900); display: block; }
.stat span { font-size: 13px; color: var(--muted); }

/* -------- Orders -------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.toolbar .filter { padding: 8px 16px; border-radius: 100px; background: #fff; border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 500; transition: .18s; }
.toolbar .filter.active { background: var(--wine); color: #fff; border-color: var(--wine); }
.toolbar .sound { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }

.orders { display: flex; flex-direction: column; gap: 14px; }
.order { background: #fff; border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--line); transition: .25s; }
.order.is-new { border-left-color: var(--wine); animation: pulse 1.6s ease-in-out 2; }
.order[data-status="done"] { opacity: .7; border-left-color: var(--ok); }
.order[data-status="canceled"] { opacity: .6; border-left-color: var(--danger); }
@keyframes pulse { 0%,100% { box-shadow: var(--shadow-sm); } 50% { box-shadow: 0 0 0 4px var(--blush); } }
.order__top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.order__num { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--wine-900); }
.order__type { padding: 4px 12px; border-radius: 100px; font-size: 12px; font-weight: 600; }
.type--pickup { background: #eef6ef; color: var(--ok); }
.type--delivery { background: #eaf1f8; color: var(--info); }
.order__time { color: var(--muted); font-size: 13px; }
.order__ready { margin-left: auto; background: var(--blush); color: var(--wine); font-weight: 600; font-size: 13px; padding: 5px 13px; border-radius: 100px; }
.order__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.order__items { display: flex; flex-direction: column; gap: 7px; }
.order__item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.order__item img { width: 40px; height: 46px; border-radius: 7px; object-fit: cover; }
.order__item .q { color: var(--muted); }
.order__item .s { margin-left: auto; font-weight: 600; }
.order__info { font-size: 13.5px; color: #4a3d43; }
.order__info div { padding: 3px 0; }
.order__info .lbl { color: var(--muted); font-size: 12px; }
.order__total { font-family: var(--font-head); font-size: 22px; color: var(--wine-900); margin-top: 6px; }
.order__foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.order__status { display: flex; gap: 6px; flex-wrap: wrap; }
.st-btn { padding: 6px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: var(--cream); color: var(--muted); border: 1.5px solid transparent; transition: .15s; }
.st-btn.active { background: var(--wine); color: #fff; }
.st-btn:hover { border-color: var(--wine-300); }
.order__del { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.order__del:hover { color: var(--danger); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty__ic { font-size: 50px; opacity: .5; margin-bottom: 10px; }

/* -------- Products -------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.prod-row { background: #fff; border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; }
.prod-row__media { position: relative; aspect-ratio: 16/11; background: var(--blush); }
.prod-row__media img { width: 100%; height: 100%; object-fit: cover; }
.prod-row__off { position: absolute; inset: 0; background: rgba(255,255,255,.7); display: grid; place-items: center; font-weight: 600; color: var(--danger); }
.prod-row__badge { position: absolute; top: 8px; left: 8px; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 700; color: #fff; background: var(--wine); }
.prod-row__body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.prod-row__cat { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--wine-300); font-weight: 600; }
.prod-row__name { font-weight: 600; font-size: 16px; margin: 3px 0 6px; color: var(--wine-900); }
.prod-row__price { font-family: var(--font-head); font-size: 20px; color: var(--wine-900); font-weight: 700; margin-top: auto; }
.prod-row__acts { display: flex; gap: 8px; padding: 0 16px 16px; }

/* -------- Modal / forms -------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal__bg { position: absolute; inset: 0; background: rgba(44,20,35,.55); }
.modal__box { position: relative; background: var(--cream); border-radius: 18px; width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; padding: 30px; box-shadow: var(--shadow); animation: fade .2s; }
.modal__box h3 { font-family: var(--font-head); font-size: 24px; color: var(--wine-900); margin-bottom: 20px; }
.modal__close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); font-size: 16px; color: var(--muted); }
.modal__close:hover { background: var(--blush); color: var(--wine); }

.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14.5px; background: #fff; transition: .18s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--wine-300); box-shadow: 0 0 0 3px var(--blush); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; padding: 8px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--wine); }

.uploader { display: flex; gap: 14px; align-items: center; }
.uploader__preview { width: 90px; height: 100px; border-radius: 10px; object-fit: cover; background: var(--blush); border: 1.5px solid var(--line); }
.uploader__actions { flex: 1; }
.gallery-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px; }
.gallery-pick img { aspect-ratio: 1; object-fit: cover; border-radius: 7px; cursor: pointer; border: 2px solid transparent; transition: .15s; }
.gallery-pick img:hover { border-color: var(--wine-300); }
.gallery-pick img.sel { border-color: var(--wine); }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--wine-900); color: #fff; padding: 13px 24px; border-radius: 100px; font-size: 14px; box-shadow: var(--shadow); z-index: 300; transition: transform .35s cubic-bezier(.3,1.3,.5,1); }
.toast.show { transform: translateX(-50%) translateY(0); }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

@media (max-width: 820px) {
  .app.show { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; transform: translateX(-100%); transition: .3s; width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px 16px; }
  .mobtop { display: flex !important; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .order__grid { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
.mobtop { display: none; align-items: center; gap: 12px; margin-bottom: 18px; }
.mobtop button { font-size: 24px; color: var(--wine); }
