:root {
  --green: #0E7A57;
  --green-dark: #0A5C41;
  --green-light: #E6F4EC;
  --bg: #F4F7F5;
  --card: #FFFFFF;
  --text: #0F1A16;
  --muted: #5B6B65;
  --line: #E2E9E5;
  --neutral-bg: #EEF2F0;
  --ok-text: #0B6B47;   --ok-bg: #E6F4EC;
  --warn-text: #9A4A00; --warn-bg: #FDF1E3;
  --bad-text: #B42318;  --bad-bg: #FDECEA;
  --radius-card: 16px;
  --radius-control: 10px;
  --font-body: "Inter", system-ui, sans-serif;
  --font-head: "Manrope", "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; color: var(--text); }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }

/* ---- Tugmalar va maydonlar (kamida 44px) ---- */
button, select, input { font: inherit; font-size: 14px; }
.btn { min-height: 44px; padding: 10px 18px; border-radius: var(--radius-control); border: 0; background: var(--green); color: #fff; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--card); color: var(--bad-text); border: 1px solid var(--line); }
.btn.link { background: none; color: var(--green); padding: 10px 4px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field select, .field input { min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--card); color: var(--text); }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---- Kartochka va holat chipi ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--muted); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok-text); }
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.chip.bad { background: var(--bad-bg); color: var(--bad-text); }
.toast { padding: 14px 16px; border-radius: 12px; background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.toast.error { background: var(--bad-bg); color: var(--bad-text); }

/* ---- Qobiq: chap menyu + asosiy qism ---- */
.shell { min-height: 100vh; display: flex; }
.sidebar { width: 264px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--green); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { font-family: var(--font-head); font-size: 17px; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-group > button, .nav a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 11px 12px; border-radius: var(--radius-control); border: 0; background: none; text-align: left; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.nav-group > button:hover, .nav a:hover { background: var(--bg); color: var(--text); }
.nav-group > button::after { content: "›"; margin-left: auto; transition: transform .15s; }
.nav-group.open > button::after { transform: rotate(90deg); }
.nav-group .sub { display: none; flex-direction: column; gap: 2px; padding-left: 14px; }
.nav-group.open .sub { display: flex; }
.nav a.active { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green-dark); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.avatar.light { width: 44px; height: 44px; background: var(--green-light); color: var(--green-dark); }
.main { flex: 1; min-width: 0; padding: 32px 40px 48px; }
.page { max-width: 1160px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green); }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.topbar { display: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat b { font-family: var(--font-head); font-size: 28px; font-weight: 800; }

/* ---- Jadval ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; font-size: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.c, th.c { text-align: center; }
td select { min-height: 40px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }

/* ---- So'rov kartochkasi ---- */
.request { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-text { display: flex; flex-direction: column; gap: 3px; }
.empty { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }

/* ---- Kirish ekrani (telefon birinchi) ---- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 32px 20px; text-align: center; }
.auth .logo { width: 72px; height: 72px; border-radius: 22px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: left; }
.auth-card .field, .auth-card form { width: 100%; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card h2, .auth-card p { text-align: center; }
.icon-circle { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.icon-circle.warn { background: var(--warn-bg); color: var(--warn-text); }
.icon-circle.bad { background: var(--bad-bg); color: var(--bad-text); }
.foot { font-size: 12px; color: var(--muted); }

/* ---- Telefon (mini-app): menyu yig'iladi ---- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .sidebar { display: none; position: fixed; inset: 0; z-index: 10; width: 100%; height: 100%; }
  .shell.menu-open .sidebar { display: flex; }
  .main { padding: 20px 16px 40px; }
  h1 { font-size: 24px; }
}
.topbar-close { display: none; margin-left: auto; }
@media (max-width: 860px) { .topbar-close { display: inline-flex; } }
