/* ============================================================
   BARPO TASKS — Vazifalar Boshqaruvi Tizimi
   Premium monochrome design system: WHITE / BLACK / RED only.
   No other colors — status differentiation uses typography,
   borders and icons instead of a rainbow of hues.
   ============================================================ */
:root{
  --bg:#ffffff; --surface:#ffffff; --surface-2:#fafafa;
  --fg:#000000; --fg-70:rgba(0,0,0,.70); --fg-50:rgba(0,0,0,.50); --fg-35:rgba(0,0,0,.35);
  --border:rgba(0,0,0,.12); --border-strong:rgba(0,0,0,.28);
  --accent:#e11d1d; --accent-bg:rgba(225,29,29,.08);
  --ink:#000000; --ink-contrast:#ffffff;
  --radius:12px; --radius-sm:9px;
  --shadow-sm:0 1px 2px rgba(0,0,0,.05);
  --shadow:0 2px 10px rgba(0,0,0,.06);
  --shadow-lg:0 16px 40px rgba(0,0,0,.16);
  --sidebar-w:248px;
  --font:-apple-system,BlinkMacSystemFont,'SF Pro Text','Segoe UI',system-ui,'Helvetica Neue',Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:var(--font);background:var(--bg);color:var(--fg);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased}
a{color:var(--fg);text-decoration:underline}
.boot{display:flex;align-items:center;justify-content:center;height:100vh;color:var(--fg-50)}
button{font-family:inherit;cursor:pointer}
input,select,textarea{font-family:inherit;font-size:14px}
h1,h2,h3,h4{margin:0;font-weight:700;color:var(--fg)}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;gap:7px;padding:10px 16px;border:1px solid var(--border-strong);
  background:var(--surface);color:var(--fg);border-radius:var(--radius-sm);font-size:13.5px;font-weight:600;
  transition:.12s;white-space:nowrap;line-height:1.2}
.btn:hover{background:var(--surface-2);border-color:var(--fg)}
.btn:disabled{opacity:.4;cursor:not-allowed}
.btn-primary{background:var(--fg);border-color:var(--fg);color:#fff}
.btn-primary:hover{background:#222;border-color:#222}
.btn-accent{background:var(--accent);border-color:var(--accent);color:#fff}
.btn-accent:hover{filter:brightness(.92)}
.btn-success{background:var(--fg);border-color:var(--fg);color:#fff}
.btn-success:hover{background:#222}
.btn-danger{background:var(--surface);border-color:var(--accent);color:var(--accent)}
.btn-danger:hover{background:var(--accent-bg)}
.btn-ghost{border-color:transparent;background:transparent}
.btn-ghost:hover{background:var(--surface-2)}
.btn-sm{padding:6px 11px;font-size:12.5px}
.btn-icon{padding:7px 9px}
.btn-block{width:100%;justify-content:center}

/* ---------- Login ---------- */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--surface);padding:20px}
.login-card{background:var(--surface);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow-lg);width:100%;max-width:412px;overflow:hidden}
.login-head{background:var(--fg);color:#fff;padding:34px 32px 28px;text-align:center}
.login-logo{display:inline-flex;align-items:center;gap:12px;font-size:22px;font-weight:800;letter-spacing:.5px}
.login-logo .mark{width:38px;height:38px;display:flex;align-items:center;justify-content:center;color:#fff}
.mark svg{width:100%;height:100%;display:block}
.login-head p{margin:10px 0 0;opacity:.75;font-size:13px}
.login-body{padding:28px 32px 30px}
.login-body h2{font-size:18px;margin-bottom:4px}
.login-body .sub{color:var(--fg-50);font-size:13px;margin-bottom:20px}
.login-lang{display:flex;gap:6px;justify-content:center;margin-top:16px;flex-wrap:wrap}

/* ---------- App shell ---------- */
.shell{display:flex;min-height:100vh}
.sidebar{width:var(--sidebar-w);background:var(--fg);color:rgba(255,255,255,.72);display:flex;flex-direction:column;position:fixed;top:0;bottom:0;left:0;z-index:40;transition:transform .2s}
.sidebar-brand{display:flex;align-items:center;gap:12px;padding:18px 20px;border-bottom:1px solid rgba(255,255,255,.12)}
.sidebar-brand .mark{width:34px;height:34px;display:flex;align-items:center;justify-content:center;color:#fff;flex:none}
.sidebar-brand .txt b{color:#fff;font-size:15px;font-weight:800;letter-spacing:.4px;display:block;line-height:1.1}
.sidebar-brand .txt span{font-size:10.5px;color:rgba(255,255,255,.5);letter-spacing:.3px}
.nav{padding:12px 10px;flex:1;overflow-y:auto}
.nav-item{display:flex;align-items:center;gap:11px;padding:10px 12px;border-radius:8px;color:rgba(255,255,255,.72);font-weight:500;font-size:13.5px;margin-bottom:2px;cursor:pointer;transition:.12s}
.nav-item:hover{background:rgba(255,255,255,.08);color:#fff}
.nav-item.active{background:var(--accent);color:#fff}
.nav-item .ico{width:18px;height:18px;flex:none;opacity:.9}
.nav-item .badge-count{margin-left:auto;background:rgba(255,255,255,.16);color:#fff;font-size:11px;padding:1px 7px;border-radius:10px}
.nav-item.active .badge-count{background:rgba(255,255,255,.3)}
.nav-sep{height:1px;background:rgba(255,255,255,.1);margin:10px 8px}
.sidebar-foot{padding:12px 14px;border-top:1px solid rgba(255,255,255,.12);font-size:11px;color:rgba(255,255,255,.4)}

.main{flex:1;margin-left:var(--sidebar-w);display:flex;flex-direction:column;min-width:0}
.topbar{height:60px;background:var(--surface);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:14px;padding:0 22px;position:sticky;top:0;z-index:30}
.topbar .page-title{font-size:17px;font-weight:700;color:var(--fg)}
.topbar .spacer{flex:1}
.hamburger{display:none;background:none;border:none;padding:6px;color:var(--fg)}
.lang-switch{display:flex;border:1px solid var(--border-strong);border-radius:8px;overflow:hidden}
.lang-switch button{border:none;background:var(--surface);padding:6px 11px;font-size:12.5px;font-weight:600;color:var(--fg-70)}
.lang-switch button.active{background:var(--fg);color:#fff}
.lang-switch button:not(:last-child){border-right:1px solid var(--border)}

.icon-btn{position:relative;background:none;border:1px solid var(--border);border-radius:9px;width:38px;height:38px;display:flex;align-items:center;justify-content:center;color:var(--fg-70)}
.icon-btn:hover{background:var(--surface-2)}
.notif-dot{position:absolute;top:-5px;right:-5px;background:var(--accent);color:#fff;font-size:10px;min-width:17px;height:17px;border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0 4px;font-weight:700;border:2px solid #fff}

.usermenu{display:flex;align-items:center;gap:10px;cursor:pointer;padding:5px 8px;border-radius:9px}
.usermenu:hover{background:var(--surface-2)}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--fg);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;flex:none;overflow:hidden}
.avatar img{width:100%;height:100%;object-fit:cover}
.usermenu .u-name{font-size:13px;font-weight:600;line-height:1.1}
.usermenu .u-role{font-size:11px;color:var(--fg-50)}

.content{padding:22px;max-width:1400px;width:100%;margin:0 auto;padding-bottom:88px}
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:18px;flex-wrap:wrap}
.page-head h1{font-size:21px}
.page-head .desc{color:var(--fg-50);font-size:13px;margin-top:3px}
.head-actions{display:flex;gap:9px;flex-wrap:wrap}

/* ---------- Cards ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-sm)}
.card-head{padding:14px 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:10px}
.card-head h3{font-size:15px}
.card-body{padding:18px}
.card-pad{padding:18px}

/* ---------- Stat tiles ---------- */
.stat-grid{display:grid;gap:14px}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-2{grid-template-columns:repeat(2,1fr)}
.stat{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 18px;position:relative;overflow:hidden}
.stat .lbl{font-size:12px;color:var(--fg-50);font-weight:600;text-transform:uppercase;letter-spacing:.3px}
.stat .val{font-size:28px;font-weight:800;color:var(--fg);margin-top:6px;line-height:1}
.stat .sub{font-size:11.5px;color:var(--fg-50);margin-top:5px}
.stat.accent-red .val{color:var(--accent)}
.section-title{font-size:13px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--fg-70);margin:24px 0 12px}
.section-title:first-child{margin-top:0}

/* ---------- Badges (typography/border driven — no rainbow) ---------- */
.badge{display:inline-flex;align-items:center;gap:5px;padding:3px 11px;border-radius:20px;font-size:12px;font-weight:700;white-space:nowrap;line-height:1.5;border:1px solid var(--fg);color:var(--fg);background:transparent}
.badge .dot{width:6px;height:6px;border-radius:50%;background:currentColor}
.badge.b-filled{background:var(--fg);color:#fff;border-color:var(--fg)}
.badge.b-muted{border-color:var(--border-strong);color:var(--fg-50)}
.badge.b-accent{border-color:var(--accent);color:var(--accent)}
.badge.b-accent-filled{background:var(--accent);color:#fff;border-color:var(--accent)}
.badge.b-outline-dashed{border-style:dashed}
.pri-low{border-color:var(--border-strong);color:var(--fg-50)}
.pri-medium{border-color:var(--fg);color:var(--fg)}
.pri-high{border-color:var(--fg);color:var(--fg);font-weight:800}
.pri-critical{background:var(--accent);color:#fff;border-color:var(--accent)}

/* ---------- Tables ---------- */
.table-wrap{overflow-x:auto;border-radius:var(--radius)}
table.tbl{width:100%;border-collapse:collapse;background:var(--surface);font-size:13.5px}
table.tbl thead th{background:var(--surface-2);text-align:left;padding:11px 14px;font-size:11.5px;text-transform:uppercase;letter-spacing:.4px;color:var(--fg-70);font-weight:700;border-bottom:1px solid var(--border);white-space:nowrap;position:relative}
table.tbl thead th.sortable{cursor:pointer;user-select:none}
table.tbl thead th .arrow{opacity:.5;font-size:10px;margin-left:3px}
table.tbl tbody td{padding:11px 14px;border-bottom:1px solid var(--border);color:var(--fg);vertical-align:middle}
table.tbl tbody tr:last-child td{border-bottom:none}
table.tbl tbody tr.clickable{cursor:pointer;transition:.1s}
table.tbl tbody tr.clickable:hover{background:var(--surface-2)}
.num{text-align:right;font-variant-numeric:tabular-nums}
.mono{font-family:'SF Mono',Menlo,Consolas,monospace;font-size:12.5px;font-weight:600;color:var(--fg)}
.cell-strong{font-weight:700;color:var(--fg)}
.text-accent{color:var(--accent);font-weight:700}

/* ---------- Filters ---------- */
.filters{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end;margin-bottom:16px}
.search-box{position:relative;flex:1;min-width:220px}
.search-box input{width:100%;padding:9px 12px 9px 34px;border:1px solid var(--border-strong);border-radius:var(--radius-sm)}
.search-box svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--fg-50)}
.field{display:flex;flex-direction:column;gap:5px}
.field label{font-size:12px;font-weight:600;color:var(--fg-70)}
.field.inline{min-width:150px}
.input,select.input,textarea.input{width:100%;padding:9px 11px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--surface);color:var(--fg)}
.input:focus,select.input:focus,textarea.input:focus{outline:none;border-color:var(--fg);box-shadow:0 0 0 3px rgba(0,0,0,.06)}
.input.err{border-color:var(--accent)}
textarea.input{resize:vertical;min-height:70px}
.field-err{color:var(--accent);font-size:12px}

/* ---------- Forms ---------- */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 20px}
.form-grid .full{grid-column:1/-1}
.form-section{margin-bottom:8px}
.form-section-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--fg-50);margin:22px 0 12px}
.form-section-title:first-child{margin-top:0}
.req-star{color:var(--accent)}
.help{font-size:11.5px;color:var(--fg-50);margin-top:3px}
.radio-row{display:flex;gap:10px;flex-wrap:wrap}
.radio-pill{display:flex;align-items:center;gap:7px;padding:8px 14px;border:1px solid var(--border-strong);border-radius:20px;cursor:pointer;font-weight:600;font-size:13px}
.radio-pill input{accent-color:var(--fg)}
.radio-pill.checked{border-color:var(--fg);background:var(--fg);color:#fff}
.form-actions{display:flex;gap:10px;justify-content:flex-end;padding-top:18px;border-top:1px solid var(--border);margin-top:20px;flex-wrap:wrap}

/* ---------- Detail page ---------- */
.detail-grid{display:grid;grid-template-columns:2fr 1fr;gap:18px;align-items:start}
.kv{display:grid;grid-template-columns:150px 1fr;gap:9px 14px}
.kv dt{color:var(--fg-50);font-size:12.5px;font-weight:600}
.kv dd{margin:0;font-size:13.5px;color:var(--fg);font-weight:500}
.summary-big{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px}
.summary-tile{text-align:center;padding:14px 8px;background:var(--surface-2);border-radius:var(--radius-sm);border:1px solid var(--border)}
.summary-tile .v{font-size:24px;font-weight:800;color:var(--fg)}
.summary-tile .l{font-size:11.5px;color:var(--fg-50);text-transform:uppercase;letter-spacing:.3px;margin-top:2px}
.timeline{list-style:none;margin:0;padding:0}
.timeline li{display:flex;gap:12px;padding-bottom:16px;position:relative}
.timeline li:before{content:'';position:absolute;left:7px;top:18px;bottom:0;width:2px;background:var(--border)}
.timeline li:last-child:before{display:none}
.timeline .tl-dot{width:16px;height:16px;border-radius:50%;background:var(--fg);flex:none;margin-top:2px;border:3px solid var(--surface-2)}
.timeline .tl-body{font-size:13px}
.timeline .tl-body .who{font-weight:600;color:var(--fg)}
.timeline .tl-body .when{font-size:11.5px;color:var(--fg-50)}
.attach-grid{display:flex;flex-wrap:wrap;gap:10px}
.attach-item{width:88px;height:88px;border-radius:var(--radius-sm);border:1px solid var(--border);overflow:hidden;display:flex;align-items:center;justify-content:center;background:var(--surface-2)}
.attach-item img,.attach-item video{width:100%;height:100%;object-fit:cover}
.comment{padding:10px 0;border-bottom:1px solid var(--border)}
.comment:last-child{border-bottom:none}
.comment .c-head{display:flex;align-items:center;gap:8px;margin-bottom:4px}
.comment .c-name{font-weight:600;font-size:12.5px}
.comment .c-time{font-size:11px;color:var(--fg-50)}

/* ---------- Modal ---------- */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:flex-start;justify-content:center;z-index:100;padding:40px 16px;overflow-y:auto}
.modal{background:var(--surface);border-radius:16px;box-shadow:var(--shadow-lg);width:100%;max-width:560px;animation:pop .14s ease-out}
.modal.lg{max-width:820px}
.modal.sm{max-width:420px}
@keyframes pop{from{transform:translateY(-8px);opacity:.6}to{transform:none;opacity:1}}
.modal-head{padding:18px 22px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.modal-head h3{font-size:16.5px}
.modal-body{padding:22px}
.modal-x{background:none;border:none;font-size:22px;color:var(--fg-50);line-height:1;padding:0 4px}
.modal-x:hover{color:var(--fg)}

/* ---------- Toast ---------- */
#toast-root{position:fixed;bottom:22px;right:22px;z-index:200;display:flex;flex-direction:column;gap:10px}
.toast{background:var(--fg);color:#fff;padding:12px 18px;border-radius:10px;box-shadow:var(--shadow-lg);font-size:13.5px;font-weight:500;display:flex;align-items:center;gap:10px;animation:slidein .18s ease-out;min-width:240px}
.toast.error{background:var(--accent)}
@keyframes slidein{from{transform:translateX(30px);opacity:0}to{transform:none;opacity:1}}

/* ---------- Notifications dropdown ---------- */
.dropdown{position:absolute;top:52px;right:14px;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);width:360px;max-height:460px;overflow:hidden;z-index:60;display:flex;flex-direction:column}
.dropdown .dd-head{padding:13px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.dropdown .dd-head h4{font-size:14px}
.dd-list{overflow-y:auto}
.dd-item{padding:12px 16px;border-bottom:1px solid var(--border);display:flex;gap:11px;cursor:pointer}
.dd-item:hover{background:var(--surface-2)}
.dd-item.unread{background:var(--accent-bg)}
.dd-item .di-ico{width:32px;height:32px;border-radius:var(--radius-sm);background:var(--surface-2);color:var(--fg);display:flex;align-items:center;justify-content:center;flex:none;border:1px solid var(--border)}
.dd-item .di-txt{font-size:12.8px}
.dd-item .di-time{font-size:11px;color:var(--fg-50);margin-top:2px}
.dd-empty{padding:30px;text-align:center;color:var(--fg-50);font-size:13px}

/* ---------- Empty / misc ---------- */
.empty{text-align:center;padding:48px 20px;color:var(--fg-50)}
.empty .em-ico{width:54px;height:54px;margin:0 auto 12px;border-radius:var(--radius);background:var(--surface-2);display:flex;align-items:center;justify-content:center;color:var(--fg-35);border:1px solid var(--border)}
.empty h3{color:var(--fg-70);font-size:15px;margin-bottom:4px}
.spinner{width:26px;height:26px;border:3px solid var(--border);border-top-color:var(--fg);border-radius:50%;animation:spin .7s linear infinite;margin:40px auto}
@keyframes spin{to{transform:rotate(360deg)}}
.skeleton{background:linear-gradient(90deg,var(--surface-2) 25%,rgba(0,0,0,.06) 37%,var(--surface-2) 63%);background-size:400% 100%;animation:sk 1.4s ease infinite;border-radius:var(--radius-sm)}
@keyframes sk{0%{background-position:100% 50%}100%{background-position:0 50%}}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);margin-bottom:18px;overflow-x:auto}
.tab{padding:10px 16px;font-weight:600;font-size:13.5px;color:var(--fg-50);border-bottom:2px solid transparent;cursor:pointer;white-space:nowrap}
.tab.active{color:var(--fg);border-bottom-color:var(--accent)}
.flex{display:flex}.between{justify-content:space-between}.aic{align-items:center}.gap{gap:10px}.wrap{flex-wrap:wrap}
.muted{color:var(--fg-50)}.mt{margin-top:14px}.mb0{margin-bottom:0}.tar{text-align:right}.tac{text-align:center}
.pill-count{background:var(--surface-2);color:var(--fg-70);font-weight:700;font-size:12px;padding:2px 9px;border-radius:20px;border:1px solid var(--border)}
.task-card{padding:15px 16px;border-bottom:1px solid var(--border);cursor:pointer;transition:.1s}
.task-card:hover{background:var(--surface-2)}
.task-card:last-child{border-bottom:none}
.task-card .tc-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.task-card .tc-title{font-weight:700;font-size:14.5px;color:var(--fg)}
.task-card .tc-meta{font-size:12.5px;color:var(--fg-50);margin-top:3px}
.task-card .tc-deadline{font-size:12px;margin-top:8px;font-weight:600}
.task-card .tc-deadline.overdue{color:var(--accent)}

/* ---------- Bottom nav (mobile Telegram Mini App) ---------- */
.bottom-nav{display:none}
@media(max-width:760px){
  .bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;background:var(--surface);border-top:1px solid var(--border);z-index:50;
    padding-bottom:env(safe-area-inset-bottom)}
  .bottom-nav .bn-item{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:9px 4px 8px;color:var(--fg-50);font-size:10.5px;font-weight:600}
  .bottom-nav .bn-item.active{color:var(--accent)}
  .bottom-nav .bn-item .ico{width:21px;height:21px}
}

/* ---------- Responsive ---------- */
.sidebar-overlay{display:none}
@media(max-width:1000px){
  .grid-4{grid-template-columns:repeat(2,1fr)}
  .detail-grid{grid-template-columns:1fr}
  .summary-big{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:760px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:none}
  .main{margin-left:0}
  .hamburger{display:block}
  .sidebar-overlay.show{display:block;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:35}
  .form-grid{grid-template-columns:1fr}
  .grid-3,.grid-2{grid-template-columns:1fr}
  .content{padding:14px;padding-bottom:76px}
  .usermenu .u-meta{display:none}
  .topbar{padding:0 14px}
  .dropdown{width:calc(100vw - 24px);right:12px}
  .kv{grid-template-columns:1fr}
  .kv dt{margin-top:4px}
}

/* Background is always white regardless of device/Telegram theme —
   no dark-mode override (intentional: the app must always render on
   a white background per product decision). */
