/* ================================================================
   Techno Task – phone layout (≤ 820px wide). Loaded last.
   Top app bar + bottom tab bar + floating "+" button, everything fits the screen.
   ================================================================ */
@media (max-width: 820px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  body { font-size: 15px; -webkit-text-size-adjust: 100%; }
  input, select, textarea { font-size: 16px; } /* stops iPhone zooming into fields */

  /* ---------- frame ---------- */
  .shell { display: block; min-height: 100vh; }
  .shell > *, .main-wrap, main, .card, .task-list, .row, .main-col, .filter-bar, .stats, .hero { min-width: 0; }
  .main-wrap { padding-top: calc(56px + env(safe-area-inset-top)); padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  main { padding: 14px 12px 24px; max-width: 100vw; }

  /* ---------- top app bar ---------- */
  .side {
    position: fixed; top: 0; left: 0; right: 0; z-index: 40;
    height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0 14px;
    display: flex; flex-direction: row; align-items: center; flex-wrap: nowrap; gap: 8px;
    /* no blur/transform here: it would trap the fixed tab bar and + button inside the top bar */
    background: rgba(255, 255, 255, .97); -webkit-backdrop-filter: none !important; backdrop-filter: none !important; transform: none !important; filter: none !important;
    border: 0; border-bottom: 1px solid rgba(29, 36, 51, .08); box-shadow: 0 4px 18px rgba(30, 40, 70, .06);
    width: auto; height: auto; min-height: calc(56px + env(safe-area-inset-top));
  }
  .side .brand { flex: 1; min-width: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
  .side .brand .brand-logo, .side .brand .bl-text { display: inline-flex !important; }
  .bell-count[hidden] { display: none !important; }
  .bl-text { font-size: 18px !important; letter-spacing: .05em; }
  .brand .bell { margin-left: auto; padding: 8px; }
  .brand .bell svg { width: 22px; height: 22px; }
  .side .me { order: 3; margin: 0; padding: 0; border: 0; gap: 0; flex: none; }
  .side .me .who-text { display: none; }
  .side .me .avatar { width: 34px; height: 34px; }

  /* ---------- bottom tab bar ---------- */
  .side nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; order: 9;
    display: flex; flex-direction: row; gap: 0; width: 100%;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
    border-top: 1px solid rgba(29, 36, 51, .08); box-shadow: 0 -4px 18px rgba(30, 40, 70, .06);
    overflow-x: auto; scrollbar-width: none; justify-content: space-between;
  }
  .side nav::-webkit-scrollbar { display: none; }
  .side nav a {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 6px 6px; border-radius: 14px; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; position: relative;
    transform: none !important; box-shadow: none !important;
  }
  .side nav a svg { display: block !important; width: 22px; height: 22px; opacity: .9; }
  .side nav a.active { background: var(--accent-soft) !important; color: var(--accent) !important; }
  .side nav a:hover { background: rgba(63, 123, 224, .06); }
  .side nav .count { position: absolute; top: 2px; right: 8px; margin: 0; font-size: 10px; padding: 0 5px; line-height: 15px; }

  /* ---------- floating "+ New task" button ---------- */
  .side .new-task {
    position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 45;
    width: 58px; height: 58px; padding: 0; margin: 0; border-radius: 50%;
    font-size: 0; display: grid; place-items: center;
    box-shadow: 0 10px 26px rgba(63, 123, 224, .45);
  }
  .side .new-task::before { content: "+"; font-size: 32px; line-height: 1; font-weight: 400; margin-top: -3px; }

  /* ---------- clock bar ---------- */
  .clockbar { padding: 8px 12px; gap: 6px; }
  .cb { padding: 4px 10px; font-size: 12px; }
  .cb .d { display: none; }
  .run-pill .rp-text { max-width: 110px; }

  /* ---------- page headers ---------- */
  .page-head { margin-bottom: 14px; gap: 10px; }
  .page-head h1 { font-size: 22px; }
  .page-head > div:first-child { min-width: 0; flex: 1 1 100%; }
  .page-head .form-actions, .page-head > .btn { width: 100%; flex-wrap: wrap; gap: 8px; }
  .page-head .form-actions .btn { flex: 1 1 auto; }
  .page-head .form-actions .btn.primary[data-action="new-task"], .page-head > .btn.primary[data-action="new-task"] { display: none; } /* the round + button does this */

  /* ---------- dashboard ---------- */
  .hero { grid-template-columns: 1fr; padding: 18px 16px; border-radius: 22px; margin-bottom: 14px; }
  .hero h1 { font-size: 22px; }
  .hero .qotd { font-size: 16px; }
  .hero .hero-art { display: none; }
  .hero .hero-actions { gap: 8px; }
  .hero .hero-actions > * { flex: 1 1 auto; justify-content: center; }
  .hero .hero-actions .btn.primary { display: none; }
  .stats.boxes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stats.boxes .stat { padding: 10px 10px; border-radius: 16px; }
  .stats.boxes .num { font-size: 22px; }
  .stats.boxes .lbl { font-size: 11.5px; line-height: 1.2; }
  .grid-2 { grid-template-columns: 1fr; gap: 14px; }
  .card { border-radius: 18px; }
  .card-head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-head h2 { font-size: 15px; }
  .card-head input[type=search] { flex: 1 1 100%; max-width: none !important; order: 5; }
  .card-head .dl-group .btn { padding: 4px 8px; }
  .mini { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .mini .t { flex: 1 1 60%; }
  .dash-list { max-height: none; }

  /* ---------- task lists ---------- */
  .quick-add { gap: 8px; }
  .quick-add input[name=title] { flex: 1 1 100%; }
  .quick-add select, .quick-add input[type=date] { flex: 1 1 40%; min-width: 0; }
  .quick-add .btn { flex: 1 1 100%; }
  .quick-add .combo { flex: 1 1 100%; }
  .filters .combo, .filter-bar .combo { flex: 1 1 100%; }
  .combo-input { min-width: 0; }
  .combo-list { font-size: 15px; }
  .combo-opt { padding: 11px 10px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
  .filters { gap: 8px; }
  .filters input[type=search] { flex: 1 1 100%; }
  .filters select { flex: 1 1 45%; min-width: 0; }
  .filters .btn { flex: 1 1 100%; }
  .row {
    grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "c t t" ". w w" ". p s";
    padding: 12px 12px 12px 10px; row-gap: 8px; column-gap: 8px;
  }
  .row .title { font-size: 15px; line-height: 1.3; }
  .row .meta { gap: 4px 10px; }
  .row .who { font-size: 13px; }
  .row > .pd { gap: 8px; }
  .row select.status { max-width: 140px; }
  .check { width: 24px; height: 24px; }
  .task-no { font-size: 10.5px; }
  .list-foot { padding: 10px 14px; }

  /* ---------- task board ---------- */
  .board-layout, .board-layout.with-side { grid-template-columns: 1fr !important; gap: 14px; }
  .board-head { padding: 12px 14px; }
  .board-head #board-date { flex: 1 1 100%; }
  .note-add { padding: 0 12px 12px; gap: 8px; }
  .note-add textarea { flex: 1 1 100%; }
  .note-add .note-colors { padding-top: 6px; flex: 1; }
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 4px 12px 14px; }
  .note-card { min-height: 120px; padding: 12px 10px 8px; transform: none !important; }
  .note-text { font-size: 14px; }
  .note-timer { flex-wrap: wrap; gap: 6px; padding: 6px; }
  .note-timer .sw { width: 26px; height: 26px; }
  .nt-time { font-size: 15px; min-width: 0; }
  .nt-btn { margin-left: 0; flex: 1 1 100%; padding: 7px 10px; }
  .note-btn { padding: 5px 9px; }

  /* ---------- people & tables ---------- */
  .filter-bar { padding: 10px 12px; gap: 8px; }
  .filter-bar input[type=search] { flex: 1 1 100%; }
  .filter-bar select { flex: 1 1 45%; min-width: 0; }
  .filter-bar .btn { flex: 1 1 auto; }
  .filter-count { margin-left: 0; flex: 1 1 100%; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.people th, table.people td { padding: 9px 10px; font-size: 13.5px; }
  table.people td:first-child { min-width: 170px; }
  .scroll-table { max-height: none; }

  /* ---------- task window & other pop-ups: full screen ---------- */
  .overlay { padding: 0; align-items: stretch; }
  .modal, .modal.narrow { max-width: 100%; width: 100%; min-height: 100dvh; border-radius: 0; box-shadow: none; }
  .modal-head { position: sticky; top: 0; z-index: 2; border-radius: 0; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: rgba(255,255,255,.97); }
  .modal-head .x { font-size: 30px; padding: 4px 10px; }
  .modal-head .dl-group { display: none; }
  .modal-body { padding: 14px 14px calc(28px + env(safe-area-inset-bottom)); }
  .title-input { font-size: 19px; }
  .fgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .audit { font-size: 12px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
  .comment-form { flex-direction: column; align-items: stretch; }
  .reassign-form { grid-template-columns: 1fr; }
  .lg-list { max-height: 55vh; }

  /* ---------- settings ---------- */
  .settings { max-width: 100%; }
  .avatar-editor { gap: 12px; }

  /* ---------- toasts / pop-ups above the tab bar ---------- */
  #toasts { left: 12px; right: 12px; bottom: calc(90px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast, .notif-pop { max-width: none; }
  .idle-warn { top: calc(64px + env(safe-area-inset-top)); }
}

@media (max-width: 380px) {
  .stats.boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fgrid { grid-template-columns: 1fr; }
  .side nav a { font-size: 10px; padding: 6px 2px; }
  .side nav a svg { width: 20px; height: 20px; }
}

/* short tab labels on phones */
.side nav .lbl-short { display: none; }
@media (max-width: 820px) {
  .side nav .lbl-long { display: none; }
  .side nav .lbl-short { display: inline; }
}
/* Settings is reached from your photo in the top bar on phones, keeping the tab bar uncluttered. */
@media (max-width: 820px) { .side nav a[data-nav="settings"] { display: none; } }
