:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --primary:#2563eb;
  --primary-dark:#1d4ed8;
  --dark:#111827;
  --light:#e5e7eb;
  --success:#166534;
  --success-bg:#dcfce7;
  --error:#991b1b;
  --error-bg:#fee2e2;
  --info:#1d4ed8;
  --info-bg:#dbeafe;
  --warning:#92400e;
  --warning-bg:#fef3c7;
  --neutral:#374151;
  --neutral-bg:#e5e7eb;
  --inactive:#92400e;
  --inactive-bg:#fef3c7;
  --shadow:0 10px 30px rgba(0,0,0,.06);
  --radius:16px;
}

*{
  box-sizing:border-box;
}

html{
  font-size:16px;
}

body{
  margin:0;
  font-family:Arial,sans-serif;
  background: #f8fafc;
  color:var(--text);
}

body.auth-guard{
  display:none;
}

body.public-page{
  display:block;
}

.topbar{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--border);
}

.topbar-inner{
  max-width:1200px;
  margin:0 auto;
  padding:14px 20px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
}

.brand{
  font-weight:700;
  font-size:18px;
}

.nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.nav a,
.nav button,
.btn,
.btn-link,
.filter-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  padding:10px 14px;
  border-radius:12px;
  font-size:14px;
  text-decoration:none;
  cursor:pointer;
}

.nav a.active,
.filter-btn.active{
  background:var(--dark);
  color:#fff;
  border-color:var(--dark);
}

.page,
.container{
  max-width:1200px;
  margin:0 auto;
  padding:28px 20px 60px;
}

.page-narrow{
  max-width:900px;
}

.page-mid{
  max-width:1100px;
}

.page-wide{
  max-width:1280px;
}

.page-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:20px;
}

.header-actions,
.actions,
.card-actions,
.row-links,
.filter-buttons{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.card,
.box,
.status,
.userbox,
.versions-box,
.summary-card,
.empty,
.result,
.login-box,
.public-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.card,
.box,
.versions-box,
.summary-card,
.login-box,
.public-card{
  padding:18px;
}

h1{
  margin:0 0 10px;
  font-size:32px;
  line-height:1.15;
}

h2{
  margin:0 0 12px;
  font-size:22px;
  line-height:1.25;
}

.lead,
.muted,
.small{
  color:var(--muted);
  line-height:1.6;
}

label{
  display:block;
  margin-bottom:8px;
  font-weight:700;
  font-size:14px;
}

input,
textarea,
select{
  width:100%;
  padding:12px 13px;
  margin-bottom:14px;
  border:1px solid #d1d5db;
  border-radius:10px;
  box-sizing:border-box;
  font-size:15px;
  background:#fff;
  color:var(--text);
}

textarea{
  resize:vertical;
  min-height:120px;
}

.btn{
  border:none;
  font-weight:700;
}

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

.btn.primary:hover{
  background:var(--primary-dark);
}

.btn.secondary{
  background:var(--dark);
  color:#fff;
}

.btn.light{
  background:var(--light);
  color:var(--text);
}

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

.btn.danger{
  background:var(--error);
  color:#fff;
}

.btn.small{
  padding:8px 12px;
  font-size:13px;
  border-radius:9px;
}

button:disabled,
.btn:disabled{
  opacity:.7;
  cursor:not-allowed;
}

.status,
.box{
  padding:14px 16px;
  line-height:1.6;
}

.status{
  display:none;
  margin-bottom:16px;
}

.status.show{
  display:block;
}

.status.success,
.box.success{
  background:var(--success-bg);
  color:var(--success);
  border-color:#a7f3d0;
}

.status.error,
.box.error{
  background:var(--error-bg);
  color:var(--error);
  border-color:#fecaca;
}

.status.info,
.box.info{
  background:var(--info-bg);
  color:var(--info);
  border-color:#bfdbfe;
}

.status.warning,
.box.warning{
  background:var(--warning-bg);
  color:var(--warning);
  border-color:#fde68a;
}

.notice,
.info-box{
  background:#eff6ff;
  border:1px solid #bfdbfe;
  color:#1e3a8a;
  padding:14px 16px;
  border-radius:12px;
  line-height:1.55;
  margin-bottom:18px;
}

.error-box{
  background:#fef2f2;
  border:1px solid #fecaca;
  color:#991b1b;
  padding:14px 16px;
  border-radius:12px;
  line-height:1.55;
}

.summary,
.stats{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:16px;
  margin-bottom:22px;
}

.summary-card .label,
.card-title{
  color:var(--muted);
  font-size:14px;
  margin-bottom:8px;
}

.summary-card .value,
.card-value{
  font-size:34px;
  font-weight:700;
  line-height:1;
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(340px, 1fr));
  gap:18px;
}

.grid-2{
  display:grid;
  grid-template-columns:1.4fr .9fr;
  gap:24px;
  align-items:start;
}

.meta{
  font-size:14px;
  color:#4b5563;
  margin-bottom:8px;
  word-break:break-word;
  line-height:1.55;
}

.link{
  word-break:break-all;
  font-size:13px;
  color:#374151;
  background:#f9fafb;
  border:1px solid var(--border);
  padding:10px 12px;
  border-radius:10px;
  margin:14px 0;
  line-height:1.5;
}

.qr-wrap{
  text-align:center;
  margin:18px 0;
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
}

.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  margin-bottom:8px;
}

.badge.active{
  background:var(--success-bg);
  color:var(--success);
}
.badge + .badge{
  margin-left:6px;
}

.badge.inactive{
  background:var(--inactive-bg);
  color:var(--inactive);
}

.badge.info{
  background:var(--info-bg);
  color:var(--info);
}

.badge.neutral{
  background:var(--neutral-bg);
  color:var(--neutral);
}
.badge-type{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  margin-top:8px;
  margin-bottom:8px;
}
.badge-type-question {
  background: #f3f4f6;
  color: #374151;
}

.badge-type-info {
  background: #e8f1ff;
  color: #1d4ed8;
}

.badge-type-poll,
.badge-type-multiple_choice,
.badge-type-yes_no {
  background: #efe9ff;
  color: #6d28d9;
}

.badge-type-rating,
.badge-type-scale {
  background: #fff4e5;
  color: #b45309;
}

.badge-type-question {
  background: #f3f4f6;
  color: #374151;
}

.card.inactive{
  border-color:#f59e0b;
}

.versions-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.versions-title{
  font-weight:700;
  font-size:20px;
}

.versions-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(260px, 1fr));
  gap:12px;
}

.version-card{
  background:#f9fafb;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:14px;
  cursor:pointer;
  transition:all .15s ease;
}

.version-card:hover{
  border-color:#cbd5e1;
}

.version-card.active{
  border-color:#93c5fd;
  background:#eff6ff;
}

.version-card.filtered{
  outline:2px solid var(--dark);
}

.version-title{
  font-weight:700;
  margin-bottom:8px;
  line-height:1.4;
}

.version-meta{
  font-size:14px;
  color:#555;
  margin-bottom:6px;
  line-height:1.5;
}

.version-actions{
  margin-top:12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.table-wrap{
  background:#fff;
  border-radius:16px;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  overflow:auto;
}

table{
  border-collapse:collapse;
  width:100%;
  min-width:900px;
  background:#fff;
}

th,
td{
  padding:12px 10px;
  border-bottom:1px solid #ddd;
  text-align:left;
  vertical-align:top;
  line-height:1.45;
}

th{
  background:#f8fafc;
  position:sticky;
  top:0;
  z-index:1;
}

tr:hover{
  background:#fafafa;
}

.empty-table{
  padding:20px;
  color:var(--muted);
}

.info-list{
  display:grid;
  gap:12px;
}

.info-item{
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fafafa;
  line-height:1.6;
  color:#374151;
}

.info-item strong{
  display:block;
  margin-bottom:6px;
  color:#111827;
}

.details-box{
  margin-top:8px;
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px 14px;
  background:#fafafa;
}

.public-layout{
  min-height:100vh;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:40px 16px;
}

.public-card{
  width:100%;
  max-width:420px;
  padding:28px;
}

.login-layout{
  min-height:100vh;
  display:flex;
  justify-content:center;
  align-items:center;
  padding:16px;
}

.login-box{
  width:100%;
  max-width:380px;
  padding:28px;
}

.app-install-note{
  margin-top:14px;
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
}

.rating-stars{
  display:flex;
  gap:8px;
  margin-bottom:14px;
}

.star-btn{
  border:none;
  background:transparent;
  font-size:32px;
  line-height:1;
  cursor:pointer;
  color:#cbd5e1;
  padding:0;
}

.star-btn.active{
  color:#f59e0b;
}

@media (max-width: 900px){
  .summary,
  .stats,
  .grid-2{
    grid-template-columns:1fr;
  }
}

@media (max-width: 768px){
  .page,
  .container{
    padding:20px 16px 50px;
  }

  .topbar-inner{
    padding:12px 16px;
  }

  h1{
    font-size:28px;
  }

  .public-layout{
    padding:20px 12px;
  }

  .public-card{
    max-width:100%;
  }
}
.rating-stars {
  display: flex;
  flex-direction: row;
  gap: 0.35rem;
  align-items: center;
}

.rating-stars input[type="radio"] {
  display: none;
}

.rating-stars label {
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.rating-stars label:hover {
  opacity: 1;
  transform: scale(1.08);
}

.rating-stars input[type="radio"]:checked + label {
  opacity: 1;
}
.rating-stars {
  display:flex;
  flex-direction:row-reverse;
  gap:4px;
  font-size:26px;
}

.rating-stars input {
  display:none;
}

.rating-stars label {
  cursor:pointer;
  color:#ccc;
}

.rating-stars input:checked ~ label,
.rating-stars label:hover,
.rating-stars label:hover ~ label {
  color:#f5b301;
}
.dashboard-stats-4{
  grid-template-columns:repeat(4, minmax(0, 1fr));
}

.responses-chart{
  width:100%;
}

.chart-bars{
  display:grid;
  grid-template-columns:repeat(14, minmax(0, 1fr));
  gap:10px;
  align-items:end;
  min-height:220px;
  padding-top:10px;
}

.chart-col{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  min-width:0;
}

.chart-value{
  font-size:12px;
  color:var(--muted);
  line-height:1;
}

.chart-bar-wrap{
  height:160px;
  width:100%;
  display:flex;
  align-items:flex-end;
}

.chart-bar{
  width:100%;
  background:var(--primary);
  border-radius:10px 10px 0 0;
  min-height:4px;
  transition:height .2s ease;
}

.chart-label{
  font-size:12px;
  color:var(--muted);
  text-align:center;
  line-height:1.2;
  word-break:break-word;
}

@media (max-width: 900px){
  .dashboard-stats-4{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .chart-bars{
    gap:6px;
  }

  .chart-label,
  .chart-value{
    font-size:11px;
  }
}

@media (max-width: 640px){
  .dashboard-stats-4{
    grid-template-columns:1fr;
  }

  .chart-bars{
    gap:4px;
  }

  .chart-label{
    font-size:10px;
  }
}
.qr-filter-bar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin:10px 0 14px 0;
}

.qr-filter-btn{
  padding:8px 12px;
  border-radius:10px;
  border:1px solid #d1d5db;
  background:#fff;
  cursor:pointer;
  font-size:13px;
  font-weight:600;
}

.qr-filter-btn.active{
  background:#111827;
  color:white;
  border-color:#111827;
}
table td {
  max-width:260px;
  vertical-align:top;
}

table td:nth-child(6) {
  white-space:normal;
  line-height:1.4;
}
.yes-no-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 10px;
}

.yes-no-option{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--border);
  background:#fff;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  min-width:0;
  white-space:normal;
  line-height:1.35;
}

.yes-no-option input{
  margin:0;
  width:auto;
}
.empty-state{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:60vh;
}

.empty-card{
  background:white;
  border-radius:12px;
  padding:40px;
  text-align:center;
  max-width:420px;
  width:100%;
  box-shadow:0 10px 30px rgba(0,0,0,0.08);
}

.empty-card h2{
  margin-bottom:10px;
}

.empty-card .muted{
  margin-bottom:20px;
}
.kpi {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.kpi-number {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-label {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
}
.box {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.qr-responses-highlight {
  font-size: 26px;
  font-weight: 700;
  margin-top: 4px;
  margin-bottom: 10px;
}

.qr-responses-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
}
