    :root {
      --primary: #2563eb;
      --primary-dark: #1d4ed8;
      --bg: #f8fafc;
      --card-bg: #ffffff;
      --text-main: #0f172a;
      --text-muted: #64748b;
      --border: #e2e8f0;
      --radius: 16px;
      --shadow: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
      --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
      --header-offset: calc(max(14px, calc(env(safe-area-inset-top, 0px) + 8px)) + 48px);
    }

    * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
    html, body {
      width: 100%;
      max-width: 100vw;
      overflow-x: hidden;
    }
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      background-color: transparent; /* Wallpaper layer handles background */
      color: var(--text-main);
      padding-top: var(--header-offset);
      padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 30px);
      padding-left: env(safe-area-inset-left, 0px);
      padding-right: env(safe-area-inset-right, 0px);
    }
    header {
      position: fixed; top: 0; left: 0; right: 0; width: 100%; z-index: 100;
      background: rgba(255, 255, 255, 0.94);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
      /* iPhone notch and status bar safe area clearance */
      padding-top: max(14px, calc(env(safe-area-inset-top, 0px) + 8px));
      padding-bottom: 12px;
      padding-left: max(16px, env(safe-area-inset-left, 0px));
      padding-right: max(16px, env(safe-area-inset-right, 0px));
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .header-bar {
      display: flex; justify-content: space-between; align-items: center; width: 100%;
      max-width: min(100% - 48px, 1720px);
      margin: 0 auto;
      gap: 12px;
    }
    @media (max-width: 768px) {
      .header-bar {
        max-width: 100%;
      }
    }
    @media (min-width: 769px) and (max-width: 1024px) {
      .header-bar {
        max-width: min(100% - 32px, 1000px);
      }
    }
    .header-nav-left {
      display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
    }
    .brand-breadcrumb {
      display: inline-flex; align-items: center; gap: 8px;
      cursor: pointer; user-select: none;
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
      flex-shrink: 0;
    }
    .brand-breadcrumb:hover { opacity: 0.88; transform: scale(1.02); }
    .brand-breadcrumb:active { transform: scale(0.97); }
    .home-logo-badge {
      display: inline-flex; align-items: center; justify-content: center;
      width: 32px; height: 32px; border-radius: 9px;
      background: linear-gradient(135deg, #2563eb, #3b82f6);
      color: #ffffff;
      box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
      flex-shrink: 0;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    .brand-breadcrumb:hover .home-logo-badge {
      transform: rotate(-5deg) scale(1.05);
      box-shadow: 0 3px 12px rgba(37, 99, 235, 0.4);
    }
    .home-logo-badge .icon-svg {
      width: 17px; height: 17px; stroke: currentColor; stroke-width: 2.2; fill: none;
    }
    .brand-text {
      font-weight: 700; font-size: 1.08rem; color: #0f172a;
      letter-spacing: -0.2px; white-space: nowrap;
    }
    .breadcrumb-separator {
      color: #94a3b8; font-size: 1rem; font-weight: 400; user-select: none; flex-shrink: 0;
    }
    .subpage-breadcrumb-title {
      display: inline-flex; align-items: center; gap: 6px;
      font-weight: 700; font-size: 1.02rem; color: #1e293b;
      letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      cursor: pointer; user-select: none; transition: opacity 0.2s;
    }
    .subpage-breadcrumb-title:hover { opacity: 0.82; }
    .subpage-icon-svg {
      width: 17px; height: 17px; stroke: #2563eb; stroke-width: 2.2; fill: none; flex-shrink: 0;
    }

    /* Modern SVG Icon Utility System */
    ui-icon, .ui-icon {
      width: 1.15em;
      height: 1.15em;
      vertical-align: -0.18em;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      fill: none;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex-shrink: 0;
      transition: transform 0.15s ease, stroke 0.15s ease, color 0.15s ease;
      line-height: 1;
    }
    ui-icon svg {
      width: 100%;
      height: 100%;
      display: block;
    }
    .btn ui-icon, .btn .ui-icon {
      margin-right: 5px;
      vertical-align: -0.16em;
    }
    .btn-icon-only ui-icon, .btn-icon-only .ui-icon {
      margin-right: 0;
    }
    .text-indigo { color: #4f46e5 !important; }
    .text-pink { color: #db2777 !important; }
    .text-emerald { color: #059669 !important; }
    .text-amber { color: #d97706 !important; }
    .text-sky { color: #0284c7 !important; }
    .text-rose { color: #e11d48 !important; }
    .text-violet { color: #7c3aed !important; }
    .text-orange { color: #ea580c !important; }
    .text-slate { color: #64748b !important; }
    .btn-copied-success {
      background: #ecfdf5 !important;
      color: #059669 !important;
      border-color: #a7f3d0 !important;
    }

    /* Bottom Storage Card & Footer */
    .app-footer {
      margin-top: 24px;
      padding-top: 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }
    .footer-storage-card {
      width: 100%;
      background: #ffffff;
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 14px 18px;
      box-shadow: var(--shadow);
    }
    .footer-storage-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    .footer-storage-title {
      font-size: 0.88rem;
      font-weight: 600;
      color: #334155;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .footer-storage-percent {
      font-size: 0.84rem;
      font-weight: 700;
      color: #0284c7;
    }
    .footer-storage-bar-wrap {
      width: 100%;
      height: 7px;
      background: #e2e8f0;
      border-radius: 999px;
      overflow: hidden;
      margin-bottom: 8px;
    }
    .footer-storage-bar {
      height: 100%;
      width: 0%;
      background: #0ea5e9;
      border-radius: 999px;
      transition: width 0.4s ease, background-color 0.3s;
    }
    .footer-storage-details {
      font-size: 0.78rem;
      color: #64748b;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    /* ── Centered 5-Box Bento Grid Dashboard ─────────────────────────── */
    .sys-bento-grid {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 14px;
      width: 100%;
      max-width: 1140px;
      margin: 0 auto;
    }

    .sys-bento-card {
      position: relative;
      background: rgba(255, 255, 255, 0.88);
      backdrop-filter: blur(24px) saturate(180%);
      -webkit-backdrop-filter: blur(24px) saturate(180%);
      border: 1px solid rgba(255, 255, 255, 0.75);
      border-radius: 16px;
      padding: 12px 14px 10px;
      box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.05),
                  inset 0 1px 0 rgba(255, 255, 255, 0.95);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      height: 116px;
      overflow: hidden;
      transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                  box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                  border-color 0.25s ease;
    }

    /* Ambient color glow & accent hairline */
    .sys-bento-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      border-radius: 16px 16px 0 0;
      opacity: 0.85;
      transition: height 0.25s ease, opacity 0.25s ease;
    }
    .sys-card-storage::before { background: linear-gradient(90deg, #0284c7, #38bdf8); }
    .sys-card-cpu::before     { background: linear-gradient(90deg, #059669, #34d399); }
    .sys-card-mem::before     { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
    .sys-card-net::before     { background: linear-gradient(90deg, #6366f1, #f59e0b); }
    .sys-card-status::before  { background: linear-gradient(90deg, #10b981, #06b6d4); }

    /* Hover interactive lift & ambient glow */
    .sys-bento-card:hover {
      transform: translateY(-4px);
      box-shadow: 0 14px 26px -4px rgba(15, 23, 42, 0.12),
                  inset 0 1px 0 #ffffff;
    }
    .sys-bento-card:hover::before {
      height: 4px;
      opacity: 1;
    }
    .sys-card-storage:hover { border-color: rgba(2, 132, 199, 0.35); box-shadow: 0 14px 26px -4px rgba(2, 132, 199, 0.18); }
    .sys-card-cpu:hover     { border-color: rgba(5, 150, 105, 0.35); box-shadow: 0 14px 26px -4px rgba(5, 150, 105, 0.18); }
    .sys-card-mem:hover     { border-color: rgba(59, 130, 246, 0.35); box-shadow: 0 14px 26px -4px rgba(59, 130, 246, 0.18); }
    .sys-card-net:hover     { border-color: rgba(99, 102, 241, 0.35); box-shadow: 0 14px 26px -4px rgba(99, 102, 241, 0.18); }
    .sys-card-status:hover  { border-color: rgba(16, 185, 129, 0.35); box-shadow: 0 14px 26px -4px rgba(16, 185, 129, 0.18); }

    /* Header */
    .sys-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      min-width: 0;
      gap: 6px;
    }
    .sys-card-title {
      font-size: 0.8rem;
      font-weight: 600;
      color: #334155;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .sys-card-title ui-icon {
      font-size: 0.95rem;
      color: #64748b;
      flex-shrink: 0;
    }
    .sys-card-value {
      font-size: 0.9rem;
      font-weight: 700;
      color: #0284c7;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .sys-card-value--net {
      font-size: 0.7rem;
      font-weight: 600;
      line-height: 1.25;
      text-align: right;
      white-space: nowrap;
      flex-shrink: 0;
    }

    /* Body (Middle area) */
    .sys-card-body {
      height: 38px;
      display: flex;
      align-items: center;
      position: relative;
    }
    .sys-body-storage {
      justify-content: center;
    }
    .sys-storage-progress-wrap {
      width: 100%;
      height: 8px;
      background: #f1f5f9;
      border-radius: 999px;
      overflow: hidden;
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    }
    .sys-storage-bar {
      height: 100%;
      background: linear-gradient(90deg, #0284c7, #38bdf8);
      border-radius: 999px;
      transition: width 0.4s ease, background-color 0.3s;
    }

    /* Sparkline SVG */
    .sys-sparkline {
      width: 100%;
      height: 38px;
      display: block;
      overflow: visible;
    }
    .spark-line {
      fill: none;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .spark-fill { stroke: none; }
    .spark-line-load { stroke: #10b981; filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.25)); }
    .spark-line-mem  { stroke: #0284c7; filter: drop-shadow(0 2px 4px rgba(2, 132, 199, 0.25)); }
    .spark-line-rx   { stroke: #6366f1; filter: drop-shadow(0 2px 3px rgba(99, 102, 241, 0.25)); }
    .spark-line-tx   { stroke: #f59e0b; filter: drop-shadow(0 2px 3px rgba(245, 158, 11, 0.25)); }

    /* Card 5 - Status Body & Badges */
    .sys-body-status {
      justify-content: center;
      align-items: center;
    }
    .sys-uptime-chip {
      font-size: 0.76rem;
      font-weight: 700;
      color: #1e293b;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      padding: 4px 8px;
      border-radius: 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      text-align: center;
    }
    .sys-temp-badge {
      font-size: 0.72rem;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 6px;
      line-height: 1.1;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .sys-temp-badge.temp-cool { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
    .sys-temp-badge.temp-warm { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
    .sys-temp-badge.temp-hot  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

    /* Live Breathing Pulse Dot */
    .sys-pulse-dot {
      display: inline-block;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #10b981;
      margin-right: 4px;
      vertical-align: middle;
      animation: sys-pulse 2s infinite ease-in-out;
    }
    @keyframes sys-pulse {
      0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
      }
      70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
      }
      100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
      }
    }

    /* Footer (subtext) */
    .sys-card-footer {
      font-size: 0.71rem;
      color: #94a3b8;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .sys-status-footer {
      color: #10b981;
      font-weight: 500;
      display: flex;
      align-items: center;
      min-width: 0;
    }
    .sys-status-footer #footerBoardInfo {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* ── Responsive ──────────────────────────────────────────────── */
    @media (max-width: 1040px) {
      .sys-bento-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 780px;
        gap: 12px;
      }
      .sys-card-net {
        grid-column: span 1;
      }
      .sys-card-status {
        grid-column: span 2;
      }
    }
    @media (max-width: 680px) {
      .sys-bento-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 440px;
        gap: 10px;
      }
      .sys-bento-card {
        height: 110px;
        padding: 10px 12px;
      }
      .sys-card-status {
        grid-column: span 2;
      }
    }

    .app-footer-brand {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-wrap: wrap;
      gap: 8px;
      font-size: 0.78rem;
      font-weight: 500;
      color: #1e293b;
      background: rgba(255, 255, 255, 0.92);
      border: 1px solid rgba(203, 213, 225, 0.85);
      padding: 6px 16px;
      border-radius: 999px;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      letter-spacing: 0.01em;
      transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
      user-select: none;
      margin-top: 4px;
    }
    .app-footer-brand:hover {
      background: #ffffff;
      border-color: #94a3b8;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
      transform: translateY(-1px);
    }
    .app-footer-brand .footer-brand-title {
      font-weight: 600;
      color: #0f172a;
    }
    .app-footer-brand .footer-brand-version {
      font-weight: 700;
      color: #0369a1;
      background: #e0f2fe;
      border: 1px solid #bae6fd;
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 0.74rem;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      letter-spacing: 0.02em;
    }
    .app-footer-brand .footer-brand-time {
      color: #475569;
      font-size: 0.74rem;
      font-weight: 500;
    }

    nav.tabs {
      display: flex; gap: 5px; background: #f1f5f9; padding: 3px; border-radius: 12px;
    }
    nav.tabs button {
      border: none; background: transparent; padding: 6px 11px; border-radius: 8px; font-size: 0.86rem;
      font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
    }
    .container {
      width: 100%;
      max-width: min(100% - 48px, 1720px);
      margin: 0 auto;
      padding: 16px 0;
    }
    @media (max-width: 768px) {
      .container {
        max-width: 100%;
        padding: 12px 14px;
      }
    }
    @media (min-width: 769px) and (max-width: 1024px) {
      .container {
        max-width: min(100% - 32px, 1000px);
        padding: 16px 0;
      }
    }
    .tab-content { display: none; }
    .tab-content.active { display: block; animation: fadeIn 0.2s ease-in; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

    .card {
      background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border);
      box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px;
    }
    .card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
    
    .dropzone {
      border: 2px dashed #cbd5e1; border-radius: 14px; padding: 22px 14px; text-align: center;
      background: #f8fafc; cursor: pointer; transition: border-color 0.2s; margin-bottom: 16px;
    }
    .dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #eff6ff; }
    .dropzone p { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
    .btn {
      display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 10px;
      font-size: 0.85rem; font-weight: 600; border: none; cursor: pointer; transition: 0.15s;
    }
    .btn-primary { background: var(--primary); color: #fff; }
    .btn-primary:hover { background: var(--primary-dark); }
    .btn-secondary { background: #e2e8f0; color: #334155; }
    .btn-secondary:hover { background: #cbd5e1; }
    .btn-success { background: #dcfce7; color: #166534; }
    .btn-success:hover { background: #bbf7d0; }
    .btn-warning { background: #fef3c7; color: #b45309; }
    .btn-warning:hover { background: #fde68a; }
    .btn-danger { background: #fee2e2; color: #dc2626; }
    .btn-danger:hover { background: #fecaca; }

    /* Clipboard Styles */
    .clip-list { display: flex; flex-direction: column; gap: 10px; }
    .clip-item {
      display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px;
      background: #f8fafc; border-radius: 12px; border: 1px solid var(--border); transition: background 0.15s;
    }
    .clip-item:hover { background: #f1f5f9; }
    .clip-content {
      font-size: 0.92rem; color: #1e293b; line-height: 1.45; word-break: break-all; white-space: pre-wrap; flex: 1;
    }
    .clip-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 4px; }

    /* ── Multi-Channel Transfer Hub & Split Workspace ───────────────── */
    .transfer-workspace-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 16px;
      align-items: start;
    }
    @media (min-width: 992px) {
      .transfer-workspace-grid {
        grid-template-columns: minmax(0, 1.32fr) minmax(320px, 0.88fr);
        gap: 20px;
      }
      .transfer-clipboard-card {
        position: sticky;
        top: 80px;
      }
    }
    .transfer-hub-card {
      position: relative;
      overflow: hidden;
      max-width: 100%;
    }
    .transfer-hub-header {
      margin-bottom: 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .transfer-header-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      width: 100%;
    }
    .transfer-header-title {
      font-size: 1.05rem;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--text-main);
    }
    .transfer-header-actions {
      display: flex;
      align-items: center;
    }
    .transfer-channel-tabs {
      display: flex;
      width: 100%;
      background: #f1f5f9;
      padding: 3px;
      border-radius: 12px;
      gap: 4px;
      box-sizing: border-box;
      max-width: 100%;
    }
    .transfer-tab-btn {
      flex: 1;
      min-width: 0;
      border: none;
      background: transparent;
      padding: 6px 8px;
      border-radius: 9px;
      font-size: 0.82rem;
      font-weight: 600;
      color: #64748b;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      white-space: nowrap;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .transfer-tab-btn:hover {
      color: #1e293b;
      background: rgba(255, 255, 255, 0.6);
    }
    .transfer-tab-btn.active {
      background: #ffffff;
      color: #0f172a;
      box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.12);
    }
    .tab-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      display: inline-block;
      flex-shrink: 0;
    }
    .dot-local { background: #10b981; }
    .dot-pan   { background: #0284c7; }
    .dot-od    { background: #0078d4; }
    .tab-badge {
      font-size: 0.68rem;
      padding: 1px 5px;
      border-radius: 6px;
      background: #f8fafc;
      color: #94a3b8;
      font-weight: 500;
      max-width: 55px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: inline-block;
      vertical-align: middle;
    }
    .transfer-tab-btn.active .tab-badge {
      background: #f1f5f9;
      color: #475569;
    }
    @media (max-width: 640px) {
      .tab-label-suffix {
        display: none;
      }
      .transfer-tab-btn {
        padding: 6px 4px;
        font-size: 0.78rem;
        gap: 4px;
      }
      .transfer-tab-btn .tab-badge {
        font-size: 0.68rem;
        padding: 1px 4px;
        max-width: 60px;
      }
      .transfer-tab-btn[data-channel="onedrive"] .tab-badge {
        display: none;
      }
    }
    @media (min-width: 769px) {
      .transfer-hub-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
      }
      .transfer-header-top {
        width: auto;
        gap: 16px;
      }
      .transfer-channel-tabs {
        width: auto;
        display: inline-flex;
      }
      .transfer-tab-btn {
        flex: 0 0 auto;
        padding: 6px 14px;
      }
      .tab-badge {
        max-width: 90px;
      }
    }

    .transfer-channel-banner {
      background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.85));
      border: 1px solid rgba(226, 232, 240, 0.8);
      border-radius: 12px;
      padding: 7px 12px;
      margin-bottom: 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }
    .transfer-banner-info {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .channel-indicator-icon {
      font-size: 1.15rem;
      line-height: 1;
    }
    .transfer-banner-text strong {
      font-size: 0.84rem;
      font-weight: 600;
      color: #1e293b;
    }
    .transfer-banner-text span {
      display: none;
    }
    .transfer-stat-chip {
      font-size: 0.72rem;
      font-weight: 600;
      color: #334155;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      padding: 3px 8px;
      border-radius: 6px;
      white-space: nowrap;
    }

    /* Connect prompt */
    .transfer-connect-prompt {
      background: #fffbeb;
      border: 1px dashed #f59e0b;
      border-radius: 12px;
      padding: 14px 16px;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      gap: 14px;
      flex-wrap: wrap;
    }
    .prompt-icon {
      font-size: 1.8rem;
    }
    .prompt-text {
      flex: 1;
      min-width: 200px;
    }
    .prompt-text h4 {
      margin: 0 0 3px 0;
      font-size: 0.92rem;
      color: #92400e;
    }
    .prompt-text p {
      margin: 0;
      font-size: 0.78rem;
      color: #b45309;
    }

    /* ── Transfer Task Board & Queue Manager ── */
    .transfer-task-board {
      background: #ffffff;
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      padding: 12px 14px;
      margin-bottom: 14px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
      transition: all 0.2s ease;
    }
    .task-board-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    .task-board-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.86rem;
      font-weight: 700;
      color: #1e293b;
    }
    .pulse-indicator {
      width: 8px;
      height: 8px;
      background: #0284c7;
      border-radius: 50%;
      box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
      animation: taskPulse 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
    }
    @keyframes taskPulse {
      to {
        box-shadow: 0 0 0 8px rgba(2, 132, 199, 0);
      }
    }
    .task-board-actions {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .btn-xs {
      padding: 3px 8px;
      font-size: 0.72rem;
      border-radius: 6px;
      font-weight: 600;
      cursor: pointer;
    }
    .btn-outline {
      background: #f8fafc;
      border: 1px solid #cbd5e1;
      color: #475569;
    }
    .btn-outline:hover {
      background: #f1f5f9;
      color: #1e293b;
    }
    .btn-outline-danger {
      background: #fff1f2;
      border: 1px solid #fecdd3;
      color: #e11d48;
    }
    .btn-outline-danger:hover {
      background: #ffe4e6;
    }
    .task-board-toggle-btn {
      background: transparent;
      border: none;
      color: #64748b;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      padding: 3px 4px;
      border-radius: 4px;
      transition: transform 0.2s ease;
    }
    .task-board-toggle-btn.collapsed {
      transform: rotate(-90deg);
    }
    .task-board-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: 380px;
      overflow-y: auto;
      padding-right: 2px;
    }
    .task-board-list.collapsed {
      display: none;
    }

    /* Individual Task Card */
    .task-card {
      border: 1px solid #e2e8f0;
      background: #f8fafc;
      border-radius: 10px;
      padding: 9px 12px;
      position: relative;
      transition: border-color 0.2s, background 0.2s;
    }
    .task-card.status-uploading {
      border-color: #bae6fd;
      background: #f0f9ff;
    }
    .task-card.status-completed {
      border-color: #a7f3d0;
      background: #f0fdf4;
    }
    .task-card.status-paused {
      border-color: #fed7aa;
      background: #fffbeb;
    }
    .task-card.status-cancelled {
      border-color: #e2e8f0;
      background: #f8fafc;
      opacity: 0.85;
    }
    .task-card.status-failed {
      border-color: #fecdd3;
      background: #fff1f2;
    }
    .task-card.status-interrupted {
      border-color: #fde68a;
      background: #fefce8;
    }

    .task-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
    }
    .task-card-info {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      flex: 1;
    }
    .task-file-icon {
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .task-file-details {
      min-width: 0;
      flex: 1;
    }
    .task-filename {
      font-size: 0.82rem;
      font-weight: 600;
      color: #1e293b;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.3;
    }
    .task-badges {
      display: flex;
      align-items: center;
      gap: 5px;
      margin-top: 2px;
      flex-wrap: wrap;
    }
    .task-status-pill {
      font-size: 0.65rem;
      font-weight: 600;
      padding: 1px 5px;
      border-radius: 4px;
      line-height: 1.2;
    }
    .pill-uploading   { background: #0284c7; color: #ffffff; }
    .pill-completed   { background: #10b981; color: #ffffff; }
    .pill-paused      { background: #f59e0b; color: #ffffff; }
    .pill-cancelled   { background: #94a3b8; color: #ffffff; }
    .pill-failed      { background: #ef4444; color: #ffffff; }
    .pill-interrupted { background: #d97706; color: #ffffff; }

    .task-card-actions {
      display: flex;
      align-items: center;
      gap: 5px;
      flex-shrink: 0;
    }
    .task-btn {
      font-size: 0.7rem;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 5px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      border: 1px solid transparent;
      transition: all 0.15s ease;
    }
    .task-btn-cancel {
      background: #fee2e2;
      color: #dc2626;
      border-color: #fca5a5;
    }
    .task-btn-cancel:hover {
      background: #fecaca;
    }
    .task-btn-pause {
      background: #fef3c7;
      color: #b45309;
      border-color: #fcd34d;
    }
    .task-btn-pause:hover {
      background: #fde68a;
    }
    .task-btn-resume {
      background: #e0e7ff;
      color: #4338ca;
      border-color: #c7d2fe;
    }
    .task-btn-resume:hover {
      background: #c7d2fe;
    }
    .task-btn-remove {
      background: #f1f5f9;
      color: #64748b;
      border-color: #cbd5e1;
    }
    .task-btn-remove:hover {
      background: #e2e8f0;
      color: #1e293b;
    }

    /* Progress bar in card */
    .task-progress-track {
      height: 6px;
      background: #e2e8f0;
      border-radius: 999px;
      overflow: hidden;
      margin: 6px 0 5px 0;
    }
    .task-progress-fill {
      height: 100%;
      border-radius: 999px;
      transition: width 0.2s linear;
    }
    .task-progress-fill.fill-uploading {
      background: linear-gradient(90deg, #0284c7, #38bdf8);
    }
    .task-progress-fill.fill-completed {
      background: #10b981;
    }
    .task-progress-fill.fill-paused {
      background: #f59e0b;
    }
    .task-progress-fill.fill-cancelled {
      background: #cbd5e1;
    }
    .task-progress-fill.fill-failed {
      background: #ef4444;
    }
    .task-progress-fill.fill-interrupted {
      background: #fbbf24;
    }

    .task-card-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.72rem;
      color: #64748b;
      gap: 6px;
    }
    .task-stats-size {
      font-variant-numeric: tabular-nums;
    }
    .task-stats-speed {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-weight: 700;
      color: #0284c7;
      font-variant-numeric: tabular-nums;
    }
    .task-stats-eta {
      font-variant-numeric: tabular-nums;
    }
    .task-error-msg {
      font-size: 0.72rem;
      color: #dc2626;
      margin-top: 4px;
      padding: 3px 6px;
      background: #fee2e2;
      border-radius: 4px;
      word-break: break-word;
    }

    /* File List & Items */
    .file-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .file-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 14px;
      background: #f8fafc;
      border-radius: 12px;
      border: 1px solid var(--border);
      transition: background 0.15s, transform 0.15s;
    }
    .file-item:hover {
      background: #f1f5f9;
      transform: translateY(-1px);
    }
    .file-item-left {
      display: flex;
      align-items: center;
      gap: 12px;
      overflow: hidden;
      flex: 1;
    }
    .file-item-icon {
      font-size: 1.5rem;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 38px;
      height: 38px;
      border-radius: 10px;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      flex-shrink: 0;
    }
    .file-item-info {
      overflow: hidden;
      min-width: 0;
    }
    .file-name {
      font-weight: 600;
      font-size: 0.9rem;
      color: #1e293b;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-bottom: 2px;
    }
    .file-meta {
      font-size: 0.75rem;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }
    .file-item-actions {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }

    /* Channel badges */
    .channel-pill-badge {
      display: inline-flex;
      align-items: center;
      font-size: 0.68rem;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 6px;
      line-height: 1.2;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .badge-ch-local    { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
    .badge-ch-pan123   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
    .badge-ch-onedrive { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }

    @media (max-width: 640px) {
      .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
      }
      .file-item-left {
        width: 100%;
        gap: 10px;
      }
      .file-item-actions {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
        border-top: 1px solid rgba(226, 232, 240, 0.6);
        padding-top: 8px;
      }
      .file-item-actions button,
      .file-item-actions a {
        flex: 1;
        justify-content: center;
        text-align: center;
        padding: 7px 10px !important;
        font-size: 0.8rem !important;
      }
      .file-item-actions .btn-danger {
        flex: 0 0 38px;
        padding: 7px 0 !important;
      }
    }

    /* Photos Styles (Google Photos & Family Hub) */
    #photoSearchInput:-webkit-autofill,
    #photoSearchInput:-webkit-autofill:hover, 
    #photoSearchInput:-webkit-autofill:focus {
      -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
      box-shadow: 0 0 0px 1000px #ffffff inset !important;
      -webkit-text-fill-color: var(--text-main) !important;
      transition: background-color 5000s ease-in-out 0s;
    }
    .photo-filter-container {
      display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 16px;
      scrollbar-width: thin; -webkit-overflow-scrolling: touch;
    }
    .photo-filter-pill {
      border: 1px solid var(--border); background: #f8fafc; color: #475569;
      font-size: 0.82rem; padding: 5px 14px; border-radius: 999px; cursor: pointer;
      white-space: nowrap; transition: all 0.15s ease; font-weight: 500;
    }
    .photo-filter-pill:hover { background: #e2e8f0; color: #1e293b; }
    .photo-filter-pill.active {
      background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600;
      box-shadow: 0 2px 8px rgba(37,99,235,0.25);
    }

    .photo-date-group { margin-bottom: 24px; }
    .photo-date-header {
      display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
      padding-bottom: 6px; border-bottom: 1px solid rgba(226,232,240,0.8);
      position: sticky; top: 0; background: rgba(255,255,255,0.92); backdrop-filter: blur(8px);
      z-index: 5; padding-top: 6px;
    }
    .photo-date-title {
      font-weight: 700; font-size: 0.98rem; color: #1e293b; display: inline-flex; align-items: center; gap: 6px;
    }
    .photo-date-title.photo-month-title {
      font-size: 1.05rem; font-weight: 700; color: #1e293b;
    }
    .photo-date-title.photo-year-title {
      font-size: 1.15rem; font-weight: 800; color: #2563eb;
    }
    .photo-date-count { font-size: 0.78rem; color: #64748b; font-weight: 500; }

    :root {
      --photo-grid-columns: 6;
    }
    @media (min-width: 1600px) {
      :root {
        --photo-grid-columns: 7;
      }
    }
    @media (min-width: 769px) and (max-width: 1024px) {
      :root {
        --photo-grid-columns: 4;
      }
    }
    @media (max-width: 768px) {
      :root {
        --photo-grid-columns: 3;
      }
    }

    .photo-grid-layout {
      display: grid;
      grid-template-columns: repeat(var(--photo-grid-columns, 4), minmax(0, 1fr));
      gap: 10px;
      transition: grid-template-columns 0.22s cubic-bezier(0.2, 0, 0.2, 1);
    }
    @media (max-width: 768px) {
      .photo-grid-layout {
        gap: 6px;
      }
    }

    .photo-columns-control {
      display: inline-flex; align-items: center; background: #f1f5f9;
      border-radius: 8px; padding: 2px 6px; gap: 4px; border: 1px solid #e2e8f0;
    }
    .photo-columns-control .btn-icon {
      width: 24px; height: 24px; font-size: 11px; padding: 0;
      border-radius: 4px; border: none; background: transparent; color: #475569;
      cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
      transition: all 0.15s;
    }
    .photo-columns-control .btn-icon:hover { background: #e2e8f0; color: #0f172a; }
    .photo-columns-badge {
      font-size: 0.76rem; font-weight: 700; color: #334155; min-width: 30px; text-align: center;
      user-select: none;
    }
    @media (max-width: 768px) {
      .photo-columns-control { display: none; }
    }

    .photo-card {
      position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1/1;
      background: #f1f5f9; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
      contain: content;
    }
    .photo-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
    .photo-thumb-wrap { width: 100%; height: 100%; position: relative; }
    .photo-thumb-wrap img {
      width: 100%; height: 100%; object-fit: cover; display: block;
      transition: opacity 0.3s ease; opacity: 0;
    }
    .photo-thumb-wrap img.loaded { opacity: 1; }

    .photo-video-badge {
      position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,0.72); color: #fff;
      font-size: 0.72rem; padding: 2px 6px; border-radius: 4px; font-weight: 600;
      backdrop-filter: blur(6px); display: inline-flex; align-items: center; gap: 3px;
      letter-spacing: 0.2px; line-height: 1.2; box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }
    .photo-fav-btn {
      position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.45); color: #fff;
      border: none; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center;
      justify-content: center; font-size: 13px; opacity: 0; transition: opacity 0.2s, color 0.15s; cursor: pointer;
    }
    .photo-fav-btn.active { color: #ef4444; background: rgba(255,255,255,0.9); }

    /* Selection Mode & Card Checkbox */
    .photo-select-checkbox {
      position: absolute; top: 7px; left: 7px; width: 22px; height: 22px;
      border-radius: 50%; border: 2px solid rgba(255,255,255,0.9);
      background: rgba(15,23,42,0.45); backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      display: none; align-items: center; justify-content: center;
      cursor: pointer; z-index: 10; transition: all 0.15s ease;
      color: transparent; box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    }
    .photo-select-checkbox svg { width: 13px; height: 13px; stroke-width: 3; }
    .photo-grid-layout.select-mode-active .photo-select-checkbox {
      display: flex;
    }
    .photo-card.selected .photo-select-checkbox {
      background: #2563eb; border-color: #ffffff; color: #ffffff;
      box-shadow: 0 2px 8px rgba(37,99,235,0.6);
    }
    .photo-card.selected {
      transform: scale(0.96);
    }
    .photo-card.selected .photo-thumb-wrap {
      outline: 3px solid #2563eb; outline-offset: -3px; border-radius: 10px;
    }
    .photo-grid-layout.select-mode-active .photo-fav-btn {
      display: none !important;
    }

    /* Floating Batch Bar */
    .photo-batch-bar {
      position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
      z-index: 990; display: flex; align-items: center; justify-content: space-between;
      gap: 16px; background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.18);
      border-radius: 999px; padding: 8px 18px; box-shadow: 0 12px 36px rgba(0,0,0,0.45);
      color: #ffffff; max-width: 92vw; animation: batchBarPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes batchBarPop {
      from { transform: translate(-50%, 40px) scale(0.95); opacity: 0; }
      to { transform: translate(-50%, 0) scale(1); opacity: 1; }
    }
    .batch-bar-left, .batch-bar-right {
      display: flex; align-items: center; gap: 8px;
    }
    .batch-count-badge {
      font-size: 0.85rem; font-weight: 700; color: #93c5fd; padding: 2px 8px;
      white-space: nowrap;
    }
    .batch-bar-btn {
      border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.12);
      color: #f8fafc; font-size: 0.82rem; font-weight: 600; padding: 6px 12px;
      border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center;
      gap: 5px; transition: all 0.15s ease; white-space: nowrap;
    }
    .batch-bar-btn:hover { background: rgba(255,255,255,0.22); color: #ffffff; }
    .batch-bar-btn.btn-primary {
      background: #2563eb; border-color: #3b82f6; color: #ffffff;
    }
    .batch-bar-btn.btn-primary:hover { background: #1d4ed8; }
    .batch-bar-btn.btn-danger {
      background: #dc2626; border-color: #ef4444; color: #ffffff;
    }
    .batch-bar-btn.btn-danger:hover { background: #b91c1c; }
    .batch-bar-btn.batch-bar-close {
      width: 28px; height: 28px; padding: 0; justify-content: center;
      border-radius: 50%;
    }
    @media (max-width: 768px) {
      .photo-batch-bar {
        bottom: 16px; width: calc(100% - 24px); border-radius: 16px; padding: 8px 12px;
        flex-wrap: wrap; justify-content: space-between; gap: 8px;
      }
      .batch-bar-btn { padding: 6px 10px; font-size: 0.78rem; }
    }

    .photo-picker-banner {
      background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
      border: 1px solid #bfdbfe; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px;
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
    }
    .photo-pulse-dot {
      width: 10px; height: 10px; border-radius: 50%; background: #2563eb;
      animation: photoPulse 1.4s infinite ease-in-out;
    }
    @keyframes photoPulse {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.6); opacity: 0.4; }
    }

    .photo-empty-state {
      text-align: center; padding: 60px 20px; background: #f8fafc; border-radius: 14px;
      border: 1px dashed var(--border); margin: 20px 0;
    }

    /* Lightbox Modal */
    .photo-lightbox-modal {
      display: none; position: fixed; inset: 0; z-index: 99999;
      flex-direction: column; overflow: hidden; user-select: none;
      overscroll-behavior: none; touch-action: none;
    }
    .photo-lightbox-modal.active { display: flex; }
    .lightbox-backdrop {
      position: absolute; inset: 0; background: rgba(0,0,0,0.95); backdrop-filter: blur(14px);
    }
    .lightbox-header {
      position: relative; z-index: 20; display: flex; justify-content: space-between; align-items: center;
      padding: max(16px, env(safe-area-inset-top)) 28px 12px 28px; color: #fff;
      background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
    }
    .lightbox-header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
    .lightbox-btn-circle {
      background: rgba(255,255,255,0.14); color: #fff; border: 1px solid rgba(255,255,255,0.18);
      width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: all 0.15s; flex-shrink: 0; backdrop-filter: blur(8px);
    }
    .lightbox-btn-circle:hover { background: rgba(255,255,255,0.28); transform: scale(1.05); }
    .lightbox-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    .lightbox-title { font-size: 0.95rem; font-weight: 700; max-width: 48vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f8fafc; }
    .lightbox-sub { font-size: 0.78rem; color: #94a3b8; display: flex; align-items: center; gap: 8px; }
    .lightbox-counter-badge {
      background: rgba(255,255,255,0.16); font-size: 0.72rem; font-weight: 600;
      padding: 1px 8px; border-radius: 999px; color: #f1f5f9; white-space: nowrap;
    }

    /* Desktop Floating Actions Pill */
    .lightbox-actions-pill {
      display: flex; align-items: center; gap: 4px;
      background: rgba(15, 23, 42, 0.78); backdrop-filter: blur(16px);
      border: 1px solid rgba(255,255,255,0.2); border-radius: 999px;
      padding: 4px 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    }
    .lightbox-actions-pill .btn-icon {
      background: transparent; color: #cbd5e1; border: none; width: 36px; height: 36px;
      border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
      transition: all 0.15s; font-size: 1rem;
    }
    .lightbox-actions-pill .btn-icon:hover { background: rgba(255,255,255,0.2); color: #fff; transform: scale(1.08); }
    .lightbox-actions-pill .btn-icon.active { color: #ef4444; }
    .lightbox-actions-pill .btn-icon.btn-danger:hover { background: rgba(239, 68, 68, 0.25); color: #f87171; }
    .lightbox-actions-pill .pill-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.2); margin: 0 4px; }

    /* Mobile Floating Bottom Bar */
    .lightbox-bottom-bar {
      display: none; position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
      z-index: 30; background: rgba(15, 23, 42, 0.88); backdrop-filter: blur(20px);
      border: 1px solid rgba(255,255,255,0.22); border-radius: 999px;
      padding: 6px 20px; gap: 24px; align-items: center;
      box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    }
    .lightbox-bottom-btn {
      background: none; border: none; color: #cbd5e1; display: flex; flex-direction: column;
      align-items: center; gap: 3px; font-size: 0.72rem; cursor: pointer; transition: all 0.15s;
      white-space: nowrap; min-width: 42px; text-align: center;
    }
    .lightbox-bottom-btn span { white-space: nowrap; }
    .lightbox-bottom-btn ui-icon { width: 20px; height: 20px; }
    .lightbox-bottom-btn:hover, .lightbox-bottom-btn:active { color: #fff; transform: scale(1.08); }
    .lightbox-bottom-btn.active { color: #ef4444; }
    .lightbox-bottom-btn.btn-danger { color: #f87171; }

    /* 3-Slide Carousel Track & Lightbox Viewport */
    .lightbox-body {
      position: relative; z-index: 10; flex: 1; display: flex; align-items: center; justify-content: space-between;
      padding: 0; overflow: hidden; width: 100%; height: 100%;
    }
    .lightbox-stage {
      flex: 1; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center;
      position: relative; overflow: hidden; padding: 0;
    }
    .lightbox-slider-track {
      position: absolute; inset: 0; width: 100%; height: 100%;
      display: flex; will-change: transform;
    }
    .lightbox-slide {
      position: absolute; inset: 0; width: 100%; height: 100%;
      display: flex; align-items: center; justify-content: center;
      padding: 0; overflow: hidden; user-select: none; -webkit-user-select: none;
    }
    .lightbox-slide.slot-prev {
      transform: translate3d(-100%, 0, 0);
    }
    .lightbox-slide.slot-curr {
      transform: translate3d(0, 0, 0);
    }
    .lightbox-slide.slot-next {
      transform: translate3d(100%, 0, 0);
    }
    .lightbox-img, .lightbox-video {
      max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain;
      border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
      touch-action: none; -webkit-user-drag: none;
    }
    .lightbox-arrow {
      background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.15); width: 44px; height: 44px;
      border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
      transition: all 0.15s; z-index: 15; backdrop-filter: blur(8px); margin: 0 16px; flex-shrink: 0;
    }
    .lightbox-arrow:hover { background: rgba(255,255,255,0.28); transform: scale(1.08); }

    .lightbox-exif-panel {
      position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
      z-index: 25; display: none; flex-wrap: wrap; gap: 8px; justify-content: center;
      background: rgba(15, 23, 42, 0.88); backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      padding: 8px 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.18);
      max-width: 92vw; box-shadow: 0 8px 32px rgba(0,0,0,0.6);
      transition: all 0.2s ease;
    }
    .lightbox-exif-tag {
      font-size: 0.8rem; color: #f1f5f9; display: inline-flex; align-items: center; gap: 4px;
      white-space: nowrap;
    }
    .lightbox-mobile-close { display: none; }

    @media (max-width: 768px) {
      .lightbox-header {
        position: absolute; top: 0; left: 0; right: 0; z-index: 25;
        padding: max(12px, env(safe-area-inset-top)) 16px 12px 16px;
        background: linear-gradient(180deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.2) 65%, transparent 100%);
        pointer-events: none;
      }
      .lightbox-header * { pointer-events: auto; }
      .lightbox-actions-pill { display: none; }
      .lightbox-mobile-close { display: flex !important; }
      .lightbox-bottom-bar { display: flex; z-index: 30; }
      .lightbox-title { max-width: 60vw; }
      .lightbox-arrow { display: none !important; }
      .lightbox-body {
        position: absolute; inset: 0; width: 100%; height: 100%;
        padding: 0 !important; margin: 0 !important; overflow: hidden;
      }
      .lightbox-stage {
        padding: 0 !important; width: 100vw; height: 100%;
        display: flex; align-items: center; justify-content: center;
        touch-action: none;
      }
      .lightbox-slide {
        padding: 0 !important; width: 100vw; height: 100%;
      }
      .lightbox-img, .lightbox-video {
        width: 100%;
        max-width: 100vw;
        height: 100%;
        max-height: 100%;
        object-fit: contain;
        border-radius: 0 !important;
        box-shadow: none !important;
        touch-action: none;
        -webkit-user-drag: none;
      }
      .lightbox-exif-panel {
        bottom: 84px !important;
        border-radius: 16px !important;
        padding: 10px 14px !important;
        max-width: 90vw !important;
      }
    }

    /* ================= 🌟 PHOTO HEADER & UNIFIED STRIP ================= */
    .photo-header-bar {
      display: flex; justify-content: space-between; align-items: center;
      width: 100%; padding: 4px 0 10px 0; gap: 8px;
    }
    .photo-header-left {
      display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; overflow: hidden;
    }
    .photo-header-title {
      font-size: 1.08rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
      white-space: nowrap; flex-shrink: 0;
    }
    .photo-desktop-actions {
      display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    }
    .photo-header-btn {
      height: 36px; padding: 0 14px; font-size: 0.82rem;
      display: inline-flex; align-items: center; justify-content: center; gap: 6px;
      border-radius: 18px; white-space: nowrap; line-height: 1;
    }
    .photo-header-icon-btn {
      width: 36px; height: 36px; min-width: 36px; border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      background: var(--card-bg); border: 1px solid var(--border);
      color: var(--text-main); cursor: pointer; transition: all 0.15s;
    }
    .photo-header-icon-btn:hover {
      background: var(--bg-hover, #f1f5f9); border-color: #cbd5e1;
    }
    .photo-header-icon-btn:active { transform: scale(0.92); }
    .photo-mobile-actions {
      display: none; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto;
    }
    .photo-mobile-btn {
      width: 36px; height: 36px; border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      background: var(--card-bg); border: 1px solid var(--border);
      color: var(--text-main); cursor: pointer; transition: all 0.15s;
    }
    .photo-mobile-btn:active { transform: scale(0.92); }
    .photo-mobile-btn.active {
      background: #2563eb; color: #fff; border-color: #2563eb;
    }

    @media (max-width: 768px) {
      .photo-desktop-actions { display: none !important; }
      .photo-mobile-actions { display: flex !important; }
      .photo-header-bar { padding: 4px 0 6px 0; gap: 8px; }
      .photo-stats-extra { display: none !important; }
      #photoStatsBadge {
        max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        font-size: 0.72rem; padding: 3px 8px;
      }
    }
    @media (max-width: 480px) {
      .photo-stats-cloud-label { display: none !important; }
      #photoStatsBadge { max-width: 95px; }
    }

    /* Expandable Search Bar */
    .photo-search-wrapper {
      margin: 0 0 10px 0;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @media (max-width: 768px) {
      .photo-search-wrapper {
        display: none;
        margin: 0 0 8px 0;
      }
      .photo-search-wrapper.expanded {
        display: block;
        animation: slideDown 0.2s ease-out;
      }
    }
    .photo-search-form {
      position: relative; width: 100%; display: flex; align-items: center; margin: 0;
    }
    .photo-search-icon {
      position: absolute; left: 12px; color: #94a3b8; display: flex; align-items: center; pointer-events: none;
    }
    .photo-search-input {
      width: 100%; padding: 7px 36px 7px 36px; border: 1px solid var(--border);
      border-radius: 10px; font-size: 0.88rem; background: var(--card-bg);
      color: var(--text-main); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
    }
    .photo-search-input:focus {
      border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    }
    .photo-search-clear {
      position: absolute; right: 10px; background: transparent; border: none;
      color: #94a3b8; cursor: pointer; padding: 4px; display: flex; align-items: center;
    }

    /* AI Smart Tags Dropdown & Quick Filter Chips */
    .photo-ai-tags-dropdown {
      margin-top: 8px; padding: 10px 14px; background: var(--card-bg);
      border: 1px solid var(--border); border-radius: 12px;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
      display: flex; flex-direction: column; gap: 8px;
      animation: slideDown 0.15s ease-out;
    }
    .photo-ai-tags-header {
      display: flex; justify-content: space-between; align-items: center;
      font-size: 0.75rem; color: #64748b; font-weight: 600;
    }
    .photo-ai-tags-container {
      display: flex; flex-wrap: wrap; gap: 6px; max-height: 140px; overflow-y: auto;
    }
    .photo-ai-tag-chip {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 4px 10px; border-radius: 999px; font-size: 0.76rem;
      background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0;
      cursor: pointer; transition: all 0.15s ease; user-select: none;
    }
    .photo-ai-tag-chip:hover {
      background: #e0f2fe; color: #0369a1; border-color: #bae6fd; transform: translateY(-1px);
    }
    .photo-ai-tag-chip.active {
      background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600;
      box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    }
    .photo-ai-tag-count {
      font-size: 0.7rem; opacity: 0.75;
    }

    /* Lightbox & Detail Tag Pills */
    .lightbox-tags-row {
      display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
    }
    .lightbox-tag-pill {
      display: inline-flex; align-items: center; gap: 3px;
      padding: 2px 8px; border-radius: 999px; font-size: 0.72rem;
      background: rgba(255, 255, 255, 0.18); color: #fff;
      backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.15);
    }

    /* Unified Single-Row Filter Strip */
    .photo-unified-filter-strip {
      display: flex; align-items: center; gap: 8px; overflow-x: auto;
      white-space: nowrap; padding: 2px 2px 8px 2px; margin-bottom: 8px;
      scrollbar-width: thin; -webkit-overflow-scrolling: touch;
    }
    .photo-unified-filter-strip::-webkit-scrollbar { height: 4px; }
    .photo-unified-filter-strip::-webkit-scrollbar-thumb {
      background: rgba(148, 163, 184, 0.3); border-radius: 999px;
    }
    .filter-strip-group {
      display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    }
    .filter-strip-divider {
      width: 1px; height: 18px; background: #cbd5e1; flex-shrink: 0; margin: 0 2px;
    }
    .photo-filter-pill {
      display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px;
      font-size: 0.8rem; font-weight: 500; border-radius: 999px;
      border: 1px solid var(--border); background: var(--card-bg);
      color: var(--text-muted); cursor: pointer; transition: all 0.15s ease;
      white-space: nowrap; flex-shrink: 0; user-select: none; -webkit-user-select: none;
    }
    .photo-filter-pill:hover { background: #f1f5f9; color: var(--text-main); }
    .photo-filter-pill.active {
      background: #2563eb; color: #ffffff; border-color: #2563eb;
      font-weight: 600; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    }
    .photo-filter-pill .pill-count { font-size: 0.72rem; opacity: 0.82; font-weight: normal; }

    /* 🌟 Apple Photos Style Segmented Control [ 天 | 月 | 年 ] */
    .segmented-control {
      display: inline-flex; align-items: center;
      background: rgba(148, 163, 184, 0.16);
      padding: 3px; border-radius: 999px; gap: 2px;
      user-select: none; flex-shrink: 0;
    }
    .segmented-btn {
      padding: 4px 12px; font-size: 0.8rem; font-weight: 500;
      border: none; background: transparent; color: var(--text-muted, #64748b);
      border-radius: 999px; cursor: pointer; transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      white-space: nowrap; line-height: 1.2;
    }
    .segmented-btn:hover { color: var(--text-main, #1e293b); }
    .segmented-btn.active {
      background: var(--card-bg, #ffffff);
      color: var(--primary, #2563eb);
      font-weight: 600;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    }
    [data-theme="dark"] .segmented-control { background: rgba(255, 255, 255, 0.08); }
    [data-theme="dark"] .segmented-btn.active {
      background: #1e293b; color: #60a5fa;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }

    /* 🌟 Year Dropdown Popover */
    .photo-year-dropdown-wrap {
      position: relative; display: inline-flex; flex-shrink: 0;
    }
    .photo-dropdown-btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 5px 12px; font-size: 0.8rem; font-weight: 500;
      background: var(--card-bg, #ffffff); border: 1px solid var(--border, #e2e8f0);
      color: var(--text-muted, #64748b); border-radius: 999px;
      cursor: pointer; transition: all 0.15s ease; white-space: nowrap;
    }
    .photo-dropdown-btn:hover {
      background: #f1f5f9; color: var(--text-main, #1e293b); border-color: #cbd5e1;
    }
    .photo-dropdown-btn.active {
      background: #2563eb; color: #ffffff; border-color: #2563eb;
      font-weight: 600; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    }
    .photo-popover-menu {
      position: absolute; top: calc(100% + 6px); left: 0;
      min-width: 200px; max-height: 280px; overflow-y: auto;
      background: var(--card-bg, #ffffff); border: 1px solid var(--border, #e2e8f0);
      border-radius: 12px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.18);
      z-index: 99999; padding: 6px; backdrop-filter: blur(12px);
      animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @media (min-width: 769px) {
      .photo-unified-filter-strip {
        overflow: visible !important;
      }
    }
    @media (max-width: 768px) {
      .photo-popover-menu {
        position: fixed !important; top: auto !important; bottom: 0 !important;
        left: 0 !important; right: 0 !important; width: 100% !important;
        min-width: 100% !important; border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -10px 30px rgba(0,0,0,0.3) !important;
        padding: 14px 16px 28px 16px !important;
        max-height: 60vh !important; z-index: 100000 !important;
      }
    }
    [data-theme="dark"] .photo-popover-menu {
      background: #0f172a; border-color: #334155; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
    .popover-header {
      display: flex; justify-content: space-between; align-items: center;
      padding: 6px 10px 8px 10px; font-size: 0.75rem; color: #64748b; font-weight: 600;
      border-bottom: 1px solid var(--border, #f1f5f9); margin-bottom: 4px;
    }
    .popover-clear-btn {
      font-size: 0.72rem; color: #ef4444; background: none; border: none; cursor: pointer; padding: 0;
    }
    .popover-items-list {
      display: flex; flex-direction: column; gap: 2px;
    }
    .popover-item {
      display: flex; justify-content: space-between; align-items: center;
      padding: 7px 10px; font-size: 0.82rem; border-radius: 8px;
      cursor: pointer; color: var(--text-main, #1e293b); transition: background 0.12s;
    }
    .popover-item:hover { background: var(--bg-hover, #f1f5f9); }
    [data-theme="dark"] .popover-item:hover { background: #1e293b; }
    .popover-item.active {
      background: #eff6ff; color: #2563eb; font-weight: 600;
    }
    [data-theme="dark"] .popover-item.active {
      background: #1e293b; color: #60a5fa;
    }
    .popover-count { font-size: 0.74rem; color: #94a3b8; font-weight: normal; }
    @keyframes popoverFadeIn {
      from { opacity: 0; transform: translateY(-4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .photo-date-title.photo-month-title {
      font-size: 1.05rem; font-weight: 700; color: var(--text-main);
    }
    .photo-date-title.photo-year-title {
      font-size: 1.15rem; font-weight: 800; color: #2563eb;
    }

    /* Mobile Bottom Action Sheet */
    .action-sheet-overlay {
      position: fixed; inset: 0; z-index: 100000;
      background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px); display: flex; align-items: flex-end;
      justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
    }
    .action-sheet-overlay.active { opacity: 1; pointer-events: auto; }
    .action-sheet-content {
      background: #ffffff; width: 100%; max-width: 500px;
      border-radius: 20px 20px 0 0; padding: 14px 20px 28px 20px;
      box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
      transform: translateY(100%); transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
      box-sizing: border-box;
    }
    .action-sheet-overlay.active .action-sheet-content { transform: translateY(0); }
    .action-sheet-drag-handle {
      width: 36px; height: 4px; background: #cbd5e1; border-radius: 999px; margin: 0 auto 12px auto;
    }
    .action-sheet-title {
      font-size: 0.98rem; font-weight: 700; color: #0f172a; text-align: center; margin-bottom: 14px;
    }
    .action-sheet-section { margin-bottom: 16px; }
    .action-sheet-section-title {
      font-size: 0.76rem; font-weight: 600; color: #64748b; text-transform: uppercase;
      letter-spacing: 0.5px; margin-bottom: 8px;
    }
    .action-sheet-pill-row { display: flex; gap: 8px; }
    .sheet-filter-pill {
      flex: 1; display: flex; align-items: center; justify-content: center;
      gap: 6px; padding: 9px 0; font-size: 0.85rem; font-weight: 600;
      border-radius: 10px; border: 1px solid #e2e8f0; background: #f8fafc;
      color: #334155; cursor: pointer; transition: all 0.15s ease;
    }
    .sheet-filter-pill.active { background: #2563eb; color: #fff; border-color: #2563eb; }
    .action-sheet-columns-row {
      display: flex; align-items: center; justify-content: space-between;
      background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 6px 14px;
    }
    .sheet-col-btn {
      display: inline-flex; align-items: center; gap: 4px; border: none;
      background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 7px 16px;
      border-radius: 8px; font-size: 0.85rem; font-weight: 600; color: #1e293b; cursor: pointer;
    }
    .sheet-col-badge { font-size: 0.92rem; font-weight: 700; color: #2563eb; }
    .action-sheet-menu-list { display: flex; flex-direction: column; gap: 8px; }
    .action-sheet-menu-item {
      display: flex; align-items: center; gap: 12px; padding: 11px 14px;
      border-radius: 12px; border: 1px solid #e2e8f0; background: #ffffff;
      color: #1e293b; font-size: 0.88rem; font-weight: 500; cursor: pointer; width: 100%; text-align: left;
    }
    .action-sheet-menu-item:hover { background: #f1f5f9; }
    .action-sheet-close-btn {
      width: 100%; padding: 11px; border-radius: 12px; border: none;
      background: #f1f5f9; color: #475569; font-size: 0.9rem; font-weight: 600; cursor: pointer; margin-top: 4px;
    }

    /* Centered Photo Action Modal (Screen Center - Zero Batch Bar Collision) */
    .photo-center-modal {
      align-items: center !important;
      justify-content: center !important;
      z-index: 100010 !important;
      padding: 16px;
    }
    .photo-center-modal-content {
      border-radius: 20px !important;
      max-width: 440px !important;
      width: 100% !important;
      transform: scale(0.95) !important;
      transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease !important;
      box-shadow: 0 20px 60px rgba(0,0,0,0.45) !important;
      max-height: 88vh;
      overflow-y: auto;
    }
    .action-sheet-overlay.active .photo-center-modal-content {
      transform: scale(1) !important;
    }

    /* Modal Scope Row & Year Dropdown Select */
    .photo-modal-scope-row {
      display: flex;
      gap: 10px;
      align-items: center;
    }
    .photo-year-select-wrap {
      position: relative;
      display: flex;
      align-items: center;
      flex: 1;
      min-width: 120px;
    }
    .photo-year-select {
      width: 100%;
      height: 38px;
      appearance: none;
      -webkit-appearance: none;
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      padding: 0 28px 0 12px;
      font-size: 0.85rem;
      font-weight: 600;
      color: #1e293b;
      cursor: pointer;
      outline: none;
      transition: all 0.15s ease;
      line-height: 38px;
    }
    .photo-year-select:hover {
      background: #e2e8f0;
      border-color: #cbd5e1;
    }
    .photo-year-select:focus {
      border-color: #2563eb;
      box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
    }
    .photo-select-arrow {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      width: 13px;
      height: 13px;
      color: #64748b;
      pointer-events: none;
    }
    [data-theme="dark"] .photo-year-select {
      background: #1e293b;
      border-color: #334155;
      color: #f1f5f9;
    }
    [data-theme="dark"] .photo-year-select:hover {
      background: #334155;
    }

    /* 2D Marquee Selection Box (iCloud / Apple Photos Style) */
    .photo-marquee-box {
      position: fixed;
      pointer-events: none;
      z-index: 980;
      background: rgba(59, 130, 246, 0.18);
      border: 1.5px solid rgba(59, 130, 246, 0.85);
      border-radius: 4px;
      backdrop-filter: blur(1px);
      display: none;
    }

    /* Dark mode support for Action Sheet */
    [data-theme="dark"] .action-sheet-content {
      background: #0f172a; color: #f8fafc; border: 1px solid #334155;
    }
    [data-theme="dark"] .action-sheet-title { color: #f8fafc; }
    [data-theme="dark"] .sheet-filter-pill {
      background: #1e293b; border-color: #334155; color: #cbd5e1;
    }
    [data-theme="dark"] .action-sheet-columns-row {
      background: #1e293b; border-color: #334155;
    }
    [data-theme="dark"] .sheet-col-btn { background: #334155; color: #f8fafc; }
    [data-theme="dark"] .action-sheet-menu-item {
      background: #1e293b; border-color: #334155; color: #f8fafc;
    }
    [data-theme="dark"] .action-sheet-close-btn { background: #1e293b; color: #cbd5e1; }

    /* Drag to select styles */
    .photo-grid-layout.select-mode-active {
      user-select: none; -webkit-user-select: none;
    }
    .photo-grid-layout.select-mode-active .photo-card {
      user-select: none; -webkit-user-select: none;
      touch-action: none;
    }
    .batch-desktop-only { display: inline-flex; }
    @media (max-width: 768px) {
      .batch-desktop-only { display: none !important; }
    }

    /* ================= 🌟 MEMORIES REEL & STORY PLAYER ================= */
    .memory-reel-container {
      display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px;
      scrollbar-width: thin; -webkit-overflow-scrolling: touch;
    }
    .memory-card {
      flex: 0 0 148px; height: 210px; position: relative; border-radius: 14px; overflow: hidden;
      cursor: pointer; user-select: none; box-shadow: 0 4px 14px rgba(0,0,0,0.08);
      transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
      background: #1e293b;
    }
    .memory-card:hover {
      transform: translateY(-4px) scale(1.02);
      box-shadow: 0 10px 24px rgba(0,0,0,0.16);
    }
    .memory-card-cover {
      width: 100%; height: 100%; object-fit: cover; display: block;
      transition: transform 0.5s ease;
    }
    .memory-card:hover .memory-card-cover {
      transform: scale(1.06);
    }
    .memory-card-overlay {
      position: absolute; inset: 0;
      background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 40%, rgba(0,0,0,0.55) 70%, rgba(0,0,0,0.92) 100%);
      display: flex; flex-direction: column; justify-content: space-between; padding: 10px;
    }
    .memory-card-badge {
      align-self: flex-start; background: rgba(0,0,0,0.55); color: #fff;
      font-size: 0.68rem; font-weight: 600; padding: 3px 8px; border-radius: 999px;
      backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
      border: 1px solid rgba(255,255,255,0.25);
    }
    .memory-card-info {
      display: flex; flex-direction: column; gap: 3px;
    }
    .memory-card-title {
      font-size: 0.88rem; font-weight: 700; color: #ffffff; line-height: 1.25;
      text-shadow: 0 1px 3px rgba(0,0,0,0.6);
      overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    }
    .memory-card-subtitle {
      font-size: 0.72rem; color: #cbd5e1;
      text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    }

    /* Fullscreen Story Player */
    .story-player-modal {
      display: none; position: fixed; inset: 0; z-index: 100000;
      background: #000; flex-direction: column; overflow: hidden;
      user-select: none;
    }
    .story-player-modal.active { display: flex; }
    
    .story-progress-bar {
      position: absolute; top: 12px; left: 16px; right: 16px; z-index: 50;
      display: flex; gap: 5px; height: 3px;
    }
    .story-progress-segment {
      flex: 1; height: 100%; background: rgba(255,255,255,0.3); border-radius: 3px;
      overflow: hidden; position: relative;
    }
    .story-progress-fill {
      height: 100%; width: 0%; background: #ffffff; border-radius: 3px;
      transition: width 0.05s linear;
    }
    .story-progress-fill.completed { width: 100% !important; }

    .story-header {
      position: absolute; top: 22px; left: 16px; right: 16px; z-index: 50;
      display: flex; justify-content: space-between; align-items: center;
      padding-top: max(8px, env(safe-area-inset-top, 0px));
      color: #fff;
    }
    .story-meta-box {
      display: flex; align-items: center; gap: 10px;
    }
    .story-avatar-badge {
      font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
      background: rgba(255,255,255,0.22); backdrop-filter: blur(10px);
    }
    .story-title-group {
      display: flex; flex-direction: column; gap: 1px;
    }
    .story-title-text {
      font-size: 0.95rem; font-weight: 700; color: #fff;
      text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    }
    .story-date-text {
      font-size: 0.75rem; color: #cbd5e1;
      text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    }
    .story-header-actions {
      display: flex; align-items: center; gap: 8px;
    }
    .story-bgm-pill {
      display: inline-flex; align-items: center; gap: 7px;
      background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(12px);
      border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px;
      padding: 4px 10px; cursor: pointer; transition: all 0.2s ease;
      user-select: none; max-width: 220px;
    }
    .story-bgm-pill:hover {
      background: rgba(0, 0, 0, 0.65); border-color: rgba(255, 255, 255, 0.35);
    }
    .story-bgm-pill.muted {
      opacity: 0.6;
    }
    .story-bgm-title {
      color: #f1f5f9; font-size: 0.75rem; font-weight: 500;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px;
      text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    }
    .story-bgm-next-btn {
      background: transparent; border: none; color: #cbd5e1; cursor: pointer;
      padding: 2px; display: flex; align-items: center; justify-content: center;
      border-radius: 50%; transition: color 0.15s, transform 0.15s;
    }
    .story-bgm-next-btn:hover {
      color: #fff; transform: scale(1.15);
    }

    /* 3-bar Audio Equalizer */
    .story-equalizer-bars {
      display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; width: 12px;
    }
    .eq-bar {
      width: 2px; background: #38bdf8; border-radius: 1px; height: 3px;
      transition: height 0.2s ease;
    }
    .story-equalizer-bars.playing .eq-bar-1 {
      animation: eqBounce1 0.7s ease-in-out infinite alternate;
    }
    .story-equalizer-bars.playing .eq-bar-2 {
      animation: eqBounce2 0.5s ease-in-out infinite alternate;
    }
    .story-equalizer-bars.playing .eq-bar-3 {
      animation: eqBounce3 0.9s ease-in-out infinite alternate;
    }

    @keyframes eqBounce1 {
      0% { height: 3px; }
      100% { height: 12px; }
    }
    @keyframes eqBounce2 {
      0% { height: 12px; }
      100% { height: 4px; }
    }
    @keyframes eqBounce3 {
      0% { height: 5px; }
      100% { height: 11px; }
    }

    .story-icon-btn {
      background: rgba(0,0,0,0.35); border: none; color: #fff; width: 36px; height: 36px;
      border-radius: 50%; display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: background 0.15s; backdrop-filter: blur(8px);
    }
    .story-icon-btn:hover { background: rgba(255,255,255,0.25); }

    .story-stage {
      position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
      overflow: hidden;
    }
    .story-bg-blur {
      position: absolute; inset: -20px; background-size: cover; background-position: center;
      filter: blur(35px) brightness(0.4); opacity: 0.8; z-index: 1; transform: scale(1.1);
      transition: background-image 0.8s ease;
    }
    .story-media-wrap {
      position: relative; z-index: 5; width: 100%; height: 100%;
      display: flex; align-items: center; justify-content: center; padding: 60px 16px;
    }
    .story-main-img {
      max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain;
      border-radius: 12px; box-shadow: 0 12px 48px rgba(0,0,0,0.7);
      will-change: transform;
    }

    /* Ken Burns 4 Directions */
    .story-main-img.ken-burns-0 {
      animation: kbZoomIn 6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    }
    .story-main-img.ken-burns-1 {
      animation: kbPanLeft 6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    }
    .story-main-img.ken-burns-2 {
      animation: kbPanRight 6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    }
    .story-main-img.ken-burns-3 {
      animation: kbZoomOut 6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    }

    @keyframes kbZoomIn {
      0% { transform: scale(1.0) translateY(0); }
      100% { transform: scale(1.12) translateY(-6px); }
    }
    @keyframes kbPanLeft {
      0% { transform: scale(1.06) translateX(2%); }
      100% { transform: scale(1.13) translateX(-2%); }
    }
    @keyframes kbPanRight {
      0% { transform: scale(1.06) translateX(-2%); }
      100% { transform: scale(1.13) translateX(2%); }
    }
    @keyframes kbZoomOut {
      0% { transform: scale(1.14) translateY(-5px); }
      100% { transform: scale(1.03) translateY(0); }
    }

    /* Tap Control Zones */
    .story-tap-zone-left, .story-tap-zone-right {
      position: absolute; top: 70px; bottom: 80px; z-index: 30; width: 35%;
      cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .story-tap-zone-left { left: 0; }
    .story-tap-zone-right { right: 0; }

    .story-footer {
      position: absolute; bottom: 16px; left: 16px; right: 16px; z-index: 50;
      padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
      display: flex; justify-content: space-between; align-items: center;
    }
    .story-footer-info {
      color: rgba(255,255,255,0.85); font-size: 0.8rem;
      background: rgba(0,0,0,0.45); backdrop-filter: blur(10px);
      padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.15);
      max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .story-footer-actions {
      display: flex; align-items: center; gap: 8px;
    }

    /* ================= ENGLISH LEARNING & VOCAB STYLES ================= */
    .english-layout {
      display: grid; grid-template-columns: minmax(280px, 320px) 1fr; gap: 18px;
    }
    @media (max-width: 860px) {
      .english-layout { grid-template-columns: 1fr; }
    }
    .lesson-menu {
      display: flex; flex-direction: column; gap: 8px; max-height: 540px; overflow-y: auto;
    }
    .lesson-item {
      padding: 10px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--border);
      cursor: pointer; transition: all 0.15s; display: flex; justify-content: space-between; align-items: center;
    }
    .lesson-item:hover { background: #eff6ff; border-color: #bfdbfe; }
    .lesson-item.active { background: #eff6ff; border-color: var(--primary); font-weight: 600; color: var(--primary); }
    .lesson-tag { font-size: 0.72rem; padding: 2px 6px; border-radius: 6px; background: #e0f2fe; color: #0369a1; }
    
    .reader-card {
      background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
      box-shadow: var(--shadow); padding: 20px; min-height: 500px;
    }
    .reader-toolbar {
      display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px;
      margin-bottom: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px;
    }
    
    .markdown-body {
      font-size: 1rem; line-height: 1.65; color: #1e293b;
    }
    .markdown-body h1, .markdown-body h2, .markdown-body h3 {
      margin-top: 18px; margin-bottom: 10px; color: #0f172a; font-weight: 700;
    }
    .markdown-body p { margin-bottom: 12px; }
    .markdown-body blockquote {
      border-left: 4px solid var(--primary); background: #eff6ff; padding: 10px 14px;
      margin: 14px 0; border-radius: 0 10px 10px 0; color: #1e40af; font-size: 0.92rem;
    }
    .markdown-body table {
      width: 100%; border-collapse: separate; border-spacing: 0; margin: 16px 0;
      border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    }
    .markdown-body th {
      background: #f1f5f9; color: #334155; font-weight: 700; text-align: left; padding: 10px 12px;
      border-bottom: 1px solid var(--border); font-size: 0.88rem;
    }
    .markdown-body td {
      padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.94rem;
      vertical-align: middle;
    }
    .markdown-body tr:last-child td { border-bottom: none; }
    .markdown-body tr:nth-child(even) { background: #fafafa; }
    
    /* Pronunciation buttons: UK first, then US */
    .pron-btn {
      display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: 6px;
      font-size: 0.72rem; font-weight: 600; cursor: pointer; border: 1px solid #cbd5e1;
      background: #fff; color: #334155; margin-left: 4px; vertical-align: middle; transition: all 0.15s;
    }
    .pron-btn:hover { background: #eff6ff; border-color: var(--primary); color: var(--primary); }
    .pron-btn.uk { color: #b91c1c; }
    .pron-btn.us { color: #0284c7; }
    .pron-btn.sentence { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; font-size: 0.74rem; }
    .pron-btn.sentence:hover { background: #dcfce7; }

    /* Star button */
    .star-btn {
      border: none; background: transparent; font-size: 1.15rem; cursor: pointer; padding: 2px 4px;
      color: #94a3b8; vertical-align: middle; transition: transform 0.15s, color 0.15s;
    }
    .star-btn:hover { transform: scale(1.2); }
    .star-btn.starred { color: #f59e0b; }

    /* Flashcard Review Mask */
    .review-mode .maskable {
      filter: blur(7px); cursor: pointer; user-select: none; transition: filter 0.2s;
      background: #e2e8f0; border-radius: 4px; padding: 2px 4px;
    }
    .review-mode .maskable:hover { filter: blur(3px); }
    .review-mode .maskable.revealed { filter: none !important; background: transparent; }

    /* Vocab Book Responsive Layout */
    .vocab-table-wrapper {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      border-radius: 12px;
      border: 1px solid var(--border);
    }
    .vocab-card-list {
      display: none;
    }
    .vocab-mobile-card {
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 14px 16px;
      box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .vocab-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #f1f5f9;
      padding-bottom: 8px;
    }
    .vocab-card-word-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .vocab-card-word {
      font-size: 1.15rem;
      font-weight: 700;
      color: #0f172a;
    }
    .vocab-card-row {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .vocab-card-label {
      font-size: 0.72rem;
      font-weight: 600;
      color: #94a3b8;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .vocab-card-val {
      font-size: 0.92rem;
      color: #334155;
      line-height: 1.45;
    }

    /* Freeform Notes & Drawing Canvas */
    .freeform-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 16px;
    }
    .freeform-card {
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 18px;
      overflow: hidden;
      box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
      transition: transform 0.2s, box-shadow 0.2s;
      display: flex;
      flex-direction: column;
    }
    .freeform-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
    }
    .freeform-thumb-wrap {
      width: 100%;
      height: 170px;
      background: #f8fafc;
      border-bottom: 1px solid #f1f5f9;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      cursor: pointer;
    }
    .freeform-thumb {
      width: 100%;
      height: 100%;
      object-fit: contain;
      background: #ffffff;
    }
    .freeform-card-body {
      padding: 14px 16px;
      flex: 1;
      display: flex;
      flex-direction: column;
    }
    .freeform-card-title {
      font-size: 1.05rem;
      font-weight: 700;
      color: #0f172a;
      margin-bottom: 6px;
      cursor: pointer;
    }
    .freeform-card-text {
      font-size: 0.85rem;
      color: #64748b;
      line-height: 1.45;
      margin-bottom: 10px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .freeform-card-footer {
      margin-top: auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-top: 10px;
      border-top: 1px solid #f8fafc;
      font-size: 0.75rem;
      color: #94a3b8;
    }
    .freeform-card-actions {
      display: flex;
      gap: 6px;
    }

    /* Integrated Note Surface & Brush Toolbar */
    .brush-toggle-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 14px;
      border-radius: 10px;
      font-size: 0.86rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      border: 1px solid #cbd5e1;
      background: #f8fafc;
      color: #334155;
    }
    .brush-toggle-btn:hover { background: #e2e8f0; }
    .brush-toggle-btn.active {
      background: #2563eb;
      color: #ffffff;
      border-color: #2563eb;
      box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    }
    .brush-toolbar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      flex-wrap: wrap;
      user-select: none;
      animation: fadeIn 0.15s ease-in;
    }
    .tool-group {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .tool-divider {
      width: 1px;
      height: 20px;
      background: #cbd5e1;
      margin: 0 4px;
    }
    .color-btn {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 2px solid #fff;
      outline: 2px solid transparent;
      cursor: pointer;
      transition: transform 0.15s, outline-color 0.15s;
      padding: 0;
    }
    .color-btn:hover { transform: scale(1.15); }
    .color-btn.active {
      outline-color: #0284c7;
      transform: scale(1.18);
    }
    .tool-btn {
      background: #fff;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      padding: 5px 10px;
      font-size: 0.8rem;
      font-weight: 600;
      color: #334155;
      cursor: pointer;
      transition: all 0.15s;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .tool-btn:hover { background: #f1f5f9; border-color: #94a3b8; }
    .tool-btn.active {
      background: #0284c7;
      color: #fff;
      border-color: #0284c7;
    }
    .size-btn {
      padding: 4px 8px;
      font-size: 0.78rem;
    }

    /* Layered Integrated Surface */
    .note-surface {
      position: relative;
      width: 100%;
      height: 480px;
      border: 1px solid #cbd5e1;
      border-radius: 14px;
      background: #ffffff;
      box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
      overflow: hidden;
      margin-top: 10px;
    }
    .note-textarea {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      padding: 16px 18px;
      border: none;
      outline: none;
      resize: none;
      background: transparent;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
      font-size: 1rem;
      line-height: 1.7;
      color: #1e293b;
      z-index: 1;
      box-sizing: border-box;
    }
    .note-canvas {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 2;
      touch-action: none;
      pointer-events: none; /* By default, typing passes through */
    }
    .note-surface.brush-mode .note-canvas {
      pointer-events: auto; /* Active drawing intercepts pen and touches */
      cursor: crosshair;
    }
    .brush-mode-indicator {
      position: absolute;
      bottom: 12px;
      right: 14px;
      z-index: 10;
      background: rgba(37, 99, 235, 0.9);
      color: #fff;
      padding: 4px 10px;
      border-radius: 20px;
      font-size: 0.75rem;
      font-weight: 500;
      pointer-events: none;
      display: none;
      backdrop-filter: blur(4px);
    }
    .note-surface.brush-mode .brush-mode-indicator {
      display: block;
    }

    @media (max-width: 768px) {
      .vocab-table-wrapper { display: none !important; }
      .vocab-card-list { display: flex !important; flex-direction: column; gap: 12px; }
      .note-surface { height: 380px; }
      .brush-toolbar { gap: 6px; padding: 6px 8px; }
      .tool-btn { padding: 4px 7px; font-size: 0.75rem; }
    }

    /* Lightbox Modal */
    .modal {
      display: none; position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.96);
      align-items: center; justify-content: center; flex-direction: column; user-select: none;
    }
    .modal.active { display: flex; }
    .modal-viewer {
      position: relative; width: 100vw; height: 78vh; overflow: hidden;
      touch-action: pan-y; user-select: none; cursor: grab;
    }
    .modal-viewer:active { cursor: grabbing; }
    .modal-track {
      position: absolute; top: 0; left: 0;
      display: flex; width: 300vw; height: 100%;
      transform: translateX(-100vw);
      will-change: transform;
    }
    .modal-slide {
      width: 100vw; height: 100%; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      padding: 0 10px; box-sizing: border-box;
    }
    .modal-slide img, .modal-slide video {
      max-width: 92vw; max-height: 76vh; object-fit: contain; border-radius: 8px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.6);
      user-select: none; -webkit-user-drag: none; -webkit-touch-callout: default;
      pointer-events: auto;
    }
    .modal-counter {
      position: absolute; top: 16px; left: 20px; color: #cbd5e1; font-size: 0.9rem; font-weight: 600;
      text-shadow: 0 1px 4px rgba(0,0,0,0.8); z-index: 100;
    }
    .modal-close {
      position: absolute; top: 14px; right: 20px; background: rgba(255,255,255,0.2); color: #fff;
      border: none; border-radius: 50%; width: 38px; height: 38px; font-size: 18px; cursor: pointer;
      z-index: 500; display: flex; align-items: center; justify-content: center; transition: background 0.2s;
    }
    .modal-close:hover { background: rgba(255,255,255,0.35); }
    .modal-nav {
      position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.22);
      color: #fff; border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 28px;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      z-index: 500; transition: background 0.2s, transform 0.1s; backdrop-filter: blur(8px);
      pointer-events: auto;
    }
    .modal-nav:hover { background: rgba(255,255,255,0.4); }
    .modal-nav:active { transform: translateY(-50%) scale(0.95); }
    .modal-nav.prev { left: 16px; }
    .modal-nav.next { right: 16px; }
    .modal-bar {
      margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
      z-index: 100;
    }
    .ios-hint { color: #94a3b8; font-size: 0.78rem; text-align: center; width: 100%; margin-top: 4px; }

    /* =========================================================================
       🏡 Modern Split-View Dashboard (Scheme 4: Operations & Living Overview)
       ========================================================================= */
    .home-split-container {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
      grid-template-areas:
        "apps tz"
        "apps cal";
      gap: 16px 24px;
      align-items: start;
      margin-top: 6px;
      margin-bottom: 30px;
    }

    .home-apps-section {
      grid-area: apps;
    }

    .home-hero-tz {
      grid-area: tz;
      margin: 0;
    }

    #homeCalendarCard {
      grid-area: cal;
      margin-bottom: 0;
    }

    .hero-greeting-bar {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: rgba(14, 165, 233, 0.08);
      border: 1px solid rgba(14, 165, 233, 0.18);
      padding: 4px 12px;
      border-radius: 999px;
      margin-bottom: 10px;
    }
    .greeting-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #10b981;
      box-shadow: 0 0 6px #10b981;
    }
    .hero-greeting-text {
      font-size: 0.82rem;
      font-weight: 600;
      color: #0369a1;
    }
    .tz-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }
    .tz-card {
      background: rgba(255, 255, 255, 0.9);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(226, 232, 240, 0.9);
      border-radius: 16px;
      padding: 12px 14px;
      box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-height: 92px;
    }
    .tz-card.nz-card {
      border-left: 4px solid #0284c7;
    }
    .tz-card.bj-card {
      border-left: 4px solid #f59e0b;
    }
    .tz-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 6px;
    }
    .tz-title-wrap {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .tz-flag { font-size: 1rem; }
    .tz-location {
      font-size: 0.82rem;
      font-weight: 700;
      color: #334155;
    }
    .tz-badge {
      font-size: 0.68rem;
      font-weight: 600;
      padding: 1px 6px;
      border-radius: 6px;
      background: #e0f2fe;
      color: #0369a1;
    }
    .tz-badge.dst {
      background: #fef3c7;
      color: #b45309;
    }
    .tz-badge.bj-badge {
      background: #fef3c7;
      color: #b45309;
    }
    .tz-offset, .tz-offset-diff {
      font-size: 0.72rem;
      font-weight: 600;
      color: #64748b;
      font-family: ui-monospace, SFMono-Regular, monospace;
    }
    .tz-offset-diff {
      color: #d97706;
    }
    .tz-time {
      font-size: 1.85rem;
      font-weight: 800;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      color: #0f172a;
      letter-spacing: -0.5px;
      line-height: 1.15;
    }
    .tz-date {
      font-size: 0.74rem;
      color: #64748b;
      margin-top: 3px;
      font-weight: 500;
    }

    /* Apple Reminders To-Do Card */
    .todo-card {
      background: rgba(255, 255, 255, 0.9);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(226, 232, 240, 0.85);
      border-radius: 20px;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
      padding: 20px 22px;
      margin: 18px auto 26px auto;
      max-width: 820px;
    }
    .todo-header {
      display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
    }
    .todo-title {
      font-size: 1.1rem; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 8px;
    }
    .todo-count-badge {
      background: #f1f5f9; color: #475569; font-size: 0.76rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
    }
    .todo-list {
      display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 280px; overflow-y: auto;
    }
    .todo-item {
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      padding: 10px 14px; border-radius: 12px; background: #f8fafc; border: 1px solid #f1f5f9;
      transition: all 0.2s;
    }
    .todo-item:hover { background: #f1f5f9; }
    .todo-item.done { opacity: 0.55; }
    .todo-item.done .todo-text { text-decoration: line-through; color: #94a3b8; }
    .todo-checkbox {
      width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cbd5e1;
      display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
      transition: all 0.2s; background: #fff; font-size: 11px; font-weight: 700;
    }
    .todo-item.done .todo-checkbox {
      background: #0ea5e9; border-color: #0ea5e9; color: #fff;
    }
    .todo-item.done .todo-checkbox .ui-icon {
      stroke: #ffffff;
    }
    .todo-text {
      flex: 1; font-size: 0.92rem; color: #1e293b; line-height: 1.4; word-break: break-all;
    }
    .todo-time-tag {
      font-size: 0.74rem; color: #64748b; background: #e2e8f0; padding: 2px 6px; border-radius: 6px; flex-shrink: 0;
    }
    .todo-del-btn {
      opacity: 0; cursor: pointer; border: none; background: transparent; color: #94a3b8;
      display: inline-flex; align-items: center; justify-content: center;
      padding: 3px; border-radius: 6px; transition: all 0.2s;
    }
    .todo-del-btn .ui-icon {
      width: 14px; height: 14px;
    }
    .todo-item:hover .todo-del-btn { opacity: 0.65; }
    .todo-del-btn:hover { opacity: 1 !important; color: #e11d48 !important; background: #ffe4e6; }
    .todo-add-box {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding-top: 12px;
      border-top: 1px solid #f1f5f9;
      margin-top: 6px;
    }
    .todo-add-row-main {
      display: flex;
      gap: 8px;
      width: 100%;
    }
    .todo-add-input {
      flex: 1; border: 1px solid #cbd5e1; border-radius: 10px; padding: 8px 12px;
      font-size: 0.88rem; outline: none; transition: border-color 0.2s; font-family: inherit;
    }
    .todo-add-input:focus { border-color: #0ea5e9; }
    .todo-add-row-options {
      display: flex;
      gap: 12px;
      align-items: center;
      flex-wrap: wrap;
    }
    .todo-opt-group {
      display: flex;
      align-items: center;
      gap: 4px;
    }

    /* Category Cards (Tile Navigation) */
    .category-header {
      display: flex;
      align-items: baseline;
      gap: 8px;
      margin: 0 0 12px 2px;
    }
    .category-title {
      font-size: 1.02rem;
      font-weight: 700;
      color: #1e293b;
    }
    .category-sub {
      font-size: 0.76rem;
      color: #64748b;
    }
    .app-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
      gap: 12px;
      margin-bottom: 0;
    }
    @media (max-width: 640px) {
      .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
      }
      .todo-header {
        flex-wrap: wrap;
        gap: 8px;
      }
      .todo-item {
        flex-wrap: wrap;
        gap: 8px;
      }
      .todo-text {
        flex: 1 1 180px;
        min-width: 140px;
      }
    }
    .app-tile {
      border-radius: 16px;
      padding: 14px 14px 12px 14px;
      min-height: 106px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      box-shadow: 0 4px 14px -3px rgba(0, 0, 0, 0.1);
      cursor: pointer;
      user-select: none;
      position: relative;
      overflow: hidden;
      transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1);
      border: none;
      text-decoration: none;
    }
    .app-tile:hover {
      transform: translateY(-4px) scale(1.02);
      box-shadow: 0 14px 26px -6px rgba(0, 0, 0, 0.22);
    }
    .app-tile:active {
      transform: translateY(-1px) scale(0.99);
    }
    .app-tile-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      width: 100%;
    }
    .tile-pill {
      display: inline-flex;
      align-items: center;
      font-size: 0.7rem;
      font-weight: 600;
      color: #ffffff;
      background: rgba(0, 0, 0, 0.22);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      padding: 2px 8px;
      border-radius: 999px;
      max-width: 75%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .tile-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.22);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid rgba(255, 255, 255, 0.35);
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.4);
      color: #ffffff;
      transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
      flex-shrink: 0;
    }
    .tile-icon .icon-svg {
      width: 21px;
      height: 21px;
      stroke: currentColor;
      stroke-width: 2.2;
      fill: none;
    }
    .app-tile:hover .tile-icon {
      transform: scale(1.1) translateY(-2px);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    }
    .app-tile-bottom {
      margin-top: 14px;
      width: 100%;
    }
    .app-tile-name {
      font-size: 1.12rem;
      font-weight: 800;
      color: #ffffff;
      letter-spacing: -0.2px;
      line-height: 1.2;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    }
    .app-tile-sub {
      font-size: 0.74rem;
      color: rgba(255, 255, 255, 0.88);
      font-weight: 500;
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.3;
    }

    /* Distinct Color Themes for Category Cards */
    .tile-violet  { background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%); }
    .tile-orange  { background: linear-gradient(135deg, #f97316 0%, #ef4444 100%); }
    .tile-blue    { background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%); }
    .tile-emerald { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
    .tile-amber   { background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%); }
    .tile-cyan    { background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%); }
    .tile-cobalt  { background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%); }
    .tile-rose    { background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%); }
    .tile-pink    { background: linear-gradient(135deg, #db2777 0%, #ec4899 100%); }
    .tile-red     { background: linear-gradient(135deg, #dc2626 0%, #f87171 100%); }
    .tile-slate   { background: linear-gradient(135deg, #475569 0%, #64748b 100%); }

    /* Back Header Bar (Option A) */
    @media (max-width: 640px) {
      #mainHeader.subpage-mode .brand-text {
        display: none;
      }
      .brand-text {
        font-size: 0.98rem;
      }
      .subpage-breadcrumb-title {
        font-size: 0.94rem;
      }
    }

    .toast {
      position: fixed; top: max(24px, env(safe-area-inset-top, 24px)); left: 50%; transform: translateX(-50%) translateY(-40px);
      background: rgba(15, 23, 42, 0.94); color: #fff; padding: 10px 22px; border-radius: 999px;
      font-size: 0.88rem; font-weight: 600; z-index: 2000005 !important; opacity: 0; transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); pointer-events: none; white-space: nowrap;
      box-shadow: 0 10px 30px rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.18);
    }
    .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

    /* Modal Backdrop & Body Scroll Locking (Strict Background Lock) */
    html.modal-open, body.modal-open {
      overflow: hidden !important;
      overscroll-behavior: none !important;
      touch-action: none !important;
    }
    .modal-overlay-backdrop {
      overscroll-behavior: contain !important;
      touch-action: none !important;
    }
    .modal-card-scrollable {
      overscroll-behavior: contain !important;
      touch-action: pan-y !important;
      -webkit-overflow-scrolling: touch;
    }

    .modal-corner-close-btn {
      border: none;
      background: rgba(15, 23, 42, 0.72);
      color: #ffffff;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      font-size: 1.25rem;
      font-weight: bold;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      box-shadow: 0 2px 8px rgba(0,0,0,0.3);
      transition: background 0.2s, transform 0.15s;
    }
    .modal-corner-close-btn:hover {
      background: rgba(15, 23, 42, 0.95);
      transform: scale(1.06);
    }
    .modal-corner-close-btn:active {
      transform: scale(0.94);
    }

    /* Media Details Card & Layout */
    .media-detail-card {
      background: #ffffff;
      border-radius: 20px;
      width: 100%;
      max-width: 680px;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
      border: 1px solid #e2e8f0;
      animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      position: relative;
    }
    .media-detail-banner {
      position: relative;
      width: 100%;
      height: 170px;
      background-size: cover;
      background-position: center;
      background-color: #1e293b;
      border-radius: 20px 20px 0 0;
      overflow: hidden;
    }
    .media-detail-meta-header {
      padding: 0 20px;
      margin-top: -65px;
      display: flex;
      align-items: flex-end;
      gap: 16px;
      position: relative;
      z-index: 10;
      margin-bottom: 14px;
    }
    .media-detail-poster {
      width: 110px;
      height: 160px;
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 10px 22px rgba(0,0,0,0.3);
      border: 3px solid #ffffff;
      background: #e2e8f0;
      flex-shrink: 0;
    }
    .media-detail-poster img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .media-detail-info {
      flex: 1;
      min-width: 0;
      padding-bottom: 4px;
    }
    .media-detail-title-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 3px;
    }
    .media-detail-title {
      margin: 0;
      font-size: 1.25rem;
      color: #0f172a;
      font-weight: 800;
      line-height: 1.25;
      user-select: text;
      word-break: break-word;
    }
    .media-detail-orig-title {
      font-size: 0.8rem;
      color: #64748b;
      user-select: text;
      word-break: break-word;
      margin-bottom: 8px;
    }
    .media-detail-badges {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }
    .media-detail-body {
      padding: 0 20px 20px 20px;
      position: relative;
    }

    /* Multi-Resource Cards (Desktop & Mobile Adaptive Layout) */
    .multi-resource-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      width: 100%;
    }
    .multi-resource-card {
      background: #ffffff;
      border: 1px solid #cbd5e1;
      border-radius: 12px;
      padding: 12px 14px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.04);
      display: flex;
      flex-direction: column;
      gap: 8px;
      transition: all 0.2s;
      width: 100%;
      box-sizing: border-box;
    }
    .multi-resource-card.is-current {
      border-color: #3b82f6;
      background: #f8faff;
      box-shadow: 0 0 0 1px #3b82f6;
    }
    .multi-resource-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px;
    }
    .multi-resource-badges {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }
    .badge-resource-idx {
      background: #f1f5f9;
      color: #475569;
      padding: 2px 8px;
      border-radius: 5px;
      font-size: 0.74rem;
      font-weight: 700;
      white-space: nowrap;
    }
    .multi-resource-card.is-current .badge-resource-idx {
      background: #dbeafe;
      color: #1e40af;
    }
    .badge-resource-current {
      background: #2563eb;
      color: #ffffff;
      padding: 2px 8px;
      border-radius: 5px;
      font-size: 0.72rem;
      font-weight: 700;
      white-space: nowrap;
    }
    .badge-resource-qual {
      background: #fef3c7;
      color: #92400e;
      padding: 2px 8px;
      border-radius: 5px;
      font-size: 0.72rem;
      font-weight: 700;
      white-space: nowrap;
    }
    .multi-resource-filename {
      font-size: 0.92rem;
      font-weight: 700;
      color: #0f172a;
      word-break: break-all;
      overflow-wrap: anywhere;
      line-height: 1.4;
      user-select: text;
    }
    .multi-resource-meta {
      font-size: 0.75rem;
      color: #64748b;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 6px 14px;
      line-height: 1.45;
    }
    .multi-resource-meta span {
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .multi-resource-meta strong {
      color: #334155;
      font-weight: 600;
      user-select: text;
    }
    .multi-resource-path-box {
      font-size: 0.74rem;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      color: #334155;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      padding: 7px 10px;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 8px;
      word-break: break-all;
      overflow-wrap: anywhere;
      box-sizing: border-box;
      width: 100%;
    }
    .multi-resource-path-text {
      line-height: 1.45;
      user-select: text;
      flex: 1;
      min-width: 0;
      word-break: break-all;
      overflow-wrap: anywhere;
    }
    .multi-resource-copy-btn {
      border: 1px solid #cbd5e1;
      background: #ffffff;
      color: #475569;
      border-radius: 6px;
      padding: 2px 7px;
      font-size: 0.75rem;
      cursor: pointer;
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      transition: all 0.15s;
    }
    .multi-resource-copy-btn:hover {
      background: #f1f5f9;
      color: #0f172a;
      border-color: #94a3b8;
    }
    .multi-resource-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      padding-top: 4px;
    }
    .multi-resource-actions .btn {
      padding: 5px 12px;
      font-size: 0.76rem;
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    @media (max-width: 640px) {
      .modal-nav { display: none; }
      .container { padding: 10px 12px; }
      .card { padding: 14px 12px; }

      /* Mobile Modal Adaptations */
      [id$="Modal"] {
        padding: 8px !important;
        align-items: center !important;
      }
      .media-detail-card {
        border-radius: 16px !important;
        max-height: 94vh !important;
      }
      .media-detail-banner {
        height: 120px !important;
        border-radius: 16px 16px 0 0 !important;
      }
      .media-detail-meta-header {
        padding: 0 12px !important;
        margin-top: -45px !important;
        gap: 12px !important;
        margin-bottom: 10px !important;
      }
      .media-detail-poster {
        width: 86px !important;
        height: 126px !important;
        border-radius: 10px !important;
        border-width: 2px !important;
      }
      .media-detail-title {
        font-size: 1.05rem !important;
      }
      .media-detail-orig-title {
        font-size: 0.74rem !important;
        margin-bottom: 6px !important;
      }
      .media-detail-badges {
        gap: 4px !important;
      }
      .media-detail-badges span {
        font-size: 0.7rem !important;
        padding: 2px 6px !important;
      }
      .media-detail-body {
        padding: 0 12px 14px 12px !important;
      }
      .fixmatch-controls-row {
        flex-direction: column !important;
        gap: 8px !important;
      }
      .fixmatch-controls-row input {
        width: 100% !important;
      }
      .fixmatch-sub-row {
        display: flex !important;
        gap: 8px !important;
        width: 100% !important;
      }
      .fixmatch-sub-row select {
        flex: 1 !important;
      }
      .fixmatch-sub-row button {
        flex-shrink: 0 !important;
      }
      .pan-rename-row {
        flex-direction: column !important;
        gap: 8px !important;
      }

      /* Mobile Multi-Resource Cards Adaptive Layout */
      .multi-resource-card {
        padding: 10px 12px !important;
        gap: 7px !important;
      }
      .multi-resource-filename {
        font-size: 0.88rem !important;
      }
      .multi-resource-meta {
        font-size: 0.72rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 3px !important;
      }
      .multi-resource-path-box {
        padding: 6px 8px !important;
        font-size: 0.7rem !important;
      }
      .multi-resource-actions {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
      }
      .multi-resource-actions .btn {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 80px !important;
        justify-content: center !important;
        padding: 7px 10px !important;
        font-size: 0.75rem !important;
      }
      .multi-resource-actions .btn-danger {
        flex: 1 1 100% !important;
      }
    }

    .header-actions {
      display: flex; align-items: center; gap: 7px; flex-shrink: 0;
    }
    .header-icon-btn {
      display: inline-flex; align-items: center; justify-content: center;
      width: 36px; height: 36px; border-radius: 10px;
      background: rgba(241, 245, 249, 0.92);
      color: #334155;
      border: 1px solid #cbd5e1;
      cursor: pointer; user-select: none; padding: 0;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
      -webkit-tap-highlight-color: transparent;
    }
    .header-icon-btn:hover {
      background: #e2e8f0; color: #0284c7; border-color: #94a3b8;
      transform: scale(1.06); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.09);
    }
    .header-icon-btn:active {
      transform: scale(0.92);
    }
    .btn-action-icon {
      width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; fill: none;
      display: block; transition: transform 0.25s ease;
    }
    .header-icon-btn:hover .btn-action-icon {
      transform: scale(1.08);
    }
    .header-icon-btn.rotating .btn-action-icon {
      animation: spinRefresh 0.55s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    }
    @keyframes spinRefresh {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }


    /* Email List & Modern Gmail Card Layout */
    .email-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .email-card {
      position: relative;
      background: #ffffff;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px 14px;
      display: flex;
      gap: 10px;
      align-items: stretch;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 1px 3px rgba(0,0,0,0.02);
      -webkit-tap-highlight-color: transparent;
      text-decoration: none;
    }
    .email-card:hover {
      background: #f8fafc;
      border-color: #cbd5e1;
      box-shadow: 0 3px 8px rgba(0,0,0,0.05);
    }
    .email-card.is-unread {
      background: #ffffff;
      border-color: #cbd5e1;
      border-left: 4px solid #2563eb;
    }
    .email-card.is-read {
      opacity: 0.88;
      background: #f8fafc;
    }

    .email-card-main {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .email-card-top-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }
    .email-card-sender-box {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      flex: 1;
    }
    .email-card-unread-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #2563eb;
      flex-shrink: 0;
      box-shadow: 0 0 5px rgba(37,99,235,0.6);
    }
    .email-card-sender-name {
      font-size: 0.9rem;
      font-weight: 500;
      color: #334155;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .email-card.is-unread .email-card-sender-name {
      font-weight: 700;
      color: #0f172a;
    }
    .email-card-date {
      font-size: 0.75rem;
      color: #94a3b8;
      font-weight: 500;
      white-space: nowrap;
      flex-shrink: 0;
      letter-spacing: -0.2px;
    }
    .email-card.is-unread .email-card-date {
      color: #2563eb;
      font-weight: 600;
    }
    .email-card-subject {
      font-size: 0.88rem;
      color: #475569;
      line-height: 1.38;
      margin: 2px 0 4px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      word-break: break-word;
    }
    .email-card.is-unread .email-card-subject {
      font-weight: 600;
      color: #0f172a;
    }
    .email-card-bottom-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-top: 2px;
    }
    .email-card-from-email {
      font-size: 0.72rem;
      color: #94a3b8;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 65%;
    }
    .email-card-actions {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }
    .email-quick-action-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 30px;
      height: 30px;
      border-radius: 8px;
      border: 1px solid #e2e8f0;
      background: #f8fafc;
      color: #64748b;
      cursor: pointer;
      transition: all 0.15s ease;
      -webkit-tap-highlight-color: transparent;
      padding: 0;
    }
    .email-quick-action-btn:hover {
      background: #e2e8f0;
      color: #0f172a;
    }
    .email-quick-action-btn.starred {
      color: #f59e0b;
      background: #fef3c7;
      border-color: #fde68a;
    }
    .email-empty-state {
      text-align: center;
      padding: 48px 20px;
      color: #64748b;
      background: #ffffff;
      border-radius: 14px;
      border: 1px solid #e2e8f0;
    }

    /* Gmail Header Controls */
    .gmail-header-card-title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }
    .gmail-title-badge-group {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .gmail-badge-pill {
      font-size: 0.75rem;
      background: #fee2e2;
      color: #b91c1c;
      padding: 2px 8px;
      border-radius: 999px;
      font-weight: 600;
    }
    .gmail-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .email-filter-group {
      display: inline-flex;
      background: #f1f5f9;
      padding: 3px;
      border-radius: 10px;
      gap: 4px;
    }
    .btn-email-filter {
      border: none;
      background: transparent;
      color: #64748b;
      padding: 4px 12px;
      border-radius: 8px;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .btn-email-filter.active {
      background: #ffffff;
      color: #0f172a;
      box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    }
    .gmail-header-btn {
      padding: 5px 12px;
      font-size: 0.82rem;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .gmail-status-text {
      font-size: 0.8rem;
      color: #64748b;
      margin-bottom: 12px;
    }

    @media (max-width: 640px) {
      .gmail-header-card-title {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
      }
      .gmail-header-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
      }
      .email-filter-group {
        flex: 1;
      }
      .btn-email-filter {
        flex: 1;
        text-align: center;
        padding: 5px 8px;
      }
      .gmail-header-btn {
        padding: 5px 10px;
        font-size: 0.78rem;
      }
      .email-card {
        padding: 10px 12px;
      }
      .email-card-sender-name {
        font-size: 0.88rem;
      }
      .email-card-subject {
        font-size: 0.84rem;
      }
      .email-card-from-email {
        max-width: 55%;
      }
    }

    /* Gmail Fullscreen Viewer & Action Bar */
    .gmail-action-bar {
      box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    .gmail-icon-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: background 0.15s ease, transform 0.1s ease;
      cursor: pointer;
    }
    .gmail-icon-btn:hover {
      background: #f1f5f9;
    }
    .gmail-icon-btn:active {
      background: #e2e8f0;
      transform: scale(0.94);
    }
    #emailDetailDrawer {
      box-sizing: border-box;
      -webkit-font-smoothing: antialiased;
    }
    .gmail-action-bar-inner,
    .email-detail-inner {
      width: 100%;
      max-width: min(100% - 48px, 1200px);
      margin: 0 auto;
      box-sizing: border-box;
    }
    @media (max-width: 768px) {
      .gmail-action-bar-inner,
      .email-detail-inner {
        max-width: 100%;
        padding-left: 14px !important;
        padding-right: 14px !important;
      }
    }

    /* Notes Grid & Cards */
    .notes-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 16px;
      margin-top: 16px;
    }
    .note-card {
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.06);
      border: 1px solid rgba(0,0,0,0.06);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-height: 140px;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    .note-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    }
    .note-text {
      font-size: 0.95rem;
      line-height: 1.5;
      color: #1e293b;
      white-space: pre-wrap;
      word-break: break-word;
      margin-bottom: 12px;
    }
    .note-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.78rem;
      color: #64748b;
      margin-top: auto;
      padding-top: 8px;
      border-top: 1px dashed rgba(0,0,0,0.08);
    }

    /* Media Search Styles */
    .media-card-wrap {
      display: flex; gap: 14px; padding: 12px; border-radius: 12px; background: #fff;
      border: 1px solid var(--border); margin-bottom: 12px; box-sizing: border-box; max-width: 100%;
    }
    .media-poster {
      width: 80px; height: 120px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #e2e8f0;
    }
    .media-results-grid {
      display: grid;
      grid-template-columns: minmax(320px, 360px) 1fr;
      gap: 18px;
      width: 100%;
      box-sizing: border-box;
      min-width: 0;
    }
    .media-results-grid > div {
      min-width: 0;
      box-sizing: border-box;
      width: 100%;
    }
    .media-column-box {
      background: #f8fafc;
      border-radius: 16px;
      border: 1px solid #e2e8f0;
      padding: 16px;
      box-sizing: border-box;
      width: 100%;
      min-width: 0;
    }
    @media (max-width: 860px) {
      .media-results-grid {
        grid-template-columns: 1fr;
        gap: 14px;
      }
      .media-column-box {
        padding: 14px 12px;
        border-radius: 12px;
      }
    }
    .forum-item {
      padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--border);
      margin-bottom: 10px; transition: all 0.2s; display: flex; flex-direction: column; gap: 8px;
      box-sizing: border-box; max-width: 100%; min-width: 0; word-break: break-word; overflow-wrap: anywhere;
    }
    .forum-item:hover { border-color: #93c5fd; box-shadow: var(--shadow); }
    .forum-title { font-size: 0.9rem; font-weight: 600; color: #1e293b; line-height: 1.4; word-break: break-word; overflow-wrap: anywhere; }

    /* ================= DISCOVER (JUSTWATCH STYLE) ================= */
    .discover-controls-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      padding: 12px 14px;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 14px;
      margin-bottom: 12px;
    }
    .discover-platform-select {
      height: 38px;
      padding: 0 14px;
      font-size: 0.88rem;
      font-weight: 600;
      color: #1e293b;
      background: #fff;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      cursor: pointer;
      outline: none;
      transition: all 0.2s ease;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
    .discover-platform-select:hover {
      border-color: #94a3b8;
    }
    .discover-platform-select:focus {
      border-color: #0284c7;
      box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
    }
    .discover-pill-group {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }
    .discover-pill {
      border: 1px solid #cbd5e1;
      background: #fff;
      color: #334155;
      padding: 6px 14px;
      border-radius: 999px;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .discover-pill:hover {
      background: #f1f5f9;
      border-color: #94a3b8;
    }
    .discover-pill.active {
      background: #0284c7;
      color: #fff;
      border-color: #0284c7;
      box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
    }
    .discover-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 14px;
      width: 100%;
      box-sizing: border-box;
    }
    @media (min-width: 900px) {
      .discover-grid {
        grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
        gap: 16px;
      }
    }
    .discover-card {
      position: relative;
      background: #fff;
      border: 1px solid #e2e8f0;
      border-radius: 14px;
      overflow: hidden;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
      user-select: none;
    }
    .discover-card:hover {
      transform: translateY(-4px);
      box-shadow: 0 10px 22px -6px rgba(15, 23, 42, 0.14);
      border-color: #cbd5e1;
    }
    .discover-poster-wrap {
      position: relative;
      width: 100%;
      aspect-ratio: 2 / 3;
      background: #e2e8f0;
      overflow: hidden;
    }
    .discover-poster-wrap img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: transform 0.3s ease;
    }
    .discover-card:hover .discover-poster-wrap img {
      transform: scale(1.04);
    }
    .discover-rank-badge {
      position: absolute;
      top: 8px;
      left: 8px;
      background: rgba(15, 23, 42, 0.82);
      color: #fff;
      font-size: 0.72rem;
      font-weight: 800;
      padding: 3px 7px;
      border-radius: 6px;
      backdrop-filter: blur(4px);
      letter-spacing: 0.5px;
      z-index: 2;
    }
    .discover-rank-badge.rank-1 {
      background: linear-gradient(135deg, #f59e0b, #d97706);
      color: #fff;
      box-shadow: 0 2px 6px rgba(217, 119, 6, 0.4);
    }
    .discover-rank-badge.rank-2 {
      background: linear-gradient(135deg, #94a3b8, #64748b);
      color: #fff;
    }
    .discover-rank-badge.rank-3 {
      background: linear-gradient(135deg, #b45309, #78350f);
      color: #fff;
    }
    .discover-rating-badge {
      position: absolute;
      top: 8px;
      right: 8px;
      background: rgba(0, 0, 0, 0.78);
      color: #fcd34d;
      font-size: 0.72rem;
      font-weight: 700;
      padding: 3px 6px;
      border-radius: 6px;
      backdrop-filter: blur(4px);
      display: flex;
      align-items: center;
      gap: 3px;
      z-index: 2;
    }
    .discover-lib-badge {
      position: absolute;
      bottom: 8px;
      left: 8px;
      background: #15803d;
      color: #fff;
      font-size: 0.68rem;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      box-shadow: 0 2px 6px rgba(21, 128, 61, 0.4);
      z-index: 2;
    }
    .discover-card-meta {
      padding: 10px 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      background: #fff;
      flex: 1;
    }
    .discover-card-title {
      font-size: 0.86rem;
      font-weight: 700;
      color: #0f172a;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.3;
    }
    .discover-card-sub {
      font-size: 0.74rem;
      color: #64748b;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    /* Discover Detail Modal (Apple TV+ / JustWatch Hybrid) */
    .discover-modal-backdrop {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(15, 23, 42, 0.75);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 10000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 16px;
      box-sizing: border-box;
      animation: fadeIn 0.2s ease;
    }
    .discover-modal-card {
      background: #ffffff;
      border-radius: 20px;
      max-width: 740px;
      width: 100%;
      overflow: hidden;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.1);
      position: relative;
      animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      max-height: 90vh;
      display: flex;
      flex-direction: column;
    }
    .discover-modal-hero {
      position: relative;
      background: #0f172a;
      min-height: 220px;
      overflow: hidden;
      display: flex;
      align-items: flex-end;
      padding: 22px 24px 20px;
      box-sizing: border-box;
      flex-shrink: 0;
    }
    .discover-modal-hero-bg {
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      filter: brightness(0.4) saturate(1.2);
      transform: scale(1.02);
      transition: opacity 0.3s;
    }
    .discover-modal-hero-overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(0deg, rgba(15,23,42,0.98) 0%, rgba(15,23,42,0.65) 55%, rgba(15,23,42,0.25) 100%);
    }
    .discover-modal-close {
      position: absolute;
      top: 14px;
      right: 14px;
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: rgba(15, 23, 42, 0.7);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      color: #fff;
      border: 1px solid rgba(255,255,255,0.2);
      font-size: 16px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
      z-index: 10;
    }
    .discover-modal-close:hover {
      background: rgba(239, 68, 68, 0.9);
      transform: scale(1.06);
    }
    .discover-modal-hero-content {
      position: relative;
      z-index: 2;
      display: flex;
      gap: 18px;
      align-items: flex-end;
      width: 100%;
    }
    .discover-modal-poster-wrap {
      flex-shrink: 0;
    }
    .discover-modal-poster {
      width: 120px;
      height: 175px;
      object-fit: cover;
      border-radius: 12px;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55), 0 0 0 2px rgba(255, 255, 255, 0.85);
      background: #1e293b;
      display: block;
    }
    .discover-modal-hero-info {
      flex: 1;
      min-width: 0;
      color: #fff;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .discover-modal-title {
      font-size: 1.35rem;
      font-weight: 800;
      color: #ffffff;
      line-height: 1.25;
      text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }
    .discover-modal-subtitle {
      font-size: 0.82rem;
      color: #cbd5e1;
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }
    .discover-modal-tagline {
      font-size: 0.82rem;
      font-style: italic;
      color: #fde68a;
      line-height: 1.35;
      text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    }
    .discover-modal-pills-row {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 2px;
    }
    .discover-badge-rating {
      background: #fef3c7;
      color: #92400e;
      font-weight: 700;
      font-size: 0.76rem;
      padding: 2px 8px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .discover-badge-pill {
      background: rgba(255, 255, 255, 0.15);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      color: #f8fafc;
      font-weight: 600;
      font-size: 0.74rem;
      padding: 2px 8px;
      border-radius: 6px;
      border: 1px solid rgba(255,255,255,0.15);
    }
    .discover-badge-type {
      background: #eff6ff;
      color: #1d4ed8;
      font-weight: 700;
      font-size: 0.74rem;
      padding: 2px 8px;
      border-radius: 6px;
    }
    .discover-badge-lib {
      font-weight: 700;
      font-size: 0.74rem;
      padding: 2px 8px;
      border-radius: 6px;
    }
    .discover-genres-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      margin-top: 2px;
    }
    .discover-genre-tag {
      background: rgba(255, 255, 255, 0.12);
      color: #e2e8f0;
      padding: 2px 7px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 500;
      border: 1px solid rgba(255,255,255,0.12);
    }
    .discover-modal-body {
      padding: 16px 24px 20px;
      overflow-y: auto;
      flex: 1;
      background: #ffffff;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .discover-detail-section {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .discover-section-heading {
      font-size: 0.85rem;
      font-weight: 700;
      color: #334155;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .discover-overview-box {
      font-size: 0.88rem;
      color: #475569;
      line-height: 1.65;
      background: #f8fafc;
      padding: 12px 14px;
      border-radius: 12px;
      border: 1px solid #e2e8f0;
      white-space: pre-wrap;
      max-height: 140px;
      overflow-y: auto;
    }
    .discover-cast-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 8px;
    }
    .discover-cast-card {
      display: flex;
      align-items: center;
      gap: 8px;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      padding: 6px 8px;
      transition: transform 0.15s, border-color 0.15s;
    }
    .discover-cast-card:hover {
      border-color: #cbd5e1;
      transform: translateY(-1px);
    }
    .discover-cast-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      object-fit: cover;
      background: #e2e8f0;
      flex-shrink: 0;
      font-size: 0.65rem;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #64748b;
    }
    .discover-cast-info {
      min-width: 0;
      flex: 1;
    }
    .discover-cast-name {
      font-size: 0.78rem;
      font-weight: 700;
      color: #1e293b;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .discover-cast-role {
      font-size: 0.7rem;
      color: #64748b;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .discover-meta-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 8px 14px;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      padding: 12px 14px;
    }
    .discover-meta-item {
      display: flex;
      align-items: center;
      font-size: 0.8rem;
      gap: 6px;
    }
    .discover-meta-item .meta-label {
      color: #64748b;
      font-weight: 600;
      flex-shrink: 0;
    }
    .discover-meta-item .meta-val {
      color: #1e293b;
      font-weight: 600;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .discover-modal-footer {
      display: flex;
      gap: 10px;
      justify-content: space-between;
      align-items: center;
      padding: 12px 24px;
      border-top: 1px solid #f1f5f9;
      background: #ffffff;
      flex-wrap: wrap;
    }
    @media (max-width: 640px) {
      .discover-modal-hero {
        padding: 16px;
        min-height: 180px;
      }
      .discover-modal-hero-content {
        gap: 12px;
      }
      .discover-modal-poster {
        width: 88px;
        height: 130px;
      }
      .discover-modal-title {
        font-size: 1.15rem;
      }
      .discover-modal-body {
        padding: 14px 16px;
      }
      .discover-modal-footer {
        padding: 10px 16px;
      }
      .discover-cast-grid {
        grid-template-columns: 1fr 1fr;
      }
    }

    /* Pan File Manager */
    .pan-file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
    .pan-item {
      padding: 10px 14px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--border);
      transition: all 0.2s; display: flex; justify-content: space-between; align-items: center; gap: 12px;
      user-select: none;
    }
    .pan-item:hover { background: #f1f5f9; border-color: #cbd5e1; }
    .pan-item.selected {
      background: #eff6ff !important;
      border-color: #3b82f6 !important;
      box-shadow: 0 1px 3px rgba(59, 130, 246, 0.15);
    }
    .pan-item-checkbox {
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: #0284c7;
      flex-shrink: 0;
      margin: 0;
    }
    .pan-item-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; cursor: pointer; }
    .pan-item-icon { font-size: 1.4rem; flex-shrink: 0; }
    .pan-item-name { font-size: 0.9rem; font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .pan-item-meta { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }

    /* Sticky Floating Batch Action Bar */
    .pan-batch-bar {
      position: sticky;
      bottom: 24px;
      z-index: 100;
      background: rgba(15, 23, 42, 0.92);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      color: #fff;
      padding: 12px 20px;
      border-radius: 16px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.45), 0 8px 16px -6px rgba(0, 0, 0, 0.3);
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      flex-wrap: wrap;
      animation: slideUpBatchBar 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes slideUpBatchBar {
      from { transform: translateY(24px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    .pan-rename-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 8px 12px;
      border-radius: 8px;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      font-size: 0.82rem;
    }
    .pan-rename-row.changed {
      border-color: #86efac;
      background: #f0fdf4;
    }
    .pan-rename-tag {
      font-size: 0.7rem;
      padding: 2px 6px;
      border-radius: 4px;
      font-weight: 600;
      flex-shrink: 0;
    }

    /* Settings Modal Redesign (macOS-style Sidebar Rail + Unified Content Pane) */
    .settings-modal-dialog {
      background: #ffffff;
      border-radius: 20px;
      width: 100%;
      max-width: min(100% - 48px, 1120px);
      height: 84vh;
      height: 84dvh;
      max-height: 850px;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
      border: 1px solid #e2e8f0;
      overflow: hidden;
      animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .settings-modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 24px;
      border-bottom: 1px solid #f1f5f9;
      background: #ffffff;
      flex-shrink: 0;
    }
    .settings-modal-layout {
      display: flex;
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }
    .settings-nav-rail {
      width: 230px;
      flex-shrink: 0;
      background: #f8fafc;
      border-right: 1px solid #e2e8f0;
      padding: 14px 10px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      overflow-y: auto;
      user-select: none;
    }
    .settings-nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      border-radius: 10px;
      font-size: 0.88rem;
      font-weight: 600;
      color: #475569;
      background: transparent;
      border: none;
      cursor: pointer;
      text-align: left;
      width: 100%;
      transition: all 0.15s ease;
    }
    .settings-nav-item:hover {
      background: #f1f5f9;
      color: #0f172a;
    }
    .settings-nav-item.active {
      background: #ffffff;
      color: var(--primary);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
      font-weight: 700;
    }
    .settings-content-pane {
      flex: 1;
      padding: 22px 28px;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior-y: contain;
      touch-action: pan-y;
      display: flex;
      flex-direction: column;
      gap: 20px;
      background: #ffffff;
    }
    .settings-tab-pane {
      display: flex;
      flex-direction: column;
      gap: 18px;
      width: 100%;
    }
    .settings-card {
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 16px;
      padding: 18px 20px;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .settings-card:focus-within {
      border-color: #cbd5e1;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }
    .settings-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }
    .settings-card-title {
      font-weight: 700;
      font-size: 0.96rem;
      color: #0f172a;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .settings-input {
      width: 100%;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      padding: 9px 13px;
      font-size: 0.9rem;
      outline: none;
      font-family: inherit;
      box-sizing: border-box;
      background: #ffffff;
      transition: border-color 0.15s, box-shadow 0.15s;
    }
    .settings-input:focus {
      border-color: #3b82f6;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    }
    .settings-secret-field {
      position: relative;
      display: flex;
      align-items: center;
      width: 100%;
    }
    .settings-secret-field .settings-input {
      padding-right: 48px;
      font-family: monospace;
    }
    .settings-secret-actions {
      position: absolute;
      right: 6px;
      top: 50%;
      transform: translateY(-50%);
      display: flex;
      align-items: center;
      gap: 2px;
    }
    .settings-secret-btn {
      background: transparent;
      border: none;
      cursor: pointer;
      color: #64748b;
      padding: 6px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
    }
    .settings-secret-btn:hover {
      color: #1e293b;
      background: #e2e8f0;
    }
    .settings-field-tip {
      font-size: 0.76rem;
      color: #059669;
      margin-top: 4px;
      display: flex;
      align-items: center;
      gap: 4px;
      font-weight: 500;
    }
    .settings-status-pill {
      font-size: 0.74rem;
      font-weight: 600;
      padding: 2px 9px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .settings-status-success {
      background: #ecfdf5;
      color: #059669;
      border: 1px solid #a7f3d0;
    }
    .settings-status-warning {
      background: #fffbeb;
      color: #d97706;
      border: 1px solid #fde68a;
    }
    .settings-status-neutral {
      background: #f1f5f9;
      color: #64748b;
      border: 1px solid #e2e8f0;
    }
    .settings-modal-footer {
      display: flex;
      justify-content: flex-end;
      gap: 12px;
      padding: 14px 24px;
      border-top: 1px solid #f1f5f9;
      background: #f8fafc;
      flex-shrink: 0;
    }

    @media (max-width: 768px) {
      #settingsModal {
        padding: 0 !important;
        align-items: flex-end !important;
      }
      .settings-modal-dialog {
        max-width: 100%;
        width: 100%;
        height: 92vh;
        height: 92dvh;
        border-radius: 20px 20px 0 0;
      }
      .settings-modal-layout {
        flex-direction: column;
      }
      .settings-nav-rail {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding: 8px 12px;
        gap: 6px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        flex-shrink: 0;
      }
      .settings-nav-item {
        width: auto;
        padding: 6px 12px;
        font-size: 0.8rem;
        flex-shrink: 0;
      }
      .settings-content-pane {
        padding: 14px 12px;
        gap: 14px;
      }
      .settings-card {
        padding: 14px 12px;
      }
      .settings-modal-header {
        padding: 12px 16px;
      }
      .settings-modal-footer {
        padding: 10px 16px;
      }
    }

    @keyframes gatePulse {
      0%, 100% { opacity: 0.65; transform: scale(0.98); }
      50% { opacity: 1; transform: scale(1.02); }
    }
    .gate-pulse-hint {
      animation: gatePulse 2.4s ease-in-out infinite;
    }

    @keyframes mediaSpin {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }
    @keyframes progressShimmer {
      0% { background-position: 0 0; }
      100% { background-position: 30px 0; }
    }
    @keyframes mediaPulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.35; transform: scale(1.25); }
    }

    /* ==========================================================================
       Bing Daily Wallpaper & Non-Intrusive Ambient Protective Masks
       ========================================================================== */
    #wallpaperLayer {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      z-index: -2;
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      opacity: 0;
      transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s ease-out;
      transform: scale(1.02);
      pointer-events: none;
    }
    #wallpaperLayer.loaded {
      opacity: 1;
      transform: scale(1);
    }
    #wallpaperMask {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      z-index: -1;
      pointer-events: none;
      transition: background-color 0.4s ease, backdrop-filter 0.4s ease, opacity 0.4s ease;
    }
    /* Mode 1: Ambient Frosted Glow – soft color-bleed atmosphere, content clear */
    #wallpaperMask.ambient {
      background: rgba(248, 250, 252, 0.60);
      backdrop-filter: blur(16px) saturate(160%);
      -webkit-backdrop-filter: blur(16px) saturate(160%);
      opacity: 1;
    }
    /* Mode 2: Scenic Clear View – photo visible through a light veil */
    #wallpaperMask.scenic {
      background: rgba(248, 250, 252, 0.30);
      backdrop-filter: blur(3px) saturate(130%);
      -webkit-backdrop-filter: blur(3px) saturate(130%);
      opacity: 1;
    }
    /* Mode 3: Off (fallback solid background, no wallpaper) */
    #wallpaperMask.off {
      background: #f8fafc;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      opacity: 1;
    }

    /* Bing Story Badge Pill in Footer */
    .wallpaper-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(255, 255, 255, 0.9);
      border: 1px solid rgba(203, 213, 225, 0.8);
      padding: 6px 14px;
      border-radius: 999px;
      font-size: 0.78rem;
      color: #475569;
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
      user-select: none;
      margin-bottom: 8px;
    }
    .wallpaper-pill:hover {
      background: #ffffff;
      border-color: #38bdf8;
      color: #0284c7;
      transform: translateY(-1px);
      box-shadow: 0 4px 14px rgba(56, 189, 248, 0.16);
    }
    .wallpaper-pill .wp-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #10b981;
    }
    .wallpaper-pill .wp-camera {
      font-size: 0.85rem;
    }
    .wallpaper-pill .wp-title {
      font-weight: 600;
      max-width: 220px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .wallpaper-pill .wp-action {
      color: #94a3b8;
      font-weight: 500;
    }

    /* Wallpaper Lightbox Modal */
    .wallpaper-modal-content {
      background: #0f172a;
      border-radius: 20px;
      overflow: hidden;
      max-width: 860px;
      width: 95vw;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
      display: flex;
      flex-direction: column;
      animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .wallpaper-modal-img-wrap {
      width: 100%;
      max-height: 65vh;
      background: #000;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }
    .wallpaper-modal-img-wrap img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .wallpaper-modal-info {
      padding: 16px 20px;
      background: #1e293b;
      color: #f8fafc;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .wallpaper-modal-title {
      font-size: 1.1rem;
      font-weight: 700;
      color: #ffffff;
    }
    .wallpaper-modal-copyright {
      font-size: 0.82rem;
      color: #94a3b8;
      line-height: 1.4;
    }
    .wallpaper-modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 8px;
    }
    .wp-mode-btn.active {
      border-color: #0284c7 !important;
      background: #e0f2fe !important;
      color: #0369a1 !important;
      font-weight: 700 !important;
    }

    /* =========================================================================
       🗓️ Family Interactive Calendar & Agenda Hub
       ========================================================================= */
    .calendar-card {
      background: rgba(255, 255, 255, 0.94);
      border-radius: 18px;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
      border: 1px solid rgba(226, 232, 240, 0.8);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      padding: 16px 18px;
      margin-bottom: 0;
      transition: all 0.25s ease;
      container-type: inline-size;
      container-name: calCard;
    }

    .cal-top-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      flex-wrap: wrap;
      gap: 8px;
    }

    .cal-title-wrap {
      display: flex;
      align-items: baseline;
      gap: 10px;
    }

    .cal-main-title {
      font-size: 1.08rem;
      font-weight: 700;
      color: #0f172a;
      letter-spacing: -0.3px;
    }

    .cal-subtitle {
      font-size: 0.88rem;
      font-weight: 600;
      color: #64748b;
    }

    .cal-controls {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .cal-nav-btn {
      border: 1px solid #cbd5e1;
      background: #ffffff;
      color: #334155;
      font-weight: 600;
      border-radius: 8px;
      padding: 4px 10px;
      font-size: 0.88rem;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .cal-nav-btn:hover {
      background: #f1f5f9;
      color: #0f172a;
    }
    .cal-today-btn {
      padding: 4px 12px;
      font-size: 0.8rem;
      background: #f8fafc;
    }

    .cal-privacy-btn {
      border: 1px solid #cbd5e1;
      background: #ffffff;
      border-radius: 8px;
      padding: 4px 9px;
      font-size: 0.95rem;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .cal-privacy-btn:hover {
      background: #fdf2f8;
      border-color: #f472b6;
    }

    .cal-sync-btn {
      padding: 4px 10px;
      font-size: 0.78rem;
    }

    .cal-layout-grid {
      display: grid;
      grid-template-columns: minmax(300px, 1.25fr) minmax(240px, 1fr);
      gap: 16px;
    }

    .cal-grid-pane {
      display: flex;
      flex-direction: column;
    }

    .cal-weekdays {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      text-align: center;
      font-size: 0.8rem;
      font-weight: 700;
      color: #64748b;
      padding-bottom: 8px;
      border-bottom: 1px solid #f1f5f9;
    }
    .cal-weekdays .cal-sat,
    .cal-weekdays .cal-sun {
      color: #ef4444;
    }

    .cal-days-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 4px;
      padding-top: 6px;
    }

    .cal-day-cell {
      min-height: 44px;
      padding: 3px 2px;
      border-radius: 9px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      position: relative;
      transition: all 0.15s ease;
      background: #ffffff;
      border: 1px solid #f1f5f9;
      user-select: none;
    }
    .cal-day-cell:hover {
      background: #f8fafc;
      border-color: #cbd5e1;
    }

    .cal-day-cell.other-month {
      opacity: 0.35;
      background: #fafafa;
    }

    .cal-day-cell.is-today {
      border: 2px solid #3b82f6;
      background: #eff6ff;
    }
    .cal-day-cell.is-today .cell-num {
      color: #1d4ed8;
      font-weight: 800;
    }

    .cal-day-cell.is-selected {
      background: #f1f5f9;
      box-shadow: 0 0 0 2px #0f172a inset;
    }

    .cal-day-cell.is-cycle-period {
      background: #fff1f2;
      border-color: #fecdd3;
    }
    .cal-day-cell.has-anniv {
      background: #fffdf5;
      border-color: #fde68a;
    }

    .cell-num {
      font-size: 0.86rem;
      font-weight: 600;
      color: #1e293b;
      line-height: 1.2;
    }

    .cell-holiday-tag {
      font-size: 0.62rem;
      font-weight: 600;
      padding: 1px 3px;
      border-radius: 4px;
      margin-top: 1px;
      line-height: 1.2;
      max-width: 95%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      text-align: center;
    }
    .cell-holiday-tag.cn-tag {
      color: #dc2626;
      background: #fee2e2;
    }
    .cell-holiday-tag.nz-tag {
      color: #0369a1;
      background: #e0f2fe;
    }
    .cell-holiday-tag.anniv-tag {
      color: #92400e;
      background: #fef3c7;
      border: 1px solid #fde68a;
      font-weight: 700;
    }

    .cell-lunar-text {
      font-size: 0.62rem;
      font-weight: 500;
      color: #94a3b8;
      line-height: 1.2;
      margin-top: 1px;
      max-width: 95%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      text-align: center;
    }
    .cal-day-cell.is-today .cell-lunar-text {
      color: #2563eb;
      font-weight: 600;
    }
    .cal-day-cell.is-selected .cell-lunar-text {
      color: #1e40af;
      font-weight: 700;
    }

    .cell-badges-row {
      display: flex;
      gap: 3px;
      align-items: center;
      justify-content: center;
      margin-top: 3px;
      min-height: 6px;
    }

    .badge-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .badge-dot.dot-yellow {
      background: #eab308;
      box-shadow: 0 0 5px #eab308;
    }
    .badge-dot.dot-anniv {
      background: #f59e0b;
      box-shadow: 0 0 5px #f59e0b;
    }
    .badge-dot.dot-pink {
      background: #f43f5e;
      box-shadow: 0 0 4px #f43f5e;
    }
    .badge-dot.dot-purple {
      background: #a855f7;
    }
    .badge-dot.dot-orange {
      background: #f97316;
    }

    .cal-legend {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      align-items: center;
      margin-top: 12px;
      padding-top: 8px;
      border-top: 1px dashed #e2e8f0;
      font-size: 0.72rem;
      color: #64748b;
    }
    .legend-item {
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .legend-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
    }
    .legend-dot.yellow-glow {
      background: #eab308;
      box-shadow: 0 0 5px #eab308;
    }
    .legend-dot.pink-glow {
      background: #f43f5e;
      box-shadow: 0 0 4px #f43f5e;
    }
    .legend-dot.anniv-glow {
      background: #f59e0b;
      box-shadow: 0 0 4px #f59e0b;
    }
    .legend-tag {
      font-size: 0.7rem;
    }

    /* Agenda Pane */
    .cal-agenda-pane {
      border-left: 1px solid #f1f5f9;
      padding-left: 16px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .agenda-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 10px;
      flex-wrap: wrap;
      padding-bottom: 10px;
      border-bottom: 1px solid #f1f5f9;
    }

    .agenda-date-info {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .agenda-date-str {
      font-size: 1.05rem;
      font-weight: 700;
      color: #0f172a;
    }

    .agenda-lunar-str {
      font-size: 0.82rem;
      font-weight: 600;
      color: #b45309;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-top: -1px;
    }
    .agenda-lunar-pill {
      background: #fffbeb;
      color: #b45309;
      border: 1px solid #fde68a;
      padding: 1px 7px;
      border-radius: 6px;
      font-size: 0.78rem;
      letter-spacing: 0.2px;
    }

    .agenda-tags-row {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }

    .agenda-tag {
      font-size: 0.72rem;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 6px;
      line-height: 1.3;
    }
    .agenda-tag.cn-badge {
      background: #fee2e2;
      color: #b91c1c;
      border: 1px solid #fecaca;
    }
    .agenda-tag.nz-badge {
      background: #e0f2fe;
      color: #0369a1;
      border: 1px solid #bae6fd;
    }
    .agenda-tag.cycle-badge {
      background: #fce7f3;
      color: #be185d;
      border: 1px solid #fbcfe8;
    }
    .agenda-tag.anniv-badge {
      background: #fef3c7;
      color: #b45309;
      border: 1px solid #fde68a;
      font-weight: 700;
    }

    .agenda-anniv-card {
      display: flex;
      align-items: center;
      gap: 12px;
      background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
      border: 1px solid #fde68a;
      border-radius: 12px;
      padding: 10px 14px;
      margin-bottom: 8px;
      box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
      animation: fadeInAnniv 0.3s ease-out;
    }
    .anniv-card-icon {
      font-size: 1.8rem;
      line-height: 1;
      flex-shrink: 0;
    }
    .anniv-card-body {
      display: flex;
      flex-direction: column;
      gap: 2px;
      flex: 1;
    }
    .anniv-card-title {
      font-size: 0.92rem;
      font-weight: 700;
      color: #92400e;
    }
    .anniv-card-desc {
      font-size: 0.8rem;
      color: #b45309;
      line-height: 1.35;
    }
    @keyframes fadeInAnniv {
      from { opacity: 0; transform: translateY(-4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .agenda-actions-row {
      display: flex;
      gap: 6px;
      align-items: center;
    }

    .agenda-quick-btn {
      border: none;
      border-radius: 8px;
      padding: 5px 12px;
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .agenda-quick-btn.add-todo-btn {
      background: #0284c7;
      color: #ffffff;
    }
    .agenda-quick-btn.add-todo-btn:hover {
      background: #0369a1;
    }

    .agenda-quick-btn.cycle-btn {
      background: #fdf2f8;
      color: #db2777;
      border: 1px solid #fbcfe8;
    }
    .agenda-quick-btn.cycle-btn:hover {
      background: #fce7f3;
    }
    .agenda-quick-btn.cycle-btn.danger-btn {
      background: #fee2e2;
      color: #dc2626;
      border-color: #fca5a5;
    }

    .agenda-subhead {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      font-size: 0.92rem;
      font-weight: 700;
      color: #334155;
    }

    .agenda-cycle-tip {
      background: #fff1f2;
      border: 1px solid #fecdd3;
      border-radius: 10px;
      padding: 8px 12px;
      margin-bottom: 10px;
      font-size: 0.8rem;
      color: #9f1239;
      display: flex;
      align-items: center;
      gap: 8px;
      line-height: 1.4;
    }
    .agenda-cycle-tip .tip-icon {
      font-size: 1.1rem;
      flex-shrink: 0;
    }

    .agenda-upcoming-wrap {
      padding-top: 10px;
      border-top: 1px dashed #e2e8f0;
    }

    /* Privacy Mode Shield: Hides all cycle details completely without hiding the day cells */
    .calendar-card.privacy-hidden .dot-pink,
    .calendar-card.privacy-hidden .dot-purple,
    .calendar-card.privacy-hidden .dot-orange,
    .calendar-card.privacy-hidden .cycle-legend,
    .calendar-card.privacy-hidden .cycle-badge,
    .calendar-card.privacy-hidden .agenda-cycle-tip,
    .calendar-card.privacy-hidden #agendaCycleRecordBtn {
      display: none !important;
    }
    .calendar-card.privacy-hidden .cal-day-cell.is-cycle-period {
      background: #ffffff !important;
      border-color: #f1f5f9 !important;
      display: flex !important;
    }


    /* Centered Mode for Custom Dialog Modal on Mobile and Desktop */
    #customDialogModal {
      align-items: center !important;
      justify-content: center !important;
      z-index: 100030 !important;
      padding: 16px !important;
    }
    @media (max-width: 640px) {
      #customDialogModal {
        align-items: center !important;
        justify-content: center !important;
        padding: 16px !important;
      }
      #customDialogCard {
        max-width: 400px !important;
        width: 92% !important;
        border-radius: 20px !important;
        margin: auto !important;
        box-shadow: 0 20px 60px rgba(0,0,0,0.45) !important;
      }
    }

/* ==========================================================================
   Photo Gallery Industrial Skeleton Loading UI (Zero-Perceived Latency)
   ========================================================================== */
@keyframes photoShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.photo-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(var(--photo-grid-columns, 4), 1fr);
  gap: 6px;
  padding: 8px 0;
  width: 100%;
}

.photo-skeleton-card {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.6) 25%, rgba(203, 213, 225, 0.9) 50%, rgba(226, 232, 240, 0.6) 75%);
  background-size: 200% 100%;
  animation: photoShimmer 1.5s infinite ease-in-out;
}

/* =========================================================================
   📱 Responsive Dashboard Breakpoints (Scheme 4)
   ========================================================================= */

/* 1. Pad Landscape / Medium Desktop (961px - 1199px) */
@media (max-width: 1199px) and (min-width: 961px) {
  .home-split-container {
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
  }
  .app-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .cal-layout-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .cal-agenda-pane {
    border-left: none !important;
    border-top: 1px dashed #e2e8f0 !important;
    padding-left: 0 !important;
    padding-top: 12px !important;
  }
  .tz-time {
    font-size: 1.55rem !important;
  }
  .tz-card-header {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .tz-location {
    font-size: 0.76rem !important;
  }
}

/* 2. Pad Portrait (641px - 960px) */
@media (max-width: 960px) {
  .home-split-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 18px !important;
    margin-top: 4px !important;
  }
  .home-apps-section,
  .home-hero-tz,
  #homeCalendarCard {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .home-hero-tz {
    order: 1 !important;
    margin: 0 !important;
  }
  .home-apps-section {
    order: 2 !important;
  }
  #homeCalendarCard {
    order: 3 !important;
    margin-bottom: 20px !important;
  }
}
@media (max-width: 960px) and (min-width: 641px) {
  .app-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }
  .cal-layout-grid {
    grid-template-columns: minmax(320px, 1.25fr) minmax(240px, 1fr) !important;
    gap: 16px !important;
  }
  .cal-agenda-pane {
    border-left: 1px solid #f1f5f9 !important;
    border-top: none !important;
    padding-left: 16px !important;
    padding-top: 0 !important;
  }
}

/* 3. Mobile Phone (< 640px) */
@media (max-width: 640px) {
  .home-split-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    margin-top: 2px !important;
  }
  .home-apps-section,
  .home-hero-tz,
  #homeCalendarCard {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .home-hero-tz {
    order: 1 !important;
    margin: 0 !important;
  }
  .hero-greeting-bar {
    margin-bottom: 8px !important;
    padding: 3px 10px !important;
  }
  .hero-greeting-text {
    font-size: 0.78rem !important;
  }
  .tz-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .tz-card {
    padding: 8px 10px !important;
    min-height: 68px !important;
    border-radius: 12px !important;
  }
  .tz-card-header {
    margin-bottom: 2px !important;
  }
  .tz-location {
    font-size: 0.72rem !important;
  }
  .tz-flag {
    font-size: 0.85rem !important;
  }
  .tz-badge {
    font-size: 0.6rem !important;
    padding: 0 4px !important;
  }
  .tz-offset, .tz-offset-diff {
    font-size: 0.65rem !important;
  }
  .tz-time {
    font-size: 1.35rem !important;
    letter-spacing: -0.5px !important;
    line-height: 1.1 !important;
  }
  .tz-date {
    font-size: 0.68rem !important;
    margin-top: 2px !important;
  }
  .home-apps-section {
    order: 2 !important;
  }
  .category-header {
    margin-bottom: 8px !important;
  }
  .category-title {
    font-size: 0.98rem !important;
  }
  .app-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 0 !important;
  }
  .app-tile {
    padding: 12px 10px !important;
    min-height: 94px !important;
    border-radius: 14px !important;
  }
  .app-tile-name {
    font-size: 0.98rem !important;
  }
  .app-tile-sub {
    font-size: 0.68rem !important;
  }
  #homeCalendarCard {
    order: 3 !important;
    padding: 14px 12px !important;
    border-radius: 16px !important;
    margin-bottom: 20px !important;
  }
  .cal-layout-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .cal-agenda-pane {
    border-left: none !important;
    border-top: 1px dashed #e2e8f0 !important;
    padding-left: 0 !important;
    padding-top: 14px !important;
  }
  .cal-day-cell {
    min-height: 44px !important;
  }
}

/* ── Cross-Cloud Transfer Hub Split Workspace ── */
.vps-transfer-workspace {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 6px 0 28px;
}
.vps-transfer-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 74px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.vps-panel-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 12px);
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  position: relative;
}
.vps-transfer-btn-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.vps-one-click-btn {
  width: 66px;
  min-height: 160px;
  border-radius: 14px;
  background: linear-gradient(145deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  border: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
}
.vps-one-click-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.55), 0 0 16px rgba(236, 72, 153, 0.35);
}
.vps-one-click-btn:active {
  transform: translateY(1px) scale(0.97);
}
.vps-one-click-btn .btn-arrow {
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  animation: arrowPulse 2s infinite ease-in-out;
}
@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}
.vps-one-click-btn .btn-text {
  writing-mode: vertical-lr;
  letter-spacing: 3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.vps-loading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 40;
  user-select: none;
  animation: fadeIn 0.15s ease-in;
}
.vps-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #e2e8f0;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: vpsSpin 0.7s linear infinite;
}
@keyframes vpsSpin {
  to { transform: rotate(360deg); }
}
.vps-loading-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.vps-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 0.83rem;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.vps-file-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.vps-file-item.is-dir {
  cursor: pointer;
}
.vps-file-item.is-selected {
  background: #f5f3ff;
  border-color: #c4b5fd;
}
.vps-file-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s ease;
  opacity: 0.4;
}
.vps-file-item:hover .vps-file-action-btn {
  opacity: 1;
}
.vps-file-action-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
  transform: scale(1.08);
}

/* AList Style Task Board */
.alist-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.82rem;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.alist-task-row:hover {
  border-color: #cbd5e1;
}
.alist-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.alist-badge-running {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.alist-badge-queued {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}
.alist-badge-success {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}
.alist-badge-failed {
  background: #fef2f2;
  color: #ef4444;
  border-color: #fecaca;
}
.alist-badge-cancelled {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
}
.alist-badge-retry {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulseDot 1.4s infinite ease-in-out;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

@media (max-width: 860px) {
  .vps-transfer-split {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .vps-one-click-btn {
    width: 100%;
    min-height: 48px;
    height: 48px;
    flex-direction: row;
    border-radius: 12px;
    gap: 10px;
  }
  .vps-one-click-btn .btn-arrow {
    font-size: 1.3rem;
    animation: arrowPulseDown 2s infinite ease-in-out;
  }
  .vps-one-click-btn .btn-text {
    writing-mode: horizontal-tb;
    letter-spacing: 2px;
  }
}
@keyframes arrowPulseDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ==========================================================================
   Hamilton Supermarket Grocery Comparison UI
   ========================================================================== */
.grocery-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  user-select: none;
}
.grocery-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}
.tile-emerald:hover {
  border-color: #10b981;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12);
}

/* Autocomplete Suggestions Dropdown */
.grocery-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.15), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  z-index: 1000;
  overflow: hidden;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grocery-suggestions-header {
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grocery-suggestions-list {
  overflow-y: auto;
  padding: 4px 0;
  margin: 0;
  list-style: none;
}

.grocery-suggestion-item {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.grocery-suggestion-item:hover,
.grocery-suggestion-item.active {
  background: #f0fdf4;
  border-left-color: #10b981;
}

.grocery-suggestion-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.grocery-suggestion-info {
  flex: 1;
  min-width: 0;
}

.grocery-suggestion-brand {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.grocery-suggestion-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.grocery-suggestion-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.grocery-suggestion-price {
  text-align: right;
  flex-shrink: 0;
}

.grocery-suggestion-amount {
  font-size: 1.05rem;
  font-weight: 800;
  color: #059669;
}

.grocery-suggestion-store {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  margin-top: 1px;
}

.grocery-suggestion-rank {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fef3c7;
  color: #b45309;
}

.grocery-suggestion-rank.top-rank {
  background: #fee2e2;
  color: #dc2626;
}

.grocery-suggestions-footer {
  padding: 6px 14px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
}

@keyframes scanLaser {
  0% { top: 12%; opacity: 0.7; }
  50% { top: 88%; opacity: 1; }
  100% { top: 12%; opacity: 0.7; }
}
.scanner-laser-line {
  animation: scanLaser 2s ease-in-out infinite;
}

/* Modern Barcode Scanner Viewfinder Reticle & Corners */
.scanner-reticle {
  position: absolute;
  inset: 16px;
  pointer-events: none;
  z-index: 12;
}
.scanner-reticle-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #10b981;
  border-style: solid;
}
.scanner-reticle-tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-top-left-radius: 6px; }
.scanner-reticle-tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-top-right-radius: 6px; }
.scanner-reticle-bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 6px; }
.scanner-reticle-br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 6px; }

.scanner-viewfinder-box.scanner-flash-success {
  box-shadow: inset 0 0 0 4px #10b981, 0 0 24px rgba(16, 185, 129, 0.6) !important;
  transition: all 0.15s ease-out;
}

#groceryScannerReader {
  width: 100%;
  height: 100%;
}
#groceryScannerReader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 14px;
}

.scanner-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.scanner-toolbar-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}
.scanner-toolbar-btn.active {
  background: #fef08a;
  color: #854d0e;
  border-color: #facc15;
}

.grocery-sort-btn:hover {
  color: #0f172a !important;
}
.grocery-sort-btn.active {

  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
}

/* Grocery Component Modern Mobile-First Styling */
.grocery-main-card {
  padding: 16px 20px;
  border-radius: 16px;
}
.grocery-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
.grocery-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.2px;
}
.grocery-sync-meta {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 2px;
}
.grocery-sync-meta strong {
  color: #0f172a;
}
.grocery-btn-sync {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem !important;
  padding: 5px 12px !important;
  border-radius: 8px !important;
  font-weight: 600;
}
.grocery-store-pills-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding-bottom: 3px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.grocery-store-pills-row::-webkit-scrollbar {
  display: none;
}
.grocery-store-pill-btn {
  padding: 4px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.grocery-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: nowrap;
}
.grocery-search-input {
  width: 100%;
  height: 42px;
  padding: 0 74px 0 36px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  background: #f8fafc;
  box-sizing: border-box;
  outline: none;
  transition: all 0.2s ease;
}
.grocery-search-input:focus {
  border-color: #10b981;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.grocery-input-scan-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.grocery-input-scan-btn:hover {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}
.grocery-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 72px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: #10b981;
  border: none;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}
.grocery-search-btn:hover {
  background: #059669;
}
.grocery-scan-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 5px;
  height: 42px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: #10b981;
  border: none;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}
.grocery-scan-btn:hover {
  background: #059669;
}
.grocery-sort-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}
.grocery-sort-tabs {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
}
.grocery-sort-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.grocery-sort-btn:hover {
  color: #0f172a;
}
.grocery-sort-btn.active {
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
}
.grocery-quick-chips-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 3px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.grocery-quick-chips-row::-webkit-scrollbar {
  display: none;
}
.grocery-quick-chip {
  font-size: 0.78rem !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
#tab-grocery {
  max-width: 1440px;
  margin: 0 auto;
}
.grocery-main-card {
  max-width: 100%;
  padding: 22px 24px;
  border-radius: 20px;
}
#groceryResults {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
  min-height: 260px;
  margin-top: 14px;
}
@media (max-width: 768px) {
  #groceryResults {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .grocery-main-card {
    padding: 12px !important;
  }
}

.rank-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}
.rank-ribbon-1 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}
.rank-ribbon-2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}
.rank-ribbon-3 {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.3);
}
.rank-ribbon-sub {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

.grocery-essentials-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.grocery-essentials-bar::-webkit-scrollbar { display: none; }
.grocery-essentials-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}
.grocery-essentials-scroll {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}
.grocery-essential-chip {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 3px;
}
.grocery-essential-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}

.grocery-product-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.grocery-product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}
.grocery-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.grocery-card-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  padding: 4px;
  flex-shrink: 0;
}
.grocery-store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.grocery-store-badge {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.grocery-store-badge.out-of-stock {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  opacity: 0.6;
}

@media (max-width: 640px) {
  .grocery-main-card {
    padding: 10px 10px !important;
    border-radius: 12px !important;
  }
  .grocery-sort-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .grocery-sort-tabs {
    display: flex;
    width: 100%;
    box-sizing: border-box;
  }
  .grocery-sort-btn {
    flex: 1;
    text-align: center;
    padding: 6px 2px;
    font-size: 0.78rem;
  }
  #groceryResultCount {
    text-align: right;
  }
  .grocery-store-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }
}

/* === Grocery Search History Row === */
.grocery-search-history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.grocery-history-scroll {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  flex: 1;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.grocery-history-scroll::-webkit-scrollbar {
  display: none;
}
.grocery-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.grocery-history-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.grocery-history-clear-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.grocery-history-clear-btn:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* === Grocery Filter Bar === */
.grocery-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding-bottom: 3px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.grocery-filter-bar::-webkit-scrollbar {
  display: none;
}
.grocery-filter-chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.grocery-filter-chip:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}
.grocery-filter-chip.active {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* === Secondary Category Taxonomy Chips === */
.grocery-category-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 3px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.grocery-category-bar::-webkit-scrollbar {
  display: none;
}
.grocery-subcat-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.grocery-subcat-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}
.grocery-subcat-chip.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}
.grocery-subcat-chip .subcat-count {
  font-size: 0.68rem;
  opacity: 0.85;
}

/* === Badges for Product Cards === */
.badge-price-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.3;
}
.badge-historic-low {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #b45309;
  border: 1px solid #fcd34d;
}
.badge-deep-discount {
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  color: #be185d;
  border: 1px solid #f472b6;
}
.badge-half-price {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
  border: 1px solid #f87171;
}
.btn-trend-curve {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #2563eb;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-trend-curve:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* === Semantic Classes for Grocery Product Cards (Unified Component) === */
.grocery-card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.grocery-card-brand-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.grocery-card-brand {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.grocery-card-cat-tag {
  font-size: 0.68rem;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  border: 1px solid #dbeafe;
}
.grocery-card-action-box {
  display: flex;
  align-items: center;
  gap: 6px;
}
.grocery-card-valid-until {
  font-size: 0.68rem;
  color: #64748b;
  background: #f8fafc;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
}
.grocery-card-valid-until strong {
  color: #0f172a;
}
.grocery-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grocery-card-tags-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}
.grocery-card-size-tag {
  font-size: 0.72rem;
  background: #f1f5f9;
  color: #475569;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.grocery-card-deal-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 10px;
}
.grocery-card-deal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.grocery-card-deal-price-box {
  display: flex;
  align-items: center;
  gap: 12px;
}
.grocery-card-store-badge-name {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.grocery-card-price-numbers {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.grocery-card-promo-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: #059669;
}
.grocery-card-reg-price {
  font-size: 0.82rem;
  color: #94a3b8;
  text-decoration: line-through;
}
.grocery-card-save-price {
  font-size: 0.75rem;
  color: #dc2626;
  font-weight: 700;
}
.grocery-card-multistore-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.75rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.grocery-card-multistore-summary {
  font-weight: 700;
  color: #0f172a;
}
.grocery-card-multistore-pills {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.grocery-card-store-pill {
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 4px;
  background: #ffffff;
  font-weight: 600;
}

/* === Price Trend Modal === */
.trend-modal-content {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px;
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}
.trend-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 14px;
}
.trend-modal-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.trend-modal-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.trend-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trend-modal-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}
.trend-modal-close {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.trend-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.trend-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.trend-kpi-card {
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.trend-kpi-card .kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.trend-kpi-card .kpi-value {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
}
.trend-kpi-card .kpi-date {
  font-size: 0.68rem;
  margin-top: 4px;
}
.kpi-card-lowest {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.kpi-card-lowest .kpi-label { color: #166534; }
.kpi-card-lowest .kpi-value { color: #15803d; }
.kpi-card-lowest .kpi-date { color: #16a34a; }

.kpi-card-highest {
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.kpi-card-highest .kpi-label { color: #991b1b; }
.kpi-card-highest .kpi-value { color: #b91c1c; }
.kpi-card-highest .kpi-date { color: #dc2626; }

.kpi-card-avg {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.kpi-card-avg .kpi-label { color: #475569; }
.kpi-card-avg .kpi-value { color: #1e293b; }
.kpi-card-avg .kpi-date { color: #64748b; }

.kpi-card-advice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.kpi-card-advice .kpi-label { color: #1e40af; }
.kpi-card-advice .kpi-value { color: #2563eb; }
.kpi-card-advice .kpi-date { color: #3b82f6; }

.trend-store-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.trend-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  transition: all 0.15s ease;
  user-select: none;
}
.trend-legend-chip.active {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.trend-legend-chip.disabled {
  opacity: 0.4;
  background: #f1f5f9;
  text-decoration: line-through;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.trend-chart-viewport {
  position: relative;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.trend-svg {
  width: 100%;
  height: 250px;
  overflow: visible;
}
.trend-chart-loading, .trend-chart-empty {
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 500;
}
.trend-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  z-index: 10;
  transform: translate(-50%, -120%);
  transition: opacity 0.1s ease;
}

@media (max-width: 640px) {
  .trend-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .trend-modal-content {
    padding: 14px;
    max-height: 94vh;
  }
}

/* ==========================================================================
   Clean E-Commerce Comparison Design (GoodAI Price Portal)
   ========================================================================== */

/* Clean Header */
.clean-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
.clean-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.clean-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.clean-brand-logo {
  font-size: 1.35rem;
  line-height: 1;
}
.clean-brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.clean-city-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 1px 8px;
  border-radius: 999px;
}
.clean-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.clean-live-status {
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.clean-live-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}
.clean-scan-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.clean-scan-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Clean Compact Search Bar */
.clean-search-wrap {
  position: relative;
  margin: 14px 0 10px;
}
.clean-search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 4px 6px 4px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}
.clean-search-box:focus-within {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.clean-search-icon {
  color: #94a3b8;
  margin-right: 8px;
  flex-shrink: 0;
}
.clean-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: #0f172a;
  background: transparent;
  padding: 6px 0;
}
.clean-search-input::placeholder {
  color: #94a3b8;
}
.clean-search-clear {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
}
.clean-search-clear:hover {
  color: #475569;
}
.clean-search-cam {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  transition: all 0.15s ease;
}
.clean-search-cam:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.clean-search-btn {
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.clean-search-btn:hover {
  background: #059669;
}

/* Compact Essentials & Stores Rows */
.clean-essentials-row, .clean-stores-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.clean-row-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}
.clean-essentials-scroll, .clean-stores-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.clean-essentials-scroll::-webkit-scrollbar, .clean-stores-scroll::-webkit-scrollbar {
  display: none;
}
.clean-chip {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.clean-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}
.clean-store-pill-btn, .grocery-store-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.clean-store-pill-btn:hover, .grocery-store-pill-btn:hover {
  transform: translateY(-1px);
}
.clean-store-toggle-all {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 2px 4px;
}

/* Compact Controls Row (Tabs + Sort) */
.clean-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.clean-sort-and-count {
  display: flex;
  align-items: center;
  gap: 10px;
}
.clean-result-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}

/* Skeleton Loading */
@keyframes shimmerWave {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-box {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmerWave 1.5s infinite;
  border-radius: 6px;
}
.skeleton-card {
  pointer-events: none;
  opacity: 0.8;
}

/* Minimal 1-line Footer */
.clean-footer {
  margin-top: 48px;
  padding: 20px 16px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
}
.clean-footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .clean-header-inner {
    padding: 8px 12px;
  }
  .clean-live-status {
    display: none;
  }
  .clean-search-wrap {
    margin: 8px 0 6px;
  }
  .clean-search-box {
    padding: 2px 4px 2px 10px;
  }
  .clean-search-btn {
    padding: 7px 12px;
    font-size: 0.8rem;
  }
  .clean-controls-row {
    margin-top: 6px;
    margin-bottom: 8px;
  }
}

/* Staples Subcategory Navigation Bar */
.clean-staples-subbar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 0 10px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.clean-staples-subbar::-webkit-scrollbar {
  display: none;
}
.clean-subcat-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.clean-subcat-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}
.clean-subcat-chip.active {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.28);
}




