/* === SURVEY SYSTEM GLOBAL STYLES === */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Primary */
  --primary: #3d5be4;
  --primary-hover: #2d46b8;
  --primary-light: #eef1fd;
  --primary-50: #f0f3ff;

  /* Accent colors */
  --teal: #2ec4c3;
  --teal-light: #e8faf9;
  --green: #4ac98e;
  --green-light: #e8faf1;
  --amber: #f5a623;
  --amber-light: #fef7e8;
  --red: #e84d4d;
  --red-light: #fdeaea;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;

  /* Borders & backgrounds */
  --border: #e5e7eb;
  --border-light: #f0f2f6;
  --bg: #f8f9fd;
  --white: #ffffff;

  /* Radii */
  --radius: 12px;
  --radius-sm: 8px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);

  /* Typography */
  --font: 'Sora', sans-serif;
  --mono: 'DM Mono', monospace;

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 60px;

  /* Backward compatibility aliases */
  --primary-dark: #2d46b8;
  --success: #4ac98e;
  --success-light: #e8faf1;
  --danger: #e84d4d;
  --danger-light: #fdeaea;
  --warning: #f5a623;
  --warning-light: #fef7e8;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --shadow: var(--shadow-sm);
  --sidebar-w: 240px;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 20px;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-outline { background: #fff; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); color: var(--text-primary); }
.btn-danger { background: var(--red-light); color: var(--red); border-color: var(--red-light); }
.btn-danger:hover { background: #fbd7d7; }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* === CARDS === */
.card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 18px;
  text-transform: capitalize;
}
/* Status badges */
.badge-active  { background: var(--green-light);   color: #1a9a5c; }
.badge-closed  { background: var(--red-light);     color: var(--red); }
.badge-draft   { background: var(--border-light);  color: var(--text-tertiary); }
.badge-blue,
.badge-primary { background: var(--primary-light); color: var(--primary); }
/* Legacy names */
.badge-green   { background: var(--green-light);   color: #1a9a5c; }
.badge-red     { background: var(--red-light);     color: var(--red); }
.badge-gray    { background: var(--border-light);  color: var(--text-tertiary); }

/* === FORMS === */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(61,91,228,0.1); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-help { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-light); color: #1a9a5c; border-color: #a7f3d0; }
.alert-danger  { background: var(--red-light);   color: var(--red); border-color: #fca5a5; }
.alert-info    { background: var(--primary-light); color: var(--primary); border-color: #bfdbfe; }

/* === TABLES === */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-light);
  background: #fafbfd;
}
td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f8f9fd; }

/* === STAT CARDS === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-teal    { background: var(--teal-light);    color: var(--teal); }
.stat-icon-green   { background: var(--green-light);   color: var(--green); }
.stat-icon-amber   { background: var(--amber-light);   color: var(--amber); }
.stat-icon-red     { background: var(--red-light);     color: var(--red); }

/* === ADMIN LAYOUT === */
.admin-layout { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.35;
  white-space: normal;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: 1px;
}
.sidebar-nav { flex: 1; padding: 12px 10px 8px; }
.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 10px 5px;
  display: block;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.12s;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--primary-50); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.nav-danger { color: var(--red); }
.nav-item.nav-danger:hover { background: var(--red-light); color: var(--red); }
.nav-icon { display: flex; align-items: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.sidebar-user-role {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* === ADMIN CONTENT === */
.admin-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* === TOPBAR === */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
}
.topbar-home { color: var(--text-tertiary); }
.topbar-sep  { color: var(--text-tertiary); }
.topbar-page { font-weight: 600; color: var(--text-primary); }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-bell {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: background 0.12s;
}
.topbar-bell:hover { background: var(--bg); }
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.topbar-avatar:hover { opacity: 0.85; }
.avatar-menu-wrapper { position: relative; }
.avatar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
}
.avatar-dropdown.open { display: block; }
.avatar-dropdown-header { padding: 12px 14px; }
.avatar-dropdown-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.avatar-dropdown-role { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.avatar-dropdown-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 14px;
  font-size: 13.5px; color: var(--text-primary); text-decoration: none;
  background: none; border: none; cursor: pointer; width: 100%;
  font: inherit; text-align: left; transition: background 0.1s;
}
.avatar-dropdown-item:hover { background: var(--bg); }
.avatar-dropdown-item svg { flex-shrink: 0; color: var(--text-secondary); }
.avatar-dropdown-divider { height: 1px; background: var(--border-light); margin: 2px 0; }
.avatar-dropdown-danger { color: var(--red); }
.avatar-dropdown-danger svg { color: var(--red); }
.avatar-dropdown-danger:hover { background: #fff5f5; }
.lang-toggle {
  height: 32px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.12s;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }

/* Legacy: keep admin-header working for pages not yet updated */
.admin-header {
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.admin-subtitle { font-size: 13px; color: var(--text-tertiary); margin-top: 2px; }

/* === PAGE HEADER === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.page-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* === ADMIN BODY === */
.admin-body { flex: 1; padding: 28px 32px; }

/* === FILTER BAR === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  text-transform: capitalize;
  transition: all 0.12s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* === SEARCH INPUT === */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
  align-items: center;
}
.search-input {
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
  width: 260px;
}
.search-input:focus { border-color: var(--primary); }

/* === ICON BUTTON === */
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.12s;
  font-family: var(--font);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg); color: var(--text-primary); }
.icon-btn-danger { color: var(--red); }
.icon-btn-danger:hover { background: var(--red-light); border-color: var(--red-light); color: var(--red); }

/* === QUICK ACTION BUTTONS === */
.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.12s;
  text-decoration: none;
}
.quick-action:hover { transform: translateY(-1px); text-decoration: none; }
.quick-action-primary { background: var(--primary); color: #fff; }
.quick-action-outline { background: var(--white); color: var(--text-primary); box-shadow: 0 0 0 1px var(--border); }

/* === SURVEY FRONTEND === */
.survey-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 40%, #f0fdf4 100%);
  padding: 40px 20px;
}
.survey-wrap { max-width: 680px; margin: 0 auto; }
.survey-header-top { text-align: center; margin-bottom: 32px; }
.survey-brand {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.survey-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.survey-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  padding: 36px 40px 32px;
  color: #fff;
}
.survey-card-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.survey-card-desc { font-size: 15px; opacity: 0.85; }
.survey-progress { height: 4px; background: rgba(255,255,255,0.2); }
.survey-progress-bar {
  height: 100%;
  background: #fff;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.survey-body { padding: 36px 40px; }
.question-block {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.question-block:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(61,91,228,0.07);
}
.question-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.question-label { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; }
.question-required { color: var(--red); margin-left: 4px; }

.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.option-item:hover { border-color: var(--primary); background: var(--primary-light); }
.option-item:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.option-item input { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.option-text { font-size: 14px; color: var(--text-primary); }

.rating-group { display: flex; gap: 8px; }
.rating-star {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.rating-star:hover { border-color: var(--amber); background: var(--amber-light); }
.rating-star input { position: absolute; opacity: 0; width: 0; height: 0; }
.rating-star:has(input:checked) { border-color: var(--amber); background: var(--amber-light); }
.star-label { font-size: 11px; color: var(--text-tertiary); margin-left: 8px; align-self: center; }

.survey-footer {
  padding: 0 40px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.survey-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.survey-submit:hover { opacity: 0.92; }
.survey-submit:active { transform: scale(0.99); }

.success-block { text-align: center; padding: 60px 40px; }
.success-icon { font-size: 60px; margin-bottom: 16px; }
.success-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.success-desc { color: var(--text-secondary); font-size: 15px; }

.survey-index-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  display: block;
}
.survey-index-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.survey-index-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.survey-index-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; }
.survey-index-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-tertiary); }

/* === ANALYTICS BARS === */
.analytics-bar-wrap { margin-top: 8px; }
.analytics-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.analytics-bar-label { font-size: 13px; color: var(--text-secondary); min-width: 150px; flex-shrink: 0; }
.analytics-bar-track {
  flex: 1;
  height: 26px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.analytics-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}
.analytics-bar-count { font-size: 13px; font-weight: 600; color: var(--text-primary); min-width: 28px; text-align: right; font-family: var(--mono); }
.analytics-bar-pct { font-size: 12px; color: var(--text-tertiary); min-width: 36px; text-align: right; }

/* === CHART === */
.chart-wrap { position: relative; height: 200px; }

/* === LOGIN === */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 52px;
  height: 52px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin: 0 auto 14px;
}
.login-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-tertiary); }

/* === SURVEY BUILDER === */
.question-builder-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 12px;
  background: var(--white);
  transition: border-color 0.15s;
}
.question-builder-item:hover { border-color: var(--border); }
.qb-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.qb-type-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary);
}

/* === RESPONSE MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 20px;
}
.modal-box {
  max-width: 560px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  position: relative;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.12s;
}
.modal-close:hover { color: var(--text-primary); }

/* === SHARE MODAL — centering + animations === */
#share-modal {
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
@keyframes shareOverlayIn {
  from { background: rgba(0,0,0,0); }
  to   { background: rgba(0,0,0,0.45); }
}
@keyframes shareOverlayOut {
  from { background: rgba(0,0,0,0.45); }
  to   { background: rgba(0,0,0,0); }
}
@keyframes shareBoxIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes shareBoxOut {
  from { opacity: 1; transform: translateY(0)    scale(1); }
  to   { opacity: 0; transform: translateY(20px) scale(0.97); }
}
#share-modal.share-enter {
  animation: shareOverlayIn 0.22s ease forwards;
}
#share-modal.share-enter > .modal-box {
  animation: shareBoxIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
#share-modal.share-exit {
  animation: shareOverlayOut 0.2s ease forwards;
}
#share-modal.share-exit > .modal-box {
  animation: shareBoxOut 0.2s ease forwards;
}

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { font-size: 44px; margin-bottom: 14px; color: var(--text-tertiary); }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-desc { font-size: 13.5px; color: var(--text-secondary); }

/* === UTILS === */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-tertiary); }
.text-primary-color { color: var(--primary); }
.font-mono { font-family: var(--mono); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === SIDEBAR OVERLAY (mobile drawer backdrop) === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.48);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* === HAMBURGER BUTTON === */
.topbar-hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.topbar-hamburger:hover { background: var(--bg); color: var(--text-primary); }

/* === TABLET (≤ 900px) === */
@media (max-width: 900px) {
  /* Narrower sidebar */
  :root { --sidebar-width: 220px; }
}

/* === MOBILE (≤ 768px) === */
@media (max-width: 768px) {
  /* Hamburger visible */
  .topbar-hamburger { display: flex; }

  /* Sidebar: off-canvas drawer */
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width) - 4px));
    transition: transform 0.26s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    z-index: 100;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.14);
  }

  /* Content fills full width */
  .admin-content { margin-left: 0; }

  /* Topbar */
  .topbar { padding: 0 16px; gap: 8px; }
  .topbar-breadcrumb { font-size: 12.5px; min-width: 0; flex: 1; overflow: hidden; }
  .topbar-right { gap: 8px; }

  /* Admin body */
  .admin-body { padding: 18px 16px 32px; }

  /* Cards */
  .card { padding: 18px 16px; }
  .card-title { font-size: 14.5px; margin-bottom: 14px; }

  /* Stat grid: 2 columns */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 16px 14px; gap: 10px; }
  .stat-value { font-size: 24px; }
  .stat-icon { width: 40px; height: 40px; }
  .stat-label { font-size: 11px; }

  /* Page header: stack title + button */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 20px; }

  /* Search: stretch */
  .search-wrap { flex: 1; min-width: 0; }
  .search-input { width: 100%; min-width: 0; }

  /* Filter bar: wraps naturally */
  .filter-bar { gap: 6px; }
  .filter-btn { padding: 6px 12px; font-size: 12.5px; }

  /* Tables: horizontal scroll already works; shrink cell padding */
  th { padding: 9px 12px; font-size: 11px; }
  td { padding: 12px 12px; font-size: 13px; }

  /* Analytics bar label: shorter */
  .analytics-bar-label { min-width: 90px; font-size: 12px; }
  .analytics-bar-pct { min-width: 30px; }

  /* Chart wrap: shorter on mobile */
  .chart-wrap { height: 180px; }

  /* Dashboard chart+actions: stack */
  .dash-chart-grid { grid-template-columns: 1fr !important; }

  /* Survey form builder: stack, unstick sidebar */
  .sf-builder-grid { grid-template-columns: 1fr !important; }
  .sf-builder-sidebar { position: static !important; top: auto !important; }

  /* Modal: full-width */
  .modal-overlay { padding: 16px; }
  .modal-box { padding: 20px 18px; }

  /* Login card */
  .login-card { padding: 28px 20px; }

  /* Survey public pages */
  .survey-body, .survey-footer, .survey-card-header { padding-left: 20px; padding-right: 20px; }
}

/* === SMALL MOBILE (≤ 480px) === */
@media (max-width: 480px) {
  /* Stat grid: single column */
  .stat-grid { grid-template-columns: 1fr; }

  /* Hide breadcrumb "首页 /" to save space */
  .topbar-home { display: none; }
  .topbar-home + .topbar-sep { display: none; }

  /* Hide notification bell */
  .topbar-bell { display: none; }

  /* Further reduce padding */
  .admin-body { padding: 14px 12px 28px; }
  .card { padding: 16px 12px; }

  /* Stat card: side by side icon+value */
  .stat-value { font-size: 22px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 10px; }

  /* Table: tighter */
  td { padding: 10px 10px; }
  th { padding: 8px 10px; }
}
