/* Admin / kassa / DJ panellari — Go Toshkent Driver uslubi: orange + white */
:root {
  --brand: #ff7625;
  --brand-dark: #e8600f;
  --brand-soft: #fff1e8;
  --brand-line: #ffd9c2;

  --bg: #f5f5f5;
  --panel: #ffffff;
  --line: #ececec;

  --text: #1a1a1a;
  --text-2: #4d4d4d;
  --muted: #8a8a8a;
  --disabled: #b0b0b0;

  --green: #1f9254;
  --green-soft: #eaf7ef;
  --red: #d63b1f;
  --red-soft: #fdeeea;

  /* Kafe rangiga qarab har so'rovda qayta yoziladi (app/theme.py) */
  --on-primary: #ffffff;
  --brand-text: #d1590a;   /* oq fonda o'qiladigan tus */

  --radius: 12px;
  --shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5;
}

/* Sahifalar orasida silliq o'tish (miltillamasin) */
@view-transition { navigation: auto; }
.side { view-transition-name: side; }
::view-transition-old(root) { animation: vt-out .14s ease both; }
::view-transition-new(root) { animation: vt-in .16s ease both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Karkas --- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 232px; flex: none; background: var(--panel);
  border-right: 1px solid var(--line); padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .logo { font-weight: 800; font-size: 17px; padding: 6px 10px 18px; color: var(--brand-text);
  display: flex; align-items: center; gap: 9px; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; flex: none; }
/* Kafe logotipi — har qanday fonli rasm uchun oq plashka */
.logo-tile { width: 60px; height: 60px; border-radius: 16px; background: #fff;
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
  padding: 7px; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.logo-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-cafe { width: 26px; height: 26px; border-radius: 7px; background: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; padding: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.logo-cafe img { max-width: 100%; max-height: 100%; object-fit: contain; }
.powered { padding: 18px 12px 4px; font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .04em; opacity: .7; }
.side a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: var(--text);
  font-size: 14px; margin-bottom: 2px; font-weight: 500;
}
.side a:hover { background: var(--bg); text-decoration: none; }
.side a.on { background: var(--brand); color: var(--on-primary); font-weight: 700; }
/* SVG ikonka — rangi matndan meros oladi */
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.side a .ic { width: 19px; height: 19px; opacity: .7; }
.side a.on .ic, .side a:hover .ic { opacity: 1; }
.side a .ico { font-size: 16px; width: 20px; text-align: center; flex: none;
  filter: grayscale(1); opacity: .65; }
.side a.on .ico { filter: none; opacity: 1; }
.side a:hover .ico { filter: none; opacity: .9; }
.side .grp { font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700; padding: 16px 12px 6px; }
.nav-sep { height: 1px; background: var(--line); margin: 9px 12px; }
.menu-btn { display: none; }

/* Til almashtirish — menyu qatori bilan bir uslubda, ramkasiz */
.lang-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; font-size: 13px; font-weight: 700; line-height: 1.2;
}
.lang-item .ico { font-size: 16px; width: 20px; text-align: center; flex: none;
  filter: grayscale(1); opacity: .55; }
.lang-item .ic { width: 19px; height: 19px; opacity: .55; }
/* .side a uslubini bekor qilamiz - bular menyu bandi emas */
.lang-item a, .lang-item a.on {
  display: inline; background: none; padding: 0 2px; margin: 0;
  border-radius: 0; font-size: 13px; letter-spacing: .03em; color: var(--muted);
}
.lang-item a:hover { color: var(--text); text-decoration: none; background: none; }
.lang-item a.on { color: var(--brand-text); }
.lang-item i { color: var(--line); font-style: normal; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { font-size: 21px; margin: 0; font-weight: 800; letter-spacing: -.01em; }

/* --- Planshet va telefon: yon menyu yig'iladigan bo'ladi --- */
@media (max-width: 860px) {
  .shell { display: block; }
  .side {
    width: auto; height: auto; position: sticky; top: 0; z-index: 30;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px;
    overflow: visible;
  }
  .side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .side .logo { padding: 4px 0; font-size: 15px; }
  .menu-btn {
    display: block; background: var(--brand); color: var(--on-primary); border: 0;
    border-radius: 10px; padding: 9px 14px; font-size: 13.5px; font-weight: 700;
    font-family: inherit; cursor: pointer;
  }
  .side-links { display: none; padding: 8px 0 4px; }
  .side.open .side-links { display: block; }
  .side .grp { padding: 12px 10px 4px; }
  .side a { padding: 11px 12px; }
  .main { padding: 14px 12px 40px; }
  .head h1 { font-size: 18px; }
  .panel { padding: 14px; border-radius: 10px; margin-bottom: 12px; }
  .panel h2 { font-size: 14px; }
}

/* --- Telefondagi pastki tugmalar paneli --- */
.mtabs, .menu-backdrop { display: none; }

@media (max-width: 860px) {
  .mtabs {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -2px 14px rgba(0, 0, 0, .06);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  }
  .mtabs-inner { display: flex; max-width: 560px; margin: 0 auto; }
  .mtabs a, .mtabs button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10px; font-weight: 700; color: var(--muted); background: none;
    border: 0; padding: 4px 2px; font-family: inherit; cursor: pointer; line-height: 1.2;
  }
  .mtabs a:hover { text-decoration: none; }
  .mtabs .ico { font-size: 19px; filter: grayscale(1); opacity: .5; }
  .mtabs .ic { width: 21px; height: 21px; opacity: .55; }
  .mtabs a.on, .mtabs button.on { color: var(--brand-text); }
  .mtabs a.on .ico, .mtabs button.on .ico { filter: none; opacity: 1; }
  .mtabs a.on .ic, .mtabs button.on .ic { opacity: 1; }

  .main { padding-bottom: 86px; }
  .menu-btn { display: none; }              /* tepadagi hamburger keraksiz */
  .side { padding: 8px 12px; }

  /* "Ko'proq" bosilganda menyu pastdan varaq bo'lib chiqadi */
  .side.open .side-links {
    position: fixed; left: 0; right: 0; bottom: 68px; top: auto; z-index: 47;
    max-height: 66vh; overflow-y: auto; background: #fff;
    border-radius: 16px 16px 0 0; padding: 12px 12px 16px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
    animation: sheet-up .18s ease both;
  }
  body.menu-open .menu-backdrop {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(0, 0, 0, .35);
  }
  body.menu-open { overflow: hidden; }
}
@keyframes sheet-up { from { transform: translateY(14px); opacity: .6; } to { transform: none; } }

/* --- Telefon: kartlar ikki ustunda, matnlar kichikroq --- */
@media (max-width: 700px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 11px 12px; border-radius: 10px; border-left-width: 3px; }
  .kpi .l { font-size: 10.5px; line-height: 1.3; }
  .kpi .v { font-size: 19px; margin-top: 2px; }
  .kpi .s { font-size: 10.5px; line-height: 1.3; }
  table { font-size: 12.5px; }
  th { font-size: 9.5px; padding: 7px 8px; }
  td { padding: 8px; }
  .btn { padding: 9px 14px; font-size: 13.5px; }
  .btn.sm { padding: 6px 10px; font-size: 12px; }
  .head { gap: 10px; margin-bottom: 12px; }
  .row { gap: 8px; }
  .row > * { min-width: 120px; }
  .row > .panel { min-width: 100%; }   /* panellar tor ekranda ustma-ust */
  .code-input { font-size: 28px; }
  .bars { height: 90px; }
}

/* --- Kartlar --- */
.panel { background: var(--panel); border-radius: var(--radius); padding: 18px;
  margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border-radius: var(--radius); padding: 15px 17px;
  box-shadow: var(--shadow); border-left: 3px solid var(--brand); }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 25px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* --- Jadval --- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: 9px 10px;
  border-bottom: 1.5px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: var(--bg); color: var(--text-2); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--brand-soft); color: var(--brand-text); }

/* --- Formalar --- */
label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px;
  font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--text); font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

.btn { display: inline-block; padding: 10px 18px; border: 0; border-radius: 10px;
  background: var(--brand); color: var(--on-primary); font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--brand-dark); text-decoration: none; color: var(--on-primary); }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--bg); border-color: var(--brand-line); color: var(--text); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b52f16; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; }
.btn.block { display: block; width: 100%; text-align: center; }
.btn:disabled { background: var(--disabled); cursor: default; }

.msg { padding: 12px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px;
  font-weight: 600; }
.msg.err { background: var(--red-soft); color: var(--red); }
.msg.ok { background: var(--green-soft); color: var(--green); }

.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.mono { font-variant-numeric: tabular-nums; }

/* --- Kassir maxsus --- */
.cashier-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .cashier-grid { grid-template-columns: 1fr; } }
.code-input { font-size: 34px; text-align: center; letter-spacing: .3em; padding: 14px;
  font-weight: 800; color: var(--brand-text); }
/* Mijoz "kassirga yuborish" bosganda chiqadigan qator */
.waitrow {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 8px; border-radius: 10px;
  background: var(--brand-soft); border: 1.5px solid var(--brand-line);
  color: var(--text) !important; text-decoration: none !important;
  animation: sheet-up .2s ease both;
}
.waitrow:hover { border-color: var(--brand); }
.waitrow .wname { font-weight: 700; font-size: 15px; }
.waitrow .wmeta { color: var(--text-2); font-size: 12.5px; flex: 1; }
.waitrow .wbtn { background: var(--brand); color: var(--on-primary);
  border-radius: 8px; padding: 6px 13px; font-size: 12.5px; font-weight: 700; }

.calc { background: var(--bg); border-radius: 10px; padding: 13px 15px; margin: 12px 0; }
.calc div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.calc div.total { border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 9px;
  font-weight: 800; font-size: 17px; color: var(--brand-text); }

/* --- PWA o'rnatish tugmasi --- */
.pwa-install {
  position: fixed; left: 16px; bottom: 16px; z-index: 55;
  background: var(--panel); color: var(--brand-text);
  border: 1.5px solid var(--brand-line); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit; box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
.pwa-install:hover { background: var(--brand-soft); }
/* Ilova sifatida ochilganda tugma keraksiz */
@media (display-mode: standalone) { .pwa-install { display: none !important; } }
@media (max-width: 700px) { .pwa-install { left: 10px; bottom: 10px; font-size: 12px; } }

/* --- Bildirishnoma banneri (kassa) --- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.toast {
  position: relative; background: var(--panel); border-left: 4px solid var(--brand);
  border-radius: 10px; padding: 12px 30px 12px 14px; font-size: 13.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
  animation: toast-in .25s ease both;
}
.toast .x { position: absolute; right: 9px; top: 6px; cursor: pointer;
  color: var(--muted); font-size: 17px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }
@media (max-width: 700px) {
  .toasts { left: 10px; right: 10px; bottom: 10px; max-width: none; }
}

/* --- Grafik --- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-top: 8px; }
.bars i { flex: 1; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px;
  display: block; opacity: .85; }
.bars i:hover { opacity: 1; }

/* --- QR chop etish --- */
@media print {
  .side, .head, .noprint { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .qr-card { page-break-inside: avoid; }
}
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { border: 2px solid var(--brand-line); border-radius: var(--radius); padding: 16px;
  text-align: center; background: #fff; color: #1a1a1a; }
.qr-card img { width: 100%; max-width: 190px; }
.qr-card .n { font-size: 21px; font-weight: 800; margin-top: 6px; color: var(--brand-text); }
.qr-card .h { font-size: 12px; color: #666; }

/* --- Xodimlar: rasm, tahrirlash, ruxsatlar --- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-text);
  font-weight: 800; font-size: 14px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 110px; height: 110px; border-radius: 18px; font-size: 40px; }
.staff-cell { display: flex; align-items: center; gap: 10px; color: inherit; }
.staff-cell:hover { text-decoration: none; color: var(--brand-text); }

.staff-edit { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.staff-edit .photo-box { width: 130px; flex: none; }
.staff-edit .fields { flex: 1; min-width: 260px; }

.perm-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px 22px;
}
.perm-group h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 10px 0 6px;
}
.perm {
  display: flex; align-items: center; gap: 8px; padding: 5px 0;
  font-size: 13px; cursor: pointer;
}
.perm input { width: auto; margin: 0; }

@media (max-width: 700px) {
  .staff-edit .photo-box { width: 100%; }
  .avatar.big { margin: 0 auto; }
}

/* --- Menejer: mijoz fikrlari --- */
.fb-card {
  border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
}
.fb-card.low { border-left-color: var(--red); background: #fff8f6; }
.fb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; margin-bottom: 6px; }
.fb-stars { color: #f5a524; font-size: 15px; letter-spacing: .06em; }
.fb-text { font-size: 14px; line-height: 1.45; margin: 6px 0 10px; }
.fb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fb-actions form { display: flex; gap: 6px; flex: 1; min-width: 240px; }
.fb-actions input { flex: 1; }
.fb-actions .btn { flex: 0 0 auto; }

/* Ish kunlari tanlagich */
.daybar { display: flex; gap: 5px; flex-wrap: wrap; }
.day { cursor: pointer; }
.day input { display: none; }
.day span {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 38px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  border: 1.5px solid var(--line); color: var(--muted); background: var(--panel);
}
.day input:checked + span {
  border-color: transparent; background: var(--brand); color: #fff;
}
