/* V50 – Modernes, responsives UI für Handy, altes iPad und Desktop */
:root{
  --ui50-bg:#f3f6fc;
  --ui50-surface:#ffffff;
  --ui50-surface-soft:#f8fbff;
  --ui50-border:#dde6f3;
  --ui50-text:#1e3152;
  --ui50-muted:#6a7d98;
  --ui50-primary:#456fda;
  --ui50-primary-2:#6f8fe7;
  --ui50-success:#2f9469;
  --ui50-shadow:0 14px 38px rgba(45,73,124,.08);
  --ui50-shadow-soft:0 8px 22px rgba(45,73,124,.06);
  --ui50-radius:20px;
}

html,body{background:var(--ui50-bg); color:var(--ui50-text);} 
body{overflow-x:hidden;}

/* Global cards / headers */
.page-heading,
.app-hero,
.welcome-card,
.shell-card,
.auth-card,
.choose-card,
.feature,
.join-panel,
.card,
.panel,
.readbox,
.worksheet-upload-dialog,
.edit-dialog{
  box-shadow:var(--ui50-shadow);
}

.page-heading{
  background:linear-gradient(135deg,#ffffff 0%, #f8fbff 100%);
  border:1px solid var(--ui50-border);
  border-radius:24px;
  padding:20px 22px;
  align-items:flex-start;
}
.page-heading p{max-width:760px;line-height:1.55;color:var(--ui50-muted)}

.scan-page-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.scan-page-actions > *{
  min-height:46px;
}
.scan-help{
  margin:0;
  padding:14px 16px;
  border:1px solid #dbe7f8;
  border-radius:16px;
  background:#f6faff;
  color:#49617f;
  line-height:1.55;
}

.shell-card,
.own-upload-card,
.share-item,
.user-card,
.student-card,
.relation-item,
.activity-item,
.archive-task-card,
.archive-subject-group,
.assignment-group,
.muted-box,
.hw-card,
.stat-card,
.quick-card{
  border-color:var(--ui50-border);
  box-shadow:var(--ui50-shadow-soft);
}

.shell-card{
  border-radius:24px;
  padding:22px;
  background:var(--ui50-surface);
}

.own-upload-list{gap:14px;}
.own-upload-card{
  position:relative;
  border-radius:22px;
  background:linear-gradient(180deg,#ffffff 0%, #fbfdff 100%);
  padding:18px;
  gap:14px;
}
.own-upload-card .own-top{align-items:flex-start;}
.own-upload-card h3{
  font-size:18px;
  line-height:1.25;
  margin:8px 0 6px;
  word-break:break-word;
}
.own-upload-card p{font-size:13px;color:var(--ui50-muted)}

.worksheet-subject,
.badge,
.user-id-badge,
.user-role-pill{
  padding:7px 11px;
  font-size:11px;
  font-weight:800;
}
.worksheet-subject{background:#edf4ff;color:#4067ba}
.badge.allowed{background:#eaf8f0;color:#277d59}
.badge.blocked{background:#fff5df;color:#9a6a21}

.own-controls,
.user-actions,
.student-actions,
.assignment-heading-actions,
.hw-heading-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.own-controls a,
.own-controls button,
.user-actions button,
.student-actions button,
.assignment-heading-actions button,
.hw-heading-actions button,
.button-soft,
.button-primary,
.tiny-button,
.btn,
.worksheet-actions button,
.topbar-workspace{
  border-radius:14px;
  min-height:44px;
  padding:10px 14px;
  font-weight:800;
  text-decoration:none;
  box-shadow:none;
}
.button-soft,
.topbar-workspace,
.own-controls a,
.own-controls button:not(.danger),
.btn.btn-white,
.tiny-button{
  background:#f3f7ff;
  border:1px solid #d9e5fb;
  color:#3f67b7;
}
.button-primary,
.btn.btn-primary{
  background:linear-gradient(135deg,var(--ui50-primary),var(--ui50-primary-2));
  border:1px solid transparent;
  color:#fff;
}
.own-controls button.danger,
.user-actions .danger,
.worksheet-actions .danger{
  background:#fff2f4;
  border:1px solid #f0d4da;
  color:#b74762;
}

.share-teachers{
  margin-top:4px;
  padding-top:8px;
  border-top:1px solid #e9eff8;
}
.share-teachers strong{
  font-size:14px;
  color:#314f83;
}
.share-teachers label{
  min-height:44px;
  padding:10px 12px;
  border:1px solid #e1eaf6;
  border-radius:14px;
  background:#f9fbff;
}
.share-teachers input{width:18px;height:18px;flex:0 0 18px}

/* Dashboard shell */
.app-shell{
  max-width:1900px;
  gap:0;
}
.dash-sidebar{
  background:linear-gradient(180deg,#ffffff 0%, #f8fbff 100%);
  border-right:1px solid #e7eef9;
}
.sidebar-brand{margin-bottom:22px}
.nav-link{
  min-height:50px;
  border-radius:15px;
  font-size:14px;
}
.nav-link.is-active{
  background:linear-gradient(135deg,#edf4ff,#f8f5ff);
  box-shadow:inset 4px 0 0 #6287e5, 0 8px 18px rgba(74,112,196,.09);
}
.nav-symbol{
  width:32px;
  height:32px;
  border-radius:11px;
}
.worksheet-link{
  min-height:48px;
  border-radius:15px;
}

.dash-topbar{
  background:rgba(255,255,255,.94);
  border-bottom:1px solid #e4ebf6;
}
.topbar-actions{flex-wrap:wrap;justify-content:flex-end}
.topbar-workspace{font-size:13px}
.profile-chip{width:42px;height:42px;border-radius:14px}

.welcome-card{
  border-radius:28px;
  box-shadow:var(--ui50-shadow);
}
.quick-card{
  border-radius:22px;
  min-height:172px;
}
.quick-card b{font-size:16px}
.quick-card small{font-size:12px;line-height:1.55}

/* Main app / editor */
.site-header{
  background:rgba(255,255,255,.94);
  backdrop-filter:blur(12px);
  border-bottom:1px solid #e5edf8;
}
.site-logo{gap:12px}
.logo-mark,
.brand-symbol{
  box-shadow:0 10px 22px rgba(74,108,193,.18);
}
.app-main,
main{min-width:0}
.app-hero,
.landing-hero,
.auth-card,
.choose-card{
  border-radius:26px;
}
.auth-card,
.choose-card,
.feature,
.join-panel,
.card,
.panel,
.readbox,
.worksheet-upload-dialog,
.edit-dialog{
  border:1px solid var(--ui50-border);
}
.app-hero-actions,
.hero-buttons{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

/* Better readability and spacing on worksheet editor */
.card,
.panel,
.readbox{
  background:#fff;
}
.workspacebar,
.editorActions,
.viewtools,
.toolbar{
  gap:8px;
}
.toolbar button,
.viewtools button,
.editorActions button,
.readcontrols button,
.pages button,
.actions button,
.actions .secondary{
  min-height:42px;
  border-radius:12px;
}

/* Forms */
input,select,textarea{
  border-radius:13px;
}
.auth-card form,
.register-layout form,
.modern-form,
#worksheetUploadForm,
#worksheetMetaForm{
  gap:14px;
}
.auth-card label,
.register-layout label,
.modern-form label{
  gap:7px;
}
.auth-card input,
.auth-card select,
.register-layout input,
.register-layout select,
.modern-form input,
.modern-form select,
.modern-form textarea{
  min-height:48px;
  padding:12px 14px;
}

/* Tablet and small desktop */
@media (max-width:1024px){
  .dash-content{padding:24px 18px 34px}
  .page-heading{padding:18px}
  .shell-card{padding:18px}
  .topbar-actions{gap:8px}
  .quick-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* Old iPad / mobile */
@media (max-width:820px){
  .dash-sidebar{width:min(88vw,340px)}
  .dash-topbar{padding:10px 14px;min-height:68px}
  .breadcrumb{font-size:11px}
  .page-heading{
    padding:16px;
    border-radius:20px;
  }
  .scan-page-actions,
  .app-hero-actions,
  .hero-buttons,
  .own-controls,
  .worksheet-actions,
  .user-actions,
  .student-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
  }
  .scan-page-actions > *,
  .app-hero-actions > *,
  .hero-buttons > *,
  .own-controls > *,
  .worksheet-actions > *,
  .user-actions > *,
  .student-actions > *{
    width:100%;
    justify-content:center;
  }
  .welcome-card{grid-template-columns:1fr;min-height:unset;padding:20px}
  .gold-hero-medal{justify-self:start}
  .quick-grid,
  .stats-grid,
  .profile-grid,
  #owned-worksheets,
  .hw-list,
  .class-management{
    grid-template-columns:1fr;
  }
  .app-hero,
  .landing-hero,
  .auth-layout,
  .register-layout,
  .choose-grid{
    grid-template-columns:1fr !important;
  }
  .hero-art,
  .auth-intro img,
  .register-intro img{max-width:260px;margin:0 auto}
}

@media (max-width:620px){
  .dash-content{padding:16px 12px 26px}
  .dash-topbar{padding:10px 12px}
  .shell-card,.own-upload-card,.auth-card,.choose-card,.feature,.join-panel,.card,.panel,.readbox{border-radius:18px}
  .page-heading h1,
  .app-hero h1,
  .landing-hero h1,
  .welcome-card h1{font-size:clamp(26px,8vw,34px)}
  .page-heading p,
  .scan-help,
  .welcome-card p,
  .app-hero p{font-size:13px}
  .scan-page-actions,
  .app-hero-actions,
  .hero-buttons,
  .own-controls,
  .worksheet-actions,
  .user-actions,
  .student-actions{
    grid-template-columns:1fr;
  }
  .topbar-workspace span,
  .menu-label{display:none}
  .profile-chip{width:38px;height:38px}
  .topbar-actions{width:100%}
  .topbar-workspace{flex:1 1 auto;text-align:center}
  .own-upload-card{padding:16px}
  .share-teachers label{align-items:flex-start}
}

@media (max-width:420px){
  .dash-content{padding-inline:10px}
  .page-heading{padding:14px}
  .shell-card{padding:15px}
  .own-upload-card h3{font-size:16px}
  .breadcrumb{max-width:140px}
}
