.container {
      padding-top: .5rem;
    }

    .search-layout {
      display: grid;
      grid-template-columns: 340px 1fr;
      gap: 1rem;
      margin-top: 1rem;
      min-height: calc(100vh - 100px);
    }

    /* left: results list */
    .results-panel {
      display: flex;
      flex-direction: column;
      gap: .5rem;
    }

    .result-item {
      padding: .65rem .85rem;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--bg);
      cursor: pointer;
      transition: background .12s, border-color .12s;
      user-select: none;
    }

    .result-item:hover {
      background: var(--accent-bg);
      border-color: var(--accent);
    }

    .result-item.active {
      background: var(--accent-bg);
      border-color: var(--accent);
    }

    .result-item.pulse {
      animation: result-pulse .55s ease;
    }

    @keyframes result-pulse {
      0% { transform: scale(1); }
      35% { transform: scale(1.015); border-color: var(--accent); }
      100% { transform: scale(1); }
    }

    .result-item .name {
      font-weight: 600;
      font-size: .92rem;
    }

    .result-item .meta {
      font-size: .78rem;
      color: var(--muted);
      margin-top: .15rem;
    }

    /* right: student detail */
    .detail-panel {
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .detail-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: .5rem;
      height: 100%;
      color: var(--muted);
      font-size: .9rem;
      border: 1px dashed var(--border);
      border-radius: var(--radius);
      padding: 3rem;
    }

    .detail-empty svg {
      opacity: .25;
    }

    /* student header */
    .student-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }

    .student-header h2 {
      margin: 0;
      font-size: 1.3rem;
    }

    .student-header .lrn {
      font-size: .82rem;
      color: var(--muted);
      margin-top: .2rem;
    }

    .student-header .actions {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: .5rem;
      flex-shrink: 0;
    }

    .student-header-tools {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: .5rem;
      flex-wrap: wrap;
    }

    .scan-indicator {
      font-size: .72rem;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      gap: .25rem;
    }

    .scan-indicator.has-scan {
      color: var(--success);
    }

    .scan-indicator.no-scan {
      color: var(--muted);
      opacity: .6;
    }

    /* timeline */
    .timeline {
      display: flex;
      flex-direction: column;
      gap: .75rem;
    }

    .timeline-year {
      border: 1px solid var(--border);
      border-radius: var(--radius);
      position: relative;
      overflow: hidden;
    }

    .timeline-year-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: .65rem 1rem;
      background: var(--bg);
      border-bottom: 1px solid var(--border);
      cursor: pointer;
      user-select: none;
      font-size: .9rem;
      font-weight: 600;
    }

    .timeline-action-btn,
    .record-tabs .timeline-action-btn {
      opacity: 0;
      transition: opacity 0.15s ease, background 0.15s, border-color 0.15s, color 0.15s;
      background: var(--bg);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: .35rem .6rem;
    }
    
    .timeline-action-btn:hover {
      background: var(--border);
    }

    .timeline-action-btn.del-btn:hover {
      background: var(--danger);
      color: white;
      border-color: var(--danger);
    }

    .timeline-year-body:hover .timeline-action-btn {
      opacity: 1;
    }



    .timeline-year-header:hover {
      background: var(--accent-bg);
    }

    .timeline-year-header .right {
      display: flex;
      align-items: center;
      gap: .65rem;
    }

    .chevron {
      display: inline-block;
      transition: transform 0.2s ease;
      transform: rotate(-90deg); /* Closed state: points right */
      font-size: .85rem;
      color: var(--muted);
      margin-left: .5rem;
    }

    .timeline-year-header.open .chevron {
      transform: rotate(0deg); /* Open state: points down */
    }

    .timeline-year-body {
      padding: 1rem;
      background: var(--surface);
      display: none; /* Closed by default */
    }

    /* grades table inside timeline */
    .grades-display {
      width: 100%;
      border-collapse: collapse;
      font-size: .83rem;
    }

    .grades-display th {
      font-size: .72rem;
      font-weight: 600;
      color: var(--muted);
      text-align: center;
      padding: .3rem .4rem;
      border-bottom: 1px solid var(--border);
    }

    .grades-display th.subj {
      text-align: left;
    }

    .grades-display td {
      padding: .3rem .4rem;
      text-align: center;
      border-bottom: 1px solid var(--border);
      font-size: .83rem;
    }

    .grades-display td.subj {
      text-align: left;
      color: var(--text);
    }

    .grades-display tr:last-child td {
      border-bottom: none;
    }

    .grades-display .avg-row td {
      font-weight: 700;
      background: var(--bg);
    }

    .grade-pill {
      display: inline-block;
      padding: .1rem .45rem;
      border-radius: 99px;
      font-size: .75rem;
      font-weight: 600;
    }

    .grade-pass {
      background: #ecfdf5;
      color: var(--success);
    }

    .grade-fail {
      background: #fef2f2;
      color: var(--danger);
    }

    .grade-honors {
      background: #eff6ff;
      color: #2563eb;
    }

    [data-theme="dark"] .grade-pass {
      background: #1a2e22;
    }

    [data-theme="dark"] .grade-fail {
      background: #2e1a1a;
    }

    /* tabs inside a year record */
    .record-tabs {
      display: flex;
      gap: .25rem;
      margin-bottom: .75rem;
    }

    .record-tabs button {
      padding: .3rem .75rem;
      font-size: .82rem;
      border: 1px solid var(--border);
      border-radius: 99px;
      background: transparent;
      color: var(--muted);
    }

    .record-tabs button.active {
      background: var(--text);
      border-color: var(--text);
      color: var(--bg);
    }

    /* attendance row */
    .attendance-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: .4rem;
      margin-top: .5rem;
    }

    .att-cell {
      text-align: center;
      padding: .35rem;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: .8rem;
    }

    .att-cell .month {
      font-size: .7rem;
      color: var(--muted);
    }

    .att-cell .days {
      font-weight: 600;
    }

    /* behavior */
    .behavior-table {
      width: 100%;
      border-collapse: collapse;
      font-size: .83rem;
      margin-top: .5rem;
    }

    .behavior-table th {
      font-size: .72rem;
      font-weight: 600;
      color: var(--muted);
      text-align: center;
      padding: .3rem;
      border-bottom: 1px solid var(--border);
    }

    .behavior-table th.value-col {
      text-align: left;
    }

    .behavior-table td {
      padding: .3rem;
      text-align: center;
      border-bottom: 1px solid var(--border);
    }

    .behavior-table td.value-col {
      text-align: left;
    }

    .behavior-table tr:last-child td {
      border-bottom: none;
    }

    /* scan viewer inline */
    .scan-inline {
      margin-top: .75rem;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      max-height: 480px;
    }

    .scan-inline img {
      width: 100%;
      object-fit: contain;
    }

    .scan-inline iframe {
      width: 100%;
      height: 480px;
      border: none;
    }

    /* print button */
    /* modal */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.4);
      backdrop-filter: blur(4px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      visibility: hidden;
      opacity: 0;
      transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
    }

    .modal-overlay.active {
      visibility: visible;
      opacity: 1;
    }

    .modal {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.5rem;
      width: 550px;
      max-width: 90%;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
      user-select: none;
    }

    .modal h3 {
      margin-top: 0;
      margin-bottom: 1rem;
    }

    .modal .field {
      margin-bottom: .8rem;
    }

    .modal .field label {
      display: block;
      font-size: .8rem;
      font-weight: 600;
      margin-bottom: .2rem;
      color: var(--muted);
    }

    .modal .field input,
    .modal .field select {
      width: 100%;
      padding: .4rem .6rem;
    }

    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: .5rem;
      margin-top: 1.5rem;
    }

    .record-choice-list {
      display: flex;
      flex-direction: column;
      gap: .5rem;
      margin-top: .75rem;
    }

    .record-choice {
      width: 100%;
      justify-content: space-between;
      padding: .7rem .8rem;
      text-align: left;
      border-radius: 2px;
    }

    .record-choice span {
      color: var(--muted);
      font-size: .78rem;
      font-weight: 500;
    }

    .empty.loading-empty {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: .65rem;
    }

    .toast-stack {
      position: fixed;
      top: 64px;
      right: 1rem;
      z-index: 1200;
      display: flex;
      flex-direction: column;
      gap: .5rem;
      pointer-events: none;
    }

    .toast {
      min-width: 260px;
      max-width: 360px;
      padding: .75rem .9rem;
      border: 1px solid #9bd3ad;
      border-left: 4px solid var(--success);
      border-radius: var(--radius);
      background: #effaf3;
      color: #164b2b;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
      font-size: .86rem;
      font-weight: 600;
      opacity: 0;
      transform: translateY(-6px);
      animation: toast-in .18s ease forwards, toast-out .18s ease 3.1s forwards;
      user-select: none;
    }

    [data-theme="dark"] .toast {
      background: #102a1b;
      border-color: #2d7a49;
      border-left-color: var(--success);
      color: #bff0cd;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    }

    @keyframes toast-in {
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes toast-out {
      to {
        opacity: 0;
        transform: translateY(-6px);
      }
    }

    @media print {
      nav,
      .search-bar,
      .results-panel,
      .student-header .actions,
      .modal-overlay,
      .timeline-action-btn {
        display: none !important;
      }

      body.printing-record .timeline-year:not(.print-target),
      body.printing-record .record-tabs {
        display: none !important;
      }

      html,
      body,
      main,
      .container,
      .search-layout,
      .detail-panel {
        overflow: visible !important;
        height: auto !important;
      }

      .search-layout {
        display: block;
        min-height: 0;
      }

      .student-header {
        align-items: flex-start;
      }

      body.printing-record .timeline-year.print-target,
      body.printing-record .timeline-year.print-target .timeline-year-body {
        display: block !important;
      }
    }

    @media (max-width: 768px) {

      nav,
      .search-bar,
      .results-panel,
      .student-header .actions {
        display: none !important;
      }

      .search-layout {
        display: block;
      }

      .detail-panel {
        display: block;
      }
    }
