/* Boshqaruv paneli layout. Tokens and components: /shared/ui.css */

.admin { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

/* Sidebar: a soft raised column; the active item is pressed in */
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
  background: var(--surface); box-shadow: 6px 0 18px rgba(150, 168, 175, .35); z-index: var(--z-sticky); }
.side-logo { padding: 14px 12px; margin: 0 2px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--raise-sm); }
.side-logo img { display: block; width: 100%; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 4px; }
.sidebar a.nav { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 12px; color: var(--text-2);
  text-decoration: none; font-weight: 500; transition: background-color .18s, color .18s, box-shadow .18s; }
.sidebar a.nav .icon { color: var(--muted); transition: color .18s; }
.sidebar a.nav:hover { color: var(--brand-strong); background: var(--surface-hi); }
.sidebar a.nav:hover .icon { color: var(--brand); }
.sidebar a.nav.active { color: var(--brand-strong); font-weight: 600; box-shadow: var(--inset); background: var(--surface); }
.sidebar a.nav.active .icon { color: var(--brand); }
.count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.side-foot { margin-top: auto; padding: 14px 12px 4px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; box-shadow: var(--raise-sm); }
.side-foot .who { min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.side-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { padding: 26px 30px 48px; display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: 1440px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 44px; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.intro { color: var(--text-2); margin: -8px 0 0; max-width: 75ch; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.toolbar .input { width: auto; min-width: 160px; }
.toolbar .input-icon { min-width: 260px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; }
.kpi { display: flex; gap: 14px; align-items: flex-start; }
.kpi .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kpi .sub a { text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 2px; }

.banner { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font-weight: 500; padding: 14px 18px; }
.banner .icon-tile { color: var(--warn); }
.banner .go { margin-left: auto; color: var(--brand-strong); display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }

/* Requests & devices */
.req { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
.req:first-of-type { border-top: 0; }
.req .main { min-width: 0; flex: 1; }
.device .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; margin-top: 14px; font-size: 14px; }
.device .grid-2 .muted { display: inline-flex; align-items: center; gap: 6px; }
.device .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.bottom-nav { display: none; }
.menu-btn { display: none; }

@media print {
  body.printing-receipt > *:not(#print-area) { display: none !important; }
  body.printing-receipt #print-area { display: block; }
  body.printing-receipt { background: #fff; }
  body:not(.printing-receipt) .sidebar, body:not(.printing-receipt) .no-print, body:not(.printing-receipt) .bottom-nav { display: none !important; }
  body:not(.printing-receipt) .admin { display: block; }
  .card, .table-wrap { box-shadow: none !important; border: 1px solid #ccc !important; }
}

@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .content { padding: 22px 20px 40px; }
}

/* Phone: bottom bar with the phone-ready sections, everything else in a drawer (Q29) */
@media (max-width: 760px) {
  :root { font-size: 16px; }
  .admin { grid-template-columns: 1fr; padding-bottom: 76px; }
  .sidebar { display: none; position: fixed; inset: 0 0 72px 0; height: auto; z-index: var(--z-drawer); }
  .sidebar.open { display: flex; }
  .content { padding: 18px 16px 24px; gap: 16px; }
  h1 { font-size: 22px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: 10px; height: 62px; z-index: var(--z-drawer);
    background: var(--surface); border-radius: 20px; box-shadow: 0 -2px 18px rgba(150, 168, 175, .45), var(--raise-sm); padding: 4px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 14px;
    font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; background: none; border: 0; position: relative; cursor: pointer; min-width: 0; }
  .bottom-nav .active { color: var(--brand-strong); box-shadow: var(--inset); font-weight: 600; }
  .bottom-nav .count { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; }
  .desktop-only { display: none !important; }
  .form-grid, .device .grid-2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { flex-direction: column; gap: 8px; padding: 14px; }
  .kpi .value { font-size: 19px; }
  .card { padding: 16px; }
  .req .row { width: 100%; }
  .req .row .btn { flex: 1; }
  .toolbar > * { flex: 1 1 140px; }
  .toolbar .input, .toolbar .input-icon { min-width: 0; width: 100%; }
  /* tables marked .cards become stacked rows */
  table.cards thead { display: none; }
  table.cards, table.cards tbody { display: block; width: 100%; }
  table.cards tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.cards td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; }
  table.cards td.num { text-align: right; }
  table.cards td.empty { grid-column: 1 / -1; text-align: center; }
}
.icon.flip { transform: scaleX(-1); }
.kpi-body { min-width: 0; }
.toolbar .input-icon { min-width: 320px; }
.toolbar label.field .input-icon { min-width: 300px; }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 10px; padding: 12px; border-radius: var(--r); box-shadow: var(--inset); }
.icon-pick button { aspect-ratio: 1; border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--raise-sm); color: var(--text-2); cursor: pointer; display: grid; place-items: center; transition: box-shadow .15s, color .15s; }
.icon-pick button:hover { color: var(--brand-strong); }
.icon-pick button.active { box-shadow: var(--inset-sm), 0 0 0 2px var(--brand); color: var(--brand-strong); }
.stock-check { align-items: flex-start; padding: 12px 14px; border-radius: var(--r); box-shadow: var(--inset-sm); }
.stock-check input { margin-top: 3px; }
.toolbar .input-icon .input { width: 100%; min-width: 0; }

/* Excel import */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.step { position: relative; display: flex; flex-direction: column; gap: 10px; }
.step .card-head { margin-bottom: 0; padding-right: 30px; }
.step p { margin: 0; }
.step .btn { align-self: flex-start; margin-top: auto; }
.step-no { position: absolute; top: 14px; right: 16px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--brand-strong); box-shadow: var(--inset-sm); }
.legend { list-style: none; padding: 0; margin: auto 0 0; display: flex; flex-direction: column; gap: 6px; }
.legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 8px; vertical-align: -2px; border: 1px solid var(--line); }
.sw.grey { background: #e7ecee; } .sw.yellow { background: #fff4c2; }
.drop { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--r); box-shadow: var(--inset); cursor: pointer; color: var(--text-2); border: 2px dashed transparent; transition: border-color .15s, background-color .15s; margin-top: auto; }
.drop .icon { color: var(--brand); }
.drop:hover, .drop.over { border-color: rgba(14, 124, 116, .45); background: var(--brand-tint); }
.drop.busy { opacity: .6; pointer-events: none; }
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 12px; font-size: 14px; }
.notice span { flex: 1; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.review .tabs { margin-bottom: 14px; }
.review .tab .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.review .tab .dot.ok { background: var(--ok); } .review .tab .dot.info { background: var(--info); } .review .tab .dot.warn { background: var(--warn); } .review .tab .dot.danger { background: var(--danger); }
.review-table td { vertical-align: top; }
.review-table tr.off td { opacity: .45; }
.review-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 2px; }
.note { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 4px; color: var(--text-2); }
.note .icon { margin-top: 2px; }
.note.danger { color: var(--danger); } .note.warn { color: var(--warn); }
.decide { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.decide .opt { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; box-shadow: var(--raise-sm); cursor: pointer; font-size: 13px; }
.decide .opt input { accent-color: var(--brand); }
.decide .opt.on { box-shadow: var(--inset-sm), 0 0 0 2px var(--brand); }
@media (max-width: 1100px) { .steps { grid-template-columns: 1fr; } }

/* Telegram profillari */
.tg-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 16px; border-radius: var(--r); box-shadow: var(--inset-sm); margin-bottom: 16px; }
.tg-status > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.tg-status .badge + .small { margin-top: 2px; }
.tg-activity .small, .tg-linked { white-space: nowrap; }
.tg-status .label, .form-grid .label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.tg-status a { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-strong); font-weight: 600; text-decoration: none; }
.tg-topics { display: flex; flex-wrap: wrap; gap: 4px; }
.tg-table td.actions { text-align: right; }
.row.nowrap { flex-wrap: nowrap; justify-content: flex-end; }
.nowrap { white-space: nowrap; }
.tg-sub { margin: 20px 0 8px; font-size: 14px; }
.tg-more { margin-top: 16px; }
.tg-more summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--text-2); padding: 6px 0; list-style: none; }
.tg-more summary::-webkit-details-marker { display: none; }
.tg-more[open] summary { margin-bottom: 8px; color: var(--text); }
.tg-text { max-width: 420px; color: var(--text-2); }
.tg-check-grid { display: grid; gap: 4px; margin-top: 6px; }
label.check > span { display: flex; flex-direction: column; gap: 1px; }
.tg-invite { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; margin-top: 4px; }
.tg-qr { background: #fff; border-radius: var(--r); padding: 10px; box-shadow: var(--raise-sm); }
.tg-qr svg { display: block; width: 100%; height: auto; }
.tg-invite-text p { margin: 0 0 10px; }
.tg-url { display: flex; gap: 8px; margin-bottom: 8px; }
.tg-url .input { flex: 1; min-width: 0; font-size: 13px; }
@media (max-width: 760px) {
  .tg-status { grid-template-columns: 1fr; }
  .tg-invite { grid-template-columns: 1fr; }
  .tg-qr { max-width: 220px; margin: 0 auto; }
  table.cards.tg-table tr { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
  .tg-table td[data-label]:not(:first-child):not([data-label=""])::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
  .tg-table td.actions { text-align: left; }
  .row.nowrap { justify-content: flex-start; }
  .tg-activity .small, .tg-linked { white-space: normal; }
}
