:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;

  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --teal: #0f766e;
  --teal-soft: #f0fdfa;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.14);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 650;
  color: var(--text);
}

h2 { font-size: 1.08rem; }
h3 { font-size: 0.96rem; }

p { margin: 0; }

.muted-small {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-danger { color: var(--danger) !important; }

/* App shell */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.brand-title {
  font-size: 1.12rem;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.privacy-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid #99f6e4;
  padding: 4px 10px;
  border-radius: 999px;
}

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

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.toggle-chip:has(input:checked) {
  background: #eef2ff;
  border-color: #818cf8;
  color: #3730a3;
}

/* Main Navigation */
.main-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.nav-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 0.89rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-badge {
  font-size: 0.74rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.nav-tab.active .tab-badge {
  background: var(--primary-soft);
  border-color: #bfdbfe;
  color: var(--primary);
}

.nav-spacer { flex: 1; }

.nav-class-pill {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Main Content */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.card-compact { padding: 12px 16px; }

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

.grid-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 18px;
}

@media (max-width: 1080px) {
  .grid-two-col, .grid-charts {
    grid-template-columns: 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.btn-sm { padding: 5px 10px; font-size: 0.82rem; }
.btn-lg { padding: 11px 18px; font-size: 0.95rem; font-weight: 600; }

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

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

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

.btn-icon-close {
  border: none;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
}
.btn-icon-close:hover { background: var(--surface-alt); color: var(--text); }

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-field-full { grid-column: 1 / -1; }

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-form input[type="text"],
.inline-form input[type="password"] { flex: 1; min-width: 180px; }

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

.bulk-box {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
}

.compact-list {
  margin: 6px 0 8px;
  padding-left: 18px;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--surface-alt);
  font-weight: 650;
  white-space: nowrap;
}

.sortable-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}
.sortable-table th[data-sort]:hover {
  color: var(--primary);
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}
.data-table tbody tr.clickable-row:hover {
  background: var(--primary-soft);
}

.code-badge {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.79rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

/* Toolbars & Segmented Controls */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-right,
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-group label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
}

.segmented {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

.segmented-sm .seg-btn { padding: 4px 9px; font-size: 0.8rem; }

.seg-btn.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Completeness bar */
.completeness-bar-wrap {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.83rem;
}

.progress-track {
  flex: 1;
  min-width: 140px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #059669);
  transition: width 0.25s ease;
}

/* Entry sheet */
.sheet-controls {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sheet-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-selector label {
  font-size: 0.86rem;
  font-weight: 600;
}

.hint-pill {
  font-size: 0.81rem;
  background: var(--primary-soft);
  color: #1e40af;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.score-input {
  width: 68px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.comment-input {
  width: 100%;
  min-width: 200px;
}

/* Matrix Grid */
.matrix-legend {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.score-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.score-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.s1 { background: #d1fae5; color: #065f46; }
.s2 { background: #e0f2fe; color: #075985; }
.s3 { background: #f1f5f9; color: #334155; }
.s4 { background: #fef3c7; color: #92400e; }
.s5 { background: #fee2e2; color: #991b1b; }

.matrix-scroll-wrap {
  overflow: auto;
  max-height: 62vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.matrix-table {
  border-collapse: collapse;
  font-size: 0.82rem;
}

.matrix-table th,
.matrix-table td {
  border: 1px solid var(--border);
  text-align: center;
  padding: 0;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-alt);
  padding: 6px 5px;
  min-width: 44px;
  font-weight: 650;
}

.matrix-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface-alt);
  text-align: left;
  padding: 5px 10px;
  white-space: nowrap;
  font-weight: 600;
}

.matrix-table thead th:first-child {
  left: 0;
  z-index: 3;
}

.matrix-cell-diag {
  background: #e2e8f0;
  color: #94a3b8;
  font-weight: 600;
}

.matrix-cell-input {
  width: 44px;
  height: 34px;
  border: none !important;
  border-radius: 0 !important;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  background: transparent;
  padding: 0;
}
.matrix-cell-input:focus {
  box-shadow: inset 0 0 0 2px var(--primary) !important;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-soft);
  font-weight: 650;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 750;
  margin-top: 4px;
  line-height: 1.15;
}

.kpi-sub {
  font-size: 0.81rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Status pills & quadrant badges */
.q-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.q-leader_popular { background: #d1fae5; color: #065f46; }
.q-leader_unpopular { background: #fef3c7; color: #92400e; }
.q-popular_low_influence { background: #dbeafe; color: #1e40af; }
.q-isolated_at_risk { background: #fee2e2; color: #991b1b; }
.q-unknown { background: #f1f5f9; color: #475569; }

.flag-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  margin-left: 4px;
  margin-top: 2px;
}

.climate-banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  margin-bottom: 10px;
}
.climate-good { background: var(--success-soft); color: #065f46; border: 1px solid #a7f3d0; }
.climate-neutral { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.climate-warn { background: var(--warn-soft); color: #92400e; border: 1px solid #fde68a; }
.climate-danger { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }

.climate-notes {
  margin: 0;
  padding-left: 18px;
  font-size: 0.87rem;
  color: var(--text-muted);
}
.climate-notes li { margin-bottom: 5px; }

.clique-card {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.clique-title {
  font-weight: 650;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.clique-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.member-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.member-chip {
  font-size: 0.79rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}
.member-chip:hover { border-color: var(--primary); color: var(--primary); }

/* Charts & Sociogram */
.socio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  user-select: none;
}

.check-green { border-color: #6ee7b7; color: #065f46; }
.check-teal { border-color: #93c5fd; color: #1e40af; }
.check-red { border-color: #fca5a5; color: #991b1b; }
.check-orange { border-color: #fcd34d; color: #92400e; }

.viz-container {
  width: 100%;
  min-height: 460px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viz-container svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Floating chart tooltip */
.chart-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 0.8rem;
  line-height: 1.45;
  max-width: 270px;
  box-shadow: var(--shadow-lg);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-lg { max-width: 760px; }

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.export-option {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: var(--surface-alt);
}

.export-danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.detail-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .detail-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.detail-stat {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.detail-stat-val {
  font-size: 1.25rem;
  font-weight: 750;
}

.detail-stat-lbl {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.comment-item {
  padding: 8px 10px;
  border-left: 3px solid var(--primary);
  background: var(--surface-alt);
  border-radius: 0 6px 6px 0;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

/* Report sheet */
.report-sheet {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 34px;
  max-width: 980px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.report-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 12px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.report-section {
  margin-bottom: 22px;
  break-inside: avoid;
}

.report-section h3 {
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin-bottom: 10px;
  color: #1e3a8a;
}

.report-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.report-chart-box {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
}

.report-chart-box svg {
  width: 100%;
  height: auto;
}

.report-conclusion-input {
  width: 100%;
  min-height: 95px;
  resize: vertical;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
}
.toast-success { background: #065f46; }
.toast-error { background: #991b1b; }

/* Print styling */
@media print {
  body {
    background: #ffffff;
    font-size: 11pt;
  }
  .no-print {
    display: none !important;
  }
  .main-content {
    padding: 0;
    max-width: none;
  }
  .tab-panel {
    display: none !important;
  }
  #panel-report {
    display: block !important;
  }
  .report-sheet {
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: none;
  }
  .report-conclusion-input {
    border: 1px solid #cbd5e1;
    padding: 8px;
  }
  .report-charts-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* =========================================================================
   DATABÁZOVÁ VERZE: AUTH, DASHBOARD TŘÍD, PŘÍSTUPY/QR A PORTÁL PRO ŽÁKY
   ========================================================================= */
.text-center { text-align: center; }

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

/* Auth layout */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #eff6ff 0%, #f4f6f9 55%, #f0fdfa 100%);
}

.auth-card {
  width: 100%;
  max-width: 450px;
  padding: 26px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  justify-content: center;
}

.auth-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

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

.alert-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.85rem;
  font-weight: 500;
}

.student-portal-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  border: 1px solid #99f6e4;
  flex-wrap: wrap;
}

.auth-footer-link {
  margin-top: 16px;
  text-align: center;
  font-size: 0.83rem;
}

.auth-footer-link a {
  color: var(--text-muted);
  text-decoration: none;
}
.auth-footer-link a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Dashboard */
.psych-user-pill {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.surveys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.empty-dash-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 24px;
}

.survey-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.12s, box-shadow 0.12s;
}
.survey-card:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.survey-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.survey-card-title {
  font-size: 1.12rem;
}

.survey-stat-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.survey-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* Status pills */
.status-badge,
.status-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-open,
.status-toggle-pill.is-open {
  background: var(--success-soft);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-closed,
.status-toggle-pill.is-closed {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.status-toggle-pill {
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s;
}
.status-toggle-pill:hover {
  filter: brightness(0.96);
}

.sub-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.sub-done { background: #d1fae5; color: #065f46; }
.sub-progress { background: #dbeafe; color: #1e40af; }
.sub-pending { background: #f1f5f9; color: #475569; }

/* Credentials & QR tab */
.portal-url-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
}

.portal-url-code {
  display: inline-block;
  margin-left: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  font-weight: 650;
  color: #1e3a8a;
  word-break: break-all;
}

.cred-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 2px 7px;
  border-radius: 5px;
}

.cred-pin {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid #99f6e4;
  padding: 2px 7px;
  border-radius: 5px;
}

.qr-preview-box {
  display: inline-block;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.qr-cred-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* =========================================================================
   PORTÁL PRO ŽÁKY (/dotaznik)
   ========================================================================= */
.student-body {
  background: linear-gradient(180deg, #eff6ff 0%, #f4f6f9 220px);
}

.student-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.student-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.student-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.save-pill.saving {
  background: var(--warn-soft);
  color: #92400e;
  border-color: #fde68a;
}

.student-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.student-main {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

.code-input-lg {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 1.15rem !important;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 11px 12px !important;
}

.student-welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.student-progress-box {
  min-width: 220px;
  flex: 0 1 280px;
}

.student-progress-text {
  font-size: 0.84rem;
  font-weight: 650;
  margin-bottom: 6px;
  color: var(--primary);
}

.scale-legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 680px) {
  .scale-legend-grid { grid-template-columns: 1fr; }
}

.scale-legend-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 0.8rem;
}

.scale-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--text-muted);
}

.classmates-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.classmate-card {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.classmate-card.is-complete {
  border-color: #a7f3d0;
}

.classmate-card.is-missing {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.classmate-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.classmate-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.classmate-name {
  font-size: 1.02rem;
}

.mate-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}
.mate-status-badge.done {
  background: #d1fae5;
  color: #065f46;
}

.rating-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rating-row-label {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  font-weight: 600;
}

.rate-btn-group {
  display: flex;
  gap: 6px;
}

.rate-btn {
  width: 44px;
  height: 42px;
  border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, background 0.12s, border-color 0.12s;
  font-family: inherit;
}

.rate-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.rate-btn:active {
  transform: scale(0.95);
}

.rate-btn.active {
  border-width: 2px;
  border-color: currentColor;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.rating-comment-row input {
  width: 100%;
}

.student-submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border-color: #bfdbfe;
  background: #f8fbff;
}

.done-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  border: 2px solid #a7f3d0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 800;
  margin: 0 auto 14px;
}
