* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
    :root {
      --primary:    #0f4c75;
      --primary-lt: #1a6fa8;
      --accent:     #10b981;
      --danger:     #ef4444;
      --warn:       #f59e0b;
      --surface:    #ffffff;
      --surface-2:  #f8fafc;
      --border:     #e2e8f0;
      --text-1:     #1e293b;
      --text-2:     #64748b;
      --text-3:     #94a3b8;
      --r:          12px;
      --r-sm:       8px;
      --shadow:     0 2px 12px rgba(0,0,0,0.08);
    }
    html, body { height: 100%; background: #f0f4f8; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--text-1); }

    /* ── Screen system ───────────────────────────────────── */
    .screen { display: none; min-height: 100vh; flex-direction: column; }
    .screen.active { display: flex; }

    /* ── Top nav bar ─────────────────────────────────────── */
    .topnav {
      background: var(--primary);
      color: #fff;
      padding: 14px 18px;
      display: flex;
      align-items: center;
      gap: 12px;
      position: sticky;
      top: 0;
      z-index: 100;
    }
    .topnav-back {
      background: none; border: none; color: #fff;
      font-size: 22px; cursor: pointer; padding: 0 4px; line-height: 1;
    }
    .topnav-title { font-size: 16px; font-weight: 700; flex: 1; }
    .topnav-sub   { font-size: 11px; opacity: .7; }

    /* ── Cards ───────────────────────────────────────────── */
    .card {
      background: var(--surface);
      border-radius: var(--r);
      box-shadow: var(--shadow);
      padding: 18px;
      margin-bottom: 14px;
    }
    .card-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-2);
      text-transform: uppercase;
      letter-spacing: .5px;
      margin-bottom: 12px;
    }
    .hw-link-btn {
      background: var(--primary); color: #fff; border: none; border-radius: 20px;
      font-size: 12px; font-weight: 700; padding: 6px 13px; cursor: pointer;
      white-space: nowrap; flex-shrink: 0;
    }
    .hw-item { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
    .hw-item:first-child { border-top: none; margin-top: 0; padding-top: 0; }
    .hw-item-date { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
    .hw-item-subj { font-size: 13px; color: var(--text-1); line-height: 1.6; padding: 4px 0; }
    .hw-item-subj b { color: var(--primary); }
    .hw-item-photo { max-width: 100%; border-radius: var(--r-sm); margin-top: 4px; display: block; cursor: zoom-in; }
    .hw-photo-error { padding: 16px; text-align: center; color: var(--danger); font-size: 12.5px; background: #fef2f2; border-radius: var(--r-sm); }

    /* ── Homework modal: Today / History tabs ──────────────── */
    .hw-nav-pill { display: flex; background: var(--surface-2); border-radius: 20px; padding: 3px; margin-bottom: 16px; border: 1px solid var(--border); }
    .hw-pill-btn { flex: 1; padding: 8px 14px; border-radius: 18px; border: none; font-size: 12.5px; font-weight: 700; cursor: pointer; background: none; color: var(--text-2); }
    .hw-pill-btn.active { background: var(--primary); color: #fff; }

    /* ── Calendar (History tab) ─────────────────────────────── */
    .cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
    .cal-nav-btn { background: var(--surface-2); border: 1.5px solid var(--border); color: var(--text-2); font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
    .cal-month-label { font-weight: 700; font-size: 13.5px; color: var(--text-1); }
    .cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text-3); margin-bottom: 6px; }
    .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
    .cal-cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; font-size: 12px; cursor: pointer; background: var(--surface-2); border: 1.5px solid transparent; }
    .cal-cell.has-hw { background: #dbeafe; color: var(--primary); font-weight: 700; }
    .cal-cell.is-today { border-color: var(--primary); }
    .cal-cell.empty-cell { visibility: hidden; cursor: default; }
    .cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); margin-top: 2px; }

    /* ── Inputs ──────────────────────────────────────────── */
    .inp-group { margin-bottom: 14px; }
    .inp-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: block; }
    .inp {
      width: 100%;
      padding: 12px 14px;
      border: 1.5px solid var(--border);
      border-radius: var(--r-sm);
      font-size: 15px;
      background: var(--surface);
      color: var(--text-1);
      outline: none;
      transition: border-color .15s;
    }
    .inp:focus { border-color: var(--primary); }
    .inp-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

    /* ── Password visibility toggle ──────────────────────── */
    .pass-wrap { position: relative; }
    .pass-wrap .inp { padding-right: 42px; }
    .pass-toggle {
      position: absolute; top: 0; right: 0; height: 100%; width: 42px;
      display: flex; align-items: center; justify-content: center;
      background: none; border: none; padding: 0; margin: 0; cursor: pointer;
      color: var(--text-3);
    }
    .pass-toggle:hover { color: var(--text-2); }
    .pass-toggle svg { width: 20px; height: 20px; pointer-events: none; }

    /* ── Buttons ─────────────────────────────────────────── */
    .btn {
      width: 100%;
      padding: 14px;
      border: none;
      border-radius: var(--r-sm);
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      transition: opacity .15s;
    }
    .btn:active { opacity: .8; }
    .btn-primary { background: var(--primary); color: #fff; }
    .btn-outline { background: none; border: 1.5px solid var(--primary); color: var(--primary); }
    .btn-danger  { background: var(--danger);  color: #fff; }
    .btn-sm { padding: 8px 16px; width: auto; font-size: 13px; border-radius: 20px; }
    .btn:disabled { opacity: .5; cursor: not-allowed; }

    /* ── PIN pad ─────────────────────────────────────────── */
    .pin-display {
      display: flex;
      gap: 12px;
      justify-content: center;
      margin: 20px 0 10px;
    }
    .pin-dot {
      width: 16px; height: 16px;
      border-radius: 50%;
      border: 2px solid var(--primary);
      background: transparent;
      transition: background .15s;
    }
    .pin-dot.filled { background: var(--primary); }
    .pin-pad {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      max-width: 280px;
      margin: 0 auto;
    }
    .pin-key {
      padding: 16px;
      border: 1.5px solid var(--border);
      border-radius: var(--r-sm);
      font-size: 20px;
      font-weight: 700;
      background: var(--surface);
      cursor: pointer;
      text-align: center;
      transition: background .1s;
    }
    .pin-key:active { background: var(--surface-2); }
    .pin-key.del { font-size: 16px; color: var(--text-2); }

    /* ── Status chips ────────────────────────────────────── */
    .status-present { color: #166534; background: #f0fdf4; }
    .status-absent  { color: #991b1b; background: #fef2f2; }
    .status-late    { color: #92400e; background: #fffbeb; }
    .status-not_marked { color: var(--text-3); background: var(--surface-2); }
    .status-holiday    { color: #0369a1; background: #f0f9ff; }
    .status-chip {
      display: inline-block;
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 12.5px;
      font-weight: 700;
    }

    /* ── Attendance bar ──────────────────────────────────── */
    .att-bar-wrap { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 6px 0; }
    .att-bar-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s; }

    /* ── NEW Advanced Calendar UI styles ─────────────────── */
    .cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
    .cal-title-wrap { font-weight: 700; font-size: 14px; color: var(--text-1); }
    .cal-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-weight: bold; color: var(--text-2); }
    .cal-btn:active { background: var(--border); }
    
    .cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin-bottom: 6px; }
    .cal-weekday { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
    .cal-weekday.sun { color: var(--danger); opacity: 0.7; }

    .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
    .cal-day { position: relative; height: 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-1); }
    .cal-day.empty { background: transparent; }
    
    /* Attendance specific states inside grid */
    .cal-day.p-state { background: #dcfce7; color: #166534; }
    .cal-day.a-state { background: #fee2e2; color: #991b1b; }
    .cal-day.l-state { background: #fef3c7; color: #92400e; }
    .cal-day.sunday-holiday { background: #e2e8f0; color: #64748b; font-size: 11px; }
    .cal-day.h-state { background: #B5E2FF; color: #0369a1; }
	.cal-day.leave-state { background: #fef9c3; color: #854d0e; }

    /* ── Leave states ────────────────────────────────────── */
    .cal-day.cal-day-clickable { cursor: pointer; border: 1.5px dashed var(--border); transition: all .15s; }
    .cal-day.cal-day-clickable:active { background: var(--primary); color: #fff; border-color: var(--primary); }
    .cal-day.leave-pending  { background: #fef3c7; color: #92400e; border: 1.5px dashed #f59e0b; }
    .cal-day.leave-approved { background: #dbeafe; color: #1d4ed8; }
    .cal-day.leave-rejected { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
    
    .cal-day .cal-label { font-size: 8px; font-weight: 700; position: absolute; bottom: 2px; opacity: 0.8; }

    /* Legend Indicator mapping */
    .cal-legend { display: flex; gap: 10px; justify-content: center; margin-top: 14px; font-size: 11px; color: var(--text-2); border-top: 1px dashed var(--border); padding-top: 10px; }
    .legend-item { display: flex; align-items: center; gap: 4px; }
    .legend-dot { width: 10px; height: 10px; border-radius: 3px; }

    /* ── Yearly summary card ────────────────────────────────── */
    .yearly-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 4px;
    }
    .yearly-stat {
      background: var(--surface-2);
      border-radius: var(--r-sm);
      padding: 12px 10px;
      text-align: center;
    }
    .yearly-stat .ys-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
    .yearly-stat .ys-lbl { font-size: 11px; color: var(--text-2); margin-top: 3px; }
    .yearly-pct-bar {
      background: var(--surface-2);
      border-radius: var(--r-sm);
      padding: 12px 14px;
      margin-top: 10px;
    }
    .yearly-pct-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
    }
    .yearly-pct-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
    .yearly-pct-val   { font-size: 18px; font-weight: 800; }

    /* ── Fee row ─────────────────────────────────────────── */
    .fee-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 0;
      border-bottom: 1px solid var(--border);
    }
    .fee-row:last-child { border-bottom: none; }
    .fee-label { font-size: 13.5px; color: var(--text-2); }
    .fee-val   { font-size: 15px; font-weight: 700; }
    .fee-val.due { color: var(--danger); }
    .fee-val.paid { color: var(--accent); }

    /* ── Student selector tabs ───────────────────────────── */
    .stu-tabs {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding: 0 18px 14px;
      scrollbar-width: none;
    }
    .stu-tab {
      flex-shrink: 0;
      padding: 8px 16px;
      border-radius: 20px;
      border: 1.5px solid var(--border);
      font-size: 13px;
      font-weight: 600;
      background: var(--surface);
      cursor: pointer;
      white-space: nowrap;
      transition: all .15s;
    }
    .stu-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

    /* ── Alert / info boxes ──────────────────────────────── */
    .alert {
      padding: 12px 14px;
      border-radius: var(--r-sm);
      font-size: 13px;
      margin-bottom: 14px;
      line-height: 1.5;
    }
    .alert-warn  { background: #fffbeb; color: #92400e; border-left: 3px solid var(--warn); }
    .alert-error { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--danger); }
    .alert-ok    { background: #f0fdf4; color: #166534; border-left: 3px solid var(--accent); }

    /* ── Misc ────────────────────────────────────────────── */
    .page-body { flex: 1; padding: 18px; overflow-y: auto; }
    .center    { text-align: center; }
    .mt-10     { margin-top: 10px; }
    .mt-16     { margin-top: 16px; }
    .mt-24     { margin-top: 24px; }
    .divider   { height: 1px; background: var(--border); margin: 14px 0; }
    .link-btn  { background: none; border: none; color: var(--primary); font-size: 13.5px; cursor: pointer; text-decoration: underline; }
    .spinner   { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .big-icon  { font-size: 56px; margin-bottom: 12px; }
    .page-title-lg { font-size: 22px; font-weight: 800; color: var(--text-1); margin-bottom: 6px; }
    .page-sub      { font-size: 14px; color: var(--text-2); line-height: 1.5; }

    /* ── Notices ─────────────────────────────────────────────── */
    .notice-item {
      background: var(--surface); border-radius: var(--r-sm);
      border-left: 4px solid var(--primary);
      padding: 12px 14px; margin-bottom: 10px;
      box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    }
    .notice-item.fee_reminder { border-left-color: #f59e0b; }
    .notice-item.holiday      { border-left-color: #0ea5e9; }
    .notice-item.result       { border-left-color: #10b981; }
    .notice-item.other        { border-left-color: #8b5cf6; }
    .notice-title { font-size: 14px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
    .notice-msg   { font-size: 13px; color: var(--text-2); line-height: 1.5; }
    .notice-meta  { font-size: 11px; color: var(--text-3); margin-top: 6px; }
    .notice-badge { display:inline-block; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:700; margin-bottom:6px; }
    .badge-general      { background:#e0e7ff; color:#3730a3; }
    .badge-fee_reminder { background:#fef3c7; color:#92400e; }
    .badge-holiday      { background:#e0f2fe; color:#0369a1; }
    .badge-result       { background:#dcfce7; color:#166534; }
    .badge-other        { background:#f3e8ff; color:#6d28d9; }
    .notif-dot {
      position: absolute; top: -2px; right: -4px;
      min-width: 16px; height: 16px; padding: 0 4px;
      display: flex; align-items: center; justify-content: center;
      background: var(--danger); color: #fff;
      border-radius: 10px; font-size: 10px; font-weight: 800;
      line-height: 1; border: 1.5px solid var(--primary);
    }
	.backBtn{
	    display:block;text-align:center;margin:24px auto 0;color:#7a7096;text-decoration:none;
	    font-family:'Baloo 2',sans-serif;font-size:14px;font-weight:600;
	}
  .backBtn:hover{color:var(--ink);}
