/* Parent Portal — extends tokens.css */
      :root {
        /* Portal-specific aliases for backward compatibility */
        --brand-primary:   var(--color-primary);
        --brand-secondary: var(--color-secondary);
        --brand-dark:      var(--blue-800);
        --brand-light:     var(--blue-50);
        --card-bg:         var(--bg-card);
        --success-light:   var(--color-success-bg);
        --warning-light:   var(--color-warning-bg);
        --danger-light:    var(--color-danger-bg);
        --success:         var(--color-success);
        --warning:         var(--color-warning);
        --danger:          var(--color-danger);
        /* radius-pill alias (tokens.css uses --radius-full) */
        --radius-pill:     var(--radius-full);
        /* T1-01 (Phase 26): .bottom-nav 實高（padding 0.5rem×2 + nav-btn min-height 48px
           ≈ 72px）+ iOS 安全區。.fixed-total / .order-summary-bar 共用此變數定位，
           避免固定底列被底部導航裁切（sticky 金額被攔腰切斷）。 */
        --bottom-nav-height: calc(72px + env(safe-area-inset-bottom, 0px));
        /* A11Y-02 (Phase 16): 家長端覆寫 --text-muted 為 WCAG AA 合格灰
           (#6b7280 對白底 ≈4.6:1)；原 tokens.css slate-400 #94a3b8 ≈2.56:1 <AA。
           深色模式不覆寫，沿用 tokens.css 深色 --text-muted #64748b。
           比照 teacher.css:13 已有的相同覆寫。 */
        --text-muted: #6b7280;
      }
      
      body {
        font-family: 'Noto Sans TC', system-ui, -apple-system, sans-serif;
        background-color: var(--bg-body);
        color: var(--text-primary);
        -webkit-font-smoothing: antialiased;
        padding-bottom: 80px;
      }

      /* ===== Header ===== */
      .app-header {
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1020;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
      }

      /* Right-side action group never shrinks; org name absorbs the squeeze */
      .app-header .header-actions {
        flex: 0 0 auto;
      }

      .brand-logo {
        font-weight: 700;
        color: var(--brand-dark);
        font-size: 1.15rem;
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 1 1 auto;
        min-width: 0;
      }

      /* Org name: single line, truncate with ellipsis (no 2-line wrap) */
      .brand-logo span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
      }

      .brand-logo-img {
        /* FB-01: responsive logo size (was 28px, too small per parent feedback) */
        width: 44px;
        height: 44px;
        object-fit: contain;
        border-radius: 6px;
        flex: 0 0 auto;
      }

      @media (max-width: 768px) {
        .brand-logo-img {
          width: 36px;
          height: 36px;
        }
      }

      .user-badge {
        background: var(--brand-light);
        color: var(--brand-primary);
        padding: 0.25rem 0.75rem;
        border-radius: var(--radius-pill);
        font-size: 0.85rem;
        font-weight: 600;
        white-space: nowrap;
        max-width: 9em;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .main-container {
        max-width: 600px;
        margin: 0 auto;
        padding: 1rem;
      }

      /* ===== Cards ===== */
      .card-box {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-light);
        margin-bottom: 1rem;
        overflow: hidden;
      }
      
      .card-p { padding: 1.25rem; }
      
      .card-header-app {
        background: var(--bg-body);
        padding: 0.875rem 1.25rem;
        border-bottom: 1px solid var(--border-light);
        font-weight: 600;
        color: var(--text-primary);
      }

      /* ===== Buttons ===== */
      .btn-primary-app {
        /* A11Y-02 (Phase 16): 白字 CTA 對比修正
           原 var(--brand-primary)(=blue-500 #3b82f6) 白字 ≈3.68:1 <AA。
           改用 blue-600 #2563eb（白字 ≈5.17:1 ≥4.5）。
           不動 --color-primary / --brand-primary token 本身（Phase 1 已收斂的品牌色）。 */
        background-color: var(--blue-600);
        border: none;
        border-radius: var(--radius-md);
        padding: 0.75rem 1.5rem;
        min-height: 44px;
        font-weight: 600;
        color: white;
        width: 100%;
        transition: all 0.2s;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
      }
      .btn-primary-app:hover { background-color: var(--blue-700); color: white; }
      .btn-primary-app:active { transform: scale(0.98); }

      .btn-secondary-app {
        /* A11Y-02 (Phase 16): 白字 CTA 對比修正
           原 var(--brand-secondary)(=green-500 #10b981) 白字 ≈2.54:1 <AA；
           green-600 #059669 ≈3.4:1 仍 <AA。改用 green-700 #047857（白字 ≈4.8:1 ≥4.5）。 */
        background-color: var(--green-700);
        border: none;
        border-radius: var(--radius-md);
        padding: 0.75rem 1.5rem;
        min-height: 44px;
        font-weight: 600;
        color: white;
        width: 100%;
        transition: all 0.2s;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
      }
      .btn-secondary-app:hover { background-color: var(--green-700); filter: brightness(0.92); color: white; }
      .btn-secondary-app:active { transform: scale(0.98); }
      
      .btn-outline-app {
        background-color: transparent;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 0.625rem 1.25rem;
        min-height: 44px;
        font-weight: 500;
        color: var(--text-primary);
        transition: all 0.2s;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
      }
      .btn-outline-app:hover { background-color: var(--bg-body); border-color: var(--brand-primary); color: var(--brand-primary); }
      /* UIFIX-86：無連結時「在家補課」鎖定鈕 disabled 視覺 */
      .btn-outline-app:disabled,
      .btn-outline-app.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background-color: transparent;
        border-color: var(--border-color);
        color: var(--text-muted);
      }

      .btn-light-app {
        background-color: var(--bg-body);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-md);
        padding: 0.5rem 1rem;
        min-height: 44px;
        font-weight: 500;
        color: var(--text-secondary);
        transition: all 0.2s;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
      }
      .btn-light-app:hover { background-color: var(--bg-hover); color: var(--text-primary); }
      
      .btn-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      /* ===== Bottom Navigation ===== */
      .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        padding: 0.5rem 0;
        box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.05);
        z-index: 1030;
        max-width: 600px;
        margin: 0 auto;
        border-top: 1px solid var(--border-light);
      }
      
      @media (min-width: 600px) {
          /* Base rule (left:0; right:0; max-width + margin:0 auto) already centers
             on the viewport, matching .main-container. Do not add left/transform here:
             left:50% + translateX(-50%) combined with right:0 + margin auto shifts
             the pill +60px off the content column centerline. */
          .bottom-nav {
              border-radius: 16px 16px 0 0;
              border: 1px solid var(--border-color);
              border-bottom: none;
          }
      }

      .nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 0.75rem;
        padding: 0.625rem 0.25rem;
        gap: 3px;
        transition: color 0.2s;
        min-height: 48px;
      }

      .nav-btn.active { color: var(--brand-primary); }
      .nav-btn.active i { color: var(--brand-primary); }
      .nav-btn[aria-current="page"] { color: var(--brand-primary); }
      .nav-btn i { font-size: 1.25rem; margin-bottom: 2px; }

      /* ===== Page Titles ===== */
      .page-title {
        font-size: 1.35rem;
        font-weight: 700;
        margin-bottom: 1.25rem;
        color: var(--brand-dark);
        line-height: 1.2;
      }
      
      .section-title {
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 1rem;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }
      .section-title i { color: var(--brand-primary); }
      
      .section-label {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-secondary);
        margin-bottom: 0.5rem;
      }

      /* ===== Forms ===== */
      .form-input {
        border-radius: var(--radius-md);
        padding: 0.75rem;
        border: 1px solid var(--border-color);
        background-color: var(--bg-card);
        width: 100%;
        font-size: 0.95rem;
        transition: border-color 0.2s, box-shadow 0.2s;
      }
      .form-input:focus {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        outline: none;
      }
      
      .form-select-app {
        border-radius: var(--radius-md);
        padding: 0.75rem;
        border: 1px solid var(--border-color);
        background-color: var(--bg-card);
        width: 100%;
        font-size: 0.95rem;
        cursor: pointer;
      }
      .form-select-app:focus {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        outline: none;
      }
      
      .form-label-app {
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-secondary);
        margin-bottom: 0.375rem;
        display: block;
      }

      /* ===== Pills / Badges ===== */
      .pill {
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.25rem 0.625rem;
        border-radius: var(--radius-pill);
        font-size: 0.75rem;
        font-weight: 600;
        border: 1px solid transparent;
        white-space: nowrap;
      }
      
      .pill-primary { background: var(--brand-light); color: var(--brand-primary); border-color: var(--blue-200); }
      .pill-secondary { background: var(--green-100); color: var(--green-600); border-color: var(--green-200); }
      .pill-success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--green-200); }
      .pill-warning { background: var(--color-warning-bg); color: var(--amber-700); border-color: var(--amber-200); }
      .pill-danger { background: var(--color-danger-bg); color: var(--color-danger-text, #b91c1c); border-color: var(--red-200); }
      .pill-info { background: var(--color-info-bg); color: var(--color-info); border-color: var(--sky-200); }
      .pill-muted { background: var(--bg-body); color: var(--text-secondary); border-color: var(--border-color); }
      
      /* Score category pills */
      .pill-quiz { background: var(--brand-light); color: var(--brand-primary); border-color: var(--blue-200); }
      .pill-cram-mock { background: var(--color-info-bg); color: var(--color-info); border-color: var(--sky-200); }
      .pill-exam { background: var(--color-success-bg); color: var(--color-success); border-color: var(--green-200); }
      .pill-school-mock { background: var(--color-warning-bg); color: var(--amber-700); border-color: var(--amber-200); }

      /* ===== Form Sections ===== */
      .form-section {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        padding: 1.25rem;
        margin-bottom: 1rem;
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-light);
      }

      /* T1-02 (Phase 26): 當 .form-check.form-switch 同時是 .form-section 卡片時，
         Bootstrap .form-switch 的 input margin-left:-2.5em 會把開關拉出卡片左緣
         （.form-section padding 簡寫 1.25rem 蓋掉了 .form-check 預留的 padding-left）。
         補足左內距讓 switch 落回卡框內。 */
      .form-section.form-check {
        padding-left: 3.25rem;
      }

      /* ===== Chip / Tag Selection ===== */
      .chip-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
      }
      
      .chip-input { display: none; }
      
      .chip-label {
        background: var(--bg-body);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-pill);
        padding: 0.5rem 1rem;
        min-height: 44px;
        font-size: 0.9rem;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
      }
      
      .chip-input:checked + .chip-label {
        background: var(--brand-primary);
        color: white;
        border-color: var(--brand-primary);
        box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
      }

      /* ===== Menu List ===== */
      .menu-list {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        overflow: hidden;
        border: 1px solid var(--border-light);
        box-shadow: var(--shadow-sm);
      }

      .menu-item {
        display: flex;
        align-items: center;
        padding: 1rem 1.25rem;
        text-decoration: none;
        color: var(--text-primary);
        border-bottom: 1px solid var(--border-light);
        transition: background-color 0.2s;
      }
      
      .menu-item:last-child { border-bottom: none; }
      .menu-item:active { background-color: var(--bg-body); }

      .menu-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 1rem;
        font-size: 1.1rem;
        flex-shrink: 0;
      }
      
      .icon-primary { background: var(--brand-light); color: var(--brand-primary); }
      .icon-secondary { background: var(--green-100); color: var(--brand-secondary); }
      .icon-warning { background: var(--color-warning-bg); color: var(--color-warning); }
      
      .menu-text { flex-grow: 1; }
      .menu-title { font-weight: 600; font-size: 1rem; display: block; }
      .menu-desc { font-size: 0.75rem; color: var(--text-secondary); }
      .arrow-icon { color: var(--text-muted); font-size: 0.9rem; }

      /* ===== Empty State ===== */
      .empty-state {
        padding: 3rem 1.5rem;
        text-align: center;
        color: var(--text-secondary);
      }
      .empty-state i {
        font-size: 3rem;
        opacity: 0.25;
        margin-bottom: 1rem;
        display: block;
      }
      .empty-state .title {
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 0.25rem;
      }
      .empty-state .desc {
        font-size: 0.875rem;
      }

      /* ===== Modal ===== */
      .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1050;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 1rem;
      }
      
      .modal-panel {
        background: var(--bg-card);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
        width: 100%;
        max-width: 400px;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
      }
      
      .modal-title {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 1rem;
      }

      /* ===== Info/Summary Box ===== */
      .info-box {
        background: var(--brand-light);
        border: 1px dashed var(--blue-300);
        border-radius: var(--radius-md);
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        color: var(--brand-dark);
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
      }
      
      .summary-box {
        background: var(--color-warning-bg);
        border: 1px dashed #fcd34d;
        border-radius: var(--radius-md);
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        color: var(--color-warning-dark);
      }

      /* ===== Quick Date Buttons ===== */
      /* T6-05：快速日期 chip 原為灰底灰字（--bg-body / --text-secondary）觀感似 disabled；
       * 改為白底品牌藍框藍字，明確為可點狀態，hover→淡藍填色、active→實心藍。 */
      .quick-btn {
        background: var(--card-bg);
        border: 1px solid var(--brand-primary);
        border-radius: var(--radius-md);
        padding: 0.5rem 1rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        font-size: 0.85rem;
        color: var(--brand-primary);
        cursor: pointer;
        transition: all 0.2s;
        white-space: nowrap;
      }
      .quick-btn:hover {
        background: var(--brand-light);
        border-color: var(--brand-primary);
        color: var(--brand-primary);
      }
      .quick-btn.active {
        background: var(--brand-primary);
        border-color: var(--brand-primary);
        color: white;
      }

      /* ===== Subject Grid Selection ===== */
      .subject-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
      }
      
      .subject-label {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 0.9rem;
        cursor: pointer;
        transition: all 0.2s;
        display: block;
      }
      
      .chip-input:checked + .subject-label {
        border-color: var(--brand-primary);
        background: var(--brand-light);
        color: var(--brand-primary);
        font-weight: 600;
      }

      /* ===== Student Tags ===== */
      .student-tag {
        background: var(--bg-body);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        padding: 0.5rem 0.875rem;
        border-radius: var(--radius-md);
        font-size: 0.875rem;
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }
      .student-tag i { color: var(--brand-secondary); }

      /* ===== Alert Overrides ===== */
      .alert {
        border-radius: var(--radius-md);
        border: none;
        font-size: 0.9rem;
      }
      .alert-success { background: var(--color-success-bg); color: var(--color-success-dark); }
      .alert-warning { background: var(--color-warning-bg); color: var(--color-warning-dark); }
      .alert-danger { background: var(--color-danger-bg); color: var(--color-danger-dark); }
      .alert-info { background: var(--color-info-bg); color: var(--color-info-dark); }

      /* ===== Minimal Theme Overrides ===== */
      body.theme-minimal {
        background-color: var(--bg-body);
      }
      body.theme-minimal .card-box {
        box-shadow: none;
        border: 1px solid var(--border-color);
      }
      body.theme-minimal .app-header {
        box-shadow: none;
      }
      body.theme-minimal .bottom-nav {
        box-shadow: none;
        border-top: 1px solid var(--border-color);
        background: var(--bg-card);
      }
      body.theme-minimal .btn-primary-app,
      body.theme-minimal .btn-secondary-app {
        box-shadow: none;
      }
      body.theme-minimal .info-box {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
      }
      body.theme-minimal .profile-header {
        box-shadow: none;
        border: 1px solid var(--border-color);
      }
      body.theme-minimal .profile-header::before {
        display: none;
      }
      body.theme-minimal .menu-list {
        box-shadow: none;
        border: 1px solid var(--border-color);
      }
      body.theme-minimal .form-section {
        box-shadow: none;
        border: 1px solid var(--border-color);
      }
      body.theme-minimal .modal-panel {
        box-shadow: none;
        border: 1px solid var(--border-color);
      }

/* === Tab Bar (Scores/Schedule Switcher) === */
.tab-bar {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: var(--space-4, 1rem);
  overflow: hidden;
}

.tab-item {
  flex: 1;
  text-align: center;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 0.5rem);
}

.tab-item.active {
  background: var(--color-primary, #3b82f6);
  color: #ffffff;
  font-weight: 600;
}

.tab-item:not(.active):hover {
  background: var(--bg-muted, #f1f5f9);
  color: var(--text-primary);
}

/* === Parent Dashboard === */
.dash-child-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  position: relative;
  overflow: hidden;
}

.dash-child-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--color-primary);
  border-radius: 4px 0 0 4px;
}

.dash-child-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.dash-child-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dash-attendance {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
}

.dash-attendance.present {
  background: var(--color-success-bg);
  color: var(--green-700);
}

.dash-attendance.late {
  background: var(--color-warning-bg);
  color: var(--amber-700);
}

.dash-attendance.absent {
  background: var(--color-danger-bg);
  color: var(--red-700);
}

.dash-attendance.leave {
  background: var(--color-info-bg);
  color: var(--sky-600);
}

.dash-attendance.pending {
  background: var(--bg-muted, #f1f5f9);
  color: var(--text-secondary);
}

.dash-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: 1rem;
}

.dash-action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dash-action-card:active {
  transform: scale(0.97);
}

.dash-action-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  text-decoration: none;
}

.dash-action-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.dash-action-title {
  font-weight: 600;
  font-size: 0.875rem;
}

/* EMPTY-01: 功能卡即時摘要徽章——僅在值 > 0 時由模板渲染 */
.dash-action-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--color-danger, #ef4444);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}
.dash-action-badge-warning { background: var(--color-warning, #f59e0b); }
.dash-action-badge-danger  { background: var(--color-danger,  #ef4444); }

/* === Child Switcher === */
.child-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.child-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand-light, #eff6ff);
  color: var(--brand-primary, #3b82f6);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-primary-border, #bfdbfe);
  transition: all 0.15s ease;
  white-space: nowrap;
}

/* Child name inside the pill: never wrap, truncate when too long */
.child-pill-name {
  max-width: 7em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.child-pill:active {
  transform: scale(0.97);
}

.child-pill .chevron {
  font-size: 0.6rem;
  transition: transform 0.15s ease;
}

.child-switcher.open .child-pill .chevron {
  transform: rotate(180deg);
}

.child-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 100;
  display: none;
  overflow: hidden;
}

.child-switcher.open .child-dropdown {
  display: block;
  animation: fadeInDown 0.15s ease;
}

.child-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-light);
}

.child-dropdown-item:last-child {
  border-bottom: none;
}

.child-dropdown-item:hover,
.child-dropdown-item.active {
  background: var(--brand-light, #eff6ff);
  text-decoration: none;
  color: var(--text-primary);
}

.child-dropdown-item.active {
  font-weight: 600;
  color: var(--brand-primary, #3b82f6);
}

/* === Meal Page Improvements === */
.day-card.today {
  border-color: var(--color-primary);
  border-width: 2px;
}

.day-card.today .date-num {
  color: var(--color-primary);
}

.today-badge {
  display: inline-block;
  background: var(--color-primary);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  margin-top: 2px;
}

.order-summary-bar {
  position: fixed;
  /* T1-01: 與 .fixed-total 共用 --bottom-nav-height（含 safe-area），行為等同原 80px */
  bottom: calc(var(--bottom-nav-height) + 8px);
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 900;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  animation: fadeInUp 0.25s ease;
}

.order-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.order-count strong {
  color: var(--color-primary);
}

/* === Meal Ordering Page === */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.month-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--brand-dark);
}

.day-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.day-card.locked {
  background: var(--bg-body);
  opacity: 0.8;
}

.day-header {
  display: flex;
  padding: 1rem;
  cursor: pointer;
  align-items: stretch;
}

.day-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  margin-right: 1rem;
  border-right: 1px solid var(--border-light);
  padding-right: 1rem;
}

.date-num { font-size: 1.25rem; font-weight: 700; line-height: 1; color: var(--text-primary); }
.date-day { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

.day-menu { flex-grow: 1; }
/* T3-11（19-12）：廠商名改中性色——原 --brand-secondary（綠）與「已訂餐」.status-ordered
   （綠）同色雙語義易混淆；廠商名僅為標籤（非狀態）故收斂為中性，綠色語義專留給「已訂/完成」。 */
.restaurant-name { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; margin-bottom: 2px; }
.menu-items-text { font-size: 0.95rem; font-weight: 500; color: var(--text-primary); }

/* T6-02（19-12）：菜單品項預設收合——summary 可點展開，收合時整月頁高大幅下降 */
.menu-collapse { margin-top: 2px; }
.menu-collapse-summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.menu-collapse-summary::-webkit-details-marker { display: none; }
.menu-collapse[open] > .menu-collapse-summary { margin-bottom: 2px; }

/* EMPTY-03: 菜單品項條列——以 chip 風格 flex-wrap，取代「A / B / C」長串擠版 */
.menu-items-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}
.menu-items-list > li {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-body, #f3f4f6);
  color: var(--text-primary, #111827);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.25;
}

.status-indicator {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.status-ordered { color: var(--success); font-weight: 600; }

.order-form-area {
  background: var(--bg-body);
  border-top: 1px solid var(--border-light);
  padding: 1rem;
  display: none;
}

.day-card.expanded .order-form-area { display: block; }
.day-card.expanded { border-color: var(--brand-primary); box-shadow: var(--shadow-md); }

/* W6 (#6)：跳日/「今天」定位後短暫高亮（JS 加 class、1.6s 後移除；
   沿用 .day-card 既有 border/box-shadow transition 淡入淡出） */
.day-card.jump-highlight {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}

.student-row {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border-color);
}
.student-row:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s;
}
.radio-option:hover { border-color: var(--brand-primary); }

.radio-option input { margin-right: 0.75rem; transform: scale(1.2); accent-color: var(--brand-primary); }
.option-label { flex-grow: 1; font-size: 0.9rem; }
.option-price { font-size: 0.85rem; color: var(--text-secondary); }

/* === Scores Page === */
.score-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.score-row {
  border-bottom: 1px solid var(--border-light);
  padding: 1rem;
}
.score-row:last-child { border-bottom: none; }
.score-meta { color: var(--text-secondary); font-size: 0.8rem; }
.score-subject { font-weight: 700; color: var(--text-primary); }
.score-value { font-weight: 800; font-size: 1.15rem; color: var(--brand-primary); }

/* === Schedule (Calendar) Page === */
.cal-container {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-head {
  background: var(--slate-700);
  text-align: center;
  font-weight: 600;
  color: var(--slate-200);
  padding: 0.6rem 0;
  font-size: 0.75rem;
}
.cal-head:first-child { color: var(--color-danger-text, #fca5a5); }
.cal-head:last-child { color: var(--blue-300); }
.cal-cell {
  background: var(--card-bg);
  min-height: 72px;
  padding: 0.4rem;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  transition: background 0.15s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.out {
  background: var(--bg-body);
}
.cal-cell.out .day-num { color: var(--text-muted); }
.cal-cell.today {
  background: linear-gradient(135deg, var(--green-50), var(--green-100));
}
.cal-cell.today .day-num {
  background: var(--success);
  color: white;
}
.cal-cell.holiday {
  background: var(--red-50);
}
.cal-cell.has-class {
  cursor: pointer;
}
.cal-cell.has-class:hover {
  background: var(--sky-50);
}
.day-num {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
  border-radius: 50%;
  margin-bottom: 0.25rem;
}
.cal-cell:first-child .day-num,
.cal-cell:nth-child(7n) .day-num { color: var(--text-muted); }
.session-dot {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
}
.session-dot span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
}
.session-dot span:nth-child(2) { background: var(--brand-secondary); }
.session-dot span:nth-child(3) { background: var(--warning); }
.holiday-tag {
  font-size: 0.6rem;
  color: var(--danger);
  font-weight: 600;
  margin-top: auto;
  line-height: 1.2;
}

/* A11Y-04 + A11Y-01 (Phase 16): 月曆圖例
   色塊沿用 .session-dot / .holiday-tag / .cal-cell.today 既有色彩 token，
   不引入新硬編色；--text-secondary 確保圖例文字 AA 對比。 */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3, 0.75rem);
  align-items: center;
  padding: var(--space-2, 0.5rem) var(--space-1, 0.25rem);
  margin-top: var(--space-2, 0.5rem);
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.cal-legend-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1;
}
.cal-legend-swatch--session {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-primary);
}
.cal-legend-swatch--holiday {
  background: var(--red-50);
  color: var(--danger);
  border: 1px solid var(--red-200);
}
.cal-legend-swatch--today {
  background: var(--success);
  border-radius: 50%;
}
.cal-legend-label {
  color: var(--text-secondary);
}

.day-detail {
  background: var(--bg-body);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-top: 1rem;
  display: none;
}
.day-detail.show { display: block; }
.day-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}
.day-detail-title {
  font-weight: 700;
  color: var(--text-primary);
}
.session-card {
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
}
.session-card:last-child { margin-bottom: 0; }
.session-subject {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.session-info {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.cal-cell.selected {
  background: var(--blue-100) !important;
  box-shadow: inset 0 0 0 2px var(--brand-primary);
}

/* === Absence Request Page === */
.date-input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quick-date-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.history-link {
  display: block;
  text-align: center;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
}
.history-link:hover {
  color: var(--brand-primary);
}

/* === Absence Records Page === */
.filter-scroll {
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  display: inline-block;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.4rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  transition: all 0.2s;
}

.filter-chip.active {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.record-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  position: relative;
  display: flex;
  gap: 1rem;
}

.record-card.status-canceled { opacity: 0.6; background: var(--bg-body); }

.date-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 60px;
  border-right: 1px dashed var(--border-color);
  padding-right: 1rem;
}

.rec-month { font-size: 0.75rem; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; }
.rec-day { font-size: 1.5rem; font-weight: 800; line-height: 1; color: var(--brand-primary); }
.rec-year { font-size: 0.7rem; color: var(--text-muted); }

.info-column { flex-grow: 1; }

.rec-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; color: var(--text-primary); }
.rec-meta { font-size: 0.85rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.5rem; }

.status-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: inline-block;
  margin-bottom: 0.5rem;
  white-space: nowrap; /* T1: 家長端狀態 badge 不一字一行直排 */
}

/* T6-08：家長端以 <a> 當按鈕（.btn / .btn-*-app）時，去除瀏覽器/全域 a 底線 */
a.btn,
a.btn-primary-app,
a.btn-secondary-app,
a.btn-outline-app,
a.btn-light-app {
  text-decoration: none;
}

.badge-pending { background: var(--warning-light); color: var(--color-warning-text, #ea580c); }
.badge-approved { background: var(--success-light); color: var(--success); }
.badge-canceled { background: var(--bg-body); color: var(--text-secondary); text-decoration: line-through; }

.btn-sm-pill {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  border-radius: var(--radius-pill);
}

.btn-cancel {
  border: 1px solid var(--danger-light);
  background: var(--card-bg);
  color: var(--danger);
  font-size: 0.75rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  margin-top: 0.75rem;
  display: inline-block;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { background: var(--danger-light); }

/* === Payment List Page === */
.bill-summary {
  background: var(--bg-body);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.bill-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.bill-row.total {
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}
.bill-row.total .amount {
  font-size: 1.125rem;
  color: var(--brand-primary);
}
.account-info {
  background: var(--bg-body);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.fixed-total {
  position: fixed;
  /* T1-01: 對齊 .order-summary-bar，落在底部導航（--bottom-nav-height）之上，
     不再寫死 60px 被 ~72px 高的 .bottom-nav 攔腰裁切。 */
  bottom: calc(var(--bottom-nav-height) + 8px);
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  /* z-index 需 ≥ .bottom-nav(1030)，避免重疊區被導航蓋住 */
  z-index: 1031;
  box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.05);
}
.payment-verified-banner {
  background: linear-gradient(135deg, var(--green-100), var(--green-200));
  border: 1px solid #6ee7b7;
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-success-dark);
  font-weight: 600;
  font-size: 0.875rem;
}
.payment-verified-banner i {
  font-size: 1.125rem;
  color: var(--green-600);
}

/* === Payment Detail Page === */
.detail-summary {
  background: var(--bg-body);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-top: 1rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.detail-row.total {
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   DARK MODE — Parent Portal
   Uses tokens.css dark theme variables. Only overrides elements
   that reference palette colors (blue-50, green-100 etc.) which
   don't auto-adapt to dark mode.
   ============================================================ */
html.dark-theme {
  /* Portal-specific alias overrides for dark backgrounds */
  --brand-dark: #93c5fd;      /* blue-800 → blue-300 (readable on dark) */
  --brand-light: rgba(59, 130, 246, 0.15);  /* blue-50 → subtle blue */
}

/* Pills & badges */
html.dark-theme .pill-primary,
html.dark-theme .pill-quiz {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary-border);
}
html.dark-theme .pill-secondary,
html.dark-theme .pill-success,
html.dark-theme .pill-exam {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border-color: rgba(16, 185, 129, 0.3);
}
html.dark-theme .pill-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Icon badges */
html.dark-theme .icon-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
html.dark-theme .icon-secondary {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

/* Buttons */
/* UIFIX-93: dark 主鈕底為亮藍（#60a5fa），白字僅 2.54:1 → 深 slate 字 ≈ 7.0:1 */
html.dark-theme .btn-primary-app {
  background: var(--color-primary);
  color: #0f172a;
}
html.dark-theme .btn-primary-app:hover {
  background: var(--color-primary-hover);
  color: #0f172a;
}
html.dark-theme .btn-secondary-app {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Cards & sections */
html.dark-theme .card-section-header,
html.dark-theme .quick-links-card a,
html.dark-theme .rc-banner-info,
html.dark-theme .user-badge {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
html.dark-theme .card-banner-info {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* Calendar */
html.dark-theme .cal-head:first-child {
  color: var(--color-danger-text);
}
html.dark-theme .cal-day.today {
  background: rgba(245, 158, 11, 0.15);
}
html.dark-theme .cal-event-marker {
  color: #fff;
}

/* Status badges */
html.dark-theme .badge-pending {
  color: var(--color-warning-text);
}

/* Meal ordering */
html.dark-theme .meal-cal-grid .day-cell {
  background: var(--bg-card);
  border-color: var(--border-color);
}
html.dark-theme .meal-cal-grid .day-cell.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

/* Payment verified banner */
html.dark-theme .payment-verified-banner {
  background: var(--color-success-bg);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--color-success-text);
}
html.dark-theme .payment-verified-banner i {
  color: var(--color-success-text);
}

/* Form inputs dark mode */
html.dark-theme .form-input:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}
html.dark-theme .form-select-app:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* Refund form */
html.dark-theme .refund-info-card {
  background: var(--bg-elevated);
  border-color: var(--border-color);
}

/* ============================================================
   UIFIX-93 — Parent dark 殘缺補修
   ============================================================ */

/* Bootstrap .text-muted 在深底為深灰字（~1.1:1 近隱形）→ 映射暗色次要文字
   （#94a3b8 on #1e293b ≈ 5.7:1，滿足 ≥4.5）。涵蓋訂餐「本日無供餐／
   （當日菜單已下架）」、success/contact、absence/records 學生名等。 */
html.dark-theme .text-muted {
  color: var(--text-secondary) !important;
}

/* 課表「休」格：亮粉底（red-50 固定值）＋近白日期數字＝數字不可見
   → 暗紅 surface，數字/「休」字恢復可讀（#f1f5f9 ≈ 12:1、#fca5a5 ≈ 6.4:1） */
html.dark-theme .cal-cell.holiday {
  background: #3f1d1d;
}
/* 週日（first-child/7n）休格數字原走 text-muted，暗紅底上不足 → 固定主文字色 */
html.dark-theme .cal-cell.holiday .day-num {
  color: var(--text-primary);
}
html.dark-theme .holiday-tag {
  color: var(--color-danger-text, #fca5a5);
}

/* 原生 select / .form-select(-app) dark 白底（或黑字深底）突兀
   → 深底亮字＋暗色 scheme（原生下拉清單跟著暗色），Bootstrap caret 換淺色 */
html.dark-theme select,
html.dark-theme .form-select,
html.dark-theme .form-select-app {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
  color-scheme: dark;
}
html.dark-theme .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
}

/* ============================================================
   UIFIX-94 — 家長端行動版表格/表單歸零（Phase 16-03）
   ============================================================ */

/* (R6-C6) absence 日期輸入溢出卡 13px：原生 date input 的固有 min-width
   會撐破 1fr 1fr grid。grid item 與 input 補 min-width:0 後輸入框可隨
   軌道收縮（.form-input 已是 width:100%）。桌機軌道寬於固有寬，為零變化
   no-op，故不包 media query（D-03 紀律之「不影響桌機的結構調整」）。 */
.date-input-group > div {
  min-width: 0;
}
.date-input-group .form-input {
  min-width: 0;
}

/* T1-27：金額欄 .num（tabular + nowrap）——金額字串永不換行/斷字，
   配合 .pd-table 橫向捲動，390px 下「本期」末位不再被卡片右緣裁掉
   （$9,000 誤讀為 $900）。沿用 _payments_table.html 的 font-monospace num 範式。 */
.num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* (R6-C3) 繳費明細表橫向溢出右緣漸層提示（payment_detail.html 內
   pdCheckOverflow 偵測加 class；同後台 .table-responsive 模式） */
.pd-table.has-overflow {
  position: relative;
}
.pd-table.has-overflow::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 36px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
  pointer-events: none;
  z-index: 2;
}
html.dark-theme .pd-table.has-overflow::after {
  background: linear-gradient(to right, transparent, rgba(30,41,59,0.9));
}

/* (R6-C3) 390px 下學費明細表 333px > 卡內 316px，「本期」金額被裁
   17px（$9000 視覺變 $900）→ 縮 科目 欄保留寬（蓋過模板 inline style
   需 !important）並收緊儲存格留白，使表格放得進卡片。 */
@media (max-width: 480px) {
  .pd-table .pd-col-subject {
    min-width: 4em !important;
  }
  .pd-table .table th,
  .pd-table .table td {
    padding-left: 0.2rem;
    padding-right: 0.2rem;
  }
  /* 實測 390px 仍差 15px（table 331 vs 卡內 316）→ 縮一級字級讓五欄完整放入，
     「本期」金額在不捲動的狀態下即完整可讀（T1-27 收尾）。 */
  .pd-table .table {
    font-size: 0.78rem;
  }
}
