/* EHSAAN admin. Dizayn: design_handoff_ehsaan/Ehsaan Admin.dc.html */
:root {
  --bg: #063b2b;
  --side: #052f22;
  --card: #0a4a37;
  --inner: #08402f;
  --border: #12604a;
  --text: #f2f7f4;
  --muted: #7a9e88;
  --nav: #9dbcaa;
  --accent: #2f9e4f;
  --soft: #5dd48b;
  --gold: #e3c46a;
  --danger: #e5484d;
  --w: 240px;
  --w-min: 76px;
}

* { box-sizing: border-box; }
/* `.layout` va `.login` ga `display` berilgani uchun brauzerning
   `[hidden]` qoidasi kuchsiz qoladi. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--soft); text-decoration: none; }
a:hover { color: #7fe2a6; }
button { font: inherit; cursor: pointer; }
svg { width: 19px; height: 19px; flex: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Kirish ─────────────────────────────────────────────────────── */

.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(90% 60% at 50% 0%, #0a5039 0%, #063b2b 65%);
}
.login form { width: 100%; max-width: 420px; }
.login .card {
  background: var(--card); border-radius: 20px; padding: 24px;
  display: grid; gap: 0;
}
.mark {
  width: 132px; height: 132px; border-radius: 66px; overflow: hidden;
  background: #003221; display: grid; place-items: center; margin: 0 auto;
}
.mark img { width: 118px; height: 118px; object-fit: contain; display: block; }
.wordmark {
  color: var(--gold); font-weight: 600; font-size: 26px;
  letter-spacing: .3em; padding: 12px 0 4px .3em; text-align: center;
}
.subword {
  color: var(--muted); font-weight: 500; font-size: 12px;
  letter-spacing: .24em; text-align: center; padding-bottom: 28px;
}
label { display: grid; gap: 7px; font-size: 13px; color: var(--muted); padding-bottom: 14px; }
input, textarea {
  background: var(--inner); border: 1px solid var(--border); color: var(--text);
  border-radius: 14px; padding: 0 14px; height: 52px; font: inherit; width: 100%;
}
textarea { height: auto; padding: 12px 14px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.primary {
  width: 100%; height: 52px; border: 0; border-radius: 14px;
  background: var(--accent); color: var(--text); font-weight: 600;
}
.primary:hover { background: #35b159; }
.error { color: var(--danger); font-size: 13px; margin: 12px 0 0; min-height: 18px; }

/* Parol maydoni: yonida ko'z tugmasi. */
.field { position: relative; }
.field input { padding-right: 48px; }
.peek {
  /* Yorliqning pastki bo'shlig'i (14px) ustiga qo'yiladi. */
  position: absolute; right: 8px; bottom: 23px;
  background: transparent; border: 0; color: var(--muted);
  padding: 7px; border-radius: 10px; display: grid; place-items: center;
}
.peek:hover { color: var(--text); background: var(--inner); }

/* ── Tuzilma ────────────────────────────────────────────────────── */

.layout { display: flex; align-items: flex-start; min-height: 100vh; }

aside {
  position: sticky; top: 0; width: var(--w); flex: none; height: 100vh;
  background: var(--side); border-right: 1px solid var(--border);
  padding: 24px 12px; display: flex; flex-direction: column;
  transition: width .18s ease;
}
.brand { display: grid; justify-items: center; padding-bottom: 22px; }
.brand .mark { width: 70px; height: 70px; border-radius: 35px; }
.brand .mark img { width: 64px; height: 64px; }
.brand .wordmark { font-size: 17px; letter-spacing: .26em; padding: 8px 0 3px .26em; }
.brand .subword { font-size: 10px; letter-spacing: .2em; padding: 0; }

nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
nav button {
  display: flex; align-items: center; gap: 12px;
  height: 46px; padding: 0 14px; border: 0; border-radius: 12px;
  background: transparent; color: var(--nav); text-align: left;
  font-size: 14.5px; width: 100%;
}
nav button svg { width: 19px; height: 19px; color: var(--muted); }
nav button:hover { background: rgba(13, 91, 68, .5); color: var(--text); }
nav button:hover svg { color: var(--text); }
nav button.active { background: #0d5b44; color: var(--text); font-weight: 600; }
nav button.active svg { color: var(--soft); }
.badge-count {
  margin-left: auto; background: var(--accent); color: #fff;
  border-radius: 8px; padding: 1px 8px; font-size: 12.5px; font-weight: 600;
}
.signout {
  display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px;
  background: transparent; border: 0; border-radius: 12px;
  color: var(--danger); font-weight: 500; font-size: 14.5px; text-align: left;
}
.signout:hover { background: rgba(229, 72, 77, .1); }

/* Yig'ilgan holat: faqat ikonkalar. */
.layout.mini aside { width: var(--w-min); padding: 24px 10px; }
.layout.mini .brand .mark { width: 46px; height: 46px; border-radius: 23px; }
.layout.mini .brand .mark img { width: 42px; height: 42px; }
.layout.mini .wordmark,
.layout.mini .subword,
.layout.mini nav button span,
.layout.mini .signout span { display: none; }
.layout.mini nav button, .layout.mini .signout { justify-content: center; }

main { flex: 1; min-width: 0; padding: 28px 32px 48px; }

.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-bottom: 22px;
}
.bar h1 { font-size: 30px; font-weight: 600; margin: 0; }
.bar .note { color: var(--muted); font-size: 14px; padding-top: 5px; }
.bar .right { display: flex; align-items: center; gap: 12px; }
.pill {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  font-size: 14px; font-weight: 500;
}
.pill.user { padding-right: 6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 16px; background: var(--inner);
  display: grid; place-items: center; color: var(--soft);
  font-weight: 600; font-size: 13px;
}
.icon {
  background: transparent; border: 0; color: var(--muted);
  padding: 8px; border-radius: 10px; display: grid; place-items: center;
}
.icon:hover { background: var(--card); color: var(--text); }
.burger { display: none; }
.scrim { display: none; }

/* ── Bloklar ────────────────────────────────────────────────────── */

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 20px;
}
.card h2 { font-size: 19px; font-weight: 600; margin: 0 0 14px; }

.kpi {
  display: grid; gap: 14px; padding-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.kpi .card { padding: 18px; }
.kpi .head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; }
.kpi .sq {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
}
.kpi .label { color: var(--muted); font-size: 13px; line-height: 1.35; flex: 1; }
.kpi .value { font-size: 32px; font-weight: 600; }
/* Summa uzun bo'ladi — ikki qatorga tushmasin. */
.kpi .value.sum { font-size: 24px; white-space: nowrap; }
.kpi .card.wide { grid-column: span 2; }
.kpi .note { color: var(--muted); font-size: 12.5px; padding-top: 4px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.queue-row {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 60px;
  padding: 0 16px; margin-bottom: 8px; background: var(--inner);
  border: 1px solid var(--border); border-radius: 14px; text-align: left;
  color: var(--text);
}
.queue-row:hover { border-color: var(--accent); }
.queue-row .grow { flex: 1; font-size: 15px; }
.queue-row b { font-size: 20px; font-weight: 600; }

/* ── Jadval ─────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 500;
  padding: 0 6px 10px; border-bottom: 1px solid var(--border);
}
td { padding: 12px 6px; border-bottom: 1px solid var(--border); font-size: 14.5px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(8, 64, 47, .5); }
.muted { color: var(--muted); font-size: 12.5px; }
td.num { font-weight: 600; }
td.right, th.right { text-align: right; }

.badge {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: 8px; font-size: 12.5px; font-weight: 500; border: 1px solid;
}
.badge.wait { color: var(--gold); background: rgba(227,196,106,.12); border-color: rgba(227,196,106,.3); }
.badge.ok { color: var(--soft); background: rgba(47,158,79,.14); border-color: rgba(47,158,79,.35); }
.badge.bad { color: var(--danger); background: rgba(229,72,77,.1); border-color: rgba(229,72,77,.35); }
.badge.off { color: var(--muted); background: rgba(122,158,136,.1); border-color: var(--border); }
.banner {
  width: 100%; border-radius: 12px; border: 1px solid var(--border);
  margin-top: 10px; display: block;
}
.thumb {
  height: 34px; border-radius: 8px; border: 1px solid var(--border);
  display: block; object-fit: cover;
}
.chip-cat {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: 13px; font-size: 12.5px; font-weight: 500;
  color: var(--soft); background: rgba(47,158,79,.14);
  border: 1px solid rgba(47,158,79,.35);
}

/* `td` ga `display:flex` berilsa jadval tuzilishi buziladi — shuning
   uchun tugmalar oddiy inline element sifatida turadi. */
td.actions { text-align: right; white-space: nowrap; }
.actions button {
  width: 34px; height: 34px; border-radius: 10px; background: transparent;
  border: 1px solid var(--border); color: var(--muted);
  display: inline-grid; place-items: center; vertical-align: middle;
  margin-left: 8px;
}
.actions button svg { width: 16px; height: 16px; }
.actions .ok { border-color: var(--accent); background: rgba(47,158,79,.12); color: var(--soft); }
.actions .no { border-color: rgba(229,72,77,.4); background: rgba(229,72,77,.1); color: var(--danger); }
.actions button:hover { filter: brightness(1.25); }

.toolbar { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; flex-wrap: wrap; }
.chip {
  height: 38px; padding: 0 16px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-size: 14px;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--text); font-weight: 600; }
.chip i { font-style: normal; opacity: .7; margin-left: 4px; }
/* Yo'nalish chiplari: nom tepada, summa ostida. */
.chip.sum {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  height: auto; padding: 7px 14px; line-height: 1.35; text-align: left;
}
.chip.sum i { margin: 0; font-size: 12px; opacity: .75; }
.chip.sum.active i { opacity: .9; }

/* Davr tanlagich — bitta blok, ichida segmentlar. */
.seg {
  display: inline-flex; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; padding: 3px;
}
.seg button {
  height: 32px; padding: 0 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13.5px;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--inner); color: var(--text); font-weight: 600; }

/* Aniq kun/oy/yil tanlagichlari. */
.toolbar.picks { padding-bottom: 14px; gap: 12px; }
.pick {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0; color: var(--muted); font-size: 13px;
}
.pick input, .pick select {
  height: 38px; width: auto; padding: 0 10px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 13.5px;
}
.pick input:focus, .pick select:focus { outline: none; border-color: var(--accent); }
.pick input::-webkit-calendar-picker-indicator { filter: invert(.7); }

/* Yo'nalish chiplari bir qatorda, kerak bo'lsa surilади. */
.toolbar.cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 14px; }
.toolbar.cats::-webkit-scrollbar { height: 0; }
.toolbar.cats .chip { flex: none; }

/* Kun sarlavhasi: jurnalni kunlarga ajratadi. */
tr.day td {
  padding: 16px 6px 8px; border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  letter-spacing: .04em;
}
tr.day td.right { color: var(--text); font-variant-numeric: tabular-nums; }
tbody:first-of-type tr.day td { padding-top: 2px; }
tr.day:hover td { background: transparent; }

/* Tanlangan kesim summasi — jadval ustidagi yagona yirik raqam. */
.sum-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; padding: 2px 2px 16px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.sum-head .muted { font-size: 13px; }
.sum-head .total {
  font-weight: 600; color: var(--soft); line-height: 1.2;
  padding-top: 4px; white-space: nowrap;
}
.sum-head .count { padding-bottom: 3px; }

/* Summa — jadvaldagi asosiy raqam. */
td.money { font-size: 16px; font-weight: 600; white-space: nowrap; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.ghost.small { height: 38px; padding: 0 14px; font-size: 13px; }
.search {
  width: 280px; height: 42px; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; margin-left: auto;
}
.warn {
  background: rgba(227,196,106,.12); border: 1px solid rgba(227,196,106,.3);
  color: var(--gold); border-radius: 14px; padding: 12px 16px;
  font-size: 13.5px; margin: 0 0 16px;
}

.two-side { display: grid; grid-template-columns: 1fr 380px; gap: 14px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.ghost {
  height: 48px; padding: 0 22px; border-radius: 12px;
  background: transparent; border: 1px solid var(--accent);
  color: var(--soft); font-weight: 600; font-size: 14px;
}
.ghost:hover { background: rgba(47, 158, 79, .12); }
.danger {
  height: 48px; padding: 0 22px; border-radius: 12px;
  background: transparent; border: 1px solid rgba(229, 72, 77, .5);
  color: var(--danger); font-weight: 500; font-size: 14px;
}
.danger:hover { background: rgba(229, 72, 77, .12); }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-size: 14.5px; font-weight: 500; }
.list-row.pick { cursor: pointer; }
.list-row.pick:hover .title { color: var(--accent); }
.list-row.editing .title { color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ── Chiquvchi panel ────────────────────────────────────────────── */

.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.drawer-body {
  position: absolute; top: 0; right: 0; bottom: 0; width: 540px; max-width: 92vw;
  background: var(--card); border-left: 1px solid var(--border);
  padding: 26px; overflow: auto; animation: slidein .18s ease;
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.drawer-body h1 { font-size: 22px; margin: 0 0 14px; }
.drawer-body img { width: 100%; border-radius: 14px; margin-bottom: 16px; display: block; }
dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 12px; margin: 16px 0; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; font-size: 14.5px; }
.docs { display: grid; gap: 8px; }
.docs a {
  background: var(--inner); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--accent); color: #fff; padding: 13px 22px;
  border-radius: 14px; z-index: 60; animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } }
.toast.bad { background: var(--danger); }

/* ── Kichik ekran ───────────────────────────────────────────────── */

@media (max-width: 980px) {
  .two, .two-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  aside {
    position: fixed; z-index: 30; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .layout.open aside { transform: none; }
  .layout.mini aside { width: var(--w); padding: 24px 12px; }
  .layout.mini .wordmark, .layout.mini .subword,
  .layout.mini nav button span, .layout.mini .signout span { display: block; }
  .layout.mini nav button, .layout.mini .signout { justify-content: flex-start; }
  .layout.open .scrim {
    display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.5);
  }
  .burger { display: grid; }
  .toggle { display: none; }
  main { padding: 20px 16px 32px; }
  .bar h1 { font-size: 22px; }
  .bar .right .pill:not(.user) { display: none; }
  .search { width: 100%; margin-left: 0; }
}

/* ── Telefon ────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .seg { width: 100%; justify-content: space-between; }
  .seg button { flex: 1; padding: 0 6px; font-size: 12.5px; }

  main { padding: 14px 12px 28px; }
  .bar { flex-wrap: wrap; gap: 10px; padding-bottom: 16px; }
  .bar .note { font-size: 13px; }
  .bar .right { margin-left: auto; }
  #who { display: none; }
  .card { padding: 14px; border-radius: 16px; }
  .kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .card { padding: 14px; }
  .kpi .card.wide { grid-column: 1 / -1; }
  .kpi .value { font-size: 24px; }
  .kpi .value.sum { font-size: 20px; white-space: normal; }
  .queue-row { height: auto; min-height: 60px; padding: 10px 12px; }
  .queue-row .grow { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
  .queue-row b { font-size: 15px; white-space: nowrap; }
  .toolbar { gap: 8px; }
  .chip { height: 34px; padding: 0 12px; font-size: 13px; }

  /* Jadval kartochkalarga aylanadi: ustun nomi katak ustida. */
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    background: var(--inner); border: 1px solid var(--border);
    border-radius: 14px; padding: 10px 12px; margin-bottom: 10px;
  }
  tbody tr:hover td { background: transparent; }
  td { border: 0; padding: 5px 0; overflow-wrap: anywhere; }
  td::before {
    content: attr(data-label); display: block;
    color: var(--muted); font-size: 11.5px; padding-bottom: 2px;
  }
  td[data-label=""]::before { display: none; }
  td.actions { text-align: left; padding-top: 8px; }
  .actions button { margin: 0 8px 0 0; width: 40px; height: 40px; }

  .row-btns > * { flex: 1 1 auto; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { padding-bottom: 8px; }
  .drawer-body { width: 100%; max-width: 100%; padding: 18px; }
  .toast { left: 12px; right: 12px; transform: none; text-align: center; }
}

@media (max-width: 640px) {
  /* Kun sarlavhasi: chap tomonda kun, o'ng tomonda o'sha kunlik jami. */
  tr.day {
    display: flex; align-items: baseline; justify-content: space-between;
    background: transparent; border: 0; padding: 16px 2px 8px; margin: 0;
  }
  tr.day td { width: auto; padding: 0; border: 0; }
  tr.day td::before { display: none; }
  tr.day td:empty { display: none; }

  /* Summa kartaning asosiy raqami — yorliqsiz va aksentda. */
  td.money {
    font-size: 19px; color: var(--soft);
    padding-top: 8px; padding-bottom: 2px;
  }
  td.money::before { display: none; }
}

@media (max-width: 640px) {
  .sum-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .sum-head .count { padding: 2px 0 0; }
}

@media (max-width: 640px) {
  .toolbar.picks { flex-wrap: wrap; }
  .pick { flex: 1 1 45%; justify-content: space-between; }
  .pick input, .pick select { flex: 1; min-width: 0; }
}
