* { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --page-bg:
        radial-gradient(circle at 12% 10%, rgba(255, 173, 173, 0.34) 0%, transparent 31%),
        radial-gradient(circle at 88% 10%, rgba(255, 210, 194, 0.3) 0%, transparent 31%),
        radial-gradient(circle at 54% 100%, rgba(255, 179, 179, 0.24), transparent 42%),
        linear-gradient(180deg, #fffafa 0%, #fff2f2 54%, #ffefef 100%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.32) 0 1px, rgba(110,64,64,0.028) 1px 2px, transparent 2px 5px);
      --panel: rgba(255, 255, 255, 0.9);
      --panel-strong: #ffffff;
      --panel-border: #efc2c2;
      --panel-shadow: 0 24px 60px rgba(141, 61, 61, 0.12);
      --accent: #8e2b2b;
      --accent-soft: #cf3f3f;
      --gold: #f24848;
      --text: #2f2323;
      --muted: #6f5656;
      --input-border: #ecd6d6;
      --input-bg: #fffbfb;
    }
    body {
      font-family: "Plus Jakarta Sans", sans-serif;
      background: var(--page-bg);
      color: var(--text);
      min-height: 100vh;
      background-attachment: fixed;
      scroll-padding-top: 112px;
    }
    .shell {
      max-width: 1420px;
      margin: 0 auto;
      padding: 112px 24px 40px;
    }
    .topbar {
      --menu-accent: #cf3f3f;
      --menu-panel-bg: #fff5f6;
      --menu-panel-border: #e4aaaa;
      --menu-panel-text: #3a2627;
      --menu-drawer-bg: #ffeef0;
      --menu-drawer-text: #3a2426;
      --menu-drawer-subtext: #5a3a3d;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 8px 12px;
      border: 1px solid #e4aaaa;
      border-bottom: 2px solid #cf3f3f;
      background: linear-gradient(135deg, #fff6f6 0%, #ffecec 52%, #fff2f2 100%);
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      width: 100%;
      z-index: 1200;
    }
    .top-left { display: flex; align-items: center; gap: clamp(28px, 5vw, 112px); min-width: 0; flex: 1; }
    .brand { display: flex; align-items: center; gap: 6px; text-decoration: none; }
    .brand img { width: 74px; height: 46px; display: block; object-fit: contain; }
    .brand-text {
      font-family: "Space Grotesk", sans-serif;
      font-size: 1.16rem;
      font-weight: 900;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      line-height: 1;
      color: #b02f2f;
      text-shadow: 0 1px 0 rgba(255,255,255,0.5), 0 2px 8px rgba(108, 35, 35, 0.2);
      white-space: nowrap;
    }
    nav { display: flex; align-items: center; }
    .menu-list { list-style: none; display: flex; align-items: center; gap: 16px; }
    .menu-item { position: relative; }
    .topbar .menu-link { text-decoration: none; color: #232c34; font-size: clamp(0.88rem, 0.25rem + 1vw, 1.25rem) !important; font-weight: 700 !important; display: inline-block; padding: 4px 0; white-space: nowrap; }
    .topbar .menu-link::after { content: " \25BE"; font-size: 1rem !important; color: #49535c; }
    .submenu { list-style: none; position: absolute; top: 100%; left: 0; min-width: 250px; background: linear-gradient(180deg, #fff7f7 0%, #ffeaea 100%); border-top: 2px solid #cf3f3f; box-shadow: 0 14px 24px rgba(96, 35, 35, .16); display: none; z-index: 50; }
    .submenu a { display: block; padding: 14px 16px; text-decoration: none; font-weight: 700; color: #1d2630; font-size: .92rem; }
    .submenu a:hover { background: linear-gradient(180deg, #ffeeee 0%, #ffdede 100%); }
    .menu-item:hover .submenu, .menu-item:focus-within .submenu { display: block; }
    .top-actions { display: flex; align-items: center; gap: 8px; }

    .account-layout {
      display: grid;
      grid-template-columns: 320px minmax(0, 1fr);
      gap: 28px;
      align-items: start;
    }
    .sidebar,
    .content-panel,
    .media-panel,
    .stats-panel {
      background: var(--panel);
      border: 1px solid var(--panel-border);
      border-radius: 28px;
      box-shadow: var(--panel-shadow);
      backdrop-filter: blur(14px);
    }
    .sidebar {
      padding: 18px;
      position: sticky;
      top: 98px;
      min-height: calc(100vh - 138px);
      display: flex;
      flex-direction: column;
    }
    .sidebar-profile {
      display: grid;
      grid-template-columns: 68px minmax(0, 1fr);
      gap: 14px;
      align-items: center;
      padding: 8px 4px 20px;
      border-bottom: 1px solid #efdfdf;
      margin-bottom: 16px;
    }
    .avatar-chip,
    .avatar-preview {
      position: relative;
      overflow: hidden;
      background: linear-gradient(180deg, #d3d3d3 0%, #c1c1c1 100%);
      display: grid;
      place-items: center;
    }
    .avatar-chip {
      width: 68px;
      height: 68px;
      border-radius: 18px;
    }
    .avatar-preview {
      width: 100%;
      aspect-ratio: 1 / 1;
      border-radius: 22px;
      border: 1px solid #ead6d6;
    }
    .avatar-chip::before,
    .avatar-preview::before {
      content: "";
      width: 34%;
      height: 34%;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.9);
      position: absolute;
      top: 18%;
    }
    .avatar-chip::after,
    .avatar-preview::after {
      content: "";
      width: 56%;
      height: 42%;
      border-radius: 999px 999px 20px 20px;
      background: rgba(255, 255, 255, 0.9);
      position: absolute;
      bottom: 7%;
    }
    .avatar-chip.has-image::before,
    .avatar-chip.has-image::after,
    .avatar-preview.has-image::before,
    .avatar-preview.has-image::after {
      display: none;
    }
    .avatar-chip img,
    .avatar-preview img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }
    .avatar-chip.has-image img,
    .avatar-preview.has-image img {
      display: block;
    }
    .profile-name {
      font-size: 1.02rem;
      font-weight: 800;
      line-height: 1.35;
    }
    .profile-email {
      margin-top: 4px;
      color: #7a6a84;
      word-break: break-word;
    }
    .side-nav {
      list-style: none;
      display: grid;
      gap: 8px;
    }
    .nav-link,
    .logout-btn {
      width: 100%;
      border: 0;
      background: transparent;
      display: flex;
      align-items: center;
      gap: 12px;
      text-align: left;
      font: inherit;
      color: var(--text);
      text-decoration: none;
      padding: 13px 16px;
      border-radius: 14px;
      font-weight: 800;
      cursor: pointer;
      transition: transform 180ms ease, background 180ms ease, color 180ms ease;
    }
    .nav-link:hover,
    .logout-btn:hover {
      background: linear-gradient(180deg, #fff2f2 0%, #ffe7e7 100%);
      transform: translateX(2px);
    }
    .nav-link.active {
      background: var(--accent);
      color: #fff;
      box-shadow: 0 12px 30px rgba(142, 43, 43, 0.24);
    }
    .nav-icon {
      width: 36px;
      height: 36px;
      flex: 0 0 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 12px;
      border: 1px solid #ead2d2;
      background: linear-gradient(180deg, #fffdfd 0%, #fff2f2 100%);
      color: #7d2f2f;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
      transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
    }
    .nav-icon svg {
      width: 18px;
      height: 18px;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.9;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .nav-link:hover .nav-icon,
    .logout-btn:hover .nav-icon {
      border-color: #dfb0b0;
      background: linear-gradient(180deg, #fff6f6 0%, #ffe8e8 100%);
      transform: translateY(-1px);
    }
    .nav-link.active .nav-icon {
      border-color: rgba(255, 255, 255, 0.22);
      background: rgba(255, 255, 255, 0.14);
      color: #fff;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    }
    .sidebar-footer {
      padding-top: 18px;
      margin-top: auto;
      border-top: 1px solid #efdfdf;
    }
    .logout-btn {
      border: 1px solid #efdddd;
      background: linear-gradient(180deg, #fffdfd 0%, #fff4f4 100%);
      border-radius: 18px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }

    .page-head {
      margin: 8px 0 28px;
    }
    .page-head h1 {
      font-family: "Space Grotesk", sans-serif;
      font-size: clamp(2.3rem, 4vw, 4rem);
      line-height: 0.95;
      letter-spacing: -0.04em;
      color: #1f1818;
      margin-bottom: 10px;
    }
    .page-head p {
      color: var(--muted);
      max-width: 720px;
      font-size: 1rem;
    }

    .content-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.65fr) 300px;
      gap: 24px;
      align-items: start;
    }
    .content-panel {
      padding: 22px;
    }
    .profile-form {
      display: grid;
      gap: 16px;
    }
    .field-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 16px 20px;
    }
    .field.span-2 {
      grid-column: span 2;
    }
    .field label {
      display: block;
      margin-bottom: 10px;
      font-weight: 800;
      color: #332626;
    }
    .required {
      color: #e44a35;
      margin-left: 2px;
    }
    .input,
    .select {
      width: 100%;
      border-radius: 14px;
      border: 1px solid var(--input-border);
      background: var(--input-bg);
      min-height: 58px;
      padding: 0 16px;
      font: inherit;
      color: var(--text);
      outline: none;
      transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
    }
    .input:focus,
    .select:focus {
      border-color: #d97777;
      box-shadow: 0 0 0 4px rgba(217, 119, 119, 0.14);
      transform: translateY(-1px);
    }
    .input[readonly] {
      color: #948282;
      background: #fff6f6;
    }
    .gender-row {
      display: flex;
      flex-wrap: wrap;
      gap: 18px;
      padding-top: 6px;
    }
    .gender-option {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      font-weight: 500;
      color: #2f2e31;
      cursor: pointer;
    }
    .gender-option input {
      width: 20px;
      height: 20px;
      accent-color: var(--accent);
    }
    .save-row {
      display: flex;
      align-items: center;
      gap: 14px;
      margin-top: 10px;
    }
    .save-btn {
      border: 0;
      border-radius: 14px;
      background: linear-gradient(135deg, #f24848 0%, #cf2f2f 60%, #a61f1f 100%);
      color: #fff;
      padding: 16px 22px;
      min-width: 210px;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
      box-shadow: 0 12px 26px rgba(166, 31, 31, 0.28);
      transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
    }
    .save-btn:hover {
      transform: translateY(-2px);
      filter: brightness(1.04);
      box-shadow: 0 16px 30px rgba(166, 31, 31, 0.34);
    }
    .save-status {
      color: var(--muted);
      font-size: 0.94rem;
      min-height: 1.4em;
    }
    .media-panel {
      padding: 24px;
      text-align: center;
    }
    .media-copy {
      margin: 18px 0 20px;
      color: #7a6868;
      line-height: 1.5;
      font-weight: 700;
    }
    .upload-label {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px dashed #d68a8a;
      color: var(--accent);
      background: linear-gradient(180deg, #fff8f8 0%, #fff0f0 100%);
      border-radius: 999px;
      min-height: 58px;
      padding: 0 22px;
      font-weight: 800;
      cursor: pointer;
      width: 100%;
    }
    /* Hidden the accessible way. With no size of its own the file input
       kept its natural width and ran 212px past a phone's right edge. */
    .upload-input {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      opacity: 0;
      pointer-events: none;
    }
    .stats-panel {
      margin-top: 24px;
      padding: 24px;
    }
    .stats-top {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 20px;
    }
    .stats-top h2 {
      font-family: "Space Grotesk", sans-serif;
      font-size: 1.8rem;
      color: #2a1d1d;
    }
    .clear-btn {
      border: 1px solid #e3b0b0;
      background: linear-gradient(180deg, #fff7f7 0%, #ffeeee 100%);
      color: #a03030;
      padding: 12px 16px;
      border-radius: 12px;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
    }
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 14px;
      margin-bottom: 18px;
    }
    .stat-card {
      border: 1px solid #efdddd;
      border-radius: 18px;
      background: linear-gradient(180deg, #fffdfd 0%, #fff3f3 100%);
      padding: 18px;
      display: grid;
      gap: 14px;
    }
    .stat-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .stat-card strong {
      display: block;
      font-size: 1.04rem;
      margin-bottom: 0;
    }
    .stat-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 32px;
      padding: 0 12px;
      border-radius: 999px;
      background: linear-gradient(135deg, #f24848 0%, #cf2f2f 60%, #a61f1f 100%);
      color: #fff;
      font-size: 0.82rem;
      font-weight: 800;
      white-space: nowrap;
    }
    .stat-meta {
      display: grid;
      gap: 10px;
    }
    .stat-row {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
      padding-bottom: 10px;
      border-bottom: 1px solid #f2e5e5;
    }
    .stat-row:last-child {
      padding-bottom: 0;
      border-bottom: 0;
    }
    .stat-label {
      color: #7d6868;
      font-size: 0.88rem;
      font-weight: 700;
    }
    .stat-value {
      color: #352828;
      font-size: 0.95rem;
      font-weight: 700;
      text-align: right;
      line-height: 1.4;
    }
    .stat-card span,
    .empty-state,
    .activity-list li,
    .book-list li {
      color: var(--muted);
      font-size: 0.95rem;
      line-height: 1.55;
    }
    .history-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
      gap: 20px;
    }
    .sub-card {
      border: 1px solid #efdddd;
      border-radius: 18px;
      padding: 18px;
      background: linear-gradient(180deg, #fffdfd 0%, #fff8f8 100%);
    }
    .sub-card h3 {
      margin-bottom: 12px;
      font-size: 1.02rem;
    }
    .book-list,
    .activity-list {
      list-style: none;
      display: grid;
      gap: 10px;
    }
    .result-list {
      list-style: none;
      display: grid;
      gap: 18px;
    }
    .result-item {
      border: 1px solid #efdddd;
      border-radius: 24px;
      background: linear-gradient(180deg, #fffefe 0%, #fff6f6 100%);
      padding: 22px;
      display: grid;
      gap: 18px;
    }
    .result-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
    }
    .result-title {
      display: grid;
      gap: 8px;
    }
    .result-title strong {
      display: block;
      font-size: 1.65rem;
      line-height: 1.05;
    }
    .result-subtitle {
      color: var(--muted);
      font-size: 0.96rem;
      line-height: 1.5;
    }
    .result-summary {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }
    .result-summary-card {
      border: 1px solid #f1e0e0;
      border-radius: 18px;
      background: linear-gradient(180deg, #fffaf9 0%, #fff2f2 100%);
      padding: 14px 16px;
      display: grid;
      gap: 6px;
    }
    .result-summary-label {
      color: #806868;
      font-size: 0.82rem;
      font-weight: 800;
      letter-spacing: 0.01em;
      text-transform: uppercase;
    }
    .result-summary-value {
      color: #2f2323;
      font-size: 1.2rem;
      font-weight: 800;
      line-height: 1.2;
    }
    .result-summary-note {
      color: var(--muted);
      font-size: 0.88rem;
      line-height: 1.45;
    }
    .attempt-list {
      list-style: none;
      display: grid;
      gap: 12px;
    }
    .attempt-item {
      border: 1px solid #efdfdf;
      border-radius: 18px;
      background: linear-gradient(180deg, #fffdfd 0%, #fff9f9 100%);
      padding: 16px;
      display: grid;
      gap: 12px;
    }
    .attempt-actions {
      display: flex;
      justify-content: flex-start;
    }
    .attempt-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      padding: 0 14px;
      border-radius: 999px;
      border: 1px solid #e3b0b0;
      background: linear-gradient(180deg, #fff7f7 0%, #ffeeee 100%);
      color: var(--accent);
      text-decoration: none;
      font-size: 0.88rem;
      font-weight: 800;
    }
    .attempt-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .attempt-label {
      font-size: 1rem;
      font-weight: 800;
      color: #2f2323;
    }
    .attempt-score {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 34px;
      padding: 0 12px;
      border-radius: 999px;
      background: linear-gradient(135deg, #f24848 0%, #cf2f2f 60%, #a61f1f 100%);
      color: #fff;
      font-size: 0.88rem;
      font-weight: 800;
      white-space: nowrap;
    }
    .attempt-meta {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px 14px;
    }
    .attempt-meta-row {
      display: grid;
      gap: 4px;
    }
    .attempt-meta-label {
      color: #806868;
      font-size: 0.76rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }
    .attempt-meta-value {
      color: #3b2d2d;
      font-size: 0.93rem;
      font-weight: 700;
      line-height: 1.45;
      word-break: break-word;
    }
    .login-list {
      list-style: none;
      display: grid;
      gap: 12px;
    }
    .login-item {
      border: 1px solid #efdddd;
      border-radius: 18px;
      background: linear-gradient(180deg, #fffdfd 0%, #fff7f7 100%);
      padding: 16px;
      display: grid;
      gap: 10px;
    }
    .login-item-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .login-item-title {
      font-size: 1rem;
      font-weight: 800;
      color: #2f2323;
    }
    .login-item-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 32px;
      padding: 0 12px;
      border-radius: 999px;
      background: linear-gradient(180deg, #fff7f7 0%, #ffeeee 100%);
      border: 1px solid #efcfcf;
      color: var(--accent);
      font-size: 0.82rem;
      font-weight: 800;
      white-space: nowrap;
    }
    .login-item-meta {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px 14px;
    }
    .login-meta-row {
      display: grid;
      gap: 4px;
    }
    .login-meta-label {
      color: #806868;
      font-size: 0.76rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }
    .login-meta-value {
      color: #3b2d2d;
      font-size: 0.93rem;
      font-weight: 700;
      line-height: 1.45;
      word-break: break-word;
    }
    .result-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      margin-top: 4px;
      min-height: 48px;
      padding: 0 18px;
      border-radius: 999px;
      border: 1px solid #e3b0b0;
      background: linear-gradient(180deg, #fff7f7 0%, #ffeeee 100%);
      color: var(--accent);
      text-decoration: none;
      font-weight: 800;
      justify-self: start;
    }
    .section-anchor {
      scroll-margin-top: 110px;
    }
    .right-panel {
      min-width: 0;
    }
    .view-panel {
      display: none;
    }
    .view-panel.active {
      display: block;
    }
    .premium-summary,
    .admin-shell,
    .admin-list-card {
      border: 1px solid #efdddd;
      border-radius: 22px;
      background: linear-gradient(180deg, #fffefe 0%, #fff5f5 100%);
      box-shadow: 0 18px 38px rgba(141, 61, 61, 0.08);
    }
    /* ---- Premium bo'limi: imtihon varag'i + xavfsizlik bosmasi muhri ----
       The section is styled as a ruled exam sheet and the status is applied as
       a security-print rubber stamp. --ink is switched by the tone class that
       syncPremiumTone() mirrors from the pill, so one variable drives every
       stamp colour. */
    .premium-summary {
      --ink: #9a8585;
      position: relative;
      overflow: hidden;
      padding: 16px 24px 16px 60px;
      margin-bottom: 22px;
      min-height: 112px;
      background-color: #fffcfb;
      background-image: repeating-linear-gradient(0deg, rgba(142, 43, 43, 0.055) 0 1px, transparent 1px 27px);
      border-color: #f2dcdc;
    }
    .premium-summary.is-approved { --ink: #2d6a4a; }
    .premium-summary.is-blocked { --ink: #a52222; }
    /* Red margin rule and punch holes of the sheet. */
    .premium-summary::before {
      content: "";
      position: absolute;
      left: 44px;
      top: 0;
      bottom: 0;
      width: 2px;
      background: rgba(207, 63, 63, 0.3);
    }
    .premium-summary::after {
      content: "";
      position: absolute;
      left: 16px;
      top: 0;
      bottom: 0;
      width: 12px;
      background-image: radial-gradient(circle at 6px 12px, rgba(142, 43, 43, 0.14) 4.5px, transparent 5px);
      background-size: 12px 44px;
      background-repeat: repeat-y;
    }
    .premium-summary-top { margin-bottom: 6px; }
    .premium-summary-top h2 {
      font-family: "Space Grotesk", sans-serif;
      font-size: 1.18rem;
      line-height: 1.2;
      color: var(--accent);
      margin-bottom: 4px;
      max-width: 58%;
    }
    .premium-summary .save-status {
      font-size: 0.8rem;
      letter-spacing: 0.02em;
      color: #a58c8c;
      max-width: 58%;
      min-height: 0;
    }
    .premium-meta {
      font-size: 0.9rem;
      line-height: 1.62;
      color: var(--muted);
      max-width: 58%;
    }
    /* ---- muhr ---- */
    .premium-stamp {
      position: absolute;
      right: 20px;
      top: 18px;
      width: 152px;
      color: var(--ink);
      border: 2px solid currentColor;
      border-radius: 4px;
      box-shadow: inset 0 0 0 1px currentColor;
      font-family: "Space Grotesk", sans-serif;
      text-align: center;
      text-transform: uppercase;
      opacity: 0;
    }
    .premium-summary.is-approved .premium-stamp,
    .premium-summary.is-blocked .premium-stamp { opacity: 0.88; }
    .premium-stamp-micro {
      display: block;
      font-size: 0.33rem;
      letter-spacing: 0.12em;
      font-weight: 800;
      opacity: 0.75;
      padding: 2px 0;
      border-bottom: 1px solid currentColor;
      white-space: nowrap;
      overflow: hidden;
    }
    .premium-stamp-core {
      display: block;
      padding: 5px 7px;
      background-image: repeating-linear-gradient(45deg, currentColor 0 0.5px, transparent 0.5px 5px);
    }
    .premium-stamp-core-in {
      display: block;
      background: #fffcfb;
      border-radius: 2px;
      padding: 5px 5px;
    }
    /* The status word is the pill element, so JS keeps writing it unchanged.
       The chip look is reset here only inside the stamp - admin tables still
       use .premium-pill as a rounded chip. */
    .premium-stamp .premium-pill {
      display: block;
      min-height: 0;
      padding: 0;
      border-radius: 0;
      background: none;
      box-shadow: none;
      color: inherit;
      font-family: inherit;
      font-size: 0.85rem;
      font-weight: 700;
      letter-spacing: 0.1em;
      line-height: 1.15;
      white-space: normal;
    }
    .premium-stamp .premium-pill::before { content: none; }
    .premium-stamp-date {
      display: block;
      margin-top: 4px;
      padding-top: 3px;
      border-top: 1px solid currentColor;
      font-size: 0.5rem;
      letter-spacing: 0.13em;
      font-weight: 700;
      opacity: 0.9;
    }
    .premium-stamp-date[hidden] { display: none; }
    .premium-stamp-foot {
      display: block;
      font-size: 0.38rem;
      letter-spacing: 0.14em;
      font-weight: 800;
      padding: 2px 0;
      border-top: 1px solid currentColor;
      opacity: 0.8;
    }
    @media (prefers-reduced-motion: no-preference) {
      .premium-summary.is-approved .premium-stamp,
      .premium-summary.is-blocked .premium-stamp {
        animation: premiumStampPress 640ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
      }
    }
    @keyframes premiumStampPress {
      0% { opacity: 0; transform: scale(2.2); }
      55% { opacity: 0.96; transform: scale(0.93); }
      72% { transform: scale(1.04); }
      100% { opacity: 0.88; transform: scale(1); }
    }
    @media (max-width: 700px) {
      .premium-summary {
        padding: 16px 16px 110px 54px;
        min-height: 0;
      }
      .premium-summary-top h2,
      .premium-summary .save-status,
      .premium-meta { max-width: 100%; }
      .premium-stamp { right: auto; left: 54px; top: auto; bottom: 18px; }
    }
    .admin-shell {
      padding: 24px;
      display: grid;
      gap: 20px;
    }
    .admin-section-nav {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      margin: 6px 0 18px;
    }
    .admin-section-btn {
      border: 1px solid #e5b6b6;
      background: #fff8f8;
      color: #8e2b2b;
      border-radius: 14px;
      padding: 12px 16px;
      font-weight: 800;
      cursor: pointer;
    }
    .admin-section-btn.is-active {
      background: linear-gradient(135deg, #c63a3a 0%, #a72f2f 100%);
      color: #fff;
      border-color: #a72f2f;
      box-shadow: 0 14px 28px rgba(167, 47, 47, 0.18);
    }
    .admin-subsection[hidden] {
      display: none !important;
    }
    .admin-form-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.3fr) 220px;
      gap: 16px;
    }
    .admin-export-grid {
      grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
      align-items: start;
    }
    .admin-export-selection-field {
      min-width: 0;
    }
    .admin-export-list {
      display: grid;
      gap: 8px;
      max-height: 360px;
      overflow: auto;
      padding: 10px;
      border: 1px solid var(--input-border);
      border-radius: 14px;
      background: var(--input-bg);
    }
    .admin-export-option {
      display: grid;
      grid-template-columns: 22px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
      min-height: 48px;
      padding: 10px 12px;
      border: 1px solid #efdddd;
      border-radius: 12px;
      background: #fff;
      cursor: pointer;
    }
    .admin-export-option input {
      width: 18px;
      height: 18px;
      margin-top: 2px;
      accent-color: var(--accent);
    }
    .admin-export-title {
      display: block;
      color: #332626;
      font-size: 0.94rem;
      font-weight: 800;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }
    .admin-export-path {
      display: block;
      margin-top: 3px;
      color: var(--muted);
      font-size: 0.82rem;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }
    .admin-actions {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      align-items: center;
    }
    .admin-note {
      min-height: 1.4em;
      color: var(--muted);
      font-size: 0.94rem;
    }
    .admin-search-row {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      align-items: center;
    }
    .admin-search-row .input {
      max-width: 360px;
    }
    .admin-section-intro {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }
    .admin-section-copy h4 {
      margin: 0;
      font-size: 1rem;
      color: #5f4343;
    }
    .admin-section-copy p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 0.92rem;
      line-height: 1.5;
    }
    .admin-list-meta {
      color: #7c5b5b;
      font-size: 0.86rem;
      font-weight: 700;
      white-space: nowrap;
    }
    .admin-stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 14px;
    }
    .admin-stat-box {
      border: 1px solid #f0d6d6;
      border-radius: 18px;
      background: linear-gradient(180deg, #fffefe 0%, #fff8f8 100%);
      padding: 16px 18px;
    }
    .admin-stat-title {
      color: #6f5656;
      font-size: 0.82rem;
      font-weight: 800;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    .admin-stat-value {
      margin-top: 10px;
      color: var(--ink);
      font-size: 1.7rem;
      font-weight: 900;
      line-height: 1;
    }
    .suggestions {
      margin-top: 10px;
      border: 1px solid #f0d6d6;
      border-radius: 18px;
      background: linear-gradient(180deg, #fffefe 0%, #fff7f7 100%);
      padding: 10px;
      display: none;
      gap: 8px;
    }
    .suggestions.active {
      display: grid;
    }
    .suggestion-chip {
      border: 1px solid #e3b0b0;
      border-radius: 999px;
      background: linear-gradient(180deg, #fff9f9 0%, #ffeeee 100%);
      color: var(--accent);
      min-height: 38px;
      padding: 0 14px;
      font: inherit;
      font-weight: 700;
      text-align: left;
      cursor: pointer;
    }
    .email-bank-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }
    .email-pill {
      border: 1px solid #f0d6d6;
      border-radius: 16px;
      background: linear-gradient(180deg, #fffefe 0%, #fff6f6 100%);
      padding: 12px 14px;
      color: #533f3f;
      font-size: 0.92rem;
      line-height: 1.5;
      cursor: pointer;
      word-break: break-word;
      text-align: left;
      font-family: inherit;
    }
    .admin-empty {
      border: 1px dashed #efc6c6;
      border-radius: 18px;
      padding: 22px;
      color: var(--muted);
      background: linear-gradient(180deg, #fffdfd 0%, #fff8f8 100%);
    }
    .admin-list-card {
      padding: 20px 22px;
      overflow: hidden;
    }
    .admin-table-scroll {
      width: 100%;
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
    }
    .admin-list-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 16px;
      flex-wrap: wrap;
    }
    .admin-table {
      width: 100%;
      border-collapse: collapse;
      min-width: 860px;
    }
    .admin-table th,
    .admin-table td {
      text-align: left;
      padding: 14px 10px;
      border-bottom: 1px solid #f1e1e1;
      vertical-align: top;
      font-size: 0.94rem;
    }
    .admin-table th {
      color: #6f5656;
      font-size: 0.82rem;
      font-weight: 800;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }
    .admin-row-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
    }
    .admin-table.admin-bans-table {
      min-width: 1100px;
      table-layout: fixed;
    }
    .admin-bans-table th,
    .admin-bans-table td {
      padding: 12px 10px;
      vertical-align: top;
      word-break: normal;
    }
    .admin-bans-table .ban-col-email   { width: 200px; }
    .admin-bans-table .ban-col-device  { width: 170px; }
    .admin-bans-table .ban-col-ip      { width: 130px; }
    .admin-bans-table .ban-col-status  { width: 90px; }
    .admin-bans-table .ban-col-reason  { width: auto; min-width: 220px; }
    .admin-bans-table .ban-col-banned  { width: 130px; }
    .admin-bans-table .ban-col-lifted  { width: 130px; }
    .admin-bans-table .ban-col-action  { width: 110px; }
    .admin-bans-table td.ban-col-device,
    .admin-bans-table td.ban-col-ip,
    .admin-bans-table td.ban-col-banned,
    .admin-bans-table td.ban-col-lifted {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .admin-bans-table td.ban-col-device {
      font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
      font-size: 0.82rem;
      color: #555;
    }
    .admin-bans-table td.ban-col-reason {
      white-space: normal;
      word-break: break-word;
      line-height: 1.45;
    }
    .admin-bans-table td.ban-col-email {
      word-break: break-word;
      line-height: 1.4;
    }
    .admin-radio-group {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      align-items: center;
    }
    .admin-radio-option {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.92rem;
      color: #3a2627;
      white-space: nowrap;
    }
    .admin-bulk-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    .admin-filter-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 10px;
    }
    .admin-pagination {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      margin-top: 16px;
      padding-top: 14px;
      border-top: 1px solid #f1e1e1;
    }
    .admin-pagination-info {
      color: #7c5b5b;
      font-size: 0.9rem;
      font-weight: 700;
    }
    .admin-pagination-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .pagination-btn {
      min-width: 40px;
      height: 40px;
      border-radius: 12px;
      border: 1px solid #e3b0b0;
      background: linear-gradient(180deg, #fff7f7 0%, #ffeeee 100%);
      color: #8e2b2b;
      font: inherit;
      font-size: 0.88rem;
      font-weight: 800;
      cursor: pointer;
      padding: 0 12px;
    }
    .pagination-btn.is-active {
      border-color: #b53030;
      background: linear-gradient(135deg, #f24848, #b72b2b);
      color: #fff;
    }
    .pagination-btn:disabled {
      opacity: 0.45;
      cursor: default;
    }
    .mini-btn {
      border: 1px solid #e3b0b0;
      background: linear-gradient(180deg, #fff7f7 0%, #ffeeee 100%);
      color: #8e2b2b;
      padding: 10px 12px;
      border-radius: 12px;
      font: inherit;
      font-size: 0.86rem;
      font-weight: 800;
      cursor: pointer;
    }
    .mini-btn.is-danger {
      border-color: #e0a5a5;
      color: #a01f1f;
    }
    .admin-gate {
      display: none;
    }
    .admin-gate.is-visible {
      display: block;
    }
    @media (max-width: 980px) {
      .admin-form-grid {
        grid-template-columns: 1fr;
      }
      .admin-stats,
      .email-bank-grid {
        grid-template-columns: 1fr;
      }
      .admin-pagination {
        align-items: stretch;
      }
      .admin-pagination-actions {
        width: 100%;
      }
    }

    @media (max-width: 1180px) {
      .account-layout,
      .content-grid {
        grid-template-columns: 1fr;
      }
      .sidebar {
        position: static;
      }
    }
    @media (max-width: 760px) {
      .shell { padding: 104px 16px 28px; }
      .top-left { flex-direction: column; align-items: flex-start; gap: 8px; }
      .brand img { width: 88px; height: auto; }
      .brand-text { font-size: 0.98rem; }
      .menu-list { gap: 12px; }
      .topbar .menu-link::after { content: ""; }
      .submenu { position: static; display: none; box-shadow: none; border: 1px solid #c5d3dc; margin-top: 6px; }
      .field-grid,
      .stats-grid,
      .history-grid {
        grid-template-columns: 1fr;
      }
      .stat-row {
        align-items: flex-start;
        flex-direction: column;
      }
      .stat-value {
        text-align: left;
      }
      .result-head,
      .attempt-head {
        align-items: flex-start;
        flex-direction: column;
      }
      .result-summary,
      .attempt-meta,
      .login-item-meta {
        grid-template-columns: 1fr;
      }
      .field.span-2 {
        grid-column: span 1;
      }
      .save-row,
      .stats-top {
        align-items: stretch;
        flex-direction: column;
      }
      .save-btn {
        width: 100%;
      }
      .sidebar-profile {
        grid-template-columns: 56px minmax(0, 1fr);
      }
      .avatar-chip {
        width: 56px;
        height: 56px;
      }
    }

    /* The sign-out confirmation.

       Closed is the default and it is the class that opens it, not a style
       account.js writes: the page ships with the dialog in the markup, and
       between HTML and script arriving there must be nothing to see.

       z-index sits above the topbar (which uses 1200) and below the blocked
       -device modal progress-tracker.js injects at 1450 - a student who is
       banned mid-session should not have this in front of that notice. */
    .confirm-modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
      background: rgba(47, 21, 21, 0.5);
      backdrop-filter: blur(4px);
      z-index: 1300;
    }
    .confirm-modal.is-open {
      display: flex;
    }
    .confirm-card {
      width: min(460px, 100%);
      padding: 28px;
      border-radius: 22px;
      background: linear-gradient(180deg, #fffdfd 0%, #fff2f2 100%);
      border: 1px solid var(--panel-border);
      box-shadow: 0 30px 80px rgba(113, 33, 33, 0.26);
    }
    .confirm-title {
      margin: 0 0 10px;
      color: var(--accent);
      font-size: 1.3rem;
      font-weight: 800;
    }
    .confirm-text {
      margin: 0;
      color: var(--muted);
      font-size: 0.98rem;
      line-height: 1.6;
    }
    .confirm-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 22px;
    }
    .confirm-btn {
      min-width: 150px;
      height: 48px;
      border-radius: 14px;
      border: 1px solid #e3b0b0;
      background: #fff;
      color: var(--accent);
      font: inherit;
      font-weight: 800;
      cursor: pointer;
      transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
    }
    .confirm-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 12px 22px rgba(142, 43, 43, 0.16);
    }
    .confirm-btn.primary {
      border-color: #b53030;
      background: linear-gradient(135deg, #f24848 0%, #cf2f2f 60%, #a61f1f 100%);
      color: #fff;
    }
    .confirm-btn:disabled {
      cursor: progress;
      filter: grayscale(0.3);
      transform: none;
    }
    /* Stacked, and the destructive one last: on a phone the thumb rests at
       the bottom of the screen, so the button nearest it should be the one
       that does nothing. */
    @media (max-width: 560px) {
      .confirm-actions {
        flex-direction: column-reverse;
      }
      .confirm-btn {
        width: 100%;
      }
    }

    /* The speaking partner card on the overview (partner.services.practice_stats). */
    .partner-stats .stats-top {
      align-items: center;
    }
    .partner-stats-link {
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 0 18px;
      border-radius: 999px;
      background: #cf3f3f;
      color: #ffffff;
      font-weight: 800;
      font-size: 0.9rem;
      text-decoration: none;
      box-shadow: 0 8px 18px rgba(207, 63, 63, 0.24);
      white-space: nowrap;
    }
    .partner-stats-link:hover {
      background: #b02f2f;
    }
    .partner-stats-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin: 16px 0;
    }
    .partner-stat {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 16px;
      border-radius: 16px;
      background: #fff6f6;
      border: 1px solid #f0d2d2;
    }
    .partner-stat strong {
      font-family: "Space Grotesk", sans-serif;
      font-size: 1.9rem;
      line-height: 1;
      color: #b02f2f;
      font-variant-numeric: tabular-nums;
    }
    .partner-stat span {
      font-size: 0.84rem;
      color: #6d5252;
    }
    .partner-bands-card {
      padding: 16px;
      border-radius: 16px;
      background: #ffffff;
      border: 1px solid #f0d2d2;
    }
    .partner-bands-card h3 {
      margin: 0 0 10px;
      font-size: 1rem;
    }
    .partner-bands-list {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 10px;
      margin: 0 0 8px;
      padding: 0;
      list-style: none;
    }
    .partner-bands-list li {
      display: flex;
      flex-direction: column;
      gap: 2px;
      font-size: 0.84rem;
      color: #6d5252;
    }
    .partner-bands-list strong {
      font-size: 1.4rem;
      color: #3a2627;
      font-variant-numeric: tabular-nums;
    }
    @media (max-width: 760px) {
      .partner-stats-grid,
      .partner-bands-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .partner-stats .stats-top {
        flex-wrap: wrap;
        gap: 12px;
      }
    }
