:root{
  --bg: #f4f6f9;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --card: #ffffff;
  --nav: #1f2d3d;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --primary: #1d4ed8;
  --primary2: #1e40af;
}

*{ box-sizing:border-box; margin:0; padding:0; font-family: Arial, Helvetica, sans-serif; }
body{ background: var(--bg); color: var(--text); }

/* ===== Teacher/Admin Topbar ===== */
.topbar{
  background: var(--nav);
  padding: 14px 22px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 16px;
}
.topbar .menu{ display:flex; flex-wrap:wrap; align-items:center; gap:18px; }
.topbar a{
  color:#fff; text-decoration:none;
  font-size:14px; font-weight:700;
  padding:6px 10px; border-radius:6px; white-space:nowrap;
}
.topbar a:hover{ background: rgba(255,255,255,0.12); }
.site-title{ font-weight:900; }
.topbar .logout a{ color:#ffe3e3; }

/* ===== Page Wrapper ===== */
.page{ width:100%; padding:18px 22px; }

/* ===== Dashboard Panel ===== */
.panel{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

/* ===== Tables ===== */
.table-wrap{ width:100%; overflow-x:auto; margin-top:10px; }
table{ width:100%; border-collapse:collapse; background:#fff; }
th, td{ border-bottom:1px solid #e5e7eb; text-align:left; padding:10px 12px; font-size:14px; }
th{ background:#e5e7eb; font-weight:900; }

/* ===== Forms ===== */
.field-label{ display:block; font-size:14px; font-weight:700; margin: 8px 0 6px; }
input[type="text"], input[type="password"], select, textarea{
  border:1px solid var(--border);
  border-radius:4px;
  padding:8px 10px;
  font-size:14px;
  background:#fff;
  color:var(--text);
}
textarea{ width:100%; resize:vertical; }

.filters-row{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:10px; }
.filters-row label{ display:flex; flex-direction:column; gap:6px; font-size:14px; }

/* Buttons */
button{
  border:1px solid transparent;
  border-radius:4px;
  padding:8px 12px;
  font-weight:700;
  cursor:pointer;
}
button:disabled{ opacity:0.6; cursor:not-allowed; }

/* Flash */
.flash-wrap{ margin-bottom:12px; }
.flash{
  border:1px solid var(--border);
  background:#fff;
  border-left:6px solid #2563eb;
  padding:10px 12px;
  margin-bottom:8px;
}

/* ===== Teacher Login (Centered) ===== */
.auth-page{
  min-height: calc(100vh - 60px);
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding-top: 80px;
}
.auth-card{
  width: 500px;
  max-width: calc(100% - 24px);
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.auth-title{ text-align:center; font-size:22px; font-weight:900; margin-bottom:6px; }
.auth-subtitle{ text-align:center; color:var(--muted); margin-bottom:14px; }
.auth-btn{
  margin-top: 14px;
  width: 120px;
  background: var(--primary);
  color:#fff;
  border-radius: 10px;
}
.auth-btn:hover{ background: var(--primary2); }
.auth-links{ text-align:center; margin-top: 14px; font-weight:700; }
.auth-links a{ color:#2563eb; text-decoration:none; }
.auth-links a:hover{ text-decoration:underline; }

/* ===== Student Timer (NOT full screen) ===== */
.student-page{
  max-width: 1100px;
  margin: 10px auto 30px;
  padding: 0 18px;
}

/* Student header (name left, logout right) */
.student-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.student-name{ font-size: 34px; font-weight: 900; }
.student-subtitle{ color: var(--muted); margin-top: 4px; }
.student-logout a{ color:#2563eb; text-decoration:underline; font-weight:700; }

/* Student card container */
.student-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

/* RUNNING/READY banner */
.banner{
  border-radius: 16px;
  padding: 14px;
  margin: 10px 0 14px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
}
.banner.running{ background:#eff6ff; border-color:#bfdbfe; }
.banner-title{
  font-weight: 900;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.banner-body{ display:grid; gap: 6px; font-size: 14px; }

/* Help text */
.help-text{ margin-top: 8px; color: var(--muted); font-size: 13px; }

/* Student controls */
.student-page select, .student-page textarea{ width:100%; border-radius: 10px; }

/* Big Start/Stop buttons */
.btnrow{
  display:flex;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items:center;
}
.btnrow button{
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 900;
  border-radius: 14px;
  line-height: 1;
  min-height: 52px;
  display:inline-flex;
  align-items:center;
  gap: 10px;
}

/* Start / Stop colours */
.primary{
  background: #1d4ed8;
  color:#fff;
}
.primary:hover{ background:#1e40af; }

.danger{
  background: #ef4444;
  color:#fff;
}
.danger:hover{ background:#dc2626; }

/* Dots */
.dot{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display:inline-block;
  border:2px solid rgba(0,0,0,0.15);
}
.dot.green{ background:#16a34a; }
.dot.red{ background:#ef4444; }

.student-tip{
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Emoji spacing safety */
.emoji-pad{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:center;
  align-items:center;
}
.emoji-btn{
  min-width: 46px;
  padding: 8px 10px;
  font-size: 20px;
  line-height: 1;
  border-radius: 12px;
  border: 1px solid #dbe2ea;
  background: #fff;
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.emoji-btn:hover{ background:#f1f5f9; }

/* Responsive */
@media (max-width: 700px){
  .topbar{ flex-direction:column; align-items:flex-start; }
  .topbar .logout{ align-self:flex-end; }
  .page{ padding:14px; }
  .student-name{ font-size: 28px; }
}


/* ============================
   NTT Admin/Teacher Shell (3-pane)
   - Left sidebar (nav)
   - Centre content (records)
   - Right panel (filters/actions)
   Mobile: sidebar + right panel become drawers
============================ */

.ntt-shell{
  min-height: 100vh;
  display: flex;
  background: #f6f7f9;
}

.ntt-overlay{
  display:none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 50;
}

.ntt-sidebar{
  width: 240px;
  background: #1f2328;
  color: #fff;
  display:flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 12px;
}

.ntt-sidebar__brand{
  padding: 6px 8px;
}

.ntt-brand{
  color:#fff;
  text-decoration:none;
  font-weight:700;
  display:block;
}

.ntt-brand__title{
  font-size: 16px;
}

.ntt-nav{
  display:flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 4px;
}

.ntt-nav__item{
  color:#d7dde6;
  text-decoration:none;
  padding: 10px 10px;
  border-radius: 10px;
  font-size: 14px;
}

.ntt-nav__item:hover{
  background: rgba(255,255,255,.08);
  color:#fff;
}

.ntt-sidebar__footer{
  margin-top:auto;
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.ntt-user__name{
  font-size: 13px;
  color:#d7dde6;
  margin-bottom: 8px;
}

.ntt-logout{
  color:#fff;
  text-decoration:none;
  font-weight:600;
  font-size: 13px;
}

.ntt-main{
  flex:1;
  display:flex;
  flex-direction: column;
  min-width: 0;
}

.ntt-center-header{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.ntt-iconbtn{
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.ntt-hamburger{
  display:none; /* desktop hidden */
}

.ntt-breadcrumb{
  font-size: 13px;
  color:#4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ntt-breadcrumb .ntt-crumb a{
  color:#2563eb;
  text-decoration:none;
}

.ntt-center-header__actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
}

.ntt-filterbtn{
  display:none; /* desktop hidden */
}

.ntt-actionbar{
  padding: 8px 14px;
  background:#fff;
  border-bottom: 1px solid rgba(0,0,0,.06);
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 44px;
}

.ntt-actionbar:empty{
  display:none;
}

.ntt-btn{
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  cursor:pointer;
}

.ntt-btn:hover{
  background:#f3f4f6;
}

.ntt-btn--primary{
  border-color: rgba(37,99,235,.35);
  background: rgba(37,99,235,.08);
  font-weight: 700;
}

.ntt-btn--danger{
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.08);
  color:#991b1b;
  font-weight:700;
}

.ntt-btn--ghost{
  border-color: transparent;
  background: transparent;
}

.ntt-content{
  display:flex;
  gap: 14px;
  padding: 14px;
  flex: 1;
  min-height: 0;
}

.ntt-center{
  flex: 1;
  min-width: 0;
}

.ntt-right{
  width: 320px;
  background:#fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 12px;
  height: calc(100vh - 120px);
  position: sticky;
  top: 76px;
  overflow:auto;
}

.ntt-muted{ color:#6b7280; font-size: 13px; }

.ntt-section{
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
}

.ntt-section__title{
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 10px 0;
  color:#111827;
}

.ntt-cardlist{
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.ntt-card{
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 10px 12px;
  background:#fff;
  display:flex;
  gap: 12px;
  justify-content: space-between;
}

.ntt-card:hover{
  border-color: rgba(37,99,235,.35);
}

.ntt-card__main{
  min-width:0;
}

.ntt-card__title{
  font-weight: 800;
  margin: 0;
  font-size: 14px;
}

.ntt-card__title a{ text-decoration:none; color:#111827; }
.ntt-card__meta{
  font-size: 12px;
  color:#6b7280;
  margin-top: 4px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.ntt-card__side{
  text-align:right;
  font-size: 12px;
  color:#374151;
  display:flex;
  flex-direction: column;
  gap: 4px;
}

.ntt-badge{
  display:inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  background:#f9fafb;
}

.ntt-badge--running{
  border-color: rgba(16,185,129,.35);
  background: rgba(16,185,129,.10);
  color:#065f46;
  font-weight:700;
}

.ntt-form h3{
  margin: 0 0 10px 0;
  font-size: 13px;
}

.ntt-form label{
  display:block;
  font-size: 12px;
  margin: 10px 0 6px;
  color:#374151;
  font-weight:600;
}

.ntt-form input, .ntt-form select, .ntt-form textarea{
  width:100%;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  box-sizing:border-box;
}

.ntt-form textarea{ min-height: 90px; resize: vertical; }

.ntt-form__footer{
  display:flex;
  gap: 10px;
  margin-top: 12px;
}

.ntt-form__footer .ntt-btn{ flex:1; }

/* Mobile: drawers */
@media (max-width: 900px){
  .ntt-content{ padding: 10px; }
  .ntt-right{
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(92vw, 360px);
    border-radius: 0;
    transform: translateX(110%);
    transition: transform .18s ease;
    z-index: 60;
  }
  .ntt-right.is-open{ transform: translateX(0); }

  .ntt-sidebar{
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-110%);
    transition: transform .18s ease;
    z-index: 60;
  }
  .ntt-sidebar.is-open{ transform: translateX(0); }

  .ntt-overlay.is-open{ display:block; }

  .ntt-hamburger{ display:inline-flex; }
  .ntt-filterbtn{ display:inline-flex; }

  .ntt-content{ flex-direction: column; }
  .ntt-right{ margin-top: 0; }
}

/* Small screens: keep breadcrumb on one line; allow horizontal scroll */
@media (max-width: 520px){
  .ntt-breadcrumb{ overflow-x:auto; text-overflow: clip; }
}


/* ===== Students cards + right-panel helpers ===== */
.ntt-cardlist{display:flex;flex-direction:column;gap:10px;}
.ntt-card{border:1px solid #e6e6e6;border-radius:12px;background:#fff;display:flex;justify-content:space-between;align-items:flex-start;padding:12px;}
.ntt-card--compact{padding:10px;}
.ntt-card.is-inactive{opacity:0.75;}
.ntt-card.is-running{border-color:#f0d38b;}
.ntt-card__left{display:flex;gap:10px;align-items:flex-start;min-width:0;}
.ntt-card__main{min-width:0;}
.ntt-card__title{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:520px;}
.ntt-card__meta{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px;}
.ntt-pill{display:inline-flex;gap:6px;align-items:center;padding:2px 8px;border:1px solid #e7e7e7;border-radius:999px;font-size:12px;color:#444;background:#fafafa;}
.ntt-card__right{text-align:right;display:flex;flex-direction:column;gap:6px;min-width:170px;}
.ntt-emoji{margin-right:6px;font-size:18px;line-height:1;}
.ntt-check{display:flex;align-items:flex-start;}
.ntt-check__box{width:18px;height:18px;margin-top:3px;}
.ntt-selectedlist{max-height:140px;overflow:auto;border:1px solid #e7e7e7;border-radius:10px;padding:8px;background:#fafafa;margin-bottom:10px;}
.ntt-selectedlist__item{display:flex;justify-content:space-between;gap:10px;font-size:13px;padding:4px 2px;border-bottom:1px dashed #e5e5e5;}
.ntt-selectedlist__item:last-child{border-bottom:none;}
.ntt-warning{border:1px solid #f0c2c2;background:#fff5f5;border-radius:12px;padding:10px;margin:10px 0;}
.ntt-emoji-grid{display:flex;flex-wrap:wrap;gap:8px;padding:8px;border:1px solid #e7e7e7;border-radius:12px;background:#fafafa;}
.ntt-emoji-btn{font-size:20px;line-height:1;border:1px solid #e5e5e5;background:#fff;border-radius:10px;padding:8px 10px;cursor:pointer;}
.ntt-emoji-btn.is-selected{outline:2px solid #111;outline-offset:1px;}
@media (max-width: 900px){
  .ntt-card{flex-direction:column;align-items:stretch;}
  .ntt-card__right{text-align:left;min-width:0;}
  .ntt-card__title{max-width:100%;}
}


.ntt-btn--sm{ padding:6px 10px; font-size:12px; }


/* Emoji tools (right panel) */
.ntt-emoji-tools{
  display:flex;
  gap:8px;
  margin:6px 0 10px;
}
.ntt-mini-btn{
  border:1px solid rgba(0,0,0,.15);
  background:#fff;
  border-radius:10px;
  padding:6px 10px;
  font-size:13px;
  cursor:pointer;
}
.ntt-mini-btn:hover{ background: rgba(0,0,0,.04); }

/* Top-left user display (moved from sidebar footer) */
.ntt-topuser{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-right: 8px;
  font-size: 13px;
  color:#111827;
}

.ntt-topuser__name{
  font-weight: 600;
}

.ntt-topuser__logout{
  color:#2563eb;
  text-decoration:none;
  font-weight: 600;
}

.ntt-topuser__logout:hover{
  text-decoration: underline;
}
