/* NNWA LMS — fresh dashboard design system */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --teal-900: #072A22;
  --teal-800: #0B3B30;
  --teal-700: #0F6E56;
  --teal-600: #128A6B;
  --teal-100: #DDF2EA;
  --teal-50:  #EFF9F5;
  --gold-500: #D4881E;
  --gold-100: #FDF0DC;
  --ink-900:  #14201C;
  --ink-700:  #33413C;
  --ink-500:  #64736D;
  --ink-300:  #A9B5B0;
  --line:     #E3E9E6;
  --bg:       #F4F7F5;
  --white:    #FFFFFF;
  --red-600:  #C93A2B;
  --red-100:  #FBE7E4;
  --green-600:#1D9E75;
  --green-100:#E2F5EC;
  --amber-600:#B37413;
  --amber-100:#FBF0DB;
  --radius:   12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(7,42,34,.06), 0 4px 16px rgba(7,42,34,.05);
  --shadow-lg: 0 8px 40px rgba(7,42,34,.16);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink-900); font-size: 14px; line-height: 1.55; }
a { color: var(--teal-700); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); font-size: 14px; }
h1,h2,h3,h4 { font-weight: 700; letter-spacing: -0.01em; }

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--teal-900); color: #CFE5DD;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px;
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -0.02em;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--teal-600);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
}
.brand small { display: block; font-size: 10px; font-weight: 500; color: #8FB8AB; letter-spacing: .08em; text-transform: uppercase; }
.nav { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  color: #A7C8BD; font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--teal-700); color: #fff; }
.nav .nav-label { padding: 16px 12px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #5E8577; }
.sidebar .foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.userchip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold-500); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.userchip .u-name { color: #fff; font-weight: 600; font-size: 13px; line-height: 1.2; }
.userchip .u-role { color: #8FB8AB; font-size: 11px; }
.userchip button { margin-left: auto; background: none; border: none; color: #8FB8AB; font-size: 12px; }
.userchip button:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 18px; }
.topbar .crumb { color: var(--ink-500); font-weight: 500; font-size: 13px; }
.topbar .spacer { flex: 1; }
.content { padding: 26px 28px 60px; max-width: 1200px; width: 100%; }

/* ---------- primitives ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; }
.card-head .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 9px; border: 1px solid transparent;
  padding: 9px 16px; font-weight: 600; font-size: 13.5px; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--teal-700); color: #fff; }
.btn-primary:hover { background: var(--teal-600); }
.btn-gold { background: var(--gold-500); color: #fff; }
.btn-gold:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--white); border-color: var(--line); color: var(--ink-700); }
.btn-ghost:hover { border-color: var(--ink-300); }
.btn-danger { background: var(--red-100); color: var(--red-600); }
.btn-danger:hover { background: #F6D5D0; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { padding: 6px 8px; background: none; border: none; color: var(--ink-500); border-radius: 6px; }
.btn-icon:hover { background: var(--bg); color: var(--ink-900); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; color: var(--ink-700); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px var(--teal-100);
}
.field .hint { font-size: 11.5px; color: var(--ink-500); margin-top: 4px; }
.field-row { display: flex; gap: 12px; } .field-row .field { flex: 1; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: var(--green-100); color: var(--green-600); }
.badge-amber { background: var(--amber-100); color: var(--amber-600); }
.badge-red { background: var(--red-100); color: var(--red-600); }
.badge-gray { background: var(--bg); color: var(--ink-500); border: 1px solid var(--line); }
.badge-teal { background: var(--teal-100); color: var(--teal-700); }
.badge-gold { background: var(--gold-100); color: var(--gold-500); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-500); padding: 11px 16px; border-bottom: 1px solid var(--line); background: #FAFCFB;
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.rowlink { cursor: pointer; } .tbl tr.rowlink:hover { background: var(--teal-50); }
.tbl .t-main { font-weight: 600; } .tbl .t-sub { font-size: 12px; color: var(--ink-500); }
.tbl .t-right { text-align: right; }

/* stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .s-label { font-size: 12px; font-weight: 600; color: var(--ink-500); display: flex; align-items: center; gap: 8px; }
.stat .s-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.stat .s-sub { font-size: 12px; color: var(--ink-500); margin-top: 3px; }
.stat.s-accent { background: var(--teal-800); border-color: var(--teal-800); }
.stat.s-accent .s-label { color: #9CC5B8; }
.stat.s-accent .s-value { color: #fff; }
.stat.s-accent .s-sub { color: #9CC5B8; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } .sidebar { width: 68px; } .sidebar .brand span, .nav a span, .nav-label, .userchip div, .userchip button { display: none; } }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  background: none; border: none; padding: 10px 16px; font-weight: 600; font-size: 13.5px; color: var(--ink-500);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--teal-700); border-bottom-color: var(--teal-700); }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(7,42,34,.45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  animation: pop .18s ease;
}
.modal.wide { max-width: 720px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-head .x { margin-left: auto; background: none; border: none; font-size: 20px; color: var(--ink-500); line-height: 1; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* lesson type picker (Learnyst-style) */
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 640px) { .type-grid { grid-template-columns: repeat(2, 1fr); } }
.type-card {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 10px; text-align: center;
  background: #fff; transition: all .15s;
}
.type-card:hover { border-color: var(--teal-600); background: var(--teal-50); }
.type-card.selected { border-color: var(--teal-700); background: var(--teal-50); box-shadow: 0 0 0 3px var(--teal-100); }
.type-card .t-ico { font-size: 22px; }
.type-card .t-name { font-weight: 700; font-size: 12.5px; margin-top: 6px; }
.type-card .t-desc { font-size: 10.5px; color: var(--ink-500); margin-top: 2px; line-height: 1.3; }

/* curriculum builder */
.sec-block { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 14px; overflow: hidden; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #FAFCFB; border-bottom: 1px solid var(--line); }
.sec-head .s-title { font-weight: 700; font-size: 14px; flex: 1; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: var(--teal-50); }
.lesson-ico {
  width: 32px; height: 32px; border-radius: 8px; background: var(--teal-100); color: var(--teal-700);
  display: grid; place-items: center; font-size: 14px; flex-shrink: 0;
}
.lesson-row .l-title { font-weight: 600; font-size: 13.5px; }
.lesson-row .l-meta { font-size: 11.5px; color: var(--ink-500); }
.lesson-row .l-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.lesson-row:hover .l-actions { opacity: 1; }
.add-lesson-btn {
  width: 100%; padding: 11px; border: 1.5px dashed var(--line); background: none; border-radius: 0 0 var(--radius) var(--radius);
  color: var(--teal-700); font-weight: 600; font-size: 13px;
}
.add-lesson-btn:hover { background: var(--teal-50); border-color: var(--teal-600); }

/* plan cards */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; position: relative; }
.plan-card.default { border-color: var(--teal-700); box-shadow: 0 0 0 2px var(--teal-100); }
.plan-card .p-name { font-weight: 700; }
.plan-card .p-price { font-size: 24px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -0.02em; }
.plan-card .p-detail { font-size: 12.5px; color: var(--ink-500); }
.plan-card .p-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink-900); color: #fff; padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  box-shadow: var(--shadow-lg); transition: transform .25s; z-index: 200; max-width: 90vw;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red-600); }

.empty { text-align: center; padding: 44px 20px; color: var(--ink-500); }
.empty .e-ico { font-size: 34px; margin-bottom: 8px; }
.progressbar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progressbar > div { height: 100%; background: var(--teal-600); border-radius: 999px; transition: width .3s; }
.searchbox { position: relative; }
.searchbox input { padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: 9px; width: 260px; }
.searchbox::before { content: '⌕'; position: absolute; left: 11px; top: 7px; font-size: 16px; color: var(--ink-300); }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-500); font-weight: 500; }
.kv .v { font-weight: 600; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-side {
  flex: 1; background: linear-gradient(160deg, var(--teal-800), var(--teal-900)); color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px; position: relative; overflow: hidden;
}
.auth-side::after {
  content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px;
  border-radius: 50%; background: radial-gradient(circle, rgba(18,138,107,.5), transparent 70%);
}
.auth-side h2 { font-size: 30px; line-height: 1.25; letter-spacing: -0.02em; max-width: 420px; }
.auth-side .quote { color: #9CC5B8; font-size: 14px; max-width: 400px; margin-top: 14px; }
.auth-form { width: 460px; max-width: 100%; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 350px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--ink-500); font-size: 13.5px; margin-bottom: 24px; }
@media (max-width: 800px) { .auth-side { display: none; } .auth-form { flex: 1; } }

/* ---------- student portal accents ---------- */
.course-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: var(--shadow); }
.course-card .cc-top { background: linear-gradient(135deg, var(--teal-700), var(--teal-800)); color: #fff; padding: 20px; }
.course-card .cc-top h3 { font-size: 16px; line-height: 1.35; }
.course-card .cc-body { padding: 16px 20px; }
.lock-banner {
  background: var(--amber-100); border: 1px solid #EAD9B0; color: var(--amber-600);
  padding: 12px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; margin-bottom: 16px;
}
.player { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .player { grid-template-columns: 1fr; } }
.player .lesson-list { max-height: 75vh; overflow-y: auto; }
.lesson-item { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.lesson-item:hover { background: var(--teal-50); }
.lesson-item.active { background: var(--teal-100); }
.lesson-item.locked { opacity: .45; cursor: not-allowed; }
.check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ink-300); flex-shrink: 0;
  display: grid; place-items: center; font-size: 10px; color: #fff;
}
.check.done { background: var(--green-600); border-color: var(--green-600); }
.viewer iframe, .viewer video { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 10px; background: #000; }
.article-body { line-height: 1.8; font-size: 15px; }
.article-body p { margin-bottom: 12px; }
