:root {
  --primary: #0F4C3A;
  --primary-light: #166b52;
  --primary-dark: #0a3327;
  --accent: #D4943A;
  --accent-light: #f4ba6d;
  --bg-main: #F7F5F0;
  --bg-card: #FFFFFF;
  --border-color: #E2DDD5;
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --success: #10B981;
  --success-bg: #ECFDF5;
  --error: #EF4444;
  --error-bg: #FEF2F2;
  --warning: #F59E0B;
  --editor-bg: #0D231C;
  --sidebar-w: 330px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Kalpurush', 'Nirmala UI', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10;
  min-height: 54px;
  gap: 12px;
}

/* Tabular Numbers for Data Integrity (Vercel Guidelines) */
.progress-widget,
.q-badge,
.q-item-tag,
.version-tag,
.stat-num,
.preview-row-count,
#preview-row-count,
#exec-time,
.table-preview-content td,
.table-preview-content th,
.results-table td,
.results-table th,
.schema-tag {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Accessible Focus Outlines (Impeccable & WCAG) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mobile Sidebar Toggle Button */
.btn-sidebar-toggle {
  display: none;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-sidebar-toggle:hover {
  background: var(--accent);
  color: var(--primary-dark);
  border-color: var(--accent);
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 52, 39, 0.65);
  backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.brand-logo {
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand-subtitle {
  display: none;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Prominent Creator Branding in Open Space */
.header-center-branding {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.24);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(212, 148, 58, 0.45);
  flex-shrink: 0;
}

.creator-label-text {
  font-size: 11px;
  color: #B5D2C8;
  font-weight: 600;
}

.creator-badge-center {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #FBD58E;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 11px;
  text-decoration: none;
  border: 1px solid rgba(212, 148, 58, 0.6);
  transition: all 0.2s ease;
}

.creator-badge-center:hover {
  background: #D4943A;
  color: #0F4C3A;
  border-color: #D4943A;
  transform: translateY(-1px);
}

.creator-badge-center .linkedin-icon {
  fill: #0077b5;
  background: #fff;
  border-radius: 2px;
  padding: 1px;
}

.creator-badge-center:hover .linkedin-icon {
  fill: #0F4C3A;
  background: transparent;
}

.progress-widget {
  background: rgba(255,255,255,0.12);
  padding: 3px 8px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  flex-shrink: 0;
}

.progress-bar-bg {
  width: 75px;
  height: 6px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.btn-header {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
  transition: all 0.2s;
}

.btn-header:hover {
  background: rgba(255,255,255,0.25);
  border-color: #fff;
}

/* Layout Container */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: #f1ede4;
}

.tab-btn {
  flex: 1;
  padding: 12px 10px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--primary);
  background: var(--bg-card);
  border-bottom: 2px solid var(--primary);
}

.sidebar-search {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 13px;
  outline: none;
  background: #FAF8F5;
}

.sidebar-search input:focus {
  border-color: var(--primary);
  background: #fff;
}

.question-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.mod-group {
  margin-bottom: 4px;
}

.mod-header {
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  background: #f5f8f6;
  border-top: 1px solid #edf3f0;
  border-bottom: 1px solid #edf3f0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mod-header:hover {
  background: #eaf1ed;
}

.mod-count {
  font-size: 11px;
  background: rgba(15, 76, 58, 0.1);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 10px;
}

.q-item {
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--text-main);
  border-bottom: 1px solid #f3f0e9;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background 0.15s;
}

.q-item:hover {
  background: #f9fbf9;
}

.q-item.active {
  background: #E8F0EC;
  border-left: 4px solid var(--primary);
  font-weight: 600;
  color: var(--primary);
}

.q-status-icon {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 2px;
}

.q-item.solved .q-status-icon {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.q-item-info {
  flex: 1;
}

.q-item-tag {
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 2px;
}

.q-item-title {
  font-size: 12px;
  line-height: 1.4;
}

/* Workspace Main Area */
.app-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-main);
}

/* Question Banner */
.workspace-q-banner {
  background: var(--bg-card);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  flex-shrink: 0;
}

.q-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.q-badge {
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
}

.q-module-badge {
  font-size: 11.5px;
  color: var(--text-muted);
}

.q-banner-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 5px;
  white-space: pre-line;
}

.q-scenario-box {
  background: #fbf8f2;
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  font-size: 12px;
  color: #63471c;
  margin-bottom: 6px;
  border-radius: 0 4px 4px 0;
}

.q-schema-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.schema-tag-label {
  font-size: 11px;
  color: var(--text-muted);
}

.schema-tag {
  background: #E8F0EC;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #d2e4da;
  transition: all 0.15s;
}

.schema-tag:hover {
  background: var(--primary);
  color: #fff;
}

/* Question Banner Footer & Hint Components */
.q-banner-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.btn-hint-toggle {
  background: #fdf7eb;
  color: #8c5d15;
  border: 1px solid #f3d79f;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-hint-toggle:hover {
  background: #fbeacf;
  border-color: var(--accent);
  color: #5d3a04;
}

.btn-hint-toggle.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.q-hint-box {
  background: #fcf8ee;
  border: 1px solid #edd99c;
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #5c3c0b;
  margin: 6px 0;
  animation: fadeIn 0.2s ease;
}

.q-hint-header {
  font-weight: 700;
  color: #8c5d15;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
}

.q-hint-content {
  font-size: 11.5px;
  color: #4a320c;
}

/* Workspace Panels */
.workspace-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Split Row: Editor (Left) & Live Table Preview (Right) */
.workspace-top-row {
  display: flex;
  height: 52%;
  min-height: 220px;
  border-bottom: 2px solid #234138;
  overflow: hidden;
}

/* Left: Editor Section */
.editor-section {
  flex: 1.15;
  min-width: 0;
  background: var(--editor-bg);
  display: flex;
  flex-direction: column;
  border-right: 2px solid #234138;
}

.editor-toolbar {
  background: #091a14;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #16362a;
  height: 42px;
  flex-shrink: 0;
}

.editor-title {
  color: #88BBA9;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.btn-editor {
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-run {
  background: #10B981;
  color: #fff;
}

.btn-run:hover {
  background: #059669;
}

.btn-check {
  background: var(--accent);
  color: #fff;
}

.btn-check:hover {
  background: #b57a27;
}

.btn-clear {
  background: #1a4234;
  color: #A3C9BC;
}

.btn-clear:hover {
  background: #255845;
  color: #fff;
}

.sql-editor-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.sql-textarea {
  width: 100%;
  height: 100%;
  background: var(--editor-bg);
  color: #E6F4EE;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 10px 14px;
  border: none;
  outline: none;
  resize: none;
  tab-size: 2;
}

/* Right: Table Preview Section */
.table-preview-section {
  flex: 1;
  min-width: 0;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-preview-toolbar {
  background: #091a14;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #16362a;
  height: 42px;
  flex-shrink: 0;
}

.table-tabs-container {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  max-width: 75%;
}

.table-tabs-container::-webkit-scrollbar {
  height: 3px;
}

.table-tabs-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
}

.tbl-tab {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  background: #16362a;
  color: #a3c9bc;
  transition: all 0.15s;
  white-space: nowrap;
}

.tbl-tab:hover {
  background: #204c3c;
  color: #fff;
}

.tbl-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.tbl-tab.relevant {
  border-color: #D4943A;
  color: #FBD58E;
  background: rgba(212, 148, 58, 0.18);
}

.tbl-tab.relevant:hover {
  background: rgba(212, 148, 58, 0.35);
  color: #fff;
}

.tbl-tab.relevant.active {
  background: #D4943A;
  color: #0F4C3A;
  border-color: #D4943A;
  font-weight: 800;
}

.btn-view-full {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-view-full:hover {
  background: rgba(255,255,255,0.25);
  border-color: #fff;
}

.table-preview-meta {
  padding: 4px 12px;
  font-size: 11px;
  background: #EDE8DE;
  color: #4B5563;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.table-preview-content {
  flex: 1;
  overflow: auto;
  padding: 8px 10px;
  background: #fff;
}

/* Compact Preview Table */
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.preview-table th {
  background: #135240;
  color: #fff;
  padding: 5px 8px;
  font-weight: 600;
  border: 1px solid #0f4435;
  position: sticky;
  top: 0;
  font-size: 11px;
  white-space: nowrap;
}

.preview-table td {
  padding: 4px 8px;
  border: 1px solid #E5E7EB;
  color: var(--text-main);
  white-space: nowrap;
}

.preview-table tr:nth-child(even) {
  background: #FAF9F6;
}

.preview-table tr:hover {
  background: #F3F4F6;
}

/* Bottom Output Section */
.output-section {
  flex: 1;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.output-header {
  padding: 6px 16px;
  background: #F1EDE4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.output-tabs {
  display: flex;
  gap: 6px;
}

.output-tab {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
}

.output-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.output-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Result Feedback Banner */
.feedback-banner {
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.feedback-banner.correct {
  display: flex;
  background: var(--success-bg);
  color: #065F46;
  border-bottom: 1px solid #A7F3D0;
}

.feedback-banner.incorrect {
  display: flex;
  background: var(--error-bg);
  color: #991B1B;
  border-bottom: 1px solid #FECACA;
}

.feedback-banner.info {
  display: flex;
  background: #EFF6FF;
  color: #1E40AF;
  border-bottom: 1px solid #BFDBFE;
}

/* Output Table Display */
.output-content {
  flex: 1;
  overflow: auto;
  padding: 10px 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.data-table th {
  background: var(--primary);
  color: #fff;
  padding: 7px 10px;
  font-weight: 600;
  border: 1px solid #1a624d;
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 6px 10px;
  border: 1px solid #E5E7EB;
  color: var(--text-main);
}

.data-table tr:nth-child(even) {
  background: #FAF9F6;
}

.data-table tr:hover {
  background: #F3F4F6;
}

.table-empty-msg {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.error-box {
  background: #FEF2F2;
  border-left: 4px solid var(--error);
  padding: 10px 14px;
  color: #991B1B;
  font-family: monospace;
  font-size: 12.5px;
  border-radius: 0 4px 4px 0;
  white-space: pre-wrap;
}

/* Schema Modal Drawer */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.45);
  display: none;
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-drawer {
  position: fixed;
  right: 0;
  top: 0;
  width: 440px;
  height: 100%;
  background: var(--bg-card);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
}

.drawer-header {
  padding: 14px 18px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.drawer-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}

.table-schema-card {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}

.table-schema-name {
  background: #E8F0EC;
  color: var(--primary);
  padding: 7px 10px;
  font-weight: 700;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-preview-tbl {
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.col-list {
  padding: 6px 10px;
  font-size: 11.5px;
}

.col-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px dashed #eee;
}

.col-item:last-child {
  border-bottom: none;
}

.col-name {
  font-family: monospace;
  color: #111;
  font-weight: 600;
}

.col-type {
  color: var(--text-muted);
}

/* Full Table Dialog Modal */
.full-table-dialog {
  width: 90%;
  max-width: 1050px;
  max-height: 85vh;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.full-table-header {
  padding: 12px 18px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--accent);
}

.full-table-body {
  flex: 1;
  overflow: auto;
  padding: 14px 18px;
}

.full-table-body .data-table {
  width: 100%;
  border-collapse: collapse;
}

.full-table-body th {
  position: sticky;
  top: 0;
  background: var(--primary);
  color: #fff;
  z-index: 2;
  box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
}

/* Authentication Header & Badges */
.auth-header-wrapper {
  display: flex;
  align-items: center;
}

.btn-login {
  background: #D4943A !important;
  color: #111827 !important;
  font-weight: 700 !important;
  border-color: #D4943A !important;
}

.btn-login:hover {
  background: #e6a74b !important;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-info {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: #ef4444;
  color: #fff;
}

/* Authentication Modal Dialog */
.auth-dialog {
  width: 90%;
  max-width: 440px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.auth-header {
  background: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-bottom: 2px solid var(--accent);
}

.auth-tabs {
  display: flex;
  gap: 4px;
}

.auth-tab-btn {
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: #a3c9bc;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.auth-body {
  padding: 22px 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.form-group input {
  padding: 9px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 76, 58, 0.15);
}

.form-row {
  display: flex;
  gap: 12px;
}

.btn-auth-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.2s;
}

.btn-auth-submit:hover {
  background: #15634d;
}

.auth-error-msg {
  color: #dc2626;
  font-size: 12px;
  display: none;
  padding: 6px 10px;
  background: #fee2e2;
  border-radius: 4px;
  border-left: 3px solid #dc2626;
}

.auth-success-msg {
  color: #065f46;
  font-size: 12px;
  padding: 8px 12px;
  background: #d1fae5;
  border-radius: 4px;
  border-left: 3px solid #10b981;
  line-height: 1.4;
}

.auth-link {
  font-size: 11.5px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
}

.auth-link:hover {
  text-decoration: underline;
  color: #1a7457;
}

.auth-footer-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #E5E7EB;
  font-size: 11px;
  color: #6B7280;
  line-height: 1.4;
  text-align: center;
}

/* Creator Branding in Header */
.version-tag {
  background: var(--accent);
  color: #111827;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.creator-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #F8D38D;
  text-decoration: none;
  font-weight: 600;
  padding: 1px 7px;
  background: rgba(212, 148, 58, 0.15);
  border: 1px solid rgba(212, 148, 58, 0.35);
  border-radius: 12px;
  transition: all 0.2s;
  font-size: 11px;
}

.creator-badge:hover {
  background: #D4943A;
  color: #0F4C3A;
  border-color: #D4943A;
}

.creator-badge:hover .linkedin-icon {
  fill: #0F4C3A;
}

.linkedin-icon {
  fill: #0A66C2;
  transition: fill 0.2s;
}

.ext-arrow {
  font-size: 10px;
  opacity: 0.7;
}

/* Leaderboard Modal Dialog */
.leaderboard-dialog {
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.leaderboard-header {
  padding: 12px 18px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--accent);
}

.leaderboard-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
}

.leaderboard-footer {
  padding: 10px 18px;
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
  font-size: 11px;
  color: #6B7280;
  text-align: center;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.leaderboard-table th {
  background: #F3F4F6;
  color: #374151;
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 2px solid #E5E7EB;
}

.leaderboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #F3F4F6;
  color: #1F2937;
}

.leaderboard-table tr:hover td {
  background: #F9FAFB;
}

.rank-badge {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 12px;
  background: #E5E7EB;
  color: #4B5563;
}

.rank-1 { background: #FEF3C7; color: #D97706; }
.rank-2 { background: #E5E7EB; color: #4B5563; }
.rank-3 { background: #FFEDD5; color: #C2410C; }

.leaderboard-progress-bg {
  width: 100%;
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.leaderboard-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

/* Certificate Modal & Canvas Styles */
.btn-cert-unlocked {
  background: linear-gradient(135deg, #D4943A 0%, #F59E0B 100%) !important;
  color: #0F4C3A !important;
  border-color: #FBD58E !important;
  font-weight: 800 !important;
  box-shadow: 0 0 12px rgba(212, 148, 58, 0.5) !important;
  animation: pulseCert 2s infinite alternate;
}

@keyframes pulseCert {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.cert-dialog {
  background: #fff;
  border-radius: 12px;
  width: 95%;
  max-width: 980px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.25s ease-out;
}

.cert-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--accent);
}

.cert-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cert-status-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.cert-status-unlocked {
  background: #E8F5E9;
  border: 1px solid #A5D6A7;
  color: #1B5E20;
}

.cert-status-locked {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #92400E;
}

.cert-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  background: #F9FAFB;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
}

.cert-input-wrap {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cert-input-wrap label {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
}

.cert-input-wrap input {
  padding: 8px 12px;
  font-size: 13.5px;
  border: 1.5px solid #D1D5DB;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  font-weight: 600;
  color: #111827;
  transition: border-color 0.15s;
}

.cert-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 58, 0.15);
}

.cert-actions-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-cert-download {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-cert-download:hover {
  background: #15634d;
  box-shadow: 0 4px 12px rgba(15, 76, 58, 0.25);
}

.btn-cert-linkedin {
  background: #0A66C2;
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-cert-linkedin:hover {
  background: #084d93;
  box-shadow: 0 4px 12px rgba(10, 102, 194, 0.3);
}

.cert-canvas-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #E5E7EB;
  padding: 12px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
  position: relative;
}

.cert-canvas-wrapper canvas {
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  display: block;
  transition: all 0.3s;
}

.cert-canvas-blurred {
  filter: blur(8px) grayscale(40%);
  opacity: 0.35;
  pointer-events: none;
}

.cert-lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 76, 58, 0.45);
  backdrop-filter: blur(3px);
  padding: 20px;
}

.cert-lock-box {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 24px 30px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  border: 2px solid #D4943A;
  animation: slideUp 0.3s ease-out;
}

.cert-lock-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.cert-lock-title {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #0F4C3A;
  font-weight: 800;
}

.cert-lock-desc {
  font-size: 13px;
  color: #4B5563;
  line-height: 1.55;
  margin: 0 0 16px 0;
}

.cert-lock-stat {
  font-size: 13.5px;
  font-weight: 700;
  color: #0F4C3A;
  margin-bottom: 6px;
}

.cert-lock-bar-bg {
  width: 100%;
  height: 8px;
  background: #E5E7EB;
  border-radius: 4px;
  overflow: hidden;
}

.cert-lock-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #D4943A, #0F4C3A);
  border-radius: 4px;
  transition: width 0.3s;
}

.cert-footer {
  padding: 10px 20px;
  background: #F3F4F6;
  border-top: 1px solid #E5E7EB;
  font-size: 11.5px;
  color: #6B7280;
  text-align: center;
}

/* ==========================================================================
   Responsive Breakpoints (Taste Skill & Vercel Web Interface Guidelines)
   ========================================================================== */

@media (max-width: 900px) {
  .btn-sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 320px;
    max-width: 86vw;
    z-index: 999;
    background: #FFFFFF;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-container {
    height: calc(100vh - 54px);
    flex-direction: column;
    overflow: hidden;
  }

  .app-workspace {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }

  .workspace-panels {
    overflow: visible;
    flex: none;
    height: auto;
  }

  .workspace-top-row {
    flex-direction: column;
    flex: none;
    height: auto;
  }

  .editor-section {
    height: 290px;
    min-height: 250px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .table-preview-section {
    height: 250px;
    min-height: 220px;
    border-bottom: 1px solid var(--border-color);
  }

  .workspace-bottom-row {
    min-height: 240px;
    flex: none;
  }

  .workspace-q-banner {
    padding: 10px 14px;
  }

  .q-banner-title {
    font-size: 13.5px;
  }

  .header-actions {
    overflow-x: auto;
    max-width: 50vw;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 6px 10px;
    gap: 6px;
  }

  .brand-title {
    font-size: 13.5px;
  }

  .version-tag {
    font-size: 9px;
    padding: 1px 4px;
  }

  .creator-label-text {
    display: none;
  }

  .creator-badge-center {
    font-size: 10px;
    padding: 2px 6px;
  }

  .progress-widget {
    padding: 2px 6px;
    font-size: 10.5px;
  }

  .progress-bar-bg {
    width: 45px;
  }

  #engine-status {
    display: none;
  }

  .editor-actions .btn-editor span {
    display: none;
  }

  .editor-actions .btn-editor {
    padding: 4px 8px;
    font-size: 11.5px;
  }
}
