:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #182523;
  --ink-soft: #5f6e6b;
  --ink-faint: #87938f;
  --line: #e2e9e6;
  --primary: #176b5b;
  --primary-dark: #0e5044;
  --primary-soft: #e6f3ef;
  --primary-pale: #f0f8f5;
  --lime: #d8ee92;
  --blue: #4f75d8;
  --blue-soft: #edf2ff;
  --amber: #b7791f;
  --amber-soft: #fff5df;
  --red: #bf4b50;
  --red-soft: #fff0f0;
  --violet: #7758bd;
  --violet-soft: #f2edff;
  --shadow-sm: 0 1px 2px rgba(20, 42, 37, .04), 0 3px 12px rgba(20, 42, 37, .035);
  --shadow-md: 0 16px 40px rgba(20, 42, 37, .09);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar: 248px;
  --header: 76px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(23, 107, 91, .18);
  outline-offset: 2px;
}
::selection { background: #cce9df; color: #123b32; }
svg { display: block; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.muted { color: var(--ink-soft); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.row { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.grow { flex: 1; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 5px 14px rgba(23, 107, 91, .16); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #293c38; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-soft); border-color: #cbd8d3; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #d9ece5; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #edf1ef; color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #ffe4e4; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.btn-icon:hover { color: var(--primary); border-color: #bfd5cc; background: var(--primary-pale); }
.btn-icon.small { width: 32px; min-height: 32px; border-radius: 8px; }
.btn-link { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }
.btn-link:hover { color: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--ink-soft); width: 34px; height: 34px; border-radius: 8px; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }

.logo { display: inline-flex; align-items: center; gap: 11px; font-weight: 780; font-size: 21px; letter-spacing: -.7px; color: var(--ink); }
.logo-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(23,107,91,.18); }
.logo-mark svg { width: 23px; height: 23px; }
.logo-dot { color: var(--primary); }

.public-header { height: 80px; display: flex; align-items: center; border-bottom: 1px solid rgba(226,233,230,.8); background: rgba(255,255,255,.88); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 50; }
.public-header-inner { width: min(1180px, calc(100% - 48px)); margin: 0 auto; display: flex; align-items: center; gap: 48px; }
.public-nav { display: flex; align-items: center; gap: 30px; margin-left: auto; }
.public-nav a, .public-nav button { font-size: 13px; font-weight: 600; color: var(--ink-soft); border: 0; background: none; padding: 8px 0; }
.public-nav a:hover, .public-nav button:hover, .public-nav a.active { color: var(--primary); }
.public-auth { display: flex; align-items: center; gap: 10px; }
.public-theme-toggle { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.public-theme-toggle:hover { color: var(--primary); background: var(--primary-pale); border-color: var(--primary); }
.mobile-menu-btn { display: none; }

.public-main { overflow: hidden; }
.container { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.hero { padding: 78px 0 72px; position: relative; }
.hero:before { content: ""; position: absolute; width: 520px; height: 520px; right: -210px; top: -210px; background: radial-gradient(circle, #d9efe5 0, rgba(233,246,240,.2) 55%, transparent 72%); pointer-events: none; }
.hero-grid { display: grid; grid-template-columns: 1.03fr .97fr; gap: 70px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 750; color: var(--primary); margin-bottom: 20px; }
.eyebrow:before { content: ""; width: 24px; height: 2px; background: var(--primary); }
.hero h1 { margin: 0 0 24px; font-size: clamp(38px, 4.2vw, 61px); line-height: 1.12; letter-spacing: -2.4px; font-weight: 780; }
.hero h1 .accent { color: var(--primary); position: relative; white-space: nowrap; }
.hero h1 .accent:after { content: ""; position: absolute; height: 10px; left: 2px; right: 0; bottom: -2px; background: var(--lime); z-index: -1; border-radius: 4px; transform: rotate(-1deg); opacity: .7; }
.hero-copy { max-width: 540px; color: var(--ink-soft); font-size: 16px; line-height: 1.75; margin: 0 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-proof { margin-top: 34px; display: flex; align-items: center; gap: 14px; color: var(--ink-soft); font-size: 12px; }
.avatar-stack { display: flex; padding-left: 8px; }
.avatar-stack .avatar { margin-left: -8px; border: 3px solid var(--bg); }
.avatar { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 750; font-size: 11px; flex: 0 0 auto; overflow: hidden; }
.avatar.blue { background: var(--blue-soft); color: var(--blue); }
.avatar.amber { background: var(--amber-soft); color: var(--amber); }
.avatar.violet { background: var(--violet-soft); color: var(--violet); }
.avatar.dark { background: var(--ink); color: #fff; }

.hero-visual { position: relative; min-height: 420px; }
.hero-card { position: absolute; background: #fff; border: 1px solid rgba(220,232,226,.85); border-radius: 18px; box-shadow: var(--shadow-md); }
.hero-editor { width: 94%; right: 0; top: 34px; padding: 20px; transform: rotate(1deg); }
.window-dots { display: flex; gap: 6px; }
.window-dots i { width: 8px; height: 8px; border-radius: 50%; background: #dce5e1; }
.window-dots i:first-child { background: #e8a4a5; }
.window-dots i:nth-child(2) { background: #e8ca8a; }
.window-dots i:nth-child(3) { background: #9bcab5; }
.editor-top { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.editor-label { font-size: 11px; color: var(--ink-faint); font-weight: 650; }
.code-window { background: #183b35; color: #d6ebe3; border-radius: 12px; padding: 18px; font: 12px/1.9 ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 16px; min-height: 150px; }
.code-keyword { color: #d8ee92; }
.code-string { color: #f0c987; }
.code-number { color: #a9c5ff; }
.code-comment { color: #84a89c; }
.result-mini { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.result-mini-row { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 9px 12px; font-size: 10px; border-top: 1px solid var(--line); }
.result-mini-row:first-child { border: 0; background: #f4f7f5; color: var(--ink-faint); font-weight: 700; }
.hero-er { width: 52%; left: -20px; bottom: 8px; padding: 16px; transform: rotate(-3deg); }
.mini-er-title { font-size: 11px; font-weight: 750; margin-bottom: 12px; }
.mini-er-diagram { height: 155px; border-radius: 10px; background: #f5faf7; border: 1px dashed #c5dbd2; position: relative; overflow: hidden; }
.mini-entity { position: absolute; background: #fff; border: 1px solid #a9c9bb; border-radius: 7px; padding: 6px 9px; font-size: 8px; font-weight: 750; color: var(--primary); box-shadow: 0 3px 8px rgba(23,107,91,.08); }
.mini-entity.one { top: 18px; left: 18px; }
.mini-entity.two { top: 82px; right: 18px; }
.mini-entity.three { top: 42px; left: calc(50% - 36px); background: var(--primary); color: #fff; }
.mini-line { position: absolute; height: 2px; background: #a9c9bb; transform-origin: left center; top: 66px; left: 86px; width: 58px; transform: rotate(26deg); }
.mini-line.second { top: 116px; left: 115px; width: 60px; transform: rotate(-31deg); }
.hero-badge { position: absolute; right: -18px; bottom: 36px; background: var(--ink); color: #fff; border-radius: 14px; padding: 14px 18px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-md); font-size: 11px; }
.hero-badge strong { display: block; font-size: 15px; }
.hero-badge-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(216,238,146,.16); color: var(--lime); display: grid; place-items: center; }

.trust-strip { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.6); }
.trust-inner { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.trust-item { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.trust-item .icon { color: var(--primary); }

.section { padding: 84px 0; }
.section-soft { background: #eef3f0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.section-heading h2 { font-size: 31px; line-height: 1.25; letter-spacing: -1px; margin: 8px 0 10px; }
.section-heading p { margin: 0; color: var(--ink-soft); max-width: 560px; }
.section-kicker { color: var(--primary); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 750; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; transition: .2s ease; }
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-sm); border-color: #cfdfd8; }
.feature-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 22px; }
.feature-card:nth-child(2) .feature-icon { background: var(--blue-soft); color: var(--blue); }
.feature-card:nth-child(3) .feature-icon { background: var(--amber-soft); color: var(--amber); }
.feature-card h3 { margin: 0 0 10px; font-size: 17px; letter-spacing: -.3px; }
.feature-card p { color: var(--ink-soft); margin: 0; line-height: 1.7; font-size: 13px; }
.feature-card .btn-link { margin-top: 20px; font-size: 12px; }

.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.course-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; transition: .2s ease; display: flex; flex-direction: column; }
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: #c8d9d1; }
.course-cover { height: 150px; padding: 20px; position: relative; overflow: hidden; background: #dfeee7; }
.course-cover:before, .course-cover:after { content: ""; position: absolute; border: 1px solid rgba(23,107,91,.16); border-radius: 50%; }
.course-cover:before { width: 180px; height: 180px; right: -40px; top: -65px; }
.course-cover:after { width: 120px; height: 120px; right: -10px; top: -35px; }
.course-cover.mint { background: linear-gradient(135deg, #dcefe6, #c4e3d6); }
.course-cover.blue { background: linear-gradient(135deg, #e4ecfb, #cbdafa); }
.course-cover.amber { background: linear-gradient(135deg, #fcf0d8, #f2ddae); }
.course-cover.violet { background: linear-gradient(135deg, #eee7fb, #d9caf2); }
.course-cover-icon { position: relative; z-index: 1; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.75); display: grid; place-items: center; color: var(--primary); backdrop-filter: blur(4px); }
.course-cover.blue .course-cover-icon { color: var(--blue); }
.course-cover.amber .course-cover-icon { color: var(--amber); }
.course-cover.violet .course-cover-icon { color: var(--violet); }
.course-cover-code { position: absolute; right: 18px; bottom: 16px; color: rgba(24,37,35,.35); font: 700 28px ui-monospace, monospace; letter-spacing: -2px; }
.course-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 6px; background: #f1f4f2; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.tag-green { background: var(--primary-soft); color: var(--primary); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-violet { background: var(--violet-soft); color: var(--violet); }
.course-card h3 { font-size: 16px; line-height: 1.45; margin: 0 0 10px; letter-spacing: -.25px; }
.course-card p { color: var(--ink-soft); font-size: 12px; line-height: 1.65; margin: 0 0 18px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-meta { display: flex; align-items: center; gap: 14px; color: var(--ink-faint); font-size: 11px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.course-meta span { display: inline-flex; align-items: center; gap: 5px; }
.progress-line { height: 5px; background: #eaf0ed; border-radius: 5px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--primary); border-radius: 5px; }

.workflow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; counter-reset: steps; }
.workflow-step { position: relative; counter-increment: steps; padding-right: 18px; }
.workflow-step:not(:last-child):after { content: ""; position: absolute; right: 5px; top: 23px; width: calc(100% - 58px); height: 1px; background: #cddad4; }
.workflow-number { width: 46px; height: 46px; border-radius: 50%; border: 1px solid #bcd2c7; background: #fff; color: var(--primary); display: grid; place-items: center; font-weight: 800; margin-bottom: 18px; position: relative; z-index: 1; }
.workflow-number:before { content: "0" counter(steps); }
.workflow-step h3 { margin: 0 0 8px; font-size: 15px; }
.workflow-step p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.cta-box { background: var(--primary); border-radius: 24px; padding: 52px 56px; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 32px; position: relative; overflow: hidden; }
.cta-box:after { content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; right: -110px; top: -180px; border: 60px solid rgba(216,238,146,.08); }
.cta-box h2 { font-size: 31px; margin: 0 0 10px; letter-spacing: -.8px; position: relative; z-index: 1; }
.cta-box p { margin: 0; color: #c7dfd7; position: relative; z-index: 1; }
.cta-box .btn { background: var(--lime); color: #183b35; position: relative; z-index: 1; }
.public-footer { padding: 52px 0 24px; background: #fff; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 50px; }
.footer-about p { color: var(--ink-soft); font-size: 12px; max-width: 300px; line-height: 1.8; margin-top: 16px; }
.footer-col h4 { margin: 4px 0 16px; font-size: 12px; }
.footer-col a, .footer-col button { display: block; border: 0; background: none; padding: 5px 0; color: var(--ink-soft); font-size: 12px; }
.footer-col a:hover, .footer-col button:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 42px; padding-top: 20px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-faint); font-size: 11px; }

.app-shell { min-height: 100vh; }
.sidebar { width: var(--sidebar); background: #fff; border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column; padding: 24px 16px 16px; transition: transform .22s ease; }
.sidebar .logo { padding: 0 10px 26px; }
.sidebar-label { font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 750; color: #9aa6a1; padding: 0 12px; margin: 18px 0 9px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 0 12px; border-radius: 9px; color: var(--ink-soft); font-size: 12px; font-weight: 600; border: 0; background: transparent; width: 100%; text-align: left; }
.nav-item:hover { background: #f4f7f5; color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 750; }
.nav-item .nav-count { margin-left: auto; min-width: 21px; height: 20px; display: grid; place-items: center; border-radius: 6px; background: #edf1ef; color: var(--ink-soft); font-size: 10px; }
.nav-item.active .nav-count { background: #fff; color: var(--primary); }
.sidebar-spacer { flex: 1; }
.sidebar-promo { margin: 20px 4px 14px; padding: 17px; border-radius: 13px; background: #eff5f1; border: 1px solid #e2ece6; }
.sidebar-promo .promo-icon { width: 32px; height: 32px; border-radius: 9px; background: #fff; display: grid; place-items: center; color: var(--primary); margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.sidebar-promo strong { display: block; font-size: 12px; margin-bottom: 5px; }
.sidebar-promo p { color: var(--ink-soft); font-size: 10px; line-height: 1.6; margin: 0 0 12px; }
.sidebar-user { border-top: 1px solid var(--line); padding: 16px 8px 0; display: flex; align-items: center; gap: 10px; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { display: block; font-size: 10px; color: var(--ink-faint); margin-top: 2px; }

.app-main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { height: var(--header); background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 34px; gap: 18px; position: sticky; top: 0; z-index: 40; backdrop-filter: blur(12px); }
.topbar-search { width: min(360px, 34vw); position: relative; }
.topbar-search input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 9px; background: #f7f9f8; padding: 0 40px 0 38px; color: var(--ink); font-size: 12px; }
.topbar-search .icon { position: absolute; left: 13px; top: 12px; color: var(--ink-faint); width: 16px; height: 16px; }
.topbar-search kbd { position: absolute; right: 10px; top: 11px; font: 9px ui-monospace, monospace; color: var(--ink-faint); border: 1px solid #dce4e0; padding: 2px 4px; border-radius: 4px; background: #fff; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.role-switch { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 0 10px; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.role-switch:hover { border-color: #bdd1c8; color: var(--primary); }
.notification-wrap { position: relative; }
.notification-dot { position: absolute; width: 6px; height: 6px; background: #d75d60; border: 2px solid #fff; box-sizing: content-box; border-radius: 50%; top: 7px; right: 8px; }
.dropdown { position: absolute; top: calc(100% + 12px); right: 0; width: 310px; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-md); z-index: 80; overflow: hidden; }
.dropdown-head { padding: 15px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 750; font-size: 12px; }
.dropdown-item { padding: 13px 16px; display: flex; gap: 10px; border-bottom: 1px solid #f0f3f1; font-size: 11px; background: transparent; }
.dropdown-item:last-child { border-bottom: 0; }
.dropdown-item:hover { background: var(--surface-soft); }
.dropdown-item p { margin: 0; color: var(--ink-soft); }
.dropdown-item time { display: block; color: var(--ink-faint); margin-top: 3px; font-size: 9px; }
.profile-wrap { position: relative; }
.profile-trigger { border: 0; background: transparent; display: flex; align-items: center; gap: 9px; padding: 0 0 0 8px; }
.profile-trigger strong { font-size: 11px; font-weight: 700; }
.profile-trigger span { display: block; font-size: 9px; color: var(--ink-faint); margin-top: 1px; }
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(15,31,27,.4); z-index: 55; backdrop-filter: blur(2px); }
.mobile-sidebar-close { display: none; }

.page { padding: 32px 34px 56px; max-width: 1540px; margin: 0 auto; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin: 0 0 7px; font-size: 27px; letter-spacing: -.8px; line-height: 1.25; }
.page-header p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.page-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--ink-faint); font-size: 11px; margin-bottom: 12px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .current { color: var(--ink-soft); }
.welcome-banner { background: linear-gradient(110deg, #174f44, #23725f); color: #fff; border-radius: 18px; padding: 30px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; position: relative; overflow: hidden; margin-bottom: 26px; }
.welcome-banner:after { content: ""; position: absolute; width: 250px; height: 250px; border: 42px solid rgba(216,238,146,.07); border-radius: 50%; right: 15%; top: -140px; }
.welcome-banner .eyebrow { color: #c7e5da; margin-bottom: 9px; font-size: 9px; }
.welcome-banner .eyebrow:before { background: var(--lime); width: 18px; }
.welcome-banner h2 { margin: 0 0 8px; font-size: 23px; letter-spacing: -.6px; }
.welcome-banner p { margin: 0; color: #c5ded5; font-size: 12px; }
.welcome-banner .btn { position: relative; z-index: 1; background: var(--lime); color: #183b35; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 20px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: 0 0 auto; }
.stat-card:nth-child(2) .stat-icon { background: var(--blue-soft); color: var(--blue); }
.stat-card:nth-child(3) .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-card:nth-child(4) .stat-icon { background: var(--violet-soft); color: var(--violet); }
.stat-info { flex: 1; }
.stat-info span { display: block; color: var(--ink-soft); font-size: 10px; margin-bottom: 5px; }
.stat-info strong { font-size: 23px; letter-spacing: -.5px; line-height: 1.1; }
.stat-info small { display: block; font-size: 9px; color: var(--ink-faint); margin-top: 7px; }
.stat-info small.positive { color: var(--primary); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 22px; }
.dashboard-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid > *, .dashboard-grid.equal > *, .progress-grid > *, .course-detail-grid > *, .sql-layout > *, .studio > * { min-width: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; }
.panel-head { padding: 19px 21px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head h3 { margin: 0; font-size: 14px; letter-spacing: -.2px; }
.panel-head p { margin: 4px 0 0; color: var(--ink-faint); font-size: 10px; }
.panel-body { padding: 21px; }
.panel-body.tight { padding: 16px; }
.panel-footer { padding: 14px 21px; border-top: 1px solid var(--line); background: #fbfcfb; text-align: center; }
.activity-list { padding: 2px 20px 8px; }
.activity-item { display: flex; gap: 13px; padding: 15px 0; border-bottom: 1px solid #edf1ef; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 35px; height: 35px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.activity-item h4 { margin: 0 0 4px; font-size: 11px; }
.activity-item p { margin: 0; font-size: 10px; color: var(--ink-soft); }
.activity-item time { display: block; margin-top: 5px; font-size: 9px; color: var(--ink-faint); }
.deadline-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #edf1ef; }
.deadline-item:last-child { border-bottom: 0; }
.date-box { width: 40px; height: 43px; border-radius: 9px; background: #f4f7f5; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 0 0 auto; }
.date-box strong { font-size: 14px; line-height: 1.1; }
.date-box span { font-size: 8px; color: var(--ink-faint); text-transform: uppercase; margin-top: 3px; }
.deadline-info { flex: 1; min-width: 0; }
.deadline-info strong { font-size: 10px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deadline-info span { color: var(--ink-faint); font-size: 9px; }
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 170px; padding-top: 12px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.chart-col span { font-size: 9px; color: var(--ink-faint); }
.chart-col i { display: block; width: 100%; max-width: 30px; background: #cce3d9; border-radius: 6px 6px 2px 2px; min-height: 8px; }
.chart-col.active i { background: var(--primary); }

.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.search-field { min-width: 240px; flex: 1; max-width: 360px; position: relative; }
.search-field .icon { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--ink-faint); }
.search-field input { width: 100%; height: 39px; border: 1px solid var(--line); border-radius: 9px; padding: 0 13px 0 36px; background: #fff; color: var(--ink); font-size: 12px; }
.search-field input:focus { border-color: #aacabc; outline: 3px solid rgba(23,107,91,.08); }
.filter-select { height: 39px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink-soft); padding: 0 30px 0 12px; font-size: 11px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); height: 34px; padding: 0 12px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip:hover { border-color: #b8cec3; }
.list-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.compact-course { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 19px; display: flex; flex-direction: column; }
.compact-course-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.compact-course-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.compact-course h3 { margin: 0 0 5px; font-size: 13px; line-height: 1.45; }
.compact-course .sub { color: var(--ink-faint); font-size: 10px; }
.compact-course .course-meta { margin-bottom: 15px; }
.compact-course-actions { display: flex; gap: 7px; margin-top: 14px; }
.empty-state { padding: 54px 20px; text-align: center; color: var(--ink-soft); background: #fff; border: 1px dashed #cddbd4; border-radius: 14px; }
.empty-state .empty-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin: 0 auto 16px; }
.empty-state h3 { margin: 0 0 6px; color: var(--ink); font-size: 15px; }
.empty-state p { margin: 0; font-size: 12px; }

.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th { text-align: left; padding: 13px 18px; background: #f8faf9; color: var(--ink-faint); font-size: 9px; text-transform: uppercase; letter-spacing: .7px; font-weight: 750; border-bottom: 1px solid var(--line); }
.data-table td { padding: 15px 18px; border-bottom: 1px solid #edf1ef; font-size: 11px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdfc; }
.table-user { display: flex; align-items: center; gap: 10px; }
.table-user strong { display: block; font-size: 11px; }
.table-user span { display: block; font-size: 9px; color: var(--ink-faint); margin-top: 2px; }
.table-actions { display: flex; justify-content: flex-end; gap: 2px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 6px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.status:before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-green { background: var(--primary-soft); color: var(--primary); }
.status-amber { background: var(--amber-soft); color: var(--amber); }
.status-red { background: var(--red-soft); color: var(--red); }
.status-blue { background: var(--blue-soft); color: var(--blue); }
.status-gray { background: #eef2f0; color: var(--ink-soft); }
.status-violet { background: var(--violet-soft); color: var(--violet); }
.tabs { display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 0 0 13px; color: var(--ink-soft); font-size: 12px; font-weight: 650; white-space: nowrap; position: relative; }
.tab.active { color: var(--primary); }
.tab.active:after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--primary); }
.tab-count { margin-left: 4px; font-size: 9px; background: #eef2f0; padding: 2px 5px; border-radius: 4px; }

.assignment-list { display: flex; flex-direction: column; gap: 12px; }
.assignment-item { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 18px 20px; display: flex; align-items: center; gap: 17px; }
.assignment-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: 0 0 auto; }
.assignment-item:nth-child(3n+2) .assignment-icon { background: var(--amber-soft); color: var(--amber); }
.assignment-item:nth-child(3n+3) .assignment-icon { background: var(--primary-soft); color: var(--primary); }
.assignment-content { flex: 1; min-width: 0; }
.assignment-content h3 { font-size: 12px; margin: 0 0 5px; }
.assignment-content p { margin: 0; color: var(--ink-faint); font-size: 10px; display: flex; flex-wrap: wrap; gap: 12px; }
.assignment-content p span { display: inline-flex; align-items: center; gap: 4px; }
.assignment-actions { display: flex; align-items: center; gap: 9px; }
.progress-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 22px; }
.progress-course { padding: 18px 0; border-bottom: 1px solid #edf1ef; }
.progress-course:last-child { border-bottom: 0; }
.progress-course-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.progress-course-head strong { font-size: 11px; }
.progress-course-head span { font-size: 10px; color: var(--ink-soft); }
.skill-row { display: grid; grid-template-columns: 100px 1fr 32px; gap: 12px; align-items: center; margin: 16px 0; font-size: 10px; }
.skill-row .progress-line { height: 6px; }
.skill-row span:last-child { color: var(--ink-soft); text-align: right; }
.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { width: 118px; height: 118px; border-radius: 50%; background: conic-gradient(var(--primary) 0 76%, #e8efeb 76% 100%); display: grid; place-items: center; flex: 0 0 auto; }
.donut:before { content: ""; width: 88px; height: 88px; background: #fff; border-radius: 50%; }
.donut-label { position: absolute; text-align: center; }
.donut-label strong { display: block; font-size: 22px; }
.donut-label span { font-size: 9px; color: var(--ink-faint); }

.course-detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 22px; }
.detail-cover { min-height: 240px; border-radius: 16px; padding: 32px; color: #153c32; background: linear-gradient(125deg, #dcefe6, #b9dfcd); position: relative; overflow: hidden; margin-bottom: 20px; }
.detail-cover:after { content: "{ }"; position: absolute; right: 30px; bottom: -15px; font: 800 120px ui-monospace, monospace; color: rgba(23,107,91,.09); }
.detail-cover h2 { margin: 18px 0 12px; font-size: 28px; max-width: 560px; line-height: 1.3; letter-spacing: -.8px; position: relative; z-index: 1; }
.detail-cover p { max-width: 510px; margin: 0; color: #40685c; font-size: 12px; position: relative; z-index: 1; }
.lesson-row { display: flex; align-items: center; gap: 13px; padding: 15px 0; border-bottom: 1px solid #edf1ef; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-status { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-faint); flex: 0 0 auto; }
.lesson-status.done { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.lesson-status.current { border-color: var(--primary); color: var(--primary); }
.lesson-info { flex: 1; }
.lesson-info strong { display: block; font-size: 11px; }
.lesson-info span { color: var(--ink-faint); font-size: 9px; }
.info-list { display: flex; flex-direction: column; gap: 16px; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 11px; }
.info-row span { color: var(--ink-soft); }
.info-row strong { font-weight: 650; }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
.studio-toolbar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.tool-divider { width: 1px; height: 24px; background: var(--line); margin: 0 5px; }
.er-canvas-wrap { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-height: 520px; }
.er-canvas { width: 100%; height: 520px; background-color: #f9fbfa; background-image: radial-gradient(#d8e2dd 1px, transparent 1px); background-size: 20px 20px; touch-action: none; }
.er-entity { cursor: grab; }
.er-entity:active { cursor: grabbing; }
.er-entity rect { fill: #fff; stroke: #a8c8ba; stroke-width: 1.5; filter: drop-shadow(0 5px 7px rgba(23,107,91,.08)); }
.er-entity.selected rect { stroke: var(--primary); stroke-width: 2.5; }
.er-entity .entity-head { fill: #e8f4ee; }
.er-entity.selected .entity-head { fill: #d7ece3; }
.er-entity text { fill: var(--ink); font-size: 11px; font-weight: 650; pointer-events: none; }
.er-entity .entity-sub { fill: var(--ink-faint); font-size: 8px; font-weight: 500; }
.er-entity .key-label { fill: var(--amber); }
.er-line { stroke: #91b2a3; stroke-width: 1.6; fill: none; }
.er-canvas-hint { position: absolute; left: 16px; bottom: 14px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: var(--ink-faint); font-size: 9px; pointer-events: none; }
.studio-side { display: flex; flex-direction: column; gap: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 650; color: var(--ink-soft); }
.form-group input, .form-group select, .form-group textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: #fff; color: var(--ink); font-size: 12px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #9fc2b3; outline: 3px solid rgba(23,107,91,.08); }
.form-group textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { margin: 5px 0 0; font-size: 9px; color: var(--ink-faint); }
.attribute-row { display: flex; align-items: center; gap: 7px; padding: 9px 0; border-bottom: 1px solid #edf1ef; font-size: 10px; }
.attribute-row:last-child { border-bottom: 0; }
.attribute-key { color: var(--amber); width: 14px; }
.attribute-row strong { flex: 1; }
.validation-box { padding: 13px; border-radius: 9px; background: var(--primary-pale); border: 1px solid #dbece4; }
.validation-box.success { background: #edf8f2; border-color: #c6e6d7; }
.validation-box.warning { background: var(--amber-soft); border-color: #f0ddb5; }
.validation-box h4 { margin: 0 0 7px; font-size: 11px; display: flex; align-items: center; gap: 7px; }
.validation-box p { margin: 0; font-size: 10px; color: var(--ink-soft); line-height: 1.6; }

.sql-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .85fr); gap: 18px; }
.sql-editor { background: #17372f; border-radius: 13px; overflow: hidden; border: 1px solid #24473e; }
.sql-editor-bar { height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid rgba(255,255,255,.08); color: #a9c8bc; font-size: 10px; }
.sql-editor textarea { display: block; width: 100%; min-height: 220px; resize: vertical; border: 0; outline: 0; background: transparent; color: #e6f2ed; padding: 20px; font: 12px/1.85 ui-monospace, SFMono-Regular, Menlo, monospace; caret-color: var(--lime); }
.sql-actions { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-top: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.08); }
.sql-actions .btn-secondary { background: transparent; color: #bfd7ce; border-color: rgba(255,255,255,.13); }
.sql-actions .btn-secondary:hover { background: rgba(255,255,255,.06); }
.sql-output { margin-top: 16px; }
.output-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.output-head strong { font-size: 11px; }
.output-head span { font-size: 9px; color: var(--ink-faint); }
.sql-result { overflow-x: auto; }
.sql-result table { border-collapse: collapse; width: 100%; min-width: 520px; }
.sql-result th { padding: 10px 14px; text-align: left; background: #f4f8f5; color: var(--ink-faint); font-size: 9px; border-bottom: 1px solid var(--line); }
.sql-result td { padding: 10px 14px; border-bottom: 1px solid #edf1ef; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sql-error { padding: 18px; color: var(--red); font: 11px/1.7 ui-monospace, monospace; }
.schema-table { border-bottom: 1px solid var(--line); }
.schema-table:last-child { border-bottom: 0; }
.schema-table-head { display: flex; align-items: center; gap: 7px; padding: 12px 14px; font-size: 10px; font-weight: 750; color: var(--primary); }
.schema-fields { padding: 0 14px 12px; }
.schema-field { display: flex; justify-content: space-between; gap: 10px; font: 9px ui-monospace, monospace; color: var(--ink-soft); padding: 3px 0; }
.schema-field span:last-child { color: var(--ink-faint); }
.saved-query { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.saved-query:last-child { border-bottom: 0; }
.saved-query strong { display: block; font-size: 10px; margin-bottom: 5px; }
.saved-query code { display: block; color: var(--ink-soft); font: 9px/1.6 ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings-list { padding: 2px 21px; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 18px 0; border-bottom: 1px solid #edf1ef; }
.setting-row:last-child { border-bottom: 0; }
.setting-info { flex: 1; }
.setting-info strong { display: block; font-size: 11px; }
.setting-info p { margin: 4px 0 0; color: var(--ink-faint); font-size: 10px; }
.toggle { width: 38px; height: 22px; border: 0; background: #dbe3df; border-radius: 20px; padding: 2px; transition: .2s ease; }
.toggle:before { content: ""; display: block; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: .2s ease; }
.toggle.active { background: var(--primary); }
.toggle.active:before { transform: translateX(16px); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(13,30,26,.46); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .15s ease; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: #fff; border-radius: 17px; box-shadow: 0 24px 70px rgba(13,30,26,.25); animation: modalIn .2s ease; }
.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 20px 23px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal-head h3 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.modal-body { padding: 23px; }
.modal-footer { padding: 16px 23px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; background: #fbfcfb; }
.modal-close { width: 32px; height: 32px; border: 0; border-radius: 8px; background: #f1f4f2; color: var(--ink-soft); display: grid; place-items: center; }
.modal-close:hover { background: #e6ece8; color: var(--ink); }
.role-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.role-option { text-align: left; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 17px; transition: .18s ease; }
.role-option:hover { border-color: #aacbbb; background: var(--primary-pale); transform: translateY(-2px); }
.role-option-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 12px; }
.role-option strong { display: block; font-size: 12px; margin-bottom: 4px; }
.role-option span { display: block; font-size: 10px; color: var(--ink-soft); line-height: 1.5; }
.detail-list { display: flex; flex-direction: column; gap: 16px; }
.detail-list-row { display: grid; grid-template-columns: 120px 1fr; gap: 14px; font-size: 12px; }
.detail-list-row span { color: var(--ink-faint); }
.detail-list-row strong { font-weight: 600; }
.submission-box { background: #f6f9f7; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 16px 0; }
.submission-box pre { margin: 0; white-space: pre-wrap; font: 10px/1.7 ui-monospace, monospace; color: var(--ink-soft); }
.grade-preview { display: flex; align-items: center; justify-content: space-between; padding: 13px; background: var(--primary-pale); border-radius: 9px; margin: 14px 0; font-size: 11px; }
.score-input { font-size: 20px !important; font-weight: 750; text-align: center; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast { min-width: 270px; max-width: 380px; background: var(--ink); color: #fff; border-radius: 11px; padding: 13px 16px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; font-size: 11px; animation: toastIn .25s ease; }
.toast.success .toast-icon { color: var(--lime); }
.toast.error .toast-icon { color: #ffb4b6; }
.toast.removing { opacity: 0; transform: translateY(8px); transition: .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

html[data-theme="dark"] {
  --bg: #0f1715;
  --surface: #17221f;
  --surface-soft: #1c2925;
  --ink: #edf5f1;
  --ink-soft: #a7b8b1;
  --ink-faint: #80948b;
  --line: #2c3c36;
  --primary: #54c5a8;
  --primary-dark: #77d8bd;
  --primary-soft: #213e34;
  --primary-pale: #1a3029;
  --lime: #d8ee92;
  --blue: #91adff;
  --blue-soft: #222f4c;
  --amber: #e0b966;
  --amber-soft: #3b3020;
  --red: #ef8589;
  --red-soft: #41252a;
  --violet: #b69aee;
  --violet-soft: #302641;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.16), 0 3px 12px rgba(0,0,0,.13);
  --shadow-md: 0 16px 40px rgba(0,0,0,.35);
}
html[data-theme="dark"] ::selection { background: #2e6554; color: #f2fff9; }
html[data-theme="dark"] .btn-primary { color: #081712; }
html[data-theme="dark"] .btn-dark { background: #e2eee9; color: #14201c; }
html[data-theme="dark"] .btn-dark:hover { background: #f3f9f6; }
html[data-theme="dark"] .btn-secondary:hover { border-color: #3d554b; }
html[data-theme="dark"] .btn-soft:hover { background: #2a4c40; }
html[data-theme="dark"] .btn-ghost:hover { background: var(--surface-soft); }
html[data-theme="dark"] .btn-danger:hover { background: #522e34; }
html[data-theme="dark"] .btn-icon:hover { border-color: #3d6657; }
html[data-theme="dark"] .public-header { border-color: var(--line); background: rgba(15,23,21,.9); }
html[data-theme="dark"] .hero:before { background: radial-gradient(circle, #244a3d 0, rgba(36,74,61,.15) 55%, transparent 72%); }
html[data-theme="dark"] .hero-card { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .result-mini-row:first-child { background: var(--surface-soft); }
html[data-theme="dark"] .mini-er-diagram { background: #14251e; border-color: #335446; }
html[data-theme="dark"] .mini-entity { background: var(--surface); border-color: #49745f; }
html[data-theme="dark"] .hero-badge { background: #07100d; }
html[data-theme="dark"] .trust-strip { background: rgba(23,34,31,.6); }
html[data-theme="dark"] .section-soft { background: #131f1b; }
html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .course-card,
html[data-theme="dark"] .public-footer,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .compact-course,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .assignment-item,
html[data-theme="dark"] .studio-toolbar,
html[data-theme="dark"] .er-canvas-wrap,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .role-option { background: var(--surface); }
html[data-theme="dark"] .course-cover { background: #25483b; }
html[data-theme="dark"] .course-cover.mint { background: linear-gradient(135deg, #234b3b, #193b30); }
html[data-theme="dark"] .course-cover.blue { background: linear-gradient(135deg, #26395d, #1d2d4c); }
html[data-theme="dark"] .course-cover.amber { background: linear-gradient(135deg, #4a3a24, #3b2e1c); }
html[data-theme="dark"] .course-cover.violet { background: linear-gradient(135deg, #3c2e53, #2e2441); }
html[data-theme="dark"] .course-cover-icon { background: rgba(23,34,31,.65); }
html[data-theme="dark"] .course-cover-code { color: rgba(237,245,241,.28); }
html[data-theme="dark"] .tag,
html[data-theme="dark"] .progress-line,
html[data-theme="dark"] .status-gray,
html[data-theme="dark"] .tab-count { background: var(--surface-soft); }
html[data-theme="dark"] .workflow-number { background: var(--surface); border-color: #3d5c4e; }
html[data-theme="dark"] .workflow-step:not(:last-child):after { background: #355045; }
html[data-theme="dark"] .sidebar-label { color: var(--ink-faint); }
html[data-theme="dark"] .nav-item:hover { background: var(--surface-soft); }
html[data-theme="dark"] .nav-item .nav-count { background: var(--surface-soft); }
html[data-theme="dark"] .nav-item.active .nav-count { background: #153027; }
html[data-theme="dark"] .sidebar-promo { background: #1b3027; border-color: #2b4438; }
html[data-theme="dark"] .sidebar-promo .promo-icon { background: var(--surface); }
html[data-theme="dark"] .topbar { background: rgba(15,23,21,.92); }
html[data-theme="dark"] .topbar-search input,
html[data-theme="dark"] .role-switch,
html[data-theme="dark"] .search-field input,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea { background: var(--surface-soft); }
html[data-theme="dark"] .topbar-search kbd { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .notification-dot { border-color: #0f1715; }
html[data-theme="dark"] .dropdown { background: var(--surface); }
html[data-theme="dark"] .panel-footer,
html[data-theme="dark"] .data-table th,
html[data-theme="dark"] .sql-result th { background: var(--surface-soft); }
html[data-theme="dark"] .date-box { background: var(--surface-soft); }
html[data-theme="dark"] .chart-col i { background: #315a49; }
html[data-theme="dark"] .data-table tbody tr:hover { background: #1b2924; }
html[data-theme="dark"] .donut { background: conic-gradient(var(--primary) 0 76%, #2a3a33 76% 100%); }
html[data-theme="dark"] .donut:before { background: var(--surface); }
html[data-theme="dark"] .detail-cover { color: #e7f4ed; background: linear-gradient(125deg, #214b3d, #17382e); }
html[data-theme="dark"] .detail-cover p { color: #b8d2c6; }
html[data-theme="dark"] .er-canvas { background-color: #131f1b; background-image: radial-gradient(#34473e 1px, transparent 1px); }
html[data-theme="dark"] .er-entity rect { fill: var(--surface); stroke: #4c7663; }
html[data-theme="dark"] .er-entity .entity-head { fill: #244437; }
html[data-theme="dark"] .er-entity.selected .entity-head { fill: #2d5948; }
html[data-theme="dark"] .er-line { stroke: #60917c; }
html[data-theme="dark"] .er-canvas-hint { background: rgba(23,34,31,.94); }
html[data-theme="dark"] .validation-box { border-color: #315442; }
html[data-theme="dark"] .validation-box.success { background: #1b382b; border-color: #315e47; }
html[data-theme="dark"] .validation-box.warning { border-color: #5b4828; }
html[data-theme="dark"] .modal-footer { background: var(--surface-soft); }
html[data-theme="dark"] .modal-close { background: var(--surface-soft); }
html[data-theme="dark"] .modal-close:hover { background: #2c3c36; }
html[data-theme="dark"] .submission-box { background: var(--surface-soft); }
html[data-theme="dark"] .toast { background: #07100d; color: #eef8f3; }
html[data-theme="dark"] .avatar.dark { background: #0b120f; color: #eef8f3; }
html[data-theme="dark"] .public-nav { background: var(--surface); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--ink-faint); opacity: .8; }

@media (max-width: 1180px) {
  .hero-grid { gap: 36px; }
  .hero h1 { font-size: 48px; }
  .hero-visual { min-height: 380px; }
  .hero-editor { top: 18px; }
  .hero-er { width: 58%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .list-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); }
  .studio { grid-template-columns: minmax(0, 1fr) 250px; }
  .sql-layout { grid-template-columns: minmax(0, 1.4fr) 260px; }
}

@media (max-width: 960px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 250px; transform: translateX(-100%); box-shadow: var(--shadow-md); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .mobile-overlay { display: block; }
  .mobile-sidebar-close { display: grid; position: absolute; right: 14px; top: 22px; }
  .app-main { margin-left: 0; }
  .mobile-menu-btn { display: inline-flex; }
  .topbar { padding: 0 24px; }
  .page { padding: 28px 24px 48px; }
  .hero { padding-top: 54px; }
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-copy { max-width: 650px; }
  .hero-visual { width: min(620px, 100%); margin: 0 auto; min-height: 430px; }
  .hero-editor { width: 88%; }
  .hero-er { width: 50%; left: 0; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .feature-card { padding: 22px; }
  .course-grid { grid-template-columns: repeat(2, 1fr); }
  .workflow { grid-template-columns: repeat(2, 1fr); gap: 34px; }
  .workflow-step:after { display: none; }
  .dashboard-grid, .dashboard-grid.equal, .progress-grid, .course-detail-grid, .sql-layout { grid-template-columns: 1fr; }
  .studio { grid-template-columns: 1fr; }
  .studio-side { display: grid; grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
  .footer-col:last-child { display: none; }
  .public-header-inner { gap: 26px; }
  .public-nav { gap: 18px; }
  .public-auth .btn-secondary { display: none; }
  .public-theme-toggle { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .public-theme-toggle span { display: none; }
}

@media (max-width: 720px) {
  .public-header { height: 68px; }
  .public-header-inner { width: calc(100% - 32px); gap: 10px; }
  .public-nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 16px; flex-direction: column; align-items: stretch; gap: 4px; box-shadow: var(--shadow-sm); }
  body.mobile-menu-open .public-nav { display: flex; }
  .public-nav a, .public-nav button { padding: 11px 8px; text-align: left; }
  .public-auth { margin-left: auto; }
  .public-auth .btn-secondary { display: none; }
  .public-auth .btn { min-height: 36px; padding: 0 10px; font-size: 10px; }
  .public-auth .btn .icon { display: none; }
  .mobile-menu-btn { display: inline-flex; order: -1; }
  .container { width: calc(100% - 32px); }
  .hero { padding: 46px 0 50px; }
  .hero h1 { font-size: 38px; letter-spacing: -1.5px; }
  .hero-copy { font-size: 14px; }
  .hero-proof { flex-wrap: wrap; }
  .hero-visual { min-height: 340px; }
  .hero-editor { padding: 14px; top: 10px; width: 94%; }
  .code-window { padding: 14px; min-height: 135px; font-size: 10px; }
  .hero-er { width: 58%; padding: 11px; left: -4px; bottom: 0; }
  .mini-er-diagram { height: 115px; }
  .mini-entity { font-size: 6px; padding: 4px 6px; }
  .mini-entity.two { top: 65px; }
  .mini-line { top: 51px; left: 62px; width: 40px; }
  .mini-line.second { top: 84px; left: 87px; width: 40px; }
  .hero-badge { right: 0; bottom: 5px; padding: 10px 12px; font-size: 9px; }
  .hero-badge strong { font-size: 12px; }
  .trust-inner { display: grid; grid-template-columns: repeat(2, 1fr); padding: 20px 0; gap: 16px; }
  .trust-item { font-size: 10px; }
  .section { padding: 58px 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .section-heading h2 { font-size: 26px; }
  .feature-grid, .course-grid, .list-grid { grid-template-columns: 1fr; }
  .feature-card { padding: 24px; }
  .workflow { grid-template-columns: 1fr; gap: 26px; }
  .workflow-step { padding-left: 62px; }
  .workflow-number { position: absolute; left: 0; top: 0; }
  .cta-box { padding: 34px 26px; flex-direction: column; align-items: flex-start; }
  .cta-box h2 { font-size: 25px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-about { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar { height: 64px; padding: 0 16px; gap: 10px; }
  .topbar-search { display: none; }
  .profile-trigger > div:not(.avatar) { display: none; }
  .role-switch { max-width: 112px; }
  .page { padding: 23px 16px 42px; }
  .page-header { flex-direction: column; gap: 16px; margin-bottom: 22px; }
  .page-header h1 { font-size: 23px; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; }
  .welcome-banner { padding: 24px; flex-direction: column; align-items: flex-start; }
  .welcome-banner h2 { font-size: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 15px; gap: 10px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-info strong { font-size: 19px; }
  .stat-info span { font-size: 9px; }
  .stat-info small { font-size: 8px; }
  .dashboard-grid { gap: 16px; }
  .panel-head { padding: 16px; }
  .panel-body { padding: 16px; }
  .filter-bar { gap: 8px; }
  .search-field { min-width: 100%; max-width: none; }
  .chips { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
  .chip { flex: 0 0 auto; }
  .assignment-item { align-items: flex-start; flex-wrap: wrap; padding: 16px; gap: 12px; }
  .assignment-content { min-width: calc(100% - 60px); }
  .assignment-actions { width: 100%; justify-content: flex-end; }
  .studio-side { grid-template-columns: 1fr; }
  .er-canvas, .er-canvas-wrap { min-height: 390px; height: 390px; }
  .studio-toolbar { gap: 4px; }
  .studio-toolbar .btn { padding: 0 10px; }
  .sql-editor textarea { min-height: 180px; font-size: 11px; }
  .sql-actions { flex-wrap: wrap; }
  .sql-actions select { margin-left: 0 !important; width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .role-options { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 12px; }
  .modal { max-height: calc(100vh - 24px); }
  .modal-head, .modal-body, .modal-footer { padding: 18px; }
  .detail-list-row { grid-template-columns: 1fr; gap: 3px; }
  .dropdown { position: fixed; right: 12px; top: 58px; width: calc(100% - 24px); }
  .toast-region { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .logo { font-size: 18px; }
  .logo-mark { width: 34px; height: 34px; }
  .public-header .logo > span:last-child { display: none; }
  .hero h1 { font-size: 33px; }
  .hero-actions .btn { width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { align-items: center; }
  .stat-info { display: grid; grid-template-columns: 1fr auto; width: 100%; align-items: center; }
  .stat-info span { margin: 0; }
  .stat-info small { grid-column: 1 / -1; }
  .topbar-actions { gap: 4px; }
  .role-switch { max-width: 94px; font-size: 10px; padding: 0 6px; }
  .profile-trigger { padding-left: 2px; }
}

@media (max-width: 360px) {
  .public-header .logo > span:last-child { display: none; }
}
