* { box-sizing: border-box; font-family: Arial, Tahoma, sans-serif; }
    body { margin: 0; background: #fff8f0; color: #3b2a1f; }
    header {
      height: 72px; background: #fff; border-bottom: 1px solid #f0d8bd;
      display: flex; align-items: center; justify-content: space-between;
      padding: 0 28px; position: sticky; top: 0; z-index: 1100;
    }
    .brand { font-size: 22px; font-weight: bold; color: #e87522; }
    .note { color: #8b572a; font-weight: bold; }
    .hamburger {
      display: none; background: #e87522; color: #fff; border: 0;
      font-size: 26px; border-radius: 10px; padding: 8px 13px; cursor: pointer;
    }
    .layout { display: flex; min-height: calc(100vh - 72px); }
    .sidebar {
      width: 260px; background: linear-gradient(180deg, #e87522, #ffad5a);
      color: #fff; padding: 24px 18px; position: fixed; top: 72px;
      left: 0; height: calc(100vh - 72px); transition: .3s; z-index: 1000;
    }
    .sidebar-title { font-size: 22px; font-weight: bold; margin-bottom: 24px; }
    .menu a {
      display: block; color: #fff; text-decoration: none; padding: 14px;
      border-radius: 12px; margin-bottom: 10px; background: rgba(255,255,255,.18);
    }
    .menu a.active, .menu a:hover { background: #fff; color: #e87522; }
    main { margin-left: 260px; width: 100%; padding: 32px; }
    .hero, .card {
      background: #fff; border-radius: 22px; padding: 26px;
      box-shadow: 0 10px 30px rgba(90,50,20,.1); margin-bottom: 24px;
    }
    .hero { background: linear-gradient(135deg, #fff, #fff0df); }
    h1, h2 { color: #e87522; }
    a {
        text-decoration: none;
        color: orange;
    }
    label { display: block; font-weight: bold; margin-bottom: 8px; }
    input, select, textarea {
      width: 100%; padding: 13px; margin-bottom: 16px;
      border: 1px solid #f0c79e; border-radius: 12px; font-size: 16px;
    }
    textarea { min-height: 90px; resize: vertical; }
    .submit-btn {
      background: #e87522; color: #fff; border: 0; padding: 14px 24px;
      border-radius: 14px; font-size: 16px; font-weight: bold; cursor: pointer;
    }
    .submit-btn:disabled { background: #b9a28c; cursor: not-allowed; }
    .message { margin-top: 12px; font-weight: bold; }
    .menu a{display:block;color:#fff;text-decoration:none;padding:14px;border-radius:12px;margin-bottom:10px;background:rgba(255,255,255,.18)}
    .menu a.active,.menu a:hover{background:#fff;color:#e87522}
    main{margin-left:260px;width:100%;padding:32px}
    .card{background:#fff;border-radius:22px;padding:26px;margin-bottom:24px;box-shadow:0 10px 30px rgba(90,50,20,.1)}
    h1,h2{color:#e87522}
    .define_radio{width: 5%;}
    .form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}
    .full{grid-column:1/-1}
    label{font-weight:bold;display:block;margin-bottom:6px}
    input,select,textarea{width:100%;padding:12px;border:1px solid #f0c79e;border-radius:12px;font-size:15px}
    textarea{min-height:90px}
    .option-group{display:flex;flex-wrap:wrap;gap:14px}
    .option-group label{font-weight:normal}
    .honeypot { position: absolute; left: -9999px; opacity: 0; }
    .table-wrap { overflow-x: auto; }
    table { width: 100%; border-collapse: collapse; min-width: 520px; }
    th { background: #e87522; color: #fff; }
    th, td { padding: 14px; border-bottom: 1px solid #f5ddc5; text-align: left; vertical-align: top; }
    tr:nth-child(even) { background: #fff8f0; }
    footer {
      margin-left: 260px; background: #3b2a1f; color: #fff;
      padding: 22px 32px; font-size: 14px;
    }
    footer strong { color: #ffad5a; }
    .overlay { display: none; }

    @media (max-width: 1024px) {
      .hamburger { display: inline-block; }
      .note { display: none; }
      .sidebar { left: -280px; }
      .sidebar.open { left: 0; }
      main, footer { margin-left: 0; }
      .overlay.show {
        display: block; position: fixed; inset: 72px 0 0 0;
        background: rgba(0,0,0,.35); z-index: 900;
      }
    }
    @media (max-width: 768px) {
      header { padding: 0 16px; }
      .brand { font-size: 18px; }
      main { padding: 18px; }
      .hero, .card { padding: 20px; }
      /* table, thead, tbody, th, td, tr { display: block; min-width: unset; } */
      /* thead { display: none; } */
      tr {
        background: #fff; margin-bottom: 14px; padding: 12px;
        border-radius: 14px; box-shadow: 0 5px 14px rgba(80,40,20,.08);
      }
      td { border: none; padding: 8px; }
      td::before { 
        /* content: attr(data-label) ": ";  */
        font-weight: bold; 
        color: #e87522; }
    }

    /* =====================================================
       CSS เพิ่มเติมสำหรับหน้า HOME
       ส่วนนี้เป็น CSS ที่เพิ่มเข้ามาจากหน้า
       "ลงทะเบียนการเรียนตัดขนสุนัขและแมว"
       ใช้สำหรับสร้างปุ่มสี่เหลี่ยมจัตุรัสบนหน้า Home
    ===================================================== */

    .home-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 22px;
        margin-top: 20px;
      }
  
      .home-button {
        aspect-ratio: 1 / 1;
        background: #ffffff;
        border: 2px solid #ffe0bf;
        border-radius: 24px;
        text-decoration: none;
        color: #3b2a1f;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 18px;
        box-shadow: 0 10px 26px rgba(90, 50, 20, 0.1);
        transition: 0.25s ease;
      }
  
      .home-button:hover {
        transform: translateY(-6px);
        border-color: #e87522;
        box-shadow: 0 16px 36px rgba(232, 117, 34, 0.22);
      }
  
      .home-button-icon {
        width: 64px;
        height: 64px;
        border-radius: 18px;
        background: linear-gradient(135deg, #e87522, #ffad5a);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 34px;
        margin-bottom: 14px;
      }
  
      .home-button-title {
        font-size: 18px;
        font-weight: bold;
        color: #e87522;
        margin-bottom: 8px;
      }
  
      .home-button-desc {
        font-size: 14px;
        line-height: 1.5;
        color: #6b4b36;
      }
  
      .quick-summary {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
        margin-top: 18px;
      }
  
      .summary-box {
        background: #fff8f0;
        border-left: 5px solid #e87522;
        border-radius: 14px;
        padding: 16px;
      }
  
      .summary-box strong {
        color: #e87522;
        display: block;
        margin-bottom: 6px;
      }

      .school-name {
        font-size: 20px;
        font-weight: bold;
        color: #7a431f;
        margin-bottom: 4px;
      }
  
      .school-name-en {
        font-size: 16px;
        color: #8b572a;
        margin-bottom: 12px;
      }
  
      .rule-list {
        counter-reset: rule-counter;
        padding: 0;
        margin: 0;
        list-style: none;
      }
  
      .rule-list li {
        counter-increment: rule-counter;
        background: #fff8f0;
        border-left: 3px solid #e87522;
        border-radius: 14px;
        padding: 16px 18px 16px 58px;
        margin-bottom: 14px;
        position: relative;
      }
  
      .rule-list li::before {
        content: counter(rule-counter);
        position: absolute;
        left: 16px;
        top: 16px;
        width: 28px;
        height: 28px;
        background: #e87522;
        color: #fff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 14px;
      }
  
      .highlight-box {
        background: #fff0df;
        border: 1px solid #ffd1a3;
        border-radius: 18px;
        padding: 20px;
        margin: 20px 0;
      }
  
      .highlight-box strong {
        color: #e87522;
      }
  
      .time-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
        margin-top: 16px;
      }
  
      .time-box {
        background: #ffffff;
        border: 2px solid #ffe0bf;
        border-radius: 16px;
        padding: 18px;
      }
  
      .time-box strong {
        color: #e87522;
      }

/* =====================================================
   MVC compatibility layer
   ใช้ให้ view ที่แยกเป็น MVC ทำงานร่วมกับธีมต้นฉบับ
===================================================== */
.auth-main {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  margin-left: 0;
  width: 100%;
}

.auth-panel {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
}
.login-card {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(90,50,20,.1);
}
.login-card h1,
.login-card p { text-align: center; }
.auth-flash { margin: 0; }
.auth-flash .alert {
  margin: 0;
  text-align: center;
  line-height: 1.45;
}
.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}
.auth-actions .auth-link {
  color: #e87522;
  font-weight: bold;
  white-space: nowrap;
}
.auth-submit { min-width: 96px; }
.auth-dev-link {
  display: grid;
  gap: 6px;
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 162, 74, .45);
  border-radius: 14px;
  background: #fff9ea;
  color: #6f5319;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}

.login-card,
.login-card * {
  box-sizing: border-box;
}

.login-card form {
  display: grid;
  gap: 0;
}

.login-card form label {
  display: block;
  margin: 14px 0 8px;
  font-weight: 800;
}

.login-card form label:first-of-type {
  margin-top: 0;
}

.login-card input {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.password-field {
  position: relative;
  width: 100%;
}

.login-card .password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #9c741d;
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle.is-visible {
  background: rgba(201, 162, 74, .16);
  color: var(--agtc-ink);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-card .flash-stack,
.login-card .alert,
.login-card .auth-dev-link {
  width: 100%;
  max-width: 100%;
}

.login-card .auth-actions {
  align-items: center;
}

.login-card .auth-submit {
  flex: 0 0 auto;
}
.btn {
  display: inline-block;
  background: #e87522;
  color: #fff;
  border: 0;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: #c75c13; color: #fff; }
.btn.secondary { background: #fff0df; color: #e87522; border: 1px solid #f0c79e; }
.btn.danger { background: #b91c1c; }
.search { display: grid; grid-template-columns: 1fr 180px auto; gap: 12px; align-items: end; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px,1fr)); gap: 14px; margin-bottom: 24px; }
.stats div { min-width: 0; background: #fff; border-radius: 22px; padding: 18px 20px; box-shadow: 0 10px 30px rgba(90,50,20,.1); }
.stats span { display: block; min-width: 0; color: #8b572a; font-size: 13px; line-height: 1.35; margin-bottom: 8px; overflow-wrap: anywhere; word-break: break-word; }
.stats strong { display: block; font-size: 30px; line-height: 1; color: #e87522; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.settings-card { display: grid; grid-template-columns: 96px 1fr; gap: 16px; min-height: 168px; align-items: center; padding: 24px; border: 1px solid #e6cf96; border-radius: 22px; background: radial-gradient(circle at 18% 18%, rgba(255, 238, 179, .9), transparent 36%), linear-gradient(145deg, #fffdf7, #f6ecd8); color: #2b2116; text-decoration: none; box-shadow: 0 14px 32px rgba(56, 36, 12, .08); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.settings-card:hover { transform: translateY(-2px); border-color: #d9ad46; box-shadow: 0 18px 38px rgba(56, 36, 12, .14); }
.settings-illustration { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 24px; background: linear-gradient(145deg, #1d160c, #4c3512); box-shadow: inset 0 0 0 1px rgba(255, 222, 132, .24), 0 16px 28px rgba(55, 34, 8, .16); }
.settings-illustration svg { width: 68px; height: 68px; fill: none; stroke: #f4d268; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.settings-card-title { color: #7a5a16; font-size: 19px; font-weight: 900; line-height: 1.3; }
.settings-card-meta { display: flex; align-items: baseline; gap: 8px; color: #705932; font-weight: 800; }
.settings-card-meta strong { color: #d4a43c; font-size: 36px; line-height: 1; }
.settings-card-meta small { color: #705932; font-weight: 800; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.dashboard-panel { height: 100%; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.btn.compact { padding: 10px 14px; border-radius: 12px; font-size: 14px; white-space: nowrap; }
.compact-list { display: grid; gap: 10px; }
.compact-list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #ead7ad; border-radius: 16px; padding: 12px 14px; background: #fffdf7; color: inherit; text-decoration: none; }
.compact-list-row:hover { border-color: #d9ad46; box-shadow: 0 8px 22px rgba(76, 48, 10, .08); }
.compact-list-row span { min-width: 0; }
.compact-list-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2f2417; }
.compact-list-row small { display: block; color: #806332; margin-top: 4px; }
.compact-list-row em { color: #806332; font-style: normal; font-size: 13px; white-space: nowrap; }
.table-scroll, .table-wrap { overflow-x: auto; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.badge { display: inline-block; background: #fff0df; color: #e87522; border-radius: 999px; padding: 6px 10px; font-weight: bold; font-size: 12px; }
.badge.status-P,.badge.status-L,.badge.attendance-P { background: #dcfce7; color: #15803d; }
.badge.status-W,.badge.attendance-L { background: #fef9c3; color: #a16207; }
.badge.status-O,.badge.status-D,.badge.attendance-A { background: #fee2e2; color: #b91c1c; }
.badge.status-S { background: #dbeafe; color: #1d4ed8; }
.badge.status-PENDING { background: #fef9c3; color: #a16207; }
.badge.status-APPROVED { background: #dbeafe; color: #1d4ed8; }
.badge.status-COMPLETED { background: #dcfce7; color: #15803d; }
.badge.status-REJECTED { background: #fee2e2; color: #b91c1c; }
.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.dashboard-chart-card {
  min-height: 260px;
  padding: 22px;
  min-width: 0;
}
.chart-card-wide {
  grid-column: 1 / -1;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.chart-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
}
.chart-head p {
  margin: 0;
  color: #7c6746;
  font-weight: 700;
}
.chart-head > strong {
  color: #c99a2f;
  font-size: 34px;
  line-height: 1;
  white-space: nowrap;
}
.line-chart {
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}
.line-chart svg {
  width: 100%;
  height: 180px;
  border-radius: 18px;
  background:
    linear-gradient(to top, rgba(201, 162, 74, .16) 1px, transparent 1px),
    linear-gradient(145deg, #fffdf7, #f5ecd9);
  background-size: 100% 25%;
  border: 1px solid rgba(201, 162, 74, .28);
}
.line-chart polyline {
  fill: none;
  stroke: #c99a2f;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-chart polygon {
  fill: rgba(201, 162, 74, .18);
}
.line-chart-points {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.line-chart-points span {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 253, 247, .9);
}
.line-chart-points em {
  color: #7c6746;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}
.line-chart-points strong {
  color: #2d2416;
  font-size: 18px;
}
.mini-bar-chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(24px, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 176px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}
.mini-bar-item {
  display: grid;
  grid-template-rows: 124px auto auto;
  gap: 5px;
  justify-items: center;
  min-width: 28px;
}
.mini-bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  max-width: 34px;
  height: 124px;
  border-radius: 999px;
  background: rgba(201, 162, 74, .16);
  overflow: hidden;
}
.mini-bar-track span {
  display: block;
  width: 100%;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, #e5bf57, #b98725);
}
.mini-bar-track.alt span {
  background: linear-gradient(180deg, #8bd3ff, #2675b8);
}
.mini-bar-item strong {
  color: #2d2416;
  font-size: 13px;
}
.mini-bar-item em {
  color: #7c6746;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}
.horizontal-bars {
  display: grid;
  gap: 12px;
}
.horizontal-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) 46px;
  gap: 12px;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.horizontal-bar-row span {
  color: #2d2416;
  font-weight: 900;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.horizontal-bar-row strong {
  color: #7a5a16;
  text-align: right;
  white-space: nowrap;
}
.horizontal-bar-track {
  min-width: 0;
  height: 13px;
  border-radius: 999px;
  background: rgba(201, 162, 74, .16);
  overflow: hidden;
}
.horizontal-bar-track em {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d8aa3b, #f0d36c);
}
.horizontal-bar-track em.status-W {
  background: linear-gradient(90deg, #f5c542, #fde68a);
}
.horizontal-bar-track em.status-L {
  background: linear-gradient(90deg, #16a34a, #86efac);
}
.horizontal-bar-track em.status-S {
  background: linear-gradient(90deg, #2563eb, #93c5fd);
}
.horizontal-bar-track em.status-O,
.horizontal-bar-track em.status-D {
  background: linear-gradient(90deg, #dc2626, #fca5a5);
}
.action-bars .horizontal-bar-row {
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 253, 247, .85);
}
.action-bars .horizontal-bar-row:hover {
  border-color: #c99a2f;
  box-shadow: 0 10px 24px rgba(60, 42, 18, .08);
}

.dashboard-report-overview {
  margin-bottom: 24px;
}

.report-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.report-dashboard-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  min-height: 210px;
  padding: 16px;
  border: 1px solid rgba(201, 162, 74, .28);
  border-radius: 18px;
  background: linear-gradient(145deg, #fffdf7, #fbf3e0);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(58, 43, 20, .06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.report-dashboard-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 162, 74, .58);
  box-shadow: 0 18px 34px rgba(58, 43, 20, .12);
}

.report-dashboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.report-dashboard-head span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.report-dashboard-head strong {
  display: block;
  color: #8a650d;
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.report-dashboard-head small {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  color: #7c6746;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.report-dashboard-head em {
  min-width: 46px;
  color: #c99a2f;
  font-size: 28px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-align: right;
}

.report-dashboard-bars {
  display: grid;
  gap: 10px;
  align-content: end;
  min-width: 0;
}

.report-dashboard-row {
  display: grid;
  grid-template-columns: minmax(72px, 112px) minmax(72px, 1fr) 32px;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.report-dashboard-row span {
  min-width: 0;
  overflow: hidden;
  color: #342819;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-dashboard-row strong {
  color: #806332;
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.report-dashboard-track {
  min-width: 0;
  height: 10px;
  border-radius: 999px;
  background: rgba(201, 162, 74, .16);
  overflow: hidden;
}

.report-dashboard-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d7aa3e, #f3d977);
}
.flash-stack { margin-bottom: 16px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 8px; font-weight: bold; }
.alert.error { background: #fde8e8; color: #991b1b; }
.alert.success { background: #e8f8ef; color: #166534; }
.profile-head { display: flex; gap: 18px; align-items: center; }
.avatar { width: 96px; height: 96px; border-radius: 22px; background: #fff0df; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #e87522; font-size: 34px; font-weight: 900; }
.avatar img, .photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-edit-head {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 12px;
  align-items: center;
  text-align: center;
}
.profile-identity-text {
  min-width: 0;
}
.profile-edit-head h2 {
  margin-top: 0;
}
.profile-photo-upload {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 720px;
  text-align: left;
}
.profile-photo-upload input[type="file"] {
  margin: 0;
}
.profile-photo-upload .hint {
  margin-top: 2px;
}
.detail-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.detail-grid .wide { grid-column: 1 / -1; }
.detail-grid div { border: 1px solid #ffe0bf; background: #fffdf9; border-radius: 14px; padding: 14px; }
.detail-grid span { display: block; color: #8b572a; font-size: 13px; margin-bottom: 5px; }
.option-grid,.course-grid,.report-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.option-card,.course-card { border: 2px solid #ffe0bf; border-radius: 18px; padding: 16px; background: #fff; }
.option-card input { width: auto; margin-right: 8px; }
.photo-preview { width: 128px; height: 128px; border: 1px dashed #f0c79e; border-radius: 16px; overflow: hidden; background: #fff8f0; }
.profile-form-head { display: grid; grid-template-columns: 1fr 150px; gap: 16px; align-items: end; }
.file-list { display: grid; gap: 8px; margin-top: 12px; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #ffe0bf; border-radius: 12px; padding: 10px 12px; background: #fff; }
.link-danger { border: 0; background: transparent; color: #b91c1c; font-weight: bold; cursor: pointer; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select { min-width: 160px; width: auto; }
.center-card { text-align: center; }
.text-success { color: #15803d; }
.text-danger { color: #b91c1c; }
button:disabled,.btn:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 768px) {
  .search,.stats,.form-grid,.detail-grid,.option-grid,.course-grid,.report-grid,.inline-form,.profile-form-head {
    grid-template-columns: 1fr;
  }
  .public-main .profile-edit-head,
  .profile-edit-head {
    gap: 14px;
  }
  .public-main .profile-edit-head .avatar,
  .profile-edit-head .avatar {
    width: clamp(112px, 34vw, 148px);
    height: clamp(112px, 34vw, 148px);
    border-radius: 28px;
    box-shadow: 0 16px 30px rgba(31, 22, 8, .12);
  }
  .public-main .profile-photo-upload,
  .profile-photo-upload {
    width: 100%;
  }
  .public-main .profile-edit-head h2,
  .profile-edit-head h2 {
    margin: 2px 0 4px;
    line-height: 1.25;
  }
  .public-main .profile-edit-head p,
  .profile-edit-head p {
    margin: 0 0 12px;
  }
  .public-main .profile-photo-upload input[type="file"],
  .profile-photo-upload input[type="file"] {
    max-width: 100%;
  }
  .public-main .profile-photo-upload .hint,
  .profile-photo-upload .hint {
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-card {
    grid-template-columns: 78px 1fr;
    min-height: 132px;
    padding: 18px;
  }
  .settings-illustration {
    width: 78px;
    height: 78px;
    border-radius: 20px;
  }
  .settings-illustration svg {
    width: 54px;
    height: 54px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .section-head .btn {
    width: 100%;
  }
  .compact-list-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .auth-actions {
    display: flex;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }
  .auth-submit {
    width: 100%;
  }
  .auth-actions .auth-link {
    display: block;
    text-align: right;
  }
}
        color: #e87522;
        display: block;
        font-size: 18px;
        margin-bottom: 6px;
      }
  
      .warning {
        background: #fff3f0;
        border-left-color: #d94b2b !important;
      }
  
      /* =====================================================
         จบ CSS เพิ่มเติมสำหรับหน้า HOME
      ===================================================== */
  
      @media (max-width: 1024px) {
        .hamburger {
          display: inline-block;
        }
  
        .note {
          display: none;
        }
  
        .sidebar {
          left: -280px;
        }
  
        .sidebar.open {
          left: 0;
        }
  
        main,
        footer {
          margin-left: 0;
        }
  
        .overlay.show {
          display: block;
          position: fixed;
          inset: 72px 0 0 0;
          background: rgba(0, 0, 0, 0.35);
          z-index: 900;
        }
      }
  
      @media (max-width: 768px) {
        header {
          padding: 0 16px;
        }
  
        .brand {
          font-size: 18px;
        }
  
        main {
          padding: 18px;
        }
  
        .hero,
        .card {
          padding: 20px;
        }
  
        /* =====================================================
           CSS เพิ่มเติมสำหรับหน้า HOME บนมือถือ
        ===================================================== */
  
        .home-grid {
          grid-template-columns: repeat(2, 1fr);
          gap: 14px;
        }
  
        .home-button {
          border-radius: 18px;
          padding: 14px;
        }
  
        .home-button-icon {
          width: 52px;
          height: 52px;
          font-size: 28px;
        }
  
        .home-button-title {
          font-size: 15px;
        }
  
        .home-button-desc {
          font-size: 12px;
        }
  
        /* =====================================================
           จบ CSS เพิ่มเติมสำหรับหน้า HOME บนมือถือ
        ===================================================== */
      }
  
      @media (max-width: 420px) {
        .home-grid {
          grid-template-columns: 1fr;
        }
      }

      
  
      
  
      .overlay {
        display: none;
      }
      @media (max-width: 1024px) {
        .hamburger {
          display: inline-block;
        }
  
        .header-note {
          display: none;
        }
  
        .sidebar {
          left: -280px;
        }
  
        .sidebar.open {
          left: 0;
        }
  
        main,
        footer {
          margin-left: 0;
        }
  
        .overlay.show {
          display: block;
          position: fixed;
          inset: 72px 0 0 0;
          background: rgba(0, 0, 0, 0.35);
          z-index: 900;
        }
      }
  
      @media (max-width: 768px) {
        header {
          padding: 0 16px;
        }
  
        .brand {
          font-size: 18px;
        }
  
        main {
          padding: 18px;
        }
  
        .hero,
        .card {
          padding: 20px;
        }
  
        h1 {
          font-size: 24px;
        }
  
        .rule-list li {
          padding: 14px 14px 14px 52px;
        }
        main{padding:18px}
        .form-grid{grid-template-columns:1fr}
      }

/* =====================================================
   Signup/Form repair
   แก้ layout หน้า public form ไม่ให้ชนกับ auth/sidebar CSS
===================================================== */
.public-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0;
}
.public-main .hero,
.public-main .card {
  width: 100%;
}
.public-main .stack-form {
  width: 100%;
}
.public-main .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.public-main .form-grid > div,
.public-main .form-grid .full {
  min-width: 0;
}
.form-grid > * {
  min-width: 0;
}
.birth-date-field {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.birth-date-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
  min-height: 48px;
  text-align: left;
}
.birth-date-input::-webkit-date-and-time-value {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  text-align: left;
}
.public-main .full {
  grid-column: 1 / -1;
}
.public-main label {
  margin: 0 0 7px;
}
.public-main input,
.public-main select,
.public-main textarea {
  display: block;
  width: 100%;
  margin: 0;
}
.public-main textarea {
  min-height: 96px;
}
.public-main .stack-form h2 {
  clear: both;
  margin: 30px 0 14px;
  color: #e87522;
}
.public-main .profile-form-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 18px;
  align-items: end;
}
.public-main .photo-preview {
  width: 140px;
  height: 140px;
  border: 1px dashed #f0c79e;
  border-radius: 18px;
  background: #fff8f0;
  overflow: hidden;
}
.public-main .option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.public-main .option-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 74px;
  border: 2px solid #ffe0bf;
  border-radius: 18px;
  padding: 16px;
  background: #fff;
  margin: 0;
}
.public-main .option-card input[type="radio"] {
  flex: 0 0 auto;
  width: auto;
  margin: 3px 0 0;
}
.public-main .option-card span {
  display: block;
  line-height: 1.35;
  word-break: break-word;
}
.public-main .check-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.public-main .check-row label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #ffe0bf;
  border-radius: 14px;
  background: #fffdf9;
  font-weight: 700;
}
.public-main .check-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}
.public-main .toolbar {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@media (max-width: 900px) {
  .public-main {
    width: min(100% - 28px, 720px);
    padding: 22px 0;
  }
  .public-main .form-grid,
  .public-main .option-grid,
  .public-main .check-row,
  .public-main .profile-form-head {
    grid-template-columns: minmax(0, 1fr);
  }
  .public-main .photo-preview {
    width: 118px;
    height: 118px;
  }
}

@media (max-width: 520px) {
  .public-main {
    width: calc(100% - 24px);
    padding: 16px 0;
  }
  .public-main .hero,
  .public-main .card {
    border-radius: 18px;
    padding: 18px;
  }
  .public-main .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .public-main .toolbar .btn {
    width: 100%;
  }
}

.student-combobox {
  position: relative;
  width: 100%;
  min-width: 0;
}

.student-combobox > input[type="search"] {
  width: 100%;
  min-width: 0;
}

.student-combobox-options {
  position: absolute;
  z-index: 100;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(320px, 45vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fffdf8;
  border: 1px solid #d9b963;
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(42, 28, 5, 0.2);
  padding: 8px;
}

.student-combobox-options[hidden],
.student-combobox-option[hidden],
.student-combobox-empty[hidden] {
  display: none;
}

.student-combobox-option {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #241b0f;
  padding: 13px 14px;
  text-align: left;
  font: inherit;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  touch-action: manipulation;
}

.student-combobox-option:hover,
.student-combobox-option:focus-visible {
  background: #f5e7bc;
  outline: none;
}

.student-combobox-empty {
  margin: 0;
  padding: 14px;
  color: #75664e;
}

@media (max-width: 520px) {
  .student-combobox-options {
    max-height: 42vh;
    border-radius: 14px;
  }

  .student-combobox-option {
    padding: 15px 12px;
    font-size: 16px;
  }
}

/* =====================================================
   Signup attachment table
===================================================== */
.attachment-preview-wrap {
  margin-top: 12px;
}

.attachment-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #fff;
}

.attachment-table th,
.attachment-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f3d8bd;
  text-align: left;
  vertical-align: middle;
}

.attachment-table th {
  color: #88420f;
  background: #fff4e8;
  font-weight: 800;
}

.attachment-table td:first-child,
.attachment-table th:first-child {
  width: 56px;
  text-align: center;
}

.attachment-table a {
  color: #d95f13;
  font-weight: 800;
  word-break: break-word;
}

.attachment-remove,
.link-danger {
  border: 0;
  border-radius: 10px;
  background: #ffe7e7;
  color: #b42318;
  cursor: pointer;
  font-weight: 800;
  padding: 8px 12px;
}

.attachment-remove:hover,
.link-danger:hover {
  background: #ffd1d1;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.row-actions form {
  margin: 0;
}

.link-button {
  border: 0;
  border-radius: 10px;
  background: #fff0df;
  color: #d95f13;
  cursor: pointer;
  font-weight: 800;
  padding: 8px 12px;
}

.link-button:hover {
  background: #ffe0bf;
}

.course-table td {
  vertical-align: middle;
}

.course-table th:nth-child(2),
.course-table td:nth-child(2),
.course-table th:nth-child(3),
.course-table td:nth-child(3),
.course-table td:nth-child(3) .badge {
  white-space: nowrap;
}

.course-table td:nth-child(3) .badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
}

.course-status-cell {
  min-width: 118px;
  white-space: nowrap;
}

.course-status-cell .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll,
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.table-scroll table,
.table-wrap table {
  min-width: 760px;
}

.table-scroll::after,
.table-wrap::after {
  content: "";
  display: block;
  height: 1px;
}

@media (max-width: 520px) {
  .attachment-table th,
  .attachment-table td {
    padding: 10px 12px;
    font-size: 14px;
  }
}

/* =====================================================
   Signup agreement
===================================================== */
.agreement-panel {
  margin-top: 34px;
  padding: 22px 24px;
  border: 1px solid #ffd8ad;
  border-radius: 18px;
  background: #fffaf4;
}

.agreement-panel h2 {
  margin-top: 0;
}

.agreement-list {
  margin: 0 0 22px;
  padding-left: 22px;
  color: #3a2b21;
  line-height: 1.7;
}

.agreement-list li {
  padding-left: 4px;
}

.regulations-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: #f08a00;
  font-weight: 800;
  text-decoration: none;
}

.regulations-link:hover {
  text-decoration: underline;
}

.agreement-check {
  display: flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  margin: 12px 0 0;
  padding: 14px 16px;
  border: 1px solid #ffd8ad;
  border-radius: 14px;
  background: #fff;
  color: #3a2b21;
  font-weight: 800;
  cursor: pointer;
}

.agreement-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
}

.agreement-check span {
  line-height: 1.35;
}

@media (max-width: 520px) {
  .agreement-panel {
    padding: 18px;
  }
  .agreement-check {
    width: 100%;
    align-items: flex-start;
  }
}

/* =====================================================
   Sidebar overlay safety
   กัน overlay ค้างแล้วบังการคลิกบนจอ desktop/tablet แนวนอน
===================================================== */
.overlay {
  display: none !important;
  pointer-events: none !important;
}

.overlay[hidden] {
  display: none !important;
}

body:not(.menu-open) .overlay,
body:not(.menu-open) .overlay.show {
  display: none !important;
  pointer-events: none !important;
  background: transparent !important;
}

@media (min-width: 1025px) {
  .overlay,
  .overlay.show {
    display: none !important;
    pointer-events: none !important;
    background: transparent !important;
  }
  .sidebar {
    left: 0 !important;
  }
}

@media (max-width: 1024px) {
  body.menu-open .overlay.show:not([hidden]) {
    display: block !important;
    position: fixed;
    inset: 72px 0 0 0;
    background: rgba(0, 0, 0, .35);
    z-index: 900;
    pointer-events: auto !important;
  }
}

/* =====================================================
   AGTC Luxury Black & Gold Theme
   โทนดำทองแบบพรีเมียม โดยยังคงพื้นที่ฟอร์มเป็นสีสว่างเพื่ออ่านง่าย
===================================================== */
:root {
  --agtc-ink: #15110b;
  --agtc-ink-2: #211a10;
  --agtc-ink-3: #302514;
  --agtc-gold: #c9a24a;
  --agtc-gold-2: #e0bc63;
  --agtc-gold-3: #f6df9a;
  --agtc-paper: #fffdf7;
  --agtc-paper-2: #f8f1e4;
  --agtc-line: #e5d4ad;
  --agtc-text: #2b2418;
  --agtc-muted: #756447;
  --agtc-danger: #b42318;
  --agtc-success: #15803d;
}

body {
  background:
    linear-gradient(180deg, rgba(21, 17, 11, .05), rgba(201, 162, 74, .06)),
    var(--agtc-paper-2);
  color: var(--agtc-text);
}

header {
  background: linear-gradient(135deg, var(--agtc-ink), var(--agtc-ink-2));
  border-bottom: 1px solid rgba(201, 162, 74, .45);
  box-shadow: 0 10px 30px rgba(21, 17, 11, .18);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.brand {
  color: var(--agtc-gold-2);
  letter-spacing: .2px;
}

.note {
  color: var(--agtc-gold-3);
}

.hamburger {
  background: var(--agtc-gold);
  color: var(--agtc-ink);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px solid rgba(201, 162, 74, .34);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: var(--agtc-paper);
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--agtc-gold-3), var(--agtc-gold));
  color: var(--agtc-ink);
  font-weight: 900;
}

.user-copy {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.user-copy span {
  color: var(--agtc-gold-3);
  font-size: 11px;
}

.user-copy strong {
  overflow: hidden;
  color: var(--agtc-paper);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-signup-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid rgba(201, 162, 74, .5);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--agtc-gold-3);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.header-signup-link:hover {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  color: var(--agtc-ink);
}

.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(201, 162, 74, .34);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
}

.language-switcher a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--agtc-gold-3);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.language-switcher a.active,
.language-switcher a:hover {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  color: var(--agtc-ink);
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #16110a 0%, #241a0d 52%, #332511 100%);
  color: var(--agtc-paper);
  border-right: 1px solid rgba(201, 162, 74, .38);
  box-shadow: 14px 0 34px rgba(21, 17, 11, .18);
  overflow: hidden;
}

.sidebar-title {
  color: var(--agtc-gold-2);
}

.sidebar-user {
  display: grid;
  gap: 4px;
  margin: -8px 0 18px;
  padding: 14px;
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 16px;
  background: rgba(255, 255, 255, .06);
}

.sidebar-user span,
.sidebar-user small {
  color: var(--agtc-gold-3);
  font-size: 12px;
}

.sidebar-user strong {
  overflow: hidden;
  color: var(--agtc-paper);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu a {
  position: relative;
  color: var(--agtc-paper);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(201, 162, 74, .13);
}

.menu {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: var(--agtc-gold) rgba(255, 255, 255, .08);
  scrollbar-width: thin;
}

.menu::-webkit-scrollbar {
  width: 8px;
}

.menu::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
}

.menu::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(201, 162, 74, .75);
}

.menu-logout {
  margin-top: 12px;
  border-color: rgba(180, 35, 24, .28) !important;
  background: rgba(180, 35, 24, .12) !important;
}

.menu-logout:hover {
  background: linear-gradient(135deg, #fca5a5, #f87171) !important;
  color: #3b0a0a !important;
}

.menu a.active,
.menu a:hover {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  border-color: rgba(246, 223, 154, .9);
  color: var(--agtc-ink);
}

.menu a.active {
  box-shadow: 0 10px 24px rgba(201, 162, 74, .24);
  font-weight: 800;
}

.menu-section {
  margin-bottom: 10px;
}

.menu-parent {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 12px;
  background: rgba(201, 162, 74, .12);
  color: var(--agtc-gold-2);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.menu-parent::-webkit-details-marker {
  display: none;
}

.menu-label-with-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.menu-parent::after {
  content: "▾";
  font-size: 12px;
  line-height: 1;
  opacity: .85;
  transition: transform .18s ease;
}

.menu-section[open] .menu-parent::after {
  transform: rotate(180deg);
}

.menu-section.active .menu-parent {
  border-color: rgba(246, 223, 154, .8);
  background: rgba(201, 162, 74, .2);
  color: var(--agtc-paper);
}

.submenu {
  margin: 8px 0 0 12px;
  padding-left: 10px;
  border-left: 2px solid rgba(201, 162, 74, .35);
}

.menu .submenu a {
  padding: 11px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  font-size: 14px;
}


.hero,
.card,
.login-card,
.stats div {
  background: var(--agtc-paper);
  border: 1px solid rgba(229, 212, 173, .85);
  box-shadow: 0 18px 44px rgba(41, 30, 13, .10);
}

.hero {
  background:
    linear-gradient(135deg, rgba(255, 253, 247, .98), rgba(248, 241, 228, .98)),
    var(--agtc-paper);
  border-top: 4px solid var(--agtc-gold);
}

h1,
h2,
.home-button-title,
.summary-box strong,
.time-box strong,
.highlight-box strong,
.school-name,
.stats strong,
.login-card h1,
.public-main .stack-form h2 {
  color: var(--agtc-gold);
}

a,
.auth-actions .auth-link,
.attachment-table a,
.regulations-link {
  color: #9c741d;
}

a:hover,
.auth-actions .auth-link:hover,
.regulations-link:hover {
  color: var(--agtc-ink);
}

label {
  color: var(--agtc-text);
}

input,
select,
textarea {
  background: #ffffff;
  border-color: var(--agtc-line);
  color: var(--agtc-text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--agtc-gold);
  box-shadow: 0 0 0 4px rgba(201, 162, 74, .18);
  outline: none;
}

.btn,
.submit-btn,
.link-button {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  border: 1px solid rgba(92, 66, 20, .16);
  color: var(--agtc-ink);
  box-shadow: 0 10px 22px rgba(201, 162, 74, .22);
}

.btn:hover,
.submit-btn:hover,
.link-button:hover {
  background: linear-gradient(135deg, var(--agtc-gold-3), var(--agtc-gold-2));
  color: var(--agtc-ink);
}

.btn.secondary {
  background: #fffaf0;
  border-color: var(--agtc-line);
  color: #8b651c;
  box-shadow: none;
}

.btn.secondary:hover {
  background: #f4ead3;
  color: var(--agtc-ink);
}

.btn.danger,
.attachment-remove,
.link-danger {
  background: #fde8e8;
  color: var(--agtc-danger);
  box-shadow: none;
}

.btn.danger:hover,
.attachment-remove:hover,
.link-danger:hover {
  background: #ffd1d1;
  color: #7f1d1d;
}

table {
  background: #ffffff;
}

th,
.attachment-table th {
  background: linear-gradient(135deg, var(--agtc-ink), var(--agtc-ink-3));
  color: var(--agtc-gold-3);
}

th,
td,
.attachment-table th,
.attachment-table td {
  border-bottom-color: var(--agtc-line);
}

tr:nth-child(even) {
  background: #fbf7ed;
}

.badge {
  background: #f4ead3;
  color: #7a5819;
}

.badge.status-L,
.badge.attendance-P {
  background: #dcfce7;
  color: var(--agtc-success);
}

.badge.status-W,
.badge.attendance-L {
  background: #fff3bf;
  color: #8a6500;
}

.badge.status-O,
.badge.status-D,
.badge.attendance-A {
  background: #fee2e2;
  color: var(--agtc-danger);
}

.badge.status-S {
  background: #efe2bd;
  color: #6e4f12;
}

.home-button,
.option-card,
.course-card,
.detail-grid div,
.public-main .option-card,
.public-main .check-row label,
.file-item,
.agreement-panel,
.agreement-check,
.highlight-box,
.time-box {
  border-color: var(--agtc-line);
  background: var(--agtc-paper);
}

.home-button:hover {
  border-color: var(--agtc-gold);
  box-shadow: 0 18px 38px rgba(41, 30, 13, .16);
}

.home-button-icon,
.rule-list li::before {
  background: linear-gradient(135deg, var(--agtc-ink), var(--agtc-gold));
  color: var(--agtc-paper);
}

.summary-box,
.rule-list li,
.photo-preview,
.public-main .photo-preview,
.avatar {
  background: #fbf6eb;
  border-color: var(--agtc-line);
}

.avatar {
  color: var(--agtc-gold);
}

.detail-grid span,
.stats span,
.home-button-desc,
.school-name-en,
.hint {
  color: var(--agtc-muted);
}

.alert.error {
  background: #fde8e8;
  color: var(--agtc-danger);
}

.alert.success {
  background: #e8f8ef;
  color: var(--agtc-success);
}

footer {
  background: var(--agtc-ink);
  border-top: 1px solid rgba(201, 162, 74, .42);
  color: var(--agtc-paper);
}

footer strong {
  color: var(--agtc-gold-2);
}

@media (max-width: 768px) {
  tr {
    box-shadow: 0 8px 20px rgba(41, 30, 13, .10);
  }

  td::before {
    color: var(--agtc-gold);
  }

  .user-chip {
    display: none;
  }

  .language-switcher a {
    min-width: 34px;
    min-height: 30px;
    padding: 5px 8px;
  }
}

@media (max-width: 520px) {
  .note {
    display: none;
  }

  .brand {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-signup-link {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
  }

  .header-actions {
    gap: 8px;
  }
}

/* =====================================================
   Course registration page + stronger system notices
===================================================== */
.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.toast-stack {
  position: fixed;
  top: 92px;
  right: 22px;
  z-index: 2200;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  border: 1px solid rgba(201, 162, 74, .42);
  border-radius: 16px;
  padding: 14px 14px 14px 16px;
  box-shadow: 0 14px 30px rgba(41, 30, 13, .08);
  line-height: 1.5;
  animation: notice-in .18s ease-out;
}

.toast-stack .alert {
  pointer-events: auto;
  box-shadow: 0 22px 48px rgba(14, 10, 4, .22);
}

.alert.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
  transition: .22s ease;
}

.alert::before {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-weight: 900;
}

.alert-message {
  flex: 1;
  min-width: 0;
}

.alert-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(41, 30, 13, .08);
  color: currentColor;
  cursor: pointer;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.alert-close:hover {
  background: rgba(41, 30, 13, .14);
}

.alert.success {
  background: #e8f8ef;
  border-color: #9fd7b5;
  color: var(--agtc-success);
}

.alert.success::before {
  content: "✓";
  background: var(--agtc-success);
  color: #fff;
}

.alert.error {
  background: #fde8e8;
  border-color: #f4b5b5;
  color: var(--agtc-danger);
}

.alert.error::before {
  content: "!";
  background: var(--agtc-danger);
  color: #fff;
}

.alert.warning {
  background: #fff7df;
  border-color: #ead28b;
  color: #7a5819;
}

.alert.warning::before {
  content: "!";
  background: var(--agtc-gold);
  color: var(--agtc-ink);
}

@keyframes notice-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dialog-open {
  overflow: hidden;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.confirm-modal.show {
  display: flex;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 10, 4, .62);
  backdrop-filter: blur(3px);
}

.confirm-dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  border: 1px solid rgba(201, 162, 74, .55);
  border-radius: 22px;
  background: linear-gradient(180deg, #fffdf7, #fbf1da);
  box-shadow: 0 28px 70px rgba(14, 10, 4, .35);
  padding: 26px;
  text-align: center;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--agtc-ink), var(--agtc-gold));
  color: var(--agtc-paper);
  font-size: 28px;
  font-weight: 900;
}

.confirm-copy h2 {
  margin: 0 0 8px;
  color: var(--agtc-ink);
  font-size: 24px;
}

.confirm-copy p {
  margin: 0;
  color: #5c4a2a;
  font-size: 17px;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.confirm-actions .btn {
  min-width: 112px;
}

.sidebar .menu .menu-logout {
  margin-top: 12px;
  border-color: rgba(180, 35, 24, .28);
  background: rgba(180, 35, 24, .12);
}

.sidebar .menu .menu-logout:hover {
  background: linear-gradient(135deg, #fca5a5, #f87171);
  color: #3b0a0a;
}

@media (max-width: 560px) {
  .toast-stack {
    top: 84px;
    right: 12px;
    width: calc(100vw - 24px);
  }

  .confirm-dialog {
    padding: 22px;
    text-align: left;
  }

  .confirm-icon {
    margin-bottom: 12px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions .btn {
    width: 100%;
  }
}

.register-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.register-summary div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--agtc-line);
  border-radius: 16px;
  background: #fffaf0;
}

.register-summary .wide {
  grid-column: 1 / -1;
}

.register-summary span {
  display: block;
  margin-bottom: 6px;
  color: var(--agtc-muted);
  font-size: 13px;
  font-weight: 800;
}

.register-summary strong {
  color: var(--agtc-text);
  line-height: 1.5;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pagination a,
.pagination span {
  min-width: 40px;
  padding: 9px 12px;
  border: 1px solid var(--agtc-line);
  border-radius: 12px;
  background: #fffaf0;
  color: #8b651c;
  font-weight: 800;
  text-align: center;
}

.pagination .active {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  color: var(--agtc-ink);
  border-color: var(--agtc-gold);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--agtc-line);
  border-radius: 12px;
  background: #fffaf0;
  color: #7a5819;
  cursor: pointer;
  vertical-align: middle;
  box-shadow: none;
}

.icon-action:hover {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  color: var(--agtc-ink);
  border-color: var(--agtc-gold);
}

.icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action-danger {
  background: #fde8e8;
  border-color: #f4b5b5;
  color: var(--agtc-danger);
}

.icon-action-danger:hover {
  background: #ffd1d1;
  color: #7f1d1d;
  border-color: #f4a3a3;
}

.icon-action-primary {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  color: var(--agtc-ink);
  border-color: var(--agtc-gold);
}

.icon-action-primary:hover {
  background: linear-gradient(135deg, var(--agtc-gold-3), var(--agtc-gold-2));
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.row-actions form {
  display: inline-flex;
  margin: 0;
}

@media (max-width: 900px) {
  .register-summary {
    grid-template-columns: 1fr;
  }
}

/* =====================================================
   Responsive table hardening
   Keeps tables readable on phone/tablet by using horizontal scroll
   instead of squeezing columns into broken vertical text.
===================================================== */
.table-wrap,
.table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.table-wrap table,
.table-scroll table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.table-wrap th,
.table-wrap td,
.table-scroll th,
.table-scroll td {
  vertical-align: middle;
}

.course-table {
  min-width: 1120px;
}

.course-table th:nth-child(4),
.course-table td:nth-child(4) {
  min-width: 230px;
}

.course-table th:nth-child(8),
.course-table td:nth-child(8) {
  min-width: 280px;
  white-space: normal;
}

.course-table th:nth-child(9),
.course-table td:nth-child(9),
.course-table th:nth-child(10),
.course-table td:nth-child(10) {
  min-width: 118px;
  text-align: center;
}

.row-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

@media (max-width: 1024px) {
  header {
    gap: 12px;
  }

  header > div:first-child {
    min-width: 0;
  }

  .brand {
    max-width: min(56vw, 360px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

@media (max-width: 768px) {
  .hero,
  .card {
    max-width: 100%;
  }

  .table-wrap,
  .table-scroll {
    margin-inline: -10px;
    padding-inline: 10px;
    padding-bottom: 8px;
  }

  .table-wrap table,
  .table-scroll table {
    width: max-content;
    min-width: 760px;
  }

  .table-wrap .course-table,
  .table-scroll .course-table {
    min-width: 1120px;
  }

  .table-wrap tr,
  .table-scroll tr {
    display: table-row;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .table-wrap tr:nth-child(even),
  .table-scroll tr:nth-child(even) {
    background: rgba(249, 242, 226, .72);
  }

  .table-wrap th,
  .table-wrap td,
  .table-scroll th,
  .table-scroll td {
    display: table-cell;
    padding: 12px 14px;
    border-bottom: 1px solid var(--agtc-line);
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }

  .table-wrap td::before,
  .table-scroll td::before {
    content: none;
  }

  .course-table td:nth-child(4),
  .course-table td:nth-child(8) {
    white-space: normal;
  }

  .course-status-cell .badge {
    min-width: 76px;
  }

  .row-actions {
    display: inline-flex;
    gap: 8px;
  }

  .icon-action {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
  }
}

@media (max-width: 520px) {
  header {
    padding-inline: 12px;
  }

  .brand {
    max-width: calc(100vw - 190px);
  }

  main {
    padding: 16px 14px;
  }

  .hero,
  .card {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .table-wrap table,
  .table-scroll table {
    min-width: 720px;
  }

  .table-wrap .course-table,
  .table-scroll .course-table {
    min-width: 1060px;
  }
}

/* =====================================================
   Page width containment
   Prevents wide tables from making the whole mobile page wider than viewport.
   Horizontal scrolling stays inside each table wrapper.
===================================================== */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.layout,
main {
  min-width: 0;
}

.table-wrap,
.table-scroll {
  position: relative;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  contain: inline-size;
}

@media (max-width: 1024px) {
  header,
  .layout,
  main,
  footer {
    width: 100%;
    max-width: 100vw;
  }

  .layout {
    overflow-x: clip;
  }
}

@media (max-width: 520px) {
  main {
    padding-inline: 10px;
  }

  .hero,
  .card {
    width: 100%;
  }

  .table-wrap,
  .table-scroll {
    margin-inline: -6px;
    padding-inline: 6px;
  }
}

/* =====================================================
   Shared status colors
   Keep every major status visually distinct across tables.
===================================================== */
.badge {
  border: 1px solid transparent;
  line-height: 1.25;
}

.badge.status-W {
  background: #fef3c7;
  border-color: rgba(245, 158, 11, .35);
  color: #92400e;
}

.badge.status-L {
  background: #dbeafe;
  border-color: rgba(59, 130, 246, .35);
  color: #1d4ed8;
}

.badge.status-S {
  background: #dcfce7;
  border-color: rgba(34, 197, 94, .35);
  color: #15803d;
}

.badge.status-O {
  background: #fee2e2;
  border-color: rgba(239, 68, 68, .35);
  color: #b91c1c;
}

.badge.status-D {
  background: #e5e7eb;
  border-color: rgba(107, 114, 128, .35);
  color: #374151;
}

.badge.status-Y {
  background: #ccfbf1;
  border-color: rgba(20, 184, 166, .35);
  color: #0f766e;
}

.badge.status-N {
  background: #f3f4f6;
  border-color: rgba(107, 114, 128, .3);
  color: #4b5563;
}

.badge.attendance-P {
  background: #dcfce7;
  border-color: rgba(34, 197, 94, .35);
  color: #15803d;
}

.badge.attendance-L {
  background: #ffedd5;
  border-color: rgba(249, 115, 22, .35);
  color: #c2410c;
}

.badge.attendance-A {
  background: #fee2e2;
  border-color: rgba(239, 68, 68, .35);
  color: #b91c1c;
}

/* =====================================================
   Sidebar top fill
   Extends the dark sidebar background behind the sticky header so
   the upper-left area never appears cut off while scrolling.
===================================================== */
.sidebar {
  top: 0;
  height: 100vh;
  padding: 96px 18px 24px;
}

@media (max-width: 1024px) {
  .sidebar {
    top: 0;
    height: 100vh;
    padding-top: 96px;
  }

body.menu-open .overlay.show:not([hidden]) {
    inset: 72px 0 0 0;
  }
}

/* =====================================================
   Regulations page
===================================================== */
.regulations-hero {
  position: relative;
  overflow: hidden;
  padding-block: 34px;
}

.regulations-hero::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: 22px;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(201, 162, 74, .16), transparent 62%);
  pointer-events: none;
}

.regulations-hero .school-name {
  color: var(--agtc-gold);
  font-size: clamp(18px, 2vw, 24px);
}

.regulations-hero .school-name-en {
  max-width: 720px;
  color: var(--agtc-muted);
  font-weight: 800;
}

.regulations-card {
  padding: clamp(18px, 3vw, 30px);
}

.regulations-list {
  display: grid;
  gap: 16px;
}

.regulations-list li {
  min-height: 76px;
  margin-bottom: 0;
  padding: 18px 20px 18px 72px;
  border: 1px solid var(--agtc-line);
  border-left: 5px solid var(--agtc-gold);
  background:
    linear-gradient(135deg, rgba(255, 253, 247, .98), rgba(250, 245, 234, .98));
  box-shadow: 0 10px 28px rgba(41, 30, 13, .06);
  color: var(--agtc-text);
  font-size: 16px;
  line-height: 1.8;
}

.regulations-list li::before {
  left: 18px;
  top: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(246, 223, 154, .42);
  box-shadow: 0 8px 18px rgba(41, 30, 13, .14);
  font-size: 15px;
}

.regulations-list li.warning {
  border-color: #f0c2bf;
  border-left-color: var(--agtc-danger);
  background: linear-gradient(135deg, #fff9f6, #fdeceb);
}

.regulations-list li.warning::before {
  background: linear-gradient(135deg, #7f1d1d, #d94b42);
  color: #fffdf7;
}

.regulations-list .highlight-box {
  margin: 14px 0 0;
  border-color: rgba(201, 162, 74, .38);
  background: #fff9eb;
}

.regulations-list .time-grid {
  margin-top: 14px;
}

.regulations-list .time-box {
  border-color: rgba(201, 162, 74, .34);
  background: #fffdf7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7);
}

.regulations-list .time-box strong {
  display: block;
  margin-bottom: 6px;
}

@media (max-width: 640px) {
  .regulations-hero::after {
    display: none;
  }

  .regulations-list {
    gap: 12px;
  }

  .regulations-list li {
    padding: 58px 15px 16px;
    font-size: 15px;
  }

  .regulations-list li::before {
    left: 15px;
    top: 15px;
  }
}

/* =====================================================
   Softer admin tables
   Reduces visual weight and keeps row actions compact.
===================================================== */
.card:has(.table-scroll),
.card:has(.table-wrap) {
  padding: 22px;
}

.table-scroll,
.table-wrap {
  border-radius: 18px;
  background: #fffdf8;
}

.table-scroll table,
.table-wrap table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
  background: #fffdf8;
}

.table-scroll thead th,
.table-wrap thead th,
.table-scroll tr:first-child th,
.table-wrap tr:first-child th {
  padding: 13px 14px;
  border-bottom: 0;
  background: linear-gradient(135deg, #171108, #32240f);
  color: #f5da8a;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
}

.table-scroll thead th:first-child,
.table-wrap thead th:first-child,
.table-scroll tr:first-child th:first-child,
.table-wrap tr:first-child th:first-child {
  border-top-left-radius: 14px;
}

.table-scroll thead th:last-child,
.table-wrap thead th:last-child,
.table-scroll tr:first-child th:last-child,
.table-wrap tr:first-child th:last-child {
  border-top-right-radius: 14px;
}

.table-scroll td,
.table-wrap td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(201, 162, 74, .22);
  background: rgba(255, 255, 255, .72);
  color: #262016;
  line-height: 1.45;
  vertical-align: middle;
}

.table-scroll tr:nth-child(even) td,
.table-wrap tr:nth-child(even) td {
  background: rgba(248, 240, 224, .58);
}

.table-scroll tbody tr:hover td,
.table-wrap tbody tr:hover td {
  background: #fff7e6;
}

.table-scroll tbody tr:last-child td,
.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.table-scroll .badge,
.table-wrap .badge {
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.table-scroll .inline-form,
.table-wrap .inline-form {
  gap: 7px;
  flex-wrap: nowrap;
}

.table-scroll .inline-form select,
.table-wrap .inline-form select,
.table-scroll td select,
.table-wrap td select {
  width: auto;
  min-width: 148px;
  min-height: 34px;
  height: 34px;
  margin: 0;
  padding: 6px 30px 6px 12px;
  border-radius: 11px;
  border-color: rgba(201, 162, 74, .4);
  background-color: #fffdf8;
  font-size: 13px;
  line-height: 1.2;
}

.table-scroll .icon-action,
.table-wrap .icon-action {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  color: #8a651d;
}

.table-scroll .icon-action svg,
.table-wrap .icon-action svg {
  width: 16px;
  height: 16px;
}

.table-scroll .icon-action:hover,
.table-wrap .icon-action:hover {
  background: rgba(212, 164, 60, .14);
  color: #5f430e;
  border-color: transparent;
}

.table-scroll .icon-action-primary,
.table-wrap .icon-action-primary {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-color: rgba(183, 133, 25, .28);
  border-radius: 12px;
  background: #d8ad4c;
  color: #191006;
}

.table-scroll .icon-action-primary:hover,
.table-wrap .icon-action-primary:hover {
  background: #c99936;
}

@media (max-width: 768px) {
  .table-scroll .inline-form,
  .table-wrap .inline-form {
    flex-wrap: nowrap;
  }

  .table-scroll .inline-form select,
  .table-wrap .inline-form select,
  .table-scroll td select,
  .table-wrap td select {
    min-width: 138px;
  }
}

/* =====================================================
   Search/filter toolbar
   Makes filter rows compact and prevents full-width dropped buttons.
===================================================== */
.card > .search,
form.search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.card > .search > input,
form.search > input {
  flex: 1 1 320px;
  min-width: 240px;
  max-width: 760px;
}

.card > .search > select,
form.search > select {
  flex: 0 1 190px;
  min-width: 150px;
}

.card > .search > div,
form.search > div {
  flex: 0 1 220px;
  min-width: 170px;
}

.card > .search input,
.card > .search select,
form.search input,
form.search select {
  height: 42px;
  margin: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

.card > .search .btn,
form.search .btn {
  flex: 0 0 auto;
  min-width: 92px;
  height: 42px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 14px;
  line-height: 40px;
  white-space: nowrap;
}

.card > .search .btn.secondary,
form.search .btn.secondary {
  min-width: 104px;
}

@media (min-width: 1100px) {
  .card > .search > input:first-child,
  form.search > input:first-child {
    flex-grow: 0;
    flex-basis: min(52vw, 620px);
  }
}

@media (max-width: 760px) {
  .card > .search,
  form.search {
    display: grid;
    grid-template-columns: 1fr;
  }

  .card > .search > input,
  .card > .search > select,
  .card > .search > div,
  form.search > input,
  form.search > select,
  form.search > div {
    min-width: 0;
    max-width: none;
    width: 100%;
    grid-column: 1 / -1;
  }

  .card > .search > input:first-child,
  form.search > input:first-child {
    grid-column: 1 / -1;
  }

  .card > .search .btn,
  form.search .btn {
    width: 100%;
    grid-column: 1 / -1;
  }
}

/* =====================================================
   Fixed app header
   Keeps language/menu controls visible while the page scrolls and
   keeps the sidebar aligned neatly below the header.
===================================================== */
body {
  padding-top: 72px;
}

header {
  position: fixed;
  inset: 0 0 auto 0;
  width: 100%;
  height: 72px;
  z-index: 1600;
}

.layout {
  min-height: calc(100vh - 72px);
}

.sidebar {
  top: 72px;
  height: calc(100vh - 72px);
  padding: 24px 18px;
}

@media (max-width: 1024px) {
  .sidebar {
    top: 72px;
    height: calc(100vh - 72px);
    padding: 24px 18px;
  }

  body.menu-open .overlay.show:not([hidden]) {
    inset: 72px 0 0 0;
  }
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 4px;
}

.hero-toolbar {
  margin: 18px 0 0;
}

code {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(201, 162, 74, .12);
  color: var(--agtc-ink);
}

@media (max-width: 640px) {
  .section-head {
    display: grid;
  }

  .section-head .btn {
    width: 100%;
  }
}

.portfolio-preview-frame,
.blog-cover-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed rgba(201, 162, 74, .42);
  border-radius: 18px;
  background: rgba(255, 252, 245, .72);
}

.portfolio-empty-preview {
  display: grid;
  min-height: 96px;
  margin-top: 12px;
  place-items: center;
  border: 1px dashed rgba(201, 162, 74, .38);
  border-radius: 16px;
  background: rgba(255, 252, 245, .72);
  color: var(--agtc-muted);
  font-weight: 800;
}

.portfolio-empty-preview[hidden] {
  display: none;
}

.portfolio-upload-group {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(201, 162, 74, .28);
  border-radius: 18px;
  background: rgba(255, 252, 245, .6);
}

.portfolio-upload-group .portfolio-preview-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portfolio-preview-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

@media (max-width: 1199px) and (min-width: 768px) {
  .portfolio-preview-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) and (min-width: 641px) {
  .portfolio-preview-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.portfolio-preview-item {
  overflow: hidden;
  border: 1px solid rgba(201, 162, 74, .26);
  border-radius: 16px;
  background: #fffdf7;
  box-shadow: 0 10px 24px rgba(39, 28, 11, .06);
}

.portfolio-preview-item.is-cover {
  border-color: var(--agtc-gold);
  box-shadow: 0 14px 30px rgba(201, 162, 74, .20);
}

.portfolio-preview-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f7f0df;
}

.portfolio-preview-meta {
  display: grid;
  gap: 4px;
  padding: 10px 12px 0;
}

.portfolio-preview-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-preview-meta span {
  color: var(--agtc-muted);
  font-size: 13px;
}

.portfolio-preview-actions,
.portfolio-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px;
}

.portfolio-card-actions {
  padding: 14px 0 0;
  border-top: 1px solid rgba(201, 162, 74, .18);
}

.portfolio-card-actions form {
  margin: 0;
}

.portfolio-card h3 a {
  color: inherit;
  text-decoration: none;
}

.portfolio-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.portfolio-detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.portfolio-detail-image {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(201, 162, 74, .28);
  border-radius: 16px;
  background: #fffdf7;
  cursor: zoom-in;
}

.portfolio-detail-image-card {
  overflow: hidden;
  border: 1px solid rgba(201, 162, 74, .28);
  border-radius: 16px;
  background: #fffdf7;
}

.portfolio-detail-image-card.is-cover {
  border-color: var(--agtc-gold);
}

.portfolio-detail-image-card .portfolio-detail-image {
  border: 0;
  border-radius: 0;
}

.portfolio-cover-form,
.portfolio-cover-status {
  margin: 0;
  padding: 10px 12px;
}

.portfolio-cover-status {
  color: #7b5b13;
  font-weight: 900;
  text-align: center;
}

.portfolio-detail-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.portfolio-detail-image span {
  position: absolute;
  left: 12px;
  top: 12px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--agtc-gold);
  color: #1f1608;
  font-size: 12px;
  font-weight: 900;
}

.portfolio-detail-note {
  margin-top: 18px;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 28px;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 5, 1, .76);
  cursor: zoom-out;
}

.image-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, 92vw);
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid rgba(228, 190, 94, .55);
  border-radius: 22px;
  background: #fffdf8;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .45);
}

.image-lightbox-dialog img {
  display: block;
  width: 100%;
  max-height: calc(92vh - 58px);
  object-fit: contain;
  background: #130d04;
}

.image-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(228, 190, 94, .55);
  border-radius: 50%;
  background: rgba(19, 13, 4, .82);
  color: #ffe9a8;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-title {
  padding: 14px 18px;
  color: #6f5017;
  font-weight: 800;
  word-break: break-word;
}

.portfolio-preview-frame img,
.blog-cover-preview img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 14px;
  object-fit: contain;
}

.portfolio-grid,
.blog-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.portfolio-card,
.blog-card,
.review-card {
  overflow: hidden;
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 16px 36px rgba(39, 28, 11, .08);
}

.blog-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.portfolio-card img,
.blog-card-cover img,
.review-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f7f0df;
}

.review-image-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-self: start;
  padding: 14px;
  background: rgba(255, 248, 230, .72);
}

.review-image {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(201, 162, 74, .25);
  border-radius: 14px;
  background: #fffdf7;
  cursor: zoom-in;
}

.review-image.is-cover {
  grid-column: 1 / -1;
  border-color: var(--agtc-gold);
}

.review-image span {
  position: absolute;
  left: 10px;
  top: 10px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--agtc-gold);
  color: #1f1608;
  font-size: 12px;
  font-weight: 900;
}

.portfolio-card-body,
.blog-card-body,
.review-content {
  padding: 16px;
}

.blog-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.blog-card-body > p {
  flex: 1;
}

.portfolio-card h3,
.blog-card h2,
.review-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

.blog-card h2 a {
  color: inherit;
  text-decoration: none;
}

.portfolio-meta,
.blog-card-meta,
.blog-card-footer,
.review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.blog-card-meta,
.blog-card-footer {
  color: #7a6a4d;
  font-size: 13px;
}

.blog-card-status {
  margin: 10px 0 8px;
}

.blog-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(201, 162, 74, .18);
}

.blog-card-actions form {
  margin: 0;
}

.blog-card-actions .btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.blog-author {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.blog-author-avatar {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(201, 162, 74, .42);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--agtc-gold-3), var(--agtc-gold));
  color: var(--agtc-ink);
  font-size: 13px;
  font-weight: 900;
}

.blog-author-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #1b1208, #4a3516);
  color: #f5d876;
  font-size: 28px;
  font-weight: 800;
}

.review-note {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #fff8e8;
  border: 1px solid rgba(201, 162, 74, .24);
}

.grade-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.status-PENDING {
  background: #fef9c3;
  color: #a16207;
}

.badge.status-DRAFT {
  background: #e5e7eb;
  color: #374151;
}

.badge.status-PUBLISHED {
  background: #dcfce7;
  color: #15803d;
}

.badge.status-REJECTED {
  background: #fee2e2;
  color: #b91c1c;
}

.portfolio-review-list {
  display: grid;
  gap: 18px;
}

.review-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
}

.review-form {
  margin-top: 14px;
}

.blog-nav-card {
  padding-top: 26px;
  padding-bottom: 18px;
}

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.blog-toolbar .btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.blog-toolbar .btn.active {
  background: linear-gradient(135deg, var(--agtc-gold-2), var(--agtc-gold));
  border-color: var(--agtc-gold);
  color: var(--agtc-ink);
  box-shadow: 0 12px 26px rgba(201, 162, 74, .22);
}

.blog-search {
  display: grid;
  grid-template-columns: minmax(280px, 620px) auto auto;
  gap: 12px;
  align-items: center;
  justify-content: start;
  margin: 0;
}

.blog-search input,
.blog-search .btn {
  min-height: 46px;
  margin: 0;
}

.blog-search .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 116px;
  padding: 0 22px;
  line-height: 1.15;
}

.has-notification {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(220, 38, 38, .3);
}

.menu .notification-badge {
  top: 6px;
  right: 8px;
}

.menu-parent .notification-badge {
  top: 7px;
  right: 28px;
}

.menu-parent .notification-badge.inline-badge {
  position: static;
  top: auto;
  right: auto;
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  margin-left: 2px;
  border-color: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 18px rgba(220, 38, 38, .32);
}

.load-more-sentinel {
  display: grid;
  place-items: center;
  padding-top: 20px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(201, 162, 74, .34);
  border-radius: 14px 14px 0 0;
  background: #fff8e8;
}

.editor-tool-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 10px;
  background: rgba(255, 255, 255, .62);
}

.editor-toolbar button,
.editor-toolbar label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  height: 32px;
  padding: 5px 9px;
  border: 1px solid rgba(201, 162, 74, .34);
  border-radius: 8px;
  background: #fff;
  color: #2d2518;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.editor-toolbar button:hover,
.editor-toolbar label:hover {
  background: #fffdf7;
  border-color: rgba(201, 162, 74, .72);
}

.editor-toolbar input[type="color"] {
  width: 24px;
  height: 18px;
  padding: 0;
  border: 0;
  vertical-align: middle;
}

.editor-toolbar select {
  width: auto;
  height: 28px;
  min-height: 28px;
  padding: 2px 22px 2px 8px;
  margin-left: 4px;
  font-size: 13px;
}

.editor-color-group {
  flex-wrap: nowrap;
  gap: 5px;
  min-height: 42px;
}

.editor-color-group label {
  height: 32px;
  min-height: 32px;
  padding: 4px 7px;
  gap: 6px;
}

.editor-color-control {
  min-width: 58px;
}

.editor-size-control {
  min-width: 112px;
}

.editor-color-group input[type="color"] {
  width: 22px;
  height: 22px;
  padding: 0;
  margin-bottom: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

.editor-color-group input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border: 0;
}

.editor-color-group input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(45, 37, 24, .28);
  border-radius: 6px;
}

.editor-color-group input[type="color"]::-moz-color-swatch {
  border: 1px solid rgba(45, 37, 24, .28);
  border-radius: 6px;
}

.editor-color-group select {
  width: 64px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 1px 18px 1px 7px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
}

.rich-editor {
  min-height: 320px;
  padding: 18px;
  border: 1px solid rgba(201, 162, 74, .34);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: #fff;
  outline: none;
}

.rich-editor:focus {
  box-shadow: 0 0 0 3px rgba(201, 162, 74, .16);
}

.rich-editor img,
.article-content img,
.article-cover img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
}

.article-cover {
  margin-bottom: 20px;
}

.article-cover img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}

.article-content {
  line-height: 1.8;
}

.article-content figure,
.rich-editor figure {
  margin: 18px 0;
}

@media (max-width: 960px) {
  .portfolio-grid,
  .blog-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-detail-grid {
    grid-template-columns: 1fr;
  }

  .review-card {
    grid-template-columns: 1fr;
  }

  .review-image-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .blog-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .portfolio-grid,
  .blog-card-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-preview-list,
  .portfolio-detail-gallery {
    grid-template-columns: 1fr;
  }

  .review-image-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }

  .portfolio-preview-actions .btn,
  .portfolio-card-actions .btn,
  .portfolio-card-actions form {
    width: 100%;
  }

  .image-lightbox {
    padding: 12px;
  }

  .image-lightbox-dialog {
    width: 96vw;
    border-radius: 18px;
  }

  .image-lightbox-dialog img {
    max-height: calc(90vh - 54px);
  }

  .blog-nav-card {
    padding: 18px;
  }

  .blog-toolbar,
  .blog-search {
    display: grid;
    grid-template-columns: 1fr;
  }

  .blog-toolbar .btn,
  .blog-search .btn {
    width: 100%;
    min-width: 0;
  }

  .editor-toolbar {
    display: grid;
  }

  .editor-tool-group {
    width: 100%;
  }

  .portfolio-meta,
  .blog-card-footer,
  .review-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.api-generated-card {
  border-color: rgba(34, 197, 94, .35);
  background: linear-gradient(135deg, #fbfff9, #fffaf0);
}

.api-copy-grid,
.api-scope-grid {
  display: grid;
  gap: 14px;
}

.api-copy-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.copy-field input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.compact-copy {
  min-height: 40px;
  padding: 0 16px;
}

.api-scope-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid #e9d8ae;
  border-radius: 14px;
  padding: 12px;
  background: #fffdf8;
}

.checkbox-card input {
  width: auto;
  margin-top: 4px;
}

.checkbox-card strong,
.checkbox-card small {
  display: block;
}

.checkbox-card small {
  color: #8b6a2b;
  margin-top: 3px;
}

.notice-box {
  border: 1px solid #e9d8ae;
  border-radius: 16px;
  background: #fff8e6;
  color: #3b2d12;
  padding: 14px 16px;
}

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

form.search.api-token-search {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 10px;
}

form.search.api-token-search > div {
  flex: 0 0 auto;
  min-width: 0;
}

form.search.api-token-search > div:first-child {
  width: 260px;
}

form.search.api-token-search > div:nth-child(2) {
  width: 220px;
}

form.search.api-token-search .btn {
  height: 44px;
  min-width: 92px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin: 0;
}

form.search.api-token-search .btn.secondary {
  min-width: 112px;
}

.code-block {
  overflow-x: auto;
  border: 1px solid rgba(201, 162, 74, .22);
  border-radius: 16px;
  background: #171107;
  color: #f8e7ad;
  padding: 16px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

.line-chart {
  width: 100%;
  min-height: 250px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(201, 162, 74, .24);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(251, 246, 235, .92)),
    radial-gradient(circle at 18% 10%, rgba(216, 176, 77, .16), transparent 30%);
}

.line-chart svg {
  display: block;
  width: 100%;
  height: 250px;
}

.line-chart .chart-grid line {
  stroke: rgba(111, 98, 75, .16);
  stroke-width: 1;
}

.line-chart .chart-grid text,
.line-chart .chart-labels text {
  fill: #6f624b;
  font-size: 12px;
}

.line-chart polyline {
  fill: none;
  stroke: var(--agtc-gold);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 7px 8px rgba(201, 162, 74, .20));
}

.line-chart .chart-points circle {
  fill: #fffdf7;
  stroke: var(--agtc-gold);
  stroke-width: 3;
}

.report-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.report-catalog-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.report-card-link {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 14px;
  border: 1px solid rgba(201, 162, 74, .32);
  border-radius: 16px;
  background: linear-gradient(135deg, #fffdf7 0%, #fbf3df 100%);
  color: #2f2618;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(58, 43, 20, .07);
}

.report-card-link:hover {
  border-color: rgba(201, 162, 74, .62);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(58, 43, 20, .10);
}

.report-card-link.active {
  background: linear-gradient(135deg, #e1bd55 0%, #c99a2f 100%);
  border-color: rgba(138, 101, 13, .62);
  color: #1f1608;
}

.report-card-link strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #21180c;
  color: #f7d979;
  font-size: 18px;
  line-height: 1;
}

.report-card-link span {
  min-width: 0;
  font-weight: 800;
  line-height: 1.35;
}

.report-section {
  scroll-margin-top: 110px;
  margin-bottom: 22px;
}

.report-section h2 {
  margin-bottom: 6px;
}

.report-section .hint {
  margin: 0 0 14px;
  color: var(--agtc-muted);
  line-height: 1.55;
}

.report-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.report-heading-row h2 {
  margin-top: 0;
}

.empty-chart {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px dashed rgba(201, 162, 74, .42);
  border-radius: 18px;
  color: var(--agtc-muted);
  background: #fffdf7;
}

.api-token-form .notice-box {
  margin-top: 10px;
  margin-bottom: 22px;
}

.api-token-form .toolbar {
  margin-top: 0;
  gap: 12px;
}

@media (max-width: 760px) {
  .api-copy-grid,
  .api-scope-grid,
  .copy-field {
    grid-template-columns: 1fr;
  }

  .compact-copy {
    width: 100%;
  }

  form.search.api-token-search {
    display: grid;
    grid-template-columns: 1fr;
  }

  form.search.api-token-search > div,
  form.search.api-token-search > div:first-child,
  form.search.api-token-search > div:nth-child(2) {
    width: 100%;
  }

form.search.api-token-search .btn {
    width: 100%;
  }
}

/* =====================================================
   Report/filter action rows
   Keeps date/select fields and action buttons visually aligned.
===================================================== */
form.search.filter-toolbar {
  align-items: flex-end;
  gap: 12px;
}

form.search.filter-toolbar > div {
  flex: 0 1 180px;
  min-width: 156px;
}

form.search.filter-toolbar > div.filter-keyword {
  flex: 0 1 230px;
  min-width: 200px;
}

form.search.filter-toolbar label {
  display: block;
  margin: 0 0 6px;
  line-height: 1.25;
}

form.search.filter-toolbar input,
form.search.filter-toolbar select {
  width: 100%;
  min-height: 44px;
}

form.search.filter-toolbar .btn {
  height: 44px;
  min-width: 86px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  margin: 0;
}

form.search.filter-toolbar .btn.secondary {
  min-width: 96px;
}

.reward-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.reward-nav .btn {
  height: 42px;
  min-width: 124px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  margin: 0;
}

.reward-nav .btn.active {
  background: var(--agtc-gold);
  color: #1f1608;
  border-color: var(--agtc-gold-dark);
  box-shadow: 0 10px 22px rgba(201, 162, 74, .18);
}

.reward-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
}

.reward-grid .home-button {
  width: 100%;
  min-width: 0;
}

.qr-checkin-panel {
  display: grid;
  grid-template-columns: minmax(220px, 350px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  margin-top: 20px;
  padding: 20px;
  border: 1px solid rgba(201, 162, 74, .32);
  border-radius: 18px;
  background: linear-gradient(135deg, #fffdf7 0%, #fbf1dc 100%);
}

.qr-checkin-code {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(201, 162, 74, .28);
  box-shadow: 0 14px 30px rgba(58, 43, 20, .10);
}

.qr-checkin-code img {
  width: min(100%, 350px);
  height: auto;
  display: block;
  border-radius: 12px;
}

.qr-checkin-detail h2 {
  margin-top: 0;
}

.qr-copy-field {
  max-width: 760px;
}

@media (max-width: 760px) {
  form.search.filter-toolbar {
    grid-template-columns: 1fr;
  }

  form.search.filter-toolbar > div,
  form.search.filter-toolbar > div.filter-keyword {
    width: 100%;
    min-width: 0;
  }

  form.search.filter-toolbar .btn,
  form.search.filter-toolbar .btn.secondary,
  .reward-nav .btn {
    width: 100%;
  }

  .reward-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .reward-grid .home-button {
    aspect-ratio: 1 / 1.08;
    padding: 12px 8px;
    border-radius: 16px;
  }

  .reward-grid .home-button-icon {
    width: 42px;
    height: 42px;
    font-size: 22px;
    border-radius: 14px;
    margin-bottom: 10px;
  }

  .reward-grid .home-button-title {
    font-size: 13px;
    line-height: 1.25;
    margin-bottom: 6px;
  }

  .reward-grid .home-button-desc {
    font-size: 11px;
    line-height: 1.35;
  }

  .reward-grid .btn.compact {
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .qr-checkin-panel {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}

@media (max-width: 980px) {
  .dashboard-chart-grid {
    grid-template-columns: 1fr;
  }

  .line-chart-points {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .dashboard-chart-grid,
  .dashboard-report-overview,
  .dashboard-chart-card,
  .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .dashboard-chart-card {
    padding: 16px;
    min-height: 0;
    overflow: clip;
  }

  .dashboard-report-overview {
    overflow: hidden;
  }

  .report-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats div {
    padding: 14px;
    border-radius: 16px;
  }

  .stats span {
    font-size: 12px;
  }

  .stats strong {
    font-size: 26px;
  }

  .report-dashboard-card {
    min-height: 0;
    padding: 14px;
  }

  .report-dashboard-head {
    gap: 8px;
  }

  .report-dashboard-head strong {
    font-size: 16px;
  }

  .report-dashboard-head small {
    -webkit-line-clamp: 2;
    font-size: 12px;
  }

  .report-dashboard-head em {
    min-width: 34px;
    font-size: 24px;
  }

  .report-dashboard-row,
  .horizontal-bar-row {
    grid-template-columns: minmax(68px, 104px) minmax(70px, 1fr) 30px;
    gap: 8px;
  }

  .report-dashboard-row span,
  .horizontal-bar-row span {
    font-size: 12px;
  }

  .chart-head {
    align-items: flex-start;
  }

  .chart-head h2 {
    font-size: 18px;
    line-height: 1.3;
  }

  .chart-head p {
    font-size: 13px;
  }

  .chart-head > strong {
    font-size: 26px;
  }

  .line-chart svg {
    display: block;
    max-width: 100%;
    height: 138px;
  }

  .line-chart-points {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 100%;
  }

  .line-chart-points span {
    min-width: 0;
    padding: 7px 9px;
  }

  .mini-bar-chart {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 2px 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .mini-bar-item {
    flex: 0 0 30px;
    min-width: 30px;
  }

  .horizontal-bar-row {
    grid-template-columns: 1fr 44px;
    gap: 8px;
  }

  .horizontal-bar-row span {
    grid-column: 1 / -1;
  }
}

/* =====================================================
   Mobile sidebar: one reliable vertical scroll surface
   iOS Chrome/Safari can lose gestures when the fixed drawer contains a
   second nested scroller. On mobile the whole drawer scrolls instead.
===================================================== */
@media (max-width: 1024px) {
  .sidebar {
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    max-height: calc(100dvh - 72px);
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  .sidebar .menu {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    touch-action: pan-y;
  }

  .sidebar .menu a,
  .sidebar .menu summary,
  .sidebar .submenu {
    touch-action: pan-y;
  }

body.menu-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
}

/* =====================================================
   Course search date controls
   Prevent the intrinsic iOS date-input width from escaping its card and
   provide a consistent, accessible calendar trigger on every browser.
===================================================== */
.course-search-form,
.course-search-grid,
.course-search-grid > *,
.course-date-field,
.date-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.date-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: stretch;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--agtc-line);
  border-radius: 12px;
  background: #fff;
}

.date-control:focus-within {
  border-color: var(--agtc-gold);
  box-shadow: 0 0 0 4px rgba(201, 162, 74, .18);
}

.date-control .course-date-input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 52px;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
}

.date-control .course-date-input:focus {
  box-shadow: none;
}

.date-control .course-date-input::-webkit-date-and-time-value {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  text-align: left;
}

.date-control .course-date-input::-webkit-calendar-picker-indicator {
  display: none;
  opacity: 0;
}

.date-picker-button {
  display: inline-grid;
  place-items: center;
  width: 52px;
  min-width: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--agtc-line);
  border-radius: 0;
  background: #fffaf0;
  color: var(--agtc-ink);
  cursor: pointer;
  touch-action: manipulation;
}

.date-picker-button:hover,
.date-picker-button:focus-visible {
  background: var(--agtc-gold-2);
  outline: none;
}

.date-picker-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.date-search-form .date-control {
  margin-bottom: 0;
}

.date-search-form > .btn,
.date-search-form > .submit-btn {
  min-height: 52px;
  margin: 0;
  white-space: nowrap;
}

.attendance-course-table {
  min-width: 720px;
}

@media (max-width: 520px) {
  .course-search-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .date-control {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .date-picker-button {
    width: 48px;
    min-width: 48px;
  }

  .date-search-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .date-search-form > .btn,
  .date-search-form > .submit-btn {
    width: 100%;
  }
}
