/* ===================================================================
   Z. Action - DESKTOP / TABLET stylesheet (>= 768px)
   Tablet and PC layout. Width breakpoints kept for 1024/1440.
   Loaded from index.html via <link media="(min-width: 768px)">, so the browser
   only applies it at that width. This file and its counterpart share
   no rules -- editing one cannot affect the other.
=================================================================== */

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --brand:       #4B52F6;
      --brand-dark:  #3B42E6;
      --brand-light: rgba(255,255,255,0.14);
      --amber:       #F59E0B;
      --danger:      #EF4444;
      --green:       #22C55E;
      --text-main:   #1E293B;
      --text-sub:    #64748B;
      --border:      #E5E7EB;
      --bg-page:     #474f52;
      --card-shadow: none;
    }
    html, body {
      height: 100%;
      margin: 0;
      padding: 0;
      font-family: 'Inter', system-ui, sans-serif;
      background: var(--bg-page);
      -webkit-font-smoothing: antialiased;
      max-width: 100%;
      overflow-x: hidden;
      overflow-y: hidden;
    }
    /* Bottom safe-area shim. In iOS standalone the layout viewport can be
       inset by the home-indicator area, so #app-screen's fixed bottom edge
       stops short of the physical screen and the purple canvas shows through
       under the nav. This paints that strip white so it reads as a
       continuation of the bottom nav. z-index keeps it behind #app-screen,
       so when there is no inset it is simply covered and invisible. */
    body::before {
      content: "";
      position: fixed;
      left: 0; right: 0; bottom: 0;
      height: 160px;
      background: #000;           /* login screen is black */
      z-index: -1;
      pointer-events: none;
    }
    body.app-active::before { background: #fff; }   /* bottom nav is white */

    input:focus, textarea:focus, select:focus, button:focus { outline: none; }

    /* ================================================================
       LOGIN
    ================================================================ */
    #login-screen {
      min-height: 100vh; display: flex; align-items: flex-start; padding-top: 40px;
      justify-content: center;
      background: black;
      padding-left: 24px; padding-right: 24px; padding-bottom: 24px;
    }
    #login-card {
      background: black; border-radius: 24px; padding: 28px 24px;
      box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    }
    .login-input {
      width: 100%; padding: 12px 14px 12px 40px;
      border: 1.5px solid #E2E8F0; border-radius: 12px;
      font-size: 16px; color: var(--text-main); font-family: inherit; /* 16px: prevents iOS Safari auto-zoom on focus */
      transition: border-color .15s, box-shadow .15s; background: #FAFBFF;
    }
    .login-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,107,248,.12); }
    .login-input::placeholder { color: #94A3B8; font-size: 13px; }
    .login-btn {
      width: 100%; padding: 14px; border: none; border-radius: 14px;
      background: linear-gradient(135deg,#5B6BF8,#818CF8); color: white;
      font-weight: 700; font-size: 15px; font-family: inherit; cursor: pointer;
      transition: opacity .15s, transform .1s;
      box-shadow: 0 4px 16px rgba(91,107,248,.4);
    }
    .login-btn:hover { opacity: .92; }
    .login-btn:active { transform: scale(.98); }
    #login-error {
      display: none; background: #FEF2F2; border: 1px solid #FECACA;
      border-radius: 10px; padding: 10px 14px; color: #DC2626;
      font-size: 13px; margin-bottom: 16px; align-items: center; gap: 8px;
    }
    #login-error.visible { display: flex; }
    .emergency-reset-btn {
      display: block; width: 100%; margin-top: 14px;
      background: none; border: 1.5px solid #FCA5A5; border-radius: 10px;
      color: #EF4444; font-size: 12.5px; font-weight: 700; font-family: inherit;
      padding: 9px; cursor: pointer; transition: background .15s;
    }
    .emergency-reset-btn:active { background: #FEF2F2; }

    /* ── Google Cloud link prompt (shown instead of app when account is cloud-linked) ── */
    #cloud-link-screen {
      display: none; min-height: 100vh;
      align-items: center; justify-content: center;
      background: linear-gradient(145deg,#4f46e5 0%,#6d28d9 60%,#7c3aed 100%);
      padding: 24px; flex-direction: column;
    }
    #cloud-link-screen.visible { display: flex; }
    #cloud-link-card {
      background: white; border-radius: 24px; padding: 32px 28px;
      box-shadow: 0 25px 60px rgba(0,0,0,.28);
      max-width: 360px; width: 100%; text-align: center;
    }
    .cl-cloud-icon {
      width: 64px; height: 64px; border-radius: 18px;
      background: linear-gradient(135deg,#EEF0FF,#E0E7FF);
      display: flex; align-items: center; justify-content: center;
      margin: 0 auto 20px;
    }
    .cl-title { font-size: 19px; font-weight: 800; color: #1e293b; margin-bottom: 10px; }
    .cl-body  { font-size: 13.5px; color: #64748b; line-height: 1.6; margin-bottom: 26px; }
    .cl-google-btn {
      width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
      padding: 14px 18px; border: 1.5px solid #E2E8F0; border-radius: 14px;
      background: white; cursor: pointer; font-family: inherit;
      font-size: 15px; font-weight: 700; color: #1e293b;
      box-shadow: 0 2px 8px rgba(0,0,0,.08); transition: box-shadow .15s, transform .1s;
      margin-bottom: 12px;
    }
    .cl-google-btn:hover  { box-shadow: 0 4px 16px rgba(0,0,0,.13); }
    .cl-google-btn:active { transform: scale(.98); }
    .cl-google-btn.loading { opacity: .7; pointer-events: none; }
    .cl-skip-btn {
      background: none; border: none; cursor: pointer; font-family: inherit;
      font-size: 13px; color: #94a3b8; text-decoration: underline;
      padding: 4px; transition: color .15s;
    }
    .cl-skip-btn:hover { color: #64748b; }

    /* ── Firebase setup guide modal ────────────────────────────────── */
    #fb-setup-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(15,15,35,.72); backdrop-filter: blur(4px);
      z-index: 9999; align-items: center; justify-content: center; padding: 20px;
    }
    #fb-setup-overlay.open { display: flex; }
    #fb-setup-card {
      background: white; border-radius: 22px; padding: 28px 24px;
      max-width: 400px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.3);
    }
    .fb-setup-title {
      font-size: 17px; font-weight: 800; color: #1e293b;
      margin-bottom: 6px; display: flex; align-items: center; gap: 9px;
    }
    .fb-setup-sub { font-size: 13px; color: #64748b; line-height: 1.55; margin-bottom: 18px; }
    .fb-setup-steps { list-style: none; margin-bottom: 20px; }
    .fb-setup-steps li {
      display: flex; gap: 10px; align-items: flex-start;
      font-size: 13px; color: #334155; line-height: 1.5; margin-bottom: 10px;
    }
    .fb-step-num {
      width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
      background: var(--brand); color: white;
      font-size: 11px; font-weight: 800;
      display: flex; align-items: center; justify-content: center;
      margin-top: 1px;
    }
    .fb-cred-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
    .fb-cred-row   { display: flex; flex-direction: column; gap: 4px; }
    .fb-cred-lbl {
      font-size: 10.5px; font-weight: 700; color: #64748b;
      text-transform: uppercase; letter-spacing: .6px;
    }
    .fb-cred-inp {
      width: 100%; padding: 10px 12px;
      border: 1.5px solid #E2E8F0; border-radius: 10px;
      font-size: 13px; color: #1e293b; font-family: inherit;
      background: #F8FAFF;
      pointer-events: auto !important; user-select: text !important;
      -webkit-user-select: text !important;
      transition: border-color .15s, box-shadow .15s;
    }
    .fb-cred-inp:focus {
      outline: none; border-color: var(--brand);
      box-shadow: 0 0 0 3px rgba(75,82,246,.1);
    }
    .fb-cred-inp::placeholder { color: #94a3b8; font-size: 12px; }
    .fb-setup-save {
      width: 100%; padding: 14px; border: none; border-radius: 13px;
      background: linear-gradient(135deg,#4B52F6,#818CF8); color: white;
      font-weight: 800; font-size: 14px; font-family: inherit; cursor: pointer;
      box-shadow: 0 4px 16px rgba(75,82,246,.35); transition: opacity .15s, transform .1s;
    }
    .fb-setup-save:active { opacity: .85; transform: scale(.98); }

    /* ================================================================
       APP SCREEN
    ================================================================ */
    #app-screen {
      /* Anchored to all four edges of the visual viewport. Deliberately NOT
         vh/dvh: in iOS standalone (home-screen) mode those units do not
         resolve to the full screen, which left a gap under the bottom nav. */
      display: none; flex-direction: column;
      position: fixed;
      top: 0; right: 0; bottom: 0; left: 0;
      margin: 0;
      padding: 0;
      background: var(--bg-page);
      box-shadow: none;
      overflow: hidden;
    }

    /* ================================================================
       HEADER
    ================================================================ */
    .app-header {
      background: var(--brand); padding: 12px 16px;
      display: flex; align-items: center; justify-content: space-between;
      flex-shrink: 0; z-index: 50;
    }
    .header-logo-wrap { display: flex; align-items: center; gap: 10px; }
    .header-team-label { color: rgba(255,255,255,.65); font-size: 10px; line-height: 1.2; }
    .header-team-name  { color: white; font-weight: 800; font-size: 13px; letter-spacing: .5px; }
    .header-actions { display: flex; gap: 6px; }
    .header-btn {
      width: 34px; height: 34px; border-radius: 50%;
      background: rgba(255,255,255,.18); border: none; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      color: white; transition: background .15s;
    }
    .header-btn:hover { background: rgba(255,255,255,.3); }

    /* ================================================================
       CONTROLS BAR
    ================================================================ */
    .controls-bar {
      background: white; border-bottom: 1px solid #F1F5F9;
      flex-shrink: 0; z-index: 40;
    }
    .filter-chips-row {
      display: flex; gap: 7px; padding: 10px 14px 0;
      overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none;
    }
    .filter-chips-row::-webkit-scrollbar { display: none; }
    .filter-chip {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 5px 13px; border-radius: 999px;
      border: 1.5px solid transparent;
      font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
      white-space: nowrap; background: #F1F5F9; color: var(--text-sub);
      transition: all .15s; flex-shrink: 0;
    }
    .filter-chip:hover { background: #E8EEFF; color: var(--brand); }
    .filter-chip.active { background: var(--brand); color: white; border-color: var(--brand); box-shadow: 0 2px 8px rgba(91,107,248,.35); }
    .filter-chip.chip-priority.active { background: var(--amber); border-color: var(--amber); box-shadow: 0 2px 8px rgba(245,158,11,.35); }
    .filter-chip.chip-done.active     { background: var(--green);  border-color: var(--green);  box-shadow: 0 2px 8px rgba(34,197,94,.35);  }
    .search-row { padding: 8px 14px 10px; position: relative; }
    .search-row svg {
      position: absolute; left: 25px; top: 50%; transform: translateY(-50%);
      width: 15px; height: 15px; color: #94A3B8; pointer-events: none;
    }
    #search-input {
      width: 100%; padding: 9px 12px 9px 36px;
      background: #F8FAFF; border: 1.5px solid #E2E8F0; border-radius: 12px;
      font-size: 13px; font-family: inherit; color: var(--text-main);
      transition: border-color .15s, box-shadow .15s;
    }
    #search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,107,248,.1); }
    #search-input::placeholder { color: #94A3B8; }

    /* ================================================================
       TASK SCROLL
    ================================================================ */
    #task-scroll {
      flex: 1; overflow-y: auto; padding: 10px 14px 16px;
    }
    #task-scroll::-webkit-scrollbar { width: 3px; }
    #task-scroll::-webkit-scrollbar-thumb { background: #C7D2FE; border-radius: 2px; }

    /* ================================================================
       DATE GROUP HEADERS
    ================================================================ */
    .date-group { margin-bottom: 4px; }
    .date-group-hdr { display: flex; align-items: center; gap: 8px; padding: 10px 2px 7px; }
    .date-group-hdr .day-chip {
      font-size: 10.5px; font-weight: 800; color: #7C86CF;
      text-transform: uppercase; letter-spacing: .7px; white-space: nowrap; flex-shrink: 0;
    }
    .date-group-hdr .day-chip.today  { color: var(--brand); }
    .date-group-hdr .day-chip.future { color: var(--amber); }
    .date-group-hdr::after { content:""; flex:1; height:1px; background:linear-gradient(to right,#D1D5F0,transparent); }

    /* ================================================================
       TASK CARDS
    ================================================================ */
    .task-wrapper { position: relative; overflow: hidden; border-radius: 14px; margin-bottom: 8px; }
    .task-card {
      position: relative; z-index: 2; background: white;
      padding: 12px 12px 11px; border-radius: 14px;
      box-shadow: var(--card-shadow); cursor: pointer;
      transition: transform .22s cubic-bezier(.25,.46,.45,.94);
      will-change: transform; user-select: none; -webkit-user-select: none;
    }
    .task-card.priority-card { border-left: 3.5px solid var(--amber); }
    .task-card.done-card { opacity: .58; }
    .task-card.done-card .tc-title { text-decoration: line-through; color: #94A3B8; }

    .task-delete-bg {
      position: absolute; right: 0; top: 0; bottom: 0; width: 76px;
      background: var(--danger); z-index: 1;
      display: flex; align-items: center; justify-content: center;
      pointer-events: auto;
    }
    .task-delete-btn {
      background: none; border: none; cursor: pointer;
      color: white; padding: 12px; display: flex; align-items: center; justify-content: center;
      pointer-events: auto; -webkit-tap-highlight-color: transparent;
    }
    .task-delete-btn:active { transform: scale(.9); }

    .tc-row { display: flex; align-items: flex-start; gap: 10px; }
    .tc-check {
      width: 22px; height: 22px; border-radius: 50%;
      border: 2px solid #C7D2FE; flex-shrink: 0; margin-top: 1px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: all .17s;
    }
    .tc-check:hover { border-color: var(--brand); }
    .tc-check.done  { background: var(--brand); border-color: var(--brand); }
    .tc-check svg   { display: none; }
    .tc-check.done svg { display: block; }
    .tc-body { flex: 1; min-width: 0; }
    .tc-top  { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 2px; }
    .tc-title { font-size: 13.5px; font-weight: 700; color: var(--text-main); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tc-time  { font-size: 10px; color: #94A3B8; font-weight: 600; flex-shrink: 0; margin-top: 1px; white-space: nowrap; }
    .tc-info  { font-size: 11.5px; color: var(--text-sub); line-height: 1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
    .tc-tag   { display:inline-block; margin-top:5px; padding:2px 8px; background:var(--brand-light); color:var(--brand); border-radius:999px; font-size:10px; font-weight:700; }
    .tc-icons { display:flex; flex-direction:column; align-items:center; gap:4px; flex-shrink:0; }
    .star-btn {
      width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      background: transparent; transition: background .15s, transform .12s; padding: 0;
    }
    .star-btn:hover  { background: #FFF7ED; transform: scale(1.12); }
    .star-btn:active { transform: scale(.92); }
    .star-btn svg { width: 16px; height: 16px; }
    .tc-indicators { display:flex; flex-direction:column; align-items:center; gap:3px; }
    .ind-dot { width:20px; height:20px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px; }
    .ind-dot.bell     { background:#EFF6FF; }
    .ind-dot.clip     { background:#FAF5FF; }
    .ind-dot.bookmark { background:var(--brand-light); }

    /* ================================================================
       EMPTY STATE
    ================================================================ */
    #empty-state { display:none; flex-direction:column; align-items:center; justify-content:center; padding:52px 24px; text-align:center; }
    #empty-state.visible { display:flex; }
    .empty-circle { width:68px; height:68px; border-radius:50%; background:var(--brand-light); display:flex; align-items:center; justify-content:center; margin-bottom:14px; }

    /* ================================================================
       BOTTOM NAV
    ================================================================ */
    .bottom-nav {
      background: white;
      border-top: 1px solid var(--border);
      box-shadow: 0 -4px 24px rgba(79,70,229,.08);
      flex-shrink: 0;
      z-index: 50;
      padding-bottom: env(safe-area-inset-bottom, 20px);
    }
    .bottom-nav-inner {
      display: flex;
      align-items: center;
      justify-content: space-around;
      padding: 8px 8px 8px 8px;
    }
    .nav-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      padding: 7px 12px;
      border-radius: 12px;
      border: none;
      background: none;
      cursor: pointer;
      color: #9CA3AF;
      font-family: inherit;
      transition: all .15s;
    }
    .nav-btn:hover { color: var(--brand); }
    .nav-btn.active { color: var(--brand); background: var(--brand-light); }
    .nav-btn span { font-size: 10.5px; font-weight: 600; }
    .nav-add-btn {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      border: none;
      cursor: pointer;
      background: linear-gradient(135deg, var(--brand), #818CF8);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 16px rgba(91,107,248,.45);
      color: white;
      margin-top: -10px;
      flex-shrink: 0;
      transition: transform .15s, box-shadow .15s;
    }
    .nav-add-btn:hover { transform: scale(1.06); box-shadow: 0 6px 22px rgba(91,107,248,.55); }
    .nav-add-btn:active { transform: scale(.94); }
    .nav-add-btn.recording {
      background: #EF4444;
      box-shadow: 0 0 0 0 rgba(239,68,68,.7);
      animation: nav-rec-pulse 1.1s ease-in-out infinite;
    }
    @keyframes nav-rec-pulse {
      0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.6); }
      50%      { box-shadow: 0 0 0 14px rgba(239,68,68,.0); }
    }

    /* ================================================================
       TOAST
    ================================================================ */
    #toast {
      position:fixed; bottom:86px; left:50%;
      transform:translateX(-50%) translateY(8px);
      background:#0F172A; color:white; padding:9px 20px; border-radius:24px;
      font-size:12.5px; font-weight:600; opacity:0; pointer-events:none;
      transition:opacity .22s,transform .22s; z-index:9999;
      white-space:nowrap; box-shadow:0 4px 16px rgba(0,0,0,.2);
    }
    #toast.visible { opacity:1; transform:translateX(-50%) translateY(0); }

    /* ================================================================
       CALENDAR VIEW
    ================================================================ */
    #calendar-view-el { /* sits inside #task-scroll, stacks above task cards */ }
    .cal-widget {
      background: white; border-radius: 16px; margin: 10px 0 0;
      box-shadow: var(--card-shadow); overflow: hidden;
    }
    .cal-nav {
      display: flex; align-items: center; justify-content: space-between;
      padding: 14px 16px 6px;
    }
    .cal-nav-title { font-size: 15px; font-weight: 800; color: var(--text-main); }
    .cal-nav-btn {
      width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
      background: var(--brand-light); color: var(--brand);
      display: flex; align-items: center; justify-content: center; transition: all .15s;
    }
    .cal-nav-btn:hover { background: var(--brand); color: white; }
    .cal-days-hdr { display: grid; grid-template-columns: repeat(7,1fr); padding: 4px 10px 0; }
    .cal-day-lbl {
      text-align: center; font-size: 9.5px; font-weight: 700; color: #94A3B8;
      padding: 2px 0 5px; text-transform: uppercase; letter-spacing: .5px;
    }
    .cal-grid { display: grid; grid-template-columns: repeat(7,1fr); padding: 0 10px 10px; gap: 3px; }
    .cal-cell {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      border-radius: 10px; cursor: pointer; transition: all .15s;
      padding: 6px 2px; min-height: 40px;
    }
    .cal-cell:hover:not(.cal-cell-empty) { background: var(--brand-light); }
    .cal-cell-empty { cursor: default; pointer-events: none; }
    .cal-cell-num { font-size: 13px; font-weight: 600; color: var(--text-main); line-height: 1; }
    .cal-cell.cal-today .cal-cell-num   { color: var(--brand); font-weight: 800; }
    .cal-cell.cal-selected              { background: var(--brand) !important; }
    .cal-cell.cal-selected .cal-cell-num { color: white !important; font-weight: 800; }
    .cal-cell-dot {
      width: 5px; height: 5px; border-radius: 50%; background: var(--brand); margin-top: 3px;
    }
    .cal-cell.cal-selected .cal-cell-dot { background: rgba(255,255,255,.75); }
    .cal-date-label {
      text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-sub);
      padding: 10px 16px 12px; border-top: 1px solid #F1F5F9;
    }
    .cal-date-label .cal-lbl-sel { color: var(--brand); }
    .cal-tasks-hdr {
      display: block; font-size: 10.5px; font-weight: 800; color: #7C86CF;
      text-transform: uppercase; letter-spacing: .7px; padding: 12px 2px 5px;
    }

    /* ================================================================
       TASK FORM PANEL — bottom sheet
    ================================================================ */
    .form-overlay {
      position: fixed; inset: 0;
      background: rgba(15,23,42,.55);
      z-index: 300; opacity: 0; pointer-events: none;
      transition: opacity .3s;
      backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    }
    .form-overlay.open { opacity: 1; pointer-events: all; }

    #task-form-panel {
      position: fixed; bottom: 0; left: 50%;
      width: min(480px, 100vw);
      max-height: 93vh;
      background: #F8FAFF;
      border-radius: 22px 22px 0 0;
      z-index: 301;
      display: flex; flex-direction: column;
      transform: translateX(-50%) translateY(105%);
      transition: transform .38s cubic-bezier(.32,.72,0,1), bottom .28s ease-out;
      box-shadow: 0 -10px 50px rgba(79,70,229,.25);
    }
    #task-form-panel.open { transform: translateX(-50%) translateY(0); }

    /* handle bar */
    .form-drag-bar {
      width: 38px; height: 4px; border-radius: 2px;
      background: #CBD5E1; margin: 11px auto 0; flex-shrink: 0;
    }

    /* panel header */
    .form-hdr {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 14px 10px; border-bottom: 1px solid #EEF0F8;
      flex-shrink: 0;
    }
    .form-close-btn {
      width: 30px; height: 30px; border-radius: 50%;
      border: none; cursor: pointer; background: #F1F5F9;
      display: flex; align-items: center; justify-content: center;
      color: var(--text-sub); flex-shrink: 0; transition: background .15s;
    }
    .form-close-btn:hover { background: #E2E8F0; }
    .form-hdr-title { font-size: 15px; font-weight: 800; color: var(--text-main); flex: 1; }
    .form-hdr-actions { display: flex; gap: 5px; align-items: center; }
    .form-hdr-icon-btn {
      width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
      background: #F1F5F9; display: flex; align-items: center; justify-content: center;
      transition: all .15s;
    }
    .form-hdr-icon-btn:hover { background: #E2E8F0; }
    .form-hdr-icon-btn.star-on     { background: #FFF7ED; }
    .form-hdr-icon-btn.bookmark-on { background: var(--brand-light); }
    /* header Save button */
    .form-hdr-save {
      padding: 7px 16px; border-radius: 12px;
      background: var(--brand); color: white; border: none;
      font-size: 12.5px; font-weight: 700; font-family: inherit; cursor: pointer;
      box-shadow: 0 2px 8px rgba(91,107,248,.35); transition: all .15s;
    }
    .form-hdr-save:hover  { background: var(--brand-dark); }
    .form-hdr-save:active { transform: scale(.96); }

    /* scrollable body */
    .form-body {
      flex: 1; overflow-y: auto; padding: 14px 14px 10px;
    }
    .form-body::-webkit-scrollbar { width: 3px; }
    .form-body::-webkit-scrollbar-thumb { background: #C7D2FE; border-radius: 2px; }

    /* section cards */
    .fsec {
      background: white; border-radius: 14px; margin-bottom: 10px;
      box-shadow: 0 1px 4px rgba(91,107,248,.06); overflow: hidden;
    }
    .fsec-label {
      font-size: 10px; font-weight: 800; color: #94A3B8;
      text-transform: uppercase; letter-spacing: .8px;
      padding: 10px 14px 0; display: block;
    }

    /* field rows */
    .frow {
      display: flex; align-items: flex-start; gap: 11px;
      padding: 11px 14px; border-bottom: 1px solid #F1F5F9; position: relative;
    }
    .frow:last-child { border-bottom: none; }

    /* field icon */
    .ficon {
      width: 34px; height: 34px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0; margin-top: 0;
    }
    .ficon svg { width: 17px; height: 17px; }
    .fi-blue   { background: #EFF6FF; color: #3B82F6; }
    .fi-indigo { background: var(--brand-light); color: var(--brand); }
    .fi-amber  { background: #FFFBEB; color: var(--amber); }
    .fi-green  { background: #F0FDF4; color: #16A34A; }
    .fi-purple { background: #FAF5FF; color: #9333EA; }
    .fi-red    { background: #FFF1F2; color: #E11D48; }
    .fi-sky    { background: #F0F9FF; color: #0284C7; }
    .fi-gray   { background: #F8FAFC; color: #64748B; }

    /* field content */
    .fcontent { flex: 1; min-width: 0; }
    .flabel {
      font-size: 9.5px; font-weight: 800; color: #94A3B8;
      text-transform: uppercase; letter-spacing: .7px; margin-bottom: 3px; display: block;
    }
    .flabel .req { color: var(--danger); margin-left: 2px; }

    .finput {
      width: 100%; border: none; background: transparent;
      font-size: 16px; font-family: inherit; color: var(--text-main); /* 16px: prevents iOS Safari auto-zoom */
      padding: 0; line-height: 1.45;
    }
    .finput::placeholder { color: #C8D2E0; }
    .finput:focus { outline: none; }

    .ftextarea {
      width: 100%; border: none; background: transparent;
      font-size: 16px; font-family: inherit; color: var(--text-main); /* 16px: prevents iOS Safari auto-zoom */
      padding: 0; line-height: 1.65; resize: none; min-height: 88px;
    }
    .ftextarea::placeholder { color: #C8D2E0; }
    .ftextarea:focus { outline: none; }

    /* date + time row */
    .fdt-row { display: flex; gap: 8px; }
    .fdt-input {
      flex: 1; border: 1.5px solid #E2E8F0; border-radius: 10px;
      padding: 8px 10px; font-size: 16px; font-family: inherit; /* 16px: prevents iOS Safari auto-zoom */
      color: var(--text-main); background: #FAFBFF;
      transition: border-color .15s, box-shadow .15s;
    }
    .fdt-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,107,248,.1); outline: none; }

    /* tag chips inside form */
    .ftag-wrap { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; }
    .ftag-chip {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 3px 9px; border-radius: 999px;
      background: var(--brand-light); color: var(--brand);
      font-size: 11px; font-weight: 700;
    }
    .ftag-chip-rm {
      background: none; border: none; cursor: pointer;
      color: var(--brand); font-size: 14px; line-height: 1; padding: 0; opacity: .7;
    }
    .ftag-chip-rm:hover { opacity: 1; }

    /* attachments */
    .fupload-btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 7px 14px; border-radius: 10px;
      background: var(--brand-light); color: var(--brand);
      border: 1.5px dashed #A5B4FC; cursor: pointer;
      font-size: 12px; font-weight: 700; font-family: inherit;
      transition: all .15s;
    }
    .fupload-btn:hover { background: #E0E7FF; border-color: var(--brand); }
    .fattach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
    .fattach-chip {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 4px 10px 4px 8px; border-radius: 8px;
      background: #F1F5F9; color: var(--text-sub);
      font-size: 11px; font-weight: 600;
    }
    .fattach-rm {
      background: none; border: none; cursor: pointer;
      color: #94A3B8; font-size: 14px; line-height: 1; padding: 0; margin-left: 2px;
    }
    .fattach-rm:hover { color: var(--danger); }

    /* validation */
    .ferr {
      font-size: 11px; color: var(--danger); font-weight: 600;
      margin-top: 3px; display: none;
    }
    .ferr.show { display: block; }
    .frow.field-err .finput { color: var(--danger); }

    /* footer save */
    .form-footer {
      padding: 12px 14px calc(env(safe-area-inset-bottom, 0px) + 12px);
      border-top: 1px solid #EEF0F8; background: white; flex-shrink: 0;
    }
    .form-footer-btn {
      width: 100%; padding: 14px; border: none; border-radius: 14px;
      background: linear-gradient(135deg,var(--brand),#818CF8);
      color: white; font-size: 15px; font-weight: 700;
      font-family: inherit; cursor: pointer; letter-spacing: .3px;
      box-shadow: 0 4px 16px rgba(91,107,248,.35);
      transition: opacity .15s, transform .1s;
    }
    .form-footer-btn:hover  { opacity: .93; }
    .form-footer-btn:active { transform: scale(.98); }

    /* ================================================================
       ANIMATIONS
    ================================================================ */
    @keyframes fadeSlideUp { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }
    .anim-in { animation: fadeSlideUp .32s ease forwards; }

    @keyframes shake {
      0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)}
      40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(4px)}
    }
    .do-shake { animation: shake .38s ease; }

    @keyframes starPop {
      0%{transform:scale(1)} 40%{transform:scale(1.45)} 70%{transform:scale(.88)} 100%{transform:scale(1)}
    }
    .star-pop { animation: starPop .3s cubic-bezier(.36,.07,.19,.97); }

    /* ================================================================
       REMINDER MODAL
    ================================================================ */
    .reminder-overlay {
      position: fixed; inset: 0;
      background: rgba(15,23,42,.45);
      z-index: 400; opacity: 0; pointer-events: none;
      transition: opacity .25s;
      backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px);
    }
    .reminder-overlay.open { opacity: 1; pointer-events: all; }
    #reminder-modal {
      position: fixed; bottom: 0; left: 50%;
      width: min(480px, 100vw);
      background: white; border-radius: 20px 20px 0 0;
      z-index: 401;
      transform: translateX(-50%) translateY(105%);
      transition: transform .32s cubic-bezier(.32,.72,0,1);
      box-shadow: 0 -8px 40px rgba(79,70,229,.22);
      max-height: 75vh; display: flex; flex-direction: column;
    }
    #reminder-modal.open { transform: translateX(-50%) translateY(0); }
    .reminder-drag-bar {
      width: 38px; height: 4px; border-radius: 2px;
      background: #CBD5E1; margin: 11px auto 0; flex-shrink: 0;
    }
    .reminder-hdr {
      display: flex; align-items: center; gap: 10px;
      padding: 12px 16px; border-bottom: 1px solid #F1F5F9; flex-shrink: 0;
    }
    .reminder-hdr-title { font-size: 15px; font-weight: 800; color: var(--text-main); flex: 1; }
    .reminder-close-btn {
      width: 28px; height: 28px; border-radius: 50%;
      border: none; cursor: pointer; background: #F1F5F9;
      display: flex; align-items: center; justify-content: center;
      color: var(--text-sub); flex-shrink: 0; transition: background .15s;
    }
    .reminder-close-btn:hover { background: #E2E8F0; }
    .reminder-list {
      overflow-y: auto; padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 14px);
    }
    .reminder-list::-webkit-scrollbar { display: none; }
    .reminder-group-lbl {
      display: block; font-size: 10px; font-weight: 800; color: #94A3B8;
      text-transform: uppercase; letter-spacing: .8px; padding: 10px 14px 3px;
    }
    .reminder-option {
      display: flex; align-items: center; gap: 12px;
      padding: 11px 14px; border-radius: 12px; cursor: pointer;
      border: none; background: transparent; width: 100%;
      font-family: inherit; text-align: left; transition: background .12s;
      min-height: 48px;
    }
    .reminder-option:hover { background: #F8FAFF; }
    .reminder-option.rem-selected { background: var(--brand-light); }
    .reminder-radio {
      width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
      border: 2px solid #C7D2FE;
      display: flex; align-items: center; justify-content: center;
      transition: all .15s;
    }
    .reminder-option.rem-selected .reminder-radio { background: var(--brand); border-color: var(--brand); }
    .reminder-radio-dot { width: 8px; height: 8px; border-radius: 50%; background: white; display: none; }
    .reminder-option.rem-selected .reminder-radio-dot { display: block; }
    .reminder-option-lbl { font-size: 14px; font-weight: 500; color: var(--text-main); flex: 1; }
    .reminder-option.rem-selected .reminder-option-lbl { color: var(--brand); font-weight: 700; }
    /* Bell trigger row inside the Date & Time form section */
    .bell-trigger-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 11px 14px; cursor: pointer;
      border: none; background: transparent; width: 100%;
      font-family: inherit; text-align: left; transition: background .12s;
      min-height: 48px;
    }
    .bell-trigger-row:hover { background: #FAFBFF; }
    .bell-trigger-left { display: flex; align-items: center; gap: 11px; }
    .bell-trigger-info { display: flex; flex-direction: column; gap: 1px; }
    .bell-trigger-val { font-size: 13.5px; color: var(--text-sub); }
    .bell-trigger-val.has-reminder { color: var(--brand); font-weight: 700; }

    /* ================================================================
       RWD TOUCH POLISH
    ================================================================ */
    .nav-btn { min-height: 48px; }
    .filter-chip { min-height: 34px; }
    .tc-check { width: 24px; height: 24px; }
    .task-delete-bg { border-radius: 0 14px 14px 0; }

    /* ================================================================
       PURPLE THEME — GLOBAL OVERRIDES
    ================================================================ */
    html, body { background: #4B52F6; }
    #app-screen { background: #4B52F6; box-shadow: none; }

    /* Header */
    .app-header { background: transparent; padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 10px; }
    .header-logo-wrap { display: flex; align-items: center; gap: 10px; }
    .header-brand-text { display: flex; flex-direction: column; line-height: 1.22; gap: 0; }
    .header-brand-sub  { color: rgba(255,255,255,0.65); font-size: 10.5px; font-weight: 400; letter-spacing: .4px; }
    .header-brand-name { color: white; font-size: 13.5px; font-weight: 800; letter-spacing: .7px; }
    .header-btn { background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.28); }
    .header-btn:hover { background: rgba(255,255,255,0.25); }
    .header-btn.voice-listening {
      background: rgba(255,59,48,0.25); border-color: rgba(255,59,48,0.7);
      animation: voice-pulse 1.1s ease-in-out infinite;
    }
    .header-btn.voice-processing { animation: voice-spin 0.75s linear infinite; }
    @keyframes voice-pulse  { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.65;transform:scale(0.93)} }
    @keyframes voice-spin   { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

    /* Voice status pill */
    #voice-status-bar {
      position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%) translateY(6px);
      background: rgba(15,15,25,0.88); color: white; border-radius: 999px;
      padding: 9px 22px; font-size: 13px; font-weight: 600; letter-spacing: .2px;
      z-index: 600; opacity: 0; pointer-events: none; white-space: nowrap;
      transition: opacity .22s, transform .22s;
      backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
      border: 1px solid rgba(255,255,255,0.12);
    }
    #voice-status-bar.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

    /* Controls bar */
    .controls-bar { background: transparent; border-bottom: none; }

    /* Old filter chips — hidden */
    .filter-chips-row { display: none !important; }

    /* Filter circles row */
    .filter-circles-row {
      display: flex; align-items: center; justify-content: center;
      gap: 40px; padding: 6px 20px 18px;
    }
    .filter-circle-btn {
      width: 54px; height: 54px; border-radius: 50%;
      border: 2px solid rgba(255,255,255,0.75);
      background: rgba(255,255,255,0.06); cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      color: white; transition: all .2s; flex-shrink: 0;
    }
    .filter-circle-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.95); }
    .filter-circle-btn:active { transform: scale(.91); }
    .filter-circle-btn.active {
      background: white; border-color: white;
      box-shadow: 0 0 0 6px rgba(255,255,255,0.18), 0 4px 14px rgba(0,0,0,0.15);
    }
    .filter-circle-btn.active svg { color: var(--brand); }
    .filter-circle-btn.active path { stroke: var(--brand); fill: none; }
    .filter-circle-btn.active.fc-priority path { fill: var(--brand); stroke: none; }
    .fc-scheduled-icon { width: 24px; height: 24px; object-fit: contain; filter: brightness(0) invert(1); }
    .filter-circle-btn.active.fc-scheduled .fc-scheduled-icon { filter: brightness(0) saturate(100%) invert(35%) sepia(96%) saturate(600%) hue-rotate(210deg); }

    /* Search bar — pill */
    .search-row { padding: 0 16px; margin-bottom: 18px; }
    .search-row svg {
      color: rgba(255,255,255,0.75); left: 28px;
      width: 17px; height: 17px; top: 50%; transform: translateY(-50%);
    }
    #search-input {
      background: rgba(255,255,255,0.13);
      border: 1.5px solid rgba(255,255,255,0.4);
      border-radius: 999px; color: white;
      padding: 12px 20px 12px 46px; font-size: 16px; /* 16px: prevents iOS Safari auto-zoom */
    }
    #search-input:focus {
      border-color: rgba(255,255,255,0.9);
      box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
      background: rgba(255,255,255,0.18);
    }
    #search-input::placeholder { color: rgba(255,255,255,0.48); font-size: 14px; }
    #search-input.has-text { padding-right: 42px; }
    #search-clear-btn {
      display: none; position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
      background: rgba(255,255,255,0.22); border: none; border-radius: 50%;
      width: 22px; height: 22px; padding: 0;
      align-items: center; justify-content: center;
      color: white; cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    #search-clear-btn.visible { display: flex; }

    /* Task scroll */
    #task-scroll { padding: 4px 16px 16px; }
    #task-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); }

    /* Outer wrapper — provides left space for timeline icon */
    .task-outer-wrapper {
      position: relative; padding-left: 58px; margin-bottom: 10px;
    }
    /* Vertical connecting line */
    .task-outer-wrapper::before {
      content: ""; position: absolute;
      left: 25px; top: 0; bottom: -10px;
      width: 2px; background: rgba(255,255,255,0.13); z-index: 1;
    }
    .task-outer-wrapper:first-child::before { top: 50%; }
    .task-outer-wrapper:last-child::before  { bottom: 50%; }

    /* Timeline icon */
    .task-timeline-icon {
      position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
      width: 46px; height: 46px; border-radius: 50%;
      border: 2px solid rgba(255,255,255,0.75);
      background: #4B52F6; color: white;
      display: flex; align-items: center; justify-content: center;
      z-index: 3; cursor: pointer; transition: all .15s;
    }
    .task-timeline-icon:hover  { background: rgba(255,255,255,0.15); }
    .task-timeline-icon:active { transform: translateY(-50%) scale(.9); }
    .task-timeline-icon.tl-priority {
      background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.9);
    }
    .task-timeline-icon.tl-done {
      background: rgba(255,255,255,0.95); border-color: white; color: var(--brand);
      box-shadow: 0 0 0 5px rgba(255,255,255,0.18), 0 0 16px rgba(255,255,255,0.2);
    }

    /* Inner swipe wrapper (overflow:hidden for swipe-delete) */
    /* swipe wrapper — clips delete bg, card sits above it */
    .task-swipe-wrapper { position: relative; overflow: hidden; border-radius: 16px; }

    /* Task card — blends into purple page background */
    .task-card {
      position: relative; z-index: 2;
      background: #4B52F6;
      border: 1.5px solid rgba(255,255,255,0.28);
      border-radius: 16px; padding: 13px 14px 12px;
      box-shadow: none;
      color: white; cursor: pointer;
      transition: border-color .15s, background .15s;
    }
    .task-card:hover { border-color: rgba(255,255,255,0.5); background: #535AF7; }
    .task-card.priority-card { border-color: rgba(255,255,255,0.65); background: #5057F6; }
    .task-card.done-card {
      background: #4B52F6;
      border-color: rgba(255,255,255,0.16);
      color: rgba(255,255,255,0.46);
      opacity: 1;   /* cancels base CSS opacity:.58 — fading is via color alpha, not element opacity */
    }
    .task-card.done-card .tc-title { text-decoration: line-through; }

    /* Card content layout */
    .tc-header-row {
      display: flex; align-items: flex-start;
      justify-content: space-between; gap: 8px; margin-bottom: 4px;
    }
    .tc-title { font-size: 15px; font-weight: 700; color: white; line-height: 1.3; flex: 1; }
    .tc-date-badge {
      font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.6);
      white-space: nowrap; flex-shrink: 0; margin-top: 2px;
      text-transform: uppercase; letter-spacing: .4px;
    }
    .tc-info {
      font-size: 13px; color: rgba(255,255,255,0.78); line-height: 1.5;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
      overflow: hidden; margin-bottom: 8px;
    }
    .tc-tag {
      display: inline-block; margin-bottom: 8px; padding: 2px 9px;
      background: rgba(255,255,255,0.16); color: rgba(255,255,255,0.9);
      border: 1px solid rgba(255,255,255,0.22); border-radius: 999px;
      font-size: 10px; font-weight: 700;
    }
    .tc-footer-row {
      display: flex; align-items: flex-end;
      justify-content: space-between; margin-top: 4px;
    }
    .tc-time-big { font-size: 15px; font-weight: 700; color: white; display: block; }
    .tc-location  { font-size: 11.5px; color: rgba(255,255,255,0.6); margin-top: 2px; }
    .tc-right-actions { display: flex; align-items: flex-end; gap: 6px; flex-shrink: 0; }
    .tc-ind { display: inline-flex; align-items: center; opacity: .9; }
    /* Indicator SVG strokes — white on purple */
    .task-card .tc-ind svg { stroke: rgba(255,255,255,0.82); }
    .star-btn { background: transparent; }
    .star-btn:hover { background: rgba(255,255,255,0.12); }
    /* Star icon: white outline when empty, amber when active */
    .task-card .star-btn svg { stroke: rgba(255,255,255,0.55); fill: none; }
    .task-card .star-btn.is-priority svg { stroke: #F59E0B; fill: #F59E0B; }

    /* Audio memo buttons — white-tinted on purple card */
    .tc-mic-btn, .tc-play-btn {
      background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.25); color: white;
    }
    .tc-mic-btn:hover, .tc-play-btn:hover { background: rgba(255,255,255,0.24); }
    .tc-mic-btn.recording { background: rgba(239,68,68,0.25); border-color: rgba(239,68,68,0.7); color: #FCA5A5; }

    /* Priority badge/ribbon node */
    .tl-badge-wrap {
      position: absolute; left: 3px; top: 50%;
      transform: translateY(-50%);
      width: 44px; cursor: pointer; z-index: 3;
      background: none; border: none; padding: 0;
    }
    .tl-badge-wrap:hover svg { opacity: .85; }
    .tl-badge-wrap:active { transform: translateY(-50%) scale(.9); }

    /* Indicator cluster — bottom-right of card */
    .tc-bottom-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
    .tc-inds-row { display: flex; gap: 4px; align-items: center; }

    /* Audio memo buttons */
    .tc-mic-btn, .tc-play-btn {
      display: inline-flex; align-items: center; justify-content: center;
      width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
      background: rgba(75,82,246,0.1); border: 1px solid rgba(75,82,246,0.18);
      cursor: pointer; padding: 0; color: var(--brand);
      transition: background .15s, color .15s;
    }
    .tc-mic-btn:hover, .tc-play-btn:hover { background: rgba(75,82,246,0.2); }
    .tc-play-btn.playing { background: rgba(75,82,246,0.18); }
    .tc-mic-btn.recording {
      background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.55); color: #EF4444;
      animation: mic-rec-pulse 1s ease-in-out infinite;
    }
    @keyframes mic-rec-pulse {
      0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
      50%     { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
    }

    /* Date group headers */
    .date-group-hdr .day-chip { color: rgba(255,255,255,0.78); font-weight: 600; }
    .date-group-hdr .day-chip.today  { color: white; font-weight: 700; }
    .date-group-hdr .day-chip.future { color: rgba(255,245,180,0.95); }
    .date-group-hdr::after { background: linear-gradient(to right,rgba(255,255,255,0.22),transparent); }

    /* Calendar on purple */
    .cal-widget { background: rgba(255,255,255,0.1); border: 1.5px solid rgba(255,255,255,0.2); }
    .cal-nav-title { color: white; }
    .cal-nav-btn   { background: rgba(255,255,255,0.15); color: white; }
    .cal-nav-btn:hover { background: rgba(255,255,255,0.25); }
    .cal-day-lbl   { color: rgba(255,255,255,0.45); }
    .cal-cell-num  { color: white; }
    .cal-cell:hover:not(.cal-cell-empty) { background: rgba(255,255,255,0.12); }
    .cal-cell.cal-today .cal-cell-num   { color: white; font-weight: 800; }
    .cal-cell.cal-selected              { background: white !important; }
    .cal-cell.cal-selected .cal-cell-num { color: var(--brand) !important; }
    .cal-cell-dot  { background: rgba(255,255,255,0.8); }
    .cal-cell.cal-selected .cal-cell-dot { background: var(--brand); }
    .cal-date-label { color: rgba(255,255,255,0.6); border-top-color: rgba(255,255,255,0.1); }
    .cal-date-label .cal-lbl-sel { color: white; }
    .cal-tasks-hdr { color: rgba(255,255,255,0.45); }

    /* Empty state */
    .empty-circle { background: rgba(255,255,255,0.12); }
    .empty-circle svg { color: white !important; }
    #empty-state p { color: rgba(255,255,255,0.85); }
    #empty-sub-text { color: rgba(255,255,255,0.5) !important; }

    .nav-btn { color: #B0B7D4; min-height: 48px; }
    .nav-btn span { display: none; }
    .nav-btn.active { color: var(--brand); background: transparent; }
    .nav-btn.active::after {
      content: ""; display: block;
      width: 5px; height: 5px; border-radius: 50%;
      background: var(--brand); margin: 3px auto 0;
    }
    .nav-add-btn {
      background: linear-gradient(135deg, #5B6BF8, #818CF8);
      box-shadow: 0 4px 18px rgba(75,82,246,0.5);
      width: 54px; height: 54px; margin-top: -14px;
    }

    /* ================================================================
       TASK DETAIL PANEL
    ================================================================ */
    .detail-overlay {
      position:fixed;inset:0;background:rgba(15,23,42,.55);
      z-index:302;opacity:0;pointer-events:none;transition:opacity .3s;
      backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);
    }
    .detail-overlay.open{opacity:1;pointer-events:all;}
    #task-detail-panel{
      position:fixed;bottom:0;left:50%;width:min(480px,100vw);
      max-height:93vh;background:#F8FAFF;
      border-radius:22px 22px 0 0;z-index:303;
      display:flex;flex-direction:column;
      transform:translateX(-50%) translateY(105%);
      transition:transform .38s cubic-bezier(.32,.72,0,1);
      box-shadow:0 -10px 50px rgba(79,70,229,.25);
    }
    #task-detail-panel.open{transform:translateX(-50%) translateY(0);}
    .dtl-drag-bar{width:38px;height:4px;border-radius:2px;background:#CBD5E1;margin:11px auto 0;flex-shrink:0;}
    .dtl-hdr{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid #EEF0F8;flex-shrink:0;}
    .dtl-close-btn{width:30px;height:30px;border-radius:50%;border:none;cursor:pointer;background:#F1F5F9;
      display:flex;align-items:center;justify-content:center;color:var(--text-sub);flex-shrink:0;transition:background .15s;}
    .dtl-close-btn:hover{background:#E2E8F0;}
    .dtl-hdr-title{font-size:15px;font-weight:800;color:var(--text-main);flex:1;}
    .dtl-edit-btn{padding:7px 16px;border-radius:12px;background:var(--brand);color:white;border:none;
      font-size:12.5px;font-weight:700;font-family:inherit;cursor:pointer;
      box-shadow:0 2px 8px rgba(91,107,248,.35);transition:all .15s;}
    .dtl-edit-btn:hover{background:var(--brand-dark);}
    .dtl-body{flex:1;overflow-y:auto;padding:14px 14px 32px;}
    .dtl-body::-webkit-scrollbar{width:3px;}
    .dtl-body::-webkit-scrollbar-thumb{background:#C7D2FE;border-radius:2px;}

    /* hero */
    .dtl-hero{background:white;border-radius:16px;padding:16px 16px 14px;
      margin-bottom:10px;box-shadow:0 1px 4px rgba(91,107,248,.06);}
    .dtl-hero-title{font-size:20px;font-weight:800;color:var(--text-main);line-height:1.25;margin-bottom:5px;}
    .dtl-hero-meta{font-size:13px;color:var(--text-sub);margin-bottom:8px;}
    .dtl-hero-badges{display:flex;flex-wrap:wrap;gap:6px;}
    .dtl-badge{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:999px;
      font-size:11px;font-weight:700;letter-spacing:.2px;}
    .dtl-badge-done    {background:#F0FDF4;color:#16A34A;border:1px solid #BBF7D0;}
    .dtl-badge-priority{background:#FFFBEB;color:var(--amber);border:1px solid #FDE68A;}
    .dtl-badge-tag     {background:var(--brand-light);color:var(--brand);border:1px solid rgba(91,107,248,.2);}
    .dtl-badge-reminder{background:#F0F9FF;color:#0284C7;border:1px solid #BAE6FD;}

    /* section cards */
    .dtl-sec{background:white;border-radius:14px;margin-bottom:10px;
      box-shadow:0 1px 4px rgba(91,107,248,.06);overflow:hidden;}
    .dtl-sec-label{font-size:10px;font-weight:800;color:#94A3B8;
      text-transform:uppercase;letter-spacing:.8px;padding:10px 14px 0;display:block;}

    /* rows */
    .dtl-row{display:flex;align-items:center;gap:11px;
      padding:11px 14px;border-bottom:1px solid #F1F5F9;}
    .dtl-row:last-child{border-bottom:none;}
    .dtl-row.dtl-top{align-items:flex-start;}
    .dtl-row.dtl-click{cursor:pointer;transition:background .1s;}
    .dtl-row.dtl-click:hover{background:#F8FAFF;}
    .dtl-row.dtl-click:active{background:#F1F5F9;}
    .dtl-row-icon{width:34px;height:34px;border-radius:10px;
      display:flex;align-items:center;justify-content:center;flex-shrink:0;}
    .dtl-row-icon svg{width:17px;height:17px;}
    .dtl-row-body{flex:1;min-width:0;}
    .dtl-row-lbl{font-size:10.5px;font-weight:600;color:var(--text-sub);
      text-transform:uppercase;letter-spacing:.4px;margin-bottom:2px;}
    .dtl-row-val{font-size:14px;font-weight:500;color:var(--text-main);word-break:break-word;line-height:1.45;}
    .dtl-row-actions{display:flex;gap:6px;align-items:center;flex-shrink:0;}

    /* copy button */
    .dtl-copy-btn{width:28px;height:28px;border-radius:8px;background:#F1F5F9;border:none;
      cursor:pointer;display:flex;align-items:center;justify-content:center;
      color:var(--text-sub);transition:background .15s;position:relative;}
    .dtl-copy-btn:hover{background:#E2E8F0;}
    .dtl-copy-tip{position:absolute;top:-30px;left:50%;transform:translateX(-50%);
      background:#0F172A;color:white;font-size:10.5px;font-weight:700;
      padding:3px 8px;border-radius:6px;white-space:nowrap;
      opacity:0;pointer-events:none;transition:opacity .18s;}
    .dtl-copy-tip.visible{opacity:1;}

    /* links */
    .dtl-tel{color:#3B82F6;text-decoration:none;font-weight:600;}
    .dtl-tel:hover{text-decoration:underline;}
    .dtl-url{color:var(--brand);text-decoration:none;word-break:break-all;}
    .dtl-url:hover{text-decoration:underline;}
    .dtl-chevron{color:#C7D2FE;flex-shrink:0;}

    /* note body */
    .dtl-note{font-size:14px;color:var(--text-sub);line-height:1.65;
      padding:10px 14px 14px;white-space:pre-wrap;word-break:break-word;}

    /* sub-tasks */
    .dtl-subtask-hdr{display:flex;align-items:center;justify-content:space-between;
      padding:12px 14px 4px;}
    .dtl-subtask-hdr-lbl{font-size:10px;font-weight:800;color:#94A3B8;letter-spacing:.06em;text-transform:uppercase;}
    .dtl-subtask-add-btn{width:26px;height:26px;border-radius:50%;border:none;
      background:var(--brand);color:white;font-size:18px;line-height:1;cursor:pointer;
      display:flex;align-items:center;justify-content:center;flex-shrink:0;
      -webkit-tap-highlight-color:transparent;transition:background .15s;}
    .dtl-subtask-add-btn:active{background:#3a41e0;}
    .dtl-subtask-input-wrap{padding:0 14px 10px;display:none;}
    .dtl-subtask-input-wrap.open{display:flex;gap:8px;align-items:center;}
    .dtl-subtask-new-inp{flex:1;border:1.5px solid #E2E8F0;border-radius:10px;
      padding:9px 12px;font-size:16px;font-family:inherit;color:var(--text-main);outline:none;} /* 16px: prevents iOS Safari auto-zoom */
    .dtl-subtask-new-inp:focus{border-color:var(--brand);}
    .dtl-subtask-save-btn{padding:8px 14px;background:var(--brand);color:white;
      border:none;border-radius:10px;font-size:13px;font-weight:700;cursor:pointer;
      -webkit-tap-highlight-color:transparent;}
    .dtl-subtask-list{padding:0 14px 14px;}
    .dtl-subtask-item{display:flex;align-items:center;gap:10px;
      padding:9px 0;border-bottom:1px solid rgba(0,0,0,0.055);}
    .dtl-subtask-item:last-child{border-bottom:none;}
    .dtl-subtask-cb{width:20px;height:20px;border-radius:6px;border:2px solid #CBD5E1;
      background:white;cursor:pointer;flex-shrink:0;display:flex;align-items:center;
      justify-content:center;transition:all .15s;-webkit-tap-highlight-color:transparent;}
    .dtl-subtask-cb.checked{background:var(--brand);border-color:var(--brand);}
    .dtl-subtask-cb.checked::after{content:'';display:block;width:5px;height:9px;
      border:2px solid white;border-top:none;border-left:none;
      transform:rotate(45deg) translate(-1px,-1px);}
    .dtl-subtask-text{flex:1;font-size:14px;color:var(--text-main);
      word-break:break-word;line-height:1.4;transition:color .15s;}
    .dtl-subtask-text.done{text-decoration:line-through;color:#94A3B8;}
    .dtl-subtask-del{background:none;border:none;padding:4px 6px;cursor:pointer;
      color:#CBD5E1;-webkit-tap-highlight-color:transparent;transition:color .15s;}
    .dtl-subtask-del:active{color:#EF4444;}

    /* attachments */
    .dtl-attach-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:8px;padding:12px 14px;}
    .dtl-attach-item{display:flex;flex-direction:column;align-items:center;gap:5px;
      cursor:pointer;border-radius:10px;padding:6px;transition:background .15s;}
    .dtl-attach-item:hover{background:#F1F5F9;}
    .dtl-attach-thumb{width:72px;height:72px;border-radius:8px;object-fit:cover;
      border:1.5px solid #E2E8F0;display:block;}
    .dtl-attach-pdf{width:72px;height:72px;border-radius:8px;
      background:#FEF2F2;border:1.5px solid #FECACA;
      display:flex;align-items:center;justify-content:center;}
    .dtl-attach-file{width:72px;height:72px;border-radius:8px;
      background:#F0F9FF;border:1.5px solid #BAE6FD;
      display:flex;align-items:center;justify-content:center;}
    .dtl-attach-name{font-size:10px;font-weight:600;color:var(--text-sub);
      text-align:center;width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
    .dtl-attach-hdr{display:flex;align-items:center;justify-content:space-between;padding:10px 14px 0;}
    .dtl-attach-add-btn{
      width:26px;height:26px;border-radius:50%;border:none;cursor:pointer;
      background:var(--brand);color:white;font-size:18px;line-height:1;
      display:flex;align-items:center;justify-content:center;
      transition:opacity .15s;flex-shrink:0;
    }
    .dtl-attach-add-btn:active{opacity:.75;}
    .dtl-attach-empty{
      padding:16px 14px;font-size:12px;color:#94A3B8;font-style:italic;
    }

    /* ================================================================
       MAP ACTION SHEET
    ================================================================ */
    .map-sh-overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);
      z-index:490;opacity:0;pointer-events:none;transition:opacity .25s;}
    .map-sh-overlay.open{opacity:1;pointer-events:all;}
    #map-action-sheet{position:fixed;bottom:0;left:50%;width:min(480px,100vw);
      z-index:491;transform:translateX(-50%) translateY(110%);
      transition:transform .32s cubic-bezier(.32,.72,0,1);
      padding:0 10px calc(14px + env(safe-area-inset-bottom,0px));}
    #map-action-sheet.open{transform:translateX(-50%) translateY(0);}
    .map-sh-card{background:white;border-radius:16px;overflow:hidden;
      box-shadow:0 8px 32px rgba(0,0,0,.18);margin-bottom:10px;}
    .map-sh-addr{font-size:12px;font-weight:600;color:var(--text-sub);text-align:center;
      padding:11px 16px 9px;border-bottom:1px solid #F1F5F9;}
    .map-sh-btn{display:block;width:100%;padding:15px 16px;border:none;
      background:none;font-family:inherit;font-size:15px;font-weight:500;
      color:#3B82F6;text-align:center;cursor:pointer;
      border-bottom:1px solid #F1F5F9;transition:background .1s;}
    .map-sh-btn:last-child{border-bottom:none;}
    .map-sh-btn:hover{background:#F8FAFF;}
    .map-sh-btn.map-sh-copy{color:var(--text-main);}
    .map-sh-cancel{display:block;width:100%;background:white;border-radius:16px;
      border:none;font-family:inherit;font-size:16px;font-weight:700;
      color:#3B82F6;padding:15px;text-align:center;cursor:pointer;
      box-shadow:0 4px 16px rgba(0,0,0,.1);transition:background .1s;}
    .map-sh-cancel:hover{background:#F8FAFF;}

    /* ================================================================
       ATTACHMENT PREVIEW MODAL
    ================================================================ */
    #attach-preview-wrap{position:fixed;inset:0;z-index:501;
      background:rgba(0,0,0,.92);
      backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
      display:none;flex-direction:column;}
    #attach-preview-wrap.open{display:flex;}
    .ap-hdr{display:flex;align-items:center;gap:10px;
      padding:calc(14px + env(safe-area-inset-top,0px)) 16px 14px;flex-shrink:0;}
    .ap-close{width:34px;height:34px;border-radius:50%;
      background:rgba(255,255,255,.12);border:none;color:white;cursor:pointer;
      display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .15s;}
    .ap-close:hover{background:rgba(255,255,255,.2);}
    .ap-fname{flex:1;font-size:14px;font-weight:600;color:white;
      white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
    .ap-share-btn{display:flex;align-items:center;gap:6px;padding:8px 18px;
      border-radius:20px;background:white;color:var(--brand);border:none;
      font-family:inherit;font-size:13.5px;font-weight:700;cursor:pointer;flex-shrink:0;
      transition:opacity .15s;}
    .ap-share-btn:hover{opacity:.88;}
    .ap-body{flex:1;display:flex;align-items:center;justify-content:center;
      overflow:hidden;padding:0 16px calc(16px + env(safe-area-inset-bottom,0px));}
    .ap-body img{max-width:100%;max-height:100%;object-fit:contain;border-radius:8px;}
    .ap-body iframe{width:100%;height:100%;border:none;border-radius:8px;background:white;}
    .ap-placeholder{display:flex;flex-direction:column;align-items:center;gap:14px;
      color:rgba(255,255,255,.55);text-align:center;}
    .ap-placeholder svg{width:64px;height:64px;}
    .ap-placeholder p{font-size:14px;line-height:1.5;}

    /* ================================================================
       iOS LOCK SCREEN REMINDER NOTIFICATION
    ================================================================ */
    #ios-notif-wrap {
      position: fixed; top: 0; left: 50%; transform: translateX(-50%);
      width: 100%; max-width: 480px;
      padding: 14px 16px 0;
      z-index: 10000; pointer-events: none;
    }
    #ios-notif-card {
      pointer-events: all;
      background: rgba(22, 22, 36, 0.84);
      backdrop-filter: blur(32px) saturate(1.8);
      -webkit-backdrop-filter: blur(32px) saturate(1.8);
      border: 1px solid rgba(255,255,255,0.13);
      border-radius: 18px;
      padding: 13px 14px 12px;
      box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
      transform: translateY(calc(-100% - 20px));
      transition: transform 0.46s cubic-bezier(.32,.72,0,1);
      will-change: transform; touch-action: pan-y;
    }
    #ios-notif-card.show { transform: translateY(0); }
    .ios-nc-inner { display: flex; align-items: flex-start; gap: 11px; }
    .ios-nc-icon {
      width: 34px; height: 34px; border-radius: 9px;
      overflow: hidden; flex-shrink: 0; margin-top: 1px;
    }
    .ios-nc-body { flex: 1; min-width: 0; }
    .ios-nc-header-row {
      display: flex; align-items: center; gap: 5px; margin-bottom: 3px;
    }
    .ios-nc-app-name {
      font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.72);
      letter-spacing: .3px; text-transform: uppercase;
    }
    .ios-nc-sep   { color: rgba(255,255,255,0.3); font-size: 10px; }
    .ios-nc-time  { font-size: 11px; color: rgba(255,255,255,0.42); }
    .ios-nc-title {
      font-size: 14px; font-weight: 700; color: white; line-height: 1.3;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      margin-bottom: 2px;
    }
    .ios-nc-info {
      font-size: 12.5px; color: rgba(255,255,255,0.62); line-height: 1.45;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .ios-nc-x {
      width: 22px; height: 22px; border-radius: 50%;
      background: rgba(255,255,255,0.1); border: none; cursor: pointer;
      color: rgba(255,255,255,0.55); display: flex; align-items: center;
      justify-content: center; flex-shrink: 0; margin-top: 1px;
      transition: background .15s;
    }
    .ios-nc-x:hover { background: rgba(255,255,255,0.18); }
    .ios-nc-bar-track {
      height: 2px; background: rgba(255,255,255,0.09);
      border-radius: 1px; margin: 11px 0 10px; overflow: hidden;
    }
    .ios-nc-bar-fill {
      height: 100%; width: 100%;
      background: rgba(255,255,255,0.4); border-radius: 1px;
    }
    #ios-notif-card.show .ios-nc-bar-fill {
      animation: notif-drain 7s linear forwards;
    }
    @keyframes notif-drain { from { width: 100%; } to { width: 0%; } }
    .ios-nc-actions { display: flex; gap: 8px; }
    .ios-nc-btn-dismiss, .ios-nc-btn-open {
      flex: 1; padding: 8px 12px; border: none; border-radius: 10px;
      font-family: inherit; font-size: 13px; font-weight: 600;
      cursor: pointer; transition: opacity .15s;
    }
    .ios-nc-btn-dismiss {
      background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.72);
    }
    .ios-nc-btn-dismiss:hover { background: rgba(255,255,255,0.16); }
    .ios-nc-btn-open {
      background: rgba(91,107,248,0.85); color: white;
    }
    .ios-nc-btn-open:hover { background: rgb(91,107,248); }

    /* ================================================================
       VOICE MEMO — detail panel section
    ================================================================ */
    .dtl-memo-row {
      display: flex; align-items: center; gap: 14px; padding: 12px 14px 14px;
    }
    .dtl-memo-rec-btn {
      display: inline-flex; align-items: center; gap: 7px;
      padding: 9px 18px; border-radius: 999px; border: none; cursor: pointer;
      background: rgba(75,82,246,0.1); color: var(--brand);
      font-size: 13px; font-weight: 700; font-family: inherit;
      transition: background .15s, color .15s; flex-shrink: 0;
    }
    .dtl-memo-rec-btn:hover { background: rgba(75,82,246,0.18); }
    .dtl-memo-rec-btn.recording { background: rgba(239,68,68,0.1); color: #EF4444; }
    .dtl-memo-rec-dot {
      display: inline-block; width: 8px; height: 8px; border-radius: 50%;
      background: #EF4444; flex-shrink: 0;
      animation: dtl-rec-blink 1s ease-in-out infinite;
    }
    @keyframes dtl-rec-blink { 0%,100%{opacity:1} 50%{opacity:.25} }
    .dtl-memo-timer {
      font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums;
      letter-spacing: .5px; color: var(--text-main);
    }
    .dtl-memo-timer.recording { color: #EF4444; }

    /* Player */
    .dtl-memo-player {
      display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    }
    .dtl-memo-play-btn {
      width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
      border: none; cursor: pointer; background: var(--brand); color: white;
      display: flex; align-items: center; justify-content: center;
      transition: opacity .15s; box-shadow: 0 2px 8px rgba(75,82,246,.35);
    }
    .dtl-memo-play-btn:hover { opacity: .88; }
    .dtl-memo-progress {
      flex: 1; -webkit-appearance: none; appearance: none;
      height: 4px; border-radius: 2px; background: #E2E8F0; outline: none; cursor: pointer;
    }
    .dtl-memo-progress::-webkit-slider-thumb {
      -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
      background: var(--brand); cursor: pointer; box-shadow: 0 1px 4px rgba(75,82,246,.4);
    }
    .dtl-memo-dur {
      font-size: 12px; font-weight: 600; color: var(--text-sub);
      white-space: nowrap; min-width: 30px; text-align: right; flex-shrink: 0;
    }
    .dtl-memo-del-btn {
      width: 32px; height: 32px; border-radius: 9px; border: none; cursor: pointer;
      background: #FEF2F2; color: #EF4444; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center; transition: background .15s;
    }
    .dtl-memo-del-btn:hover { background: #FEE2E2; }

    /* ================================================================
       PURPLE THEME — Task Detail Panel overrides
       (placed last so they win the cascade over base CSS above)
    ================================================================ */
    #task-detail-panel {
      background: #4B52F6;
      box-shadow: 0 -12px 50px rgba(0,0,0,0.28);
    }
    /* Drag handle */
    .dtl-drag-bar { background: rgba(255,255,255,0.28); }

    /* Header bar */
    .dtl-hdr { border-bottom-color: rgba(255,255,255,0.12); }
    .dtl-hdr-title { color: white; }
    .dtl-close-btn {
      background: rgba(255,255,255,0.14);
      border: 1px solid rgba(255,255,255,0.2);
      color: white;
    }
    .dtl-close-btn:hover { background: rgba(255,255,255,0.24); }

    /* Scrollbar on purple */
    .dtl-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); }

    /* White section cards — lift shadow so they pop on purple */
    .dtl-hero { box-shadow: 0 2px 14px rgba(0,0,0,0.14); }
    .dtl-sec  { box-shadow: 0 2px 14px rgba(0,0,0,0.14); }

    /* ══════════════════════════════════════════════
       DAILY VIEW
    ══════════════════════════════════════════════ */
    #task-scroll.daily-mode { padding: 0; overflow: hidden; }
    #daily-view-el { display: none; flex-direction: column; height: 100%; background: #f4f5fb; overflow: hidden; }
    #daily-view-el.active { display: flex; }

    /* 3-panel sliding track */
    #daily-track {
      display: flex; width: 300%; flex: 1; min-height: 0;
      transform: translateX(-33.3333%);
      will-change: transform;
    }
    .daily-panel {
      width: 33.3333%; flex-shrink: 0;
      display: flex; flex-direction: column;
      overflow: hidden; background: #f4f5fb;
    }

    /* date header */
    .daily-hdr { display: flex; justify-content: space-between; align-items: center;
      padding: 14px 16px 10px; background: #f4f5fb; flex-shrink: 0; }
    .daily-hdr-day  { font-size: 20px; font-weight: 900; color: #111827; letter-spacing: .3px; }
    .daily-hdr-date { font-size: 13px; font-weight: 700; color: #4B52F6; letter-spacing: .4px; }
    .daily-hdr-divider { height: 2.5px; background: #4B52F6; flex-shrink: 0; }
    .daily-hdr-nav { display: flex; align-items: center; gap: 4px; }
    .daily-nav-arrow {
      width: 30px; height: 30px; border-radius: 50%; border: none;
      background: rgba(75,82,246,.1); color: #4B52F6;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: background .15s; flex-shrink: 0;
      -webkit-tap-highlight-color: transparent;
    }
    .daily-nav-arrow:active { background: rgba(75,82,246,.22); }

    /* two-column grid */
    .daily-grid { display: flex; flex: 1; overflow: hidden; }

    /* left — schedule */
    .daily-col-sched { flex: 0 0 56%; display: flex; flex-direction: column;
      border-right: 1.5px solid #d1d5db; overflow: hidden; }
    .daily-block-hdr { background: #7478d9; color: white;
      font-size: 13.5px; font-weight: 700; padding: 8px 10px;
      text-align: center; flex-shrink: 0; }
    .daily-sched-rows { flex: 1; overflow-y: auto; }
    .daily-hour-row { display: flex; align-items: flex-start;
      border-bottom: 1px solid #e5e7eb; min-height: 44px; }
    .daily-hour-lbl { font-size: 10px; font-weight: 600; color: #6b7280;
      width: 46px; flex-shrink: 0; padding: 6px 4px 0 10px; }
    .daily-hour-tasks { flex: 1; padding: 3px 6px 3px 2px; }

    /* right — priority + todo */
    .daily-col-right { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
    .daily-priority-block { flex: 0 0 38%; display: flex; flex-direction: column;
      border-bottom: 1.5px solid #d1d5db; overflow: hidden; min-height: 0; }
    .daily-priority-list { flex: 1; overflow-y: auto; }
    .daily-todo-block    { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
    .daily-todo-list     { flex: 1; overflow-y: auto; }

    /* task row */
    .daily-task-item { display: flex; align-items: flex-start; gap: 8px;
      padding: 7px 8px; cursor: pointer;
      border-bottom: 1px solid rgba(0,0,0,0.045);
      -webkit-tap-highlight-color: transparent; transition: background .1s; }
    .daily-task-item:last-child { border-bottom: none; }
    .daily-task-item:active { background: #eef0ff; }
    .daily-cb { width: 17px; height: 17px; border-radius: 50%;
      border: 1.8px solid #94a3b8; flex-shrink: 0; margin-top: 1px;
      display: flex; align-items: center; justify-content: center; }
    .daily-cb.checked { border-color: #4B52F6; background: #4B52F6; }
    .daily-cb.checked::after { content: ''; display: block; width: 4px; height: 7px;
      border: 1.5px solid white; border-top: none; border-left: none;
      transform: rotate(45deg) translate(-1px,-1px); }
    .daily-task-title { font-size: 13px; color: #1f2937; line-height: 1.35;
      display: -webkit-box; -webkit-line-clamp: 2;
      -webkit-box-orient: vertical; overflow: hidden; }
    .daily-task-title.done { text-decoration: line-through; color: #9ca3af; }

    /* ── Location autocomplete dropdown ── */
    .location-wrap { position: relative; }
    #location-suggestions {
      display: none; position: absolute;
      top: calc(100% + 6px); left: 0; right: 0; z-index: 99999;
      background: #ffffff; border-radius: 16px;
      box-shadow: 0 8px 36px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
      border: 1px solid rgba(0,0,0,0.07);
      overflow: hidden; max-height: 280px; overflow-y: auto;
    }
    #location-suggestions.open { display: block; }
    .loc-suggestion {
      display: flex; align-items: flex-start; gap: 12px;
      padding: 13px 16px; cursor: pointer;
      border-bottom: 1px solid rgba(0,0,0,0.055);
      -webkit-tap-highlight-color: transparent;
      transition: background .12s;
    }
    .loc-suggestion:last-child { border-bottom: none; }
    .loc-suggestion:active, .loc-suggestion.hover { background: #EEF0FF; }
    .loc-sug-icon { flex-shrink: 0; color: var(--brand); margin-top: 1px; }
    .loc-sug-main { font-size: 14px; font-weight: 600; color: #1e293b; line-height: 1.35; }
    .loc-sug-sub  { font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.3; }

    /* ── Integrations View ─────────────────────────────────────── */
    #task-scroll.integrations-mode { padding: 0; overflow: hidden; }
    #integrations-view-el {
      display: none; flex-direction: column;
      height: 100%; background: #f4f5fb;
      overflow-y: auto; -webkit-overflow-scrolling: touch;
    }
    #integrations-view-el.active { display: flex; }
    .int-inner { padding: 20px 16px 40px; max-width: 480px; margin: 0 auto; width: 100%; }
    .int-page-title {
      font-size: 20px; font-weight: 800; color: #1e293b;
      letter-spacing: .3px; margin-bottom: 20px;
    }
    .int-section-lbl {
      font-size: 10px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 1.1px; color: #94a3b8; margin-bottom: 10px;
    }
    .int-card {
      background: white; border-radius: 16px;
      padding: 16px; display: flex; align-items: center; gap: 14px;
      box-shadow: 0 2px 12px rgba(79,70,229,.07);
      margin-bottom: 12px;
    }
    .int-card-icon {
      width: 44px; height: 44px; border-radius: 12px;
      background: #EEF0FF; display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .int-card-body { flex: 1; min-width: 0; }
    .int-card-title { font-size: 14px; font-weight: 700; color: #1e293b; }
    .int-card-sub   { font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.4; }
    .int-connect-btn {
      background: var(--brand); color: white;
      border: none; border-radius: 10px;
      padding: 9px 16px; font-size: 13px; font-weight: 700;
      cursor: pointer; white-space: nowrap; font-family: inherit;
      transition: opacity .15s;
    }
    .int-connect-btn:active { opacity: .8; }
    .int-connected-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
    .int-connected-badge {
      display: inline-flex; align-items: center; gap: 5px;
      background: #dcfce7; color: #16a34a;
      border-radius: 20px; padding: 5px 11px;
      font-size: 12px; font-weight: 700; white-space: nowrap;
    }
    .int-badge-dot {
      width: 7px; height: 7px; border-radius: 50%;
      background: #16a34a; flex-shrink: 0;
    }
    .int-disconnect-btn {
      background: none; border: 1.5px solid #e2e8f0;
      color: #64748b; border-radius: 8px;
      padding: 5px 11px; font-size: 12px; font-weight: 600;
      cursor: pointer; font-family: inherit; transition: all .15s;
    }
    .int-disconnect-btn:active { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
    .int-sync-card {
      background: white; border-radius: 16px;
      padding: 16px 16px 18px;
      box-shadow: 0 2px 12px rgba(79,70,229,.07);
      margin-bottom: 12px;
    }
    .int-sync-card-title { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 3px; }
    .int-sync-card-sub   { font-size: 12px; color: #64748b; line-height: 1.4; margin-bottom: 14px; }
    .int-sync-rule {
      display: flex; align-items: flex-start; gap: 10px;
      padding: 9px 0; border-bottom: 1px solid #f1f5f9;
    }
    .int-sync-rule:last-of-type { border-bottom: none; }
    .int-rule-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--brand); flex-shrink: 0; margin-top: 5px;
    }
    .int-rule-text { font-size: 12px; color: #475569; line-height: 1.5; }
    .int-rule-text strong { color: #1e293b; font-weight: 700; }
    .int-sync-all-btn {
      width: 100%; background: var(--brand); color: white;
      border: none; border-radius: 12px;
      padding: 13px; font-size: 14px; font-weight: 700;
      cursor: pointer; font-family: inherit;
      display: flex; align-items: center; justify-content: center; gap: 8px;
      margin-top: 14px; transition: opacity .15s;
    }
    .int-sync-all-btn:active { opacity: .8; }

    /* ── Cloud Sync & Backup panel ─────────────────────────────────── */
    @keyframes sync-pulse { 0%,100%{opacity:1}50%{opacity:.35} }
    .sync-live-badge {
      display:inline-flex;align-items:center;gap:6px;
      background:#dcfce7;color:#16a34a;border-radius:20px;
      padding:5px 12px;font-size:12px;font-weight:700;
    }
    .sync-live-dot {
      width:8px;height:8px;border-radius:50%;background:#16a34a;
      animation:sync-pulse 1.8s ease-in-out infinite;flex-shrink:0;
    }
    .int-feature-card {
      background:white;border-radius:16px;margin-bottom:10px;
      box-shadow:0 2px 12px rgba(79,70,229,.07);overflow:hidden;
    }
    .int-feature-row {
      display:flex;align-items:center;justify-content:space-between;
      padding:14px 16px;
    }
    .int-feature-lbl { font-size:14px;font-weight:700;color:#1e293b; }
    .int-feature-sub { font-size:12px;color:#64748b;margin-top:3px;line-height:1.4; }
    /* Toggle switch */
    .tog-wrap { position:relative;width:46px;height:27px;flex-shrink:0; }
    .tog-wrap input { opacity:0;width:0;height:0;position:absolute; }
    .tog-slider {
      position:absolute;inset:0;background:#CBD5E1;border-radius:14px;
      cursor:pointer;transition:background .2s;
    }
    .tog-slider::before {
      content:"";position:absolute;width:21px;height:21px;
      left:3px;top:3px;background:white;border-radius:50%;
      transition:transform .2s;box-shadow:0 1px 4px rgba(0,0,0,.2);
    }
    .tog-wrap input:checked + .tog-slider { background:#4B52F6; }
    .tog-wrap input:checked + .tog-slider::before { transform:translateX(19px); }
    /* Backup list */
    .backup-list-wrap { border-top:1px solid #f1f5f9; }
    .backup-list-hdr {
      display:flex;align-items:center;justify-content:space-between;
      padding:10px 16px 6px;
    }
    .backup-list-title { font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.7px;color:#94a3b8; }
    .backup-now-btn {
      background:none;border:1.5px solid var(--brand);color:var(--brand);
      border-radius:8px;padding:4px 11px;font-size:11.5px;font-weight:700;
      cursor:pointer;font-family:inherit;transition:all .15s;
    }
    .backup-now-btn:active { background:var(--brand);color:white; }
    .backup-item {
      display:flex;align-items:center;justify-content:space-between;
      padding:10px 16px;border-top:1px solid #f8faff;
    }
    .backup-ts { font-size:12.5px;color:#334155;font-weight:600; }
    .backup-count { font-size:11px;color:#94a3b8;margin-top:2px; }
    .restore-btn {
      background:var(--brand);color:white;border:none;border-radius:9px;
      padding:7px 14px;font-size:12px;font-weight:700;
      cursor:pointer;font-family:inherit;transition:opacity .15s;white-space:nowrap;
    }
    .restore-btn:active { opacity:.8; }
    .backup-empty { padding:16px;text-align:center;font-size:12.5px;color:#94a3b8;font-style:italic; }
    /* ================================================================
       RESPONSIVE DESIGN — Tablet & Desktop
    ================================================================ */
    

    

    

    /* ================================================================
       INSTALLED APP ONLY (iPhone home-screen icon)
       Matches only when launched standalone, so the PC browser and
       iPhone Safari are both unaffected. Shifts the whole app frame
       down 20px: both edges move together, so the frame keeps its
       height instead of being shortened from the top.
    ================================================================ */
    

@media (min-width: 768px) {
      /* Tablet and up */
      html, body {
        width: 100%;
        max-width: 100%;
      }
      #app-screen {
        width: 100%;
        max-width: 100%;
        box-shadow: none;
      }
      #login-screen {
        width: 100%;
        max-width: 100%;
        background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
        align-items: center;
        justify-content: center;
      }
      #login-card {
        width: 90%;
        max-width: 450px;
        margin: auto;
      }
      .controls-bar {
        width: 100vw;
        max-width: 100%;
        height: auto;
        bottom: auto;
        top: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        justify-content: space-between;
        border-bottom: 1px solid var(--border);
        padding: 12px 20px;
        gap: 20px;
      }
      #task-scroll {
        margin-top: 70px;
        max-width: 100%;
        width: 100%;
        padding: 0 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
      }
      .task-card {
        max-width: 600px;
        width: 100%;
        margin: 0 auto 12px;
        min-height: 80px;
        display: flex;
        align-items: stretch;
      }
    }
@media (min-width: 1024px) {
      /* Desktop */
      #login-card {
        max-width: 500px;
        padding: 40px 32px;
      }
      .login-input {
        padding: 14px 16px 14px 44px;
        font-size: 15px;
      }
      .task-card {
        max-width: 750px;
      }
      #task-scroll {
        padding: 0 40px;
      }
      .int-card {
        max-width: 800px;
      }
      .int-inner {
        max-width: 900px;
        margin: 0 auto;
      }
      .task-delete-bg {
        top: 50% !important;
        bottom: auto !important;
        height: 66.67% !important;
        transform: translateY(-50%) !important;
      }
    }
@media (min-width: 1440px) {
      /* Large desktop */
      .task-card {
        max-width: 900px;
      }
      #task-scroll {
        padding: 0 60px;
      }
      .int-inner {
        max-width: 1100px;
        margin: 0 auto;
      }
    }

    /* ================================================================
       The speed-dial FAB is a mobile-only component. Its markup is in
       index.html for every device, so hide it here; desktop keeps the
       bottom tab bar exactly as before.
    ================================================================ */
    .fab-wrap, .fab-scrim { display: none !important; }
