/* SoftNeed Loyiha — qurilish maydoni uchun interfeys.
   Yorug' quyoshda o'qilishi va qo'lqopli qo'l bilan bosilishi hisobga olingan. */

:root {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-2: #1e232c;
  --line: #2a313d;
  --ink: #e8ecf2;
  --muted: #8a94a3;
  --dim: #5c6673;

  --hivis: #f2c200;      /* faqat kechikish va shoshilinch uchun */
  --blue: #4c8dff;
  --green: #2fbf71;
  --red: #ef4444;
  --amber: #f59e0b;

  --tap: 56px;           /* minimal bosish maydoni */
  --r: 10px;
  --pad: 16px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
}

a { color: var(--blue); text-decoration: none; }

/* --- Sarlavha --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 var(--pad);
  padding-top: env(safe-area-inset-top);
  background: rgba(14, 17, 22, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .back { color: var(--muted); font-size: 22px; line-height: 1; }

.bell { position: relative; color: var(--muted); font-size: 20px; }
.bell[data-count]:not([data-count="0"])::after {
  content: attr(data-count);
  position: absolute;
  top: -6px; right: -8px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: #fff;
  font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center;
  border-radius: 9px;
}

/* --- Tarkib --- */

.wrap { padding: var(--pad); max-width: 720px; margin: 0 auto; }

.eyebrow {
  margin: 24px 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.eyebrow:first-child { margin-top: 4px; }

/* --- Vazifa qatori: muddat hisoblagichi asosiy element --- */

.task {
  display: flex;
  align-items: stretch;
  gap: 14px;
  min-height: var(--tap);
  margin-bottom: 8px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.task__days {
  flex: 0 0 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  padding-right: 12px;
}

.task__days b {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.task__days span {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.task--overdue { border-color: var(--hivis); }
.task--overdue .task__days b { color: var(--hivis); }
.task--overdue .task__days span { color: var(--hivis); opacity: 0.8; }

/* Ogohlantirish chizig'i — qurilish lentasi */
.task--overdue::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: repeating-linear-gradient(
    45deg, var(--hivis) 0 6px, #0e1116 6px 12px);
}
.task { position: relative; overflow: hidden; }

.task--risk .task__days b { color: var(--amber); }

.task__body { flex: 1; min-width: 0; }
.task__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.task__meta {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Holat belgisi --- */

.chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  border: 1px solid;
}
.chip--gray  { color: var(--muted); border-color: var(--line); }
.chip--blue  { color: var(--blue); border-color: rgba(76,141,255,.35); }
.chip--amber { color: var(--amber); border-color: rgba(245,158,11,.35); }
.chip--green { color: var(--green); border-color: rgba(47,191,113,.35); }
.chip--red   { color: var(--red); border-color: rgba(239,68,68,.35); }

/* --- Ob'ekt kartasi --- */

.project {
  display: block;
  margin-bottom: 10px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: inherit;
}
.project__head { display: flex; align-items: baseline; gap: 10px; }
.project__name { flex: 1; margin: 0; font-size: 16px; font-weight: 600; }
.project__pct { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bar { height: 6px; margin-top: 12px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.bar--warn > i { background: var(--amber); }
.bar--late > i { background: var(--hivis); }

.project__foot {
  display: flex; gap: 14px;
  margin-top: 10px;
  font-size: 12.5px; color: var(--muted);
}
.project__foot .late { color: var(--hivis); font-weight: 600; }

/* --- Tugmalar --- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 20px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
.btn:active { transform: scale(0.985); }
.btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--done    { background: var(--green); border-color: var(--green); color: #06240f; }
.btn--danger  { background: transparent; border-color: rgba(239,68,68,.4); color: var(--red); }
.btn + .btn { margin-top: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* --- Shakl --- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px;               /* 16px — iOS zoom qilmasligi uchun */
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: transparent;
}
.field .help { margin-top: 5px; font-size: 12.5px; color: var(--dim); }
.field .error { margin-top: 5px; font-size: 13px; color: var(--red); }

/* --- Kamera tugmasi --- */

.camera {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 88px;
  border: 2px dashed var(--line);
  border-radius: var(--r);
  color: var(--muted);
  font-weight: 600;
}
.camera input { display: none; }
.camera--filled { border-style: solid; border-color: var(--green); color: var(--green); }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* --- Pastki menyu --- */

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(23, 27, 34, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 60px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--dim);
}
.nav a.on { color: var(--ink); }
.nav a .ico { font-size: 20px; line-height: 1; }

/* --- Banner (o'rnatish / bildirishnoma) --- */

.banner { display: none; margin-bottom: 14px; padding: 14px 16px;
          border-radius: var(--r); border: 1px solid; font-size: 14px; }
.banner b { display: block; margin-bottom: 4px; font-size: 14.5px; }
.banner ol { margin: 8px 0 0; padding-left: 18px; }
.banner li { margin: 3px 0; }

[data-push-banner][data-state="install"] .b-install,
[data-push-banner][data-state="ask"] .b-ask,
[data-push-banner][data-state="denied"] .b-denied { display: block; }

.b-install { background: rgba(242,194,0,.08); border-color: rgba(242,194,0,.35); color: var(--hivis); }
.b-ask     { background: rgba(76,141,255,.08); border-color: rgba(76,141,255,.35); color: var(--blue); }
.b-denied  { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.3); color: var(--red); }

.banner .btn { margin-top: 10px; min-height: 44px; font-size: 14px; }

/* --- Xabarlar --- */

.msg { margin-bottom: 12px; padding: 12px 14px; border-radius: var(--r);
       font-size: 14px; border: 1px solid; }
.msg--success { background: rgba(47,191,113,.08); border-color: rgba(47,191,113,.3); color: var(--green); }
.msg--error   { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.3); color: var(--red); }
.msg--info    { background: var(--panel); border-color: var(--line); color: var(--muted); }

/* --- Bo'sh holat --- */

.empty { padding: 48px 20px; text-align: center; color: var(--dim); }
.empty .ico { font-size: 40px; opacity: .5; }
.empty p { margin: 12px 0 0; font-size: 14.5px; }

/* --- Filtr --- */

.filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(var(--pad) * -1);
           padding: 0 var(--pad) 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters a { flex: 0 0 auto; padding: 9px 15px; font-size: 13.5px; font-weight: 600;
             color: var(--muted); background: var(--panel); border: 1px solid var(--line);
             border-radius: 999px; white-space: nowrap; }
.filters a.on { color: var(--bg); background: var(--ink); border-color: var(--ink); }

/* --- Tafsilot --- */

.card { padding: 16px; margin-bottom: 12px; background: var(--panel);
        border: 1px solid var(--line); border-radius: var(--r); }
.card h2 { margin: 0 0 12px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.rows { display: grid; gap: 10px; }
.row { display: flex; gap: 12px; font-size: 14px; }
.row dt { flex: 0 0 108px; color: var(--dim); }
.row dd { flex: 1; margin: 0; }

.comment { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.comment b { font-size: 13px; }
.comment time { font-size: 12px; color: var(--dim); }
.comment--return { color: var(--red); }

.blocked { padding: 12px 14px; background: rgba(242,194,0,.07);
           border: 1px solid rgba(242,194,0,.3); border-radius: var(--r);
           color: var(--hivis); font-size: 14px; margin-bottom: 12px; }

.offline-bar { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom));
               padding: 8px; text-align: center; font-size: 13px; font-weight: 600;
               background: var(--hivis); color: #16130a; display: none; z-index: 60; }
body.is-offline .offline-bar { display: block; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
