:root {
  --ink: #111827;
  --muted: #6b7280;
  --subtle: #9ca3af;
  --line: #e5e7eb;
  --line-soft: #f0f1f3;
  --surface: #ffffff;
  --canvas: #f9fafb;
  --sidebar: #111827;
  --sidebar-muted: #9ca3af;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow: 0 22px 60px rgba(17, 24, 39, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); background: var(--canvas); font-family: "Segoe UI", "Microsoft YaHei", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }

/* Login page: retains the existing secure login flow while using the template's clean card language. */
.login-page { min-height: 100vh; background: #f9fafb; }
.login-shell { display: grid; grid-template-columns: minmax(420px, .92fr) minmax(500px, 1.08fr); min-height: 100vh; }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(48px, 8vw, 120px); color: #eef2ff; background: linear-gradient(145deg, #111827 0%, #1e1b4b 56%, #4338ca 100%); }
.login-brand::before, .login-brand::after { position: absolute; border: 1px solid rgba(199, 210, 254, .16); border-radius: 50%; content: ""; pointer-events: none; }
.login-brand::before { width: 620px; height: 620px; right: -275px; top: -170px; }
.login-brand::after { width: 410px; height: 410px; left: -260px; bottom: -165px; }
.brand-mark, .template-logo { position: relative; z-index: 1; display: flex; gap: 4px; align-items: end; width: 42px; height: 38px; margin-bottom: 32px; }
.brand-mark span, .template-logo span { display: block; width: 10px; border-radius: 4px 4px 2px 2px; background: #a5b4fc; box-shadow: 0 4px 10px rgba(129, 140, 248, .25); }
.brand-mark span:nth-child(1), .template-logo span:nth-child(1) { height: 22px; opacity: .75; }
.brand-mark span:nth-child(2), .template-logo span:nth-child(2) { height: 35px; background: #818cf8; }
.brand-mark span:nth-child(3), .template-logo span:nth-child(3) { height: 28px; opacity: .88; }
.brand-mark.small { width: 34px; height: 30px; margin: 0; }
.brand-mark.small span, .template-logo span { width: 8px; }
.brand-mark.small span:nth-child(1), .template-logo span:nth-child(1) { height: 17px; }
.brand-mark.small span:nth-child(2), .template-logo span:nth-child(2) { height: 28px; }
.brand-mark.small span:nth-child(3), .template-logo span:nth-child(3) { height: 23px; }
.eyebrow { margin: 0 0 9px; color: #9ca3af; font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.login-brand .eyebrow { position: relative; z-index: 1; color: #c7d2fe; }
.login-brand h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(33px, 4vw, 57px); font-weight: 700; letter-spacing: -.045em; line-height: 1.18; }
.brand-description { position: relative; z-index: 1; max-width: 470px; margin: 28px 0 0; color: #c7d2fe; font-size: 15px; line-height: 1.9; }
.security-points { position: relative; z-index: 1; display: grid; gap: 22px; margin-top: 66px; }
.security-points div { display: grid; gap: 3px; padding-left: 19px; border-left: 2px solid #818cf8; }
.security-points strong { font-size: 14px; letter-spacing: .04em; }
.security-points span { color: #a5b4fc; font-size: 12px; }
.login-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 60px 7vw; background: #f9fafb; }
.login-card { width: min(100%, 472px); padding: 47px 48px 40px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .96); box-shadow: var(--shadow); }
.mobile-brand { display: none; }
.login-heading { display: flex; gap: 9px; align-items: center; margin-bottom: 23px; color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .07em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(16, 185, 129, .12); }
.login-card h2 { margin: 0 0 9px; font-size: 32px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 31px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.field { display: block; margin-bottom: 21px; }
.field > span:first-child { display: block; margin-bottom: 9px; color: #374151; font-size: 13px; font-weight: 700; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg { position: absolute; left: 15px; width: 18px; height: 18px; fill: none; stroke: #9ca3af; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; pointer-events: none; }
.input-wrap input { width: 100%; height: 48px; padding: 0 45px; border: 1px solid #d1d5db; border-radius: 8px; outline: 0; color: var(--ink); background: #fff; transition: .2s ease; }
.input-wrap input::placeholder { color: #9ca3af; }
.input-wrap input:focus { border-color: #818cf8; background: #fff; box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }
.icon-button { display: grid; place-items: center; border: 0; border-radius: 8px; color: #6b7280; background: transparent; }
.icon-button:hover { color: var(--primary-dark); background: #eef2ff; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.login-card .icon-button { position: absolute; right: 5px; width: 37px; height: 37px; }
.captcha-row { display: grid; grid-template-columns: 1fr 126px; gap: 10px; align-items: center; }
.captcha-input input { padding-right: 12px; letter-spacing: .22em; text-transform: uppercase; }
.captcha-image { position: relative; display: block; overflow: hidden; width: 100%; height: 48px; padding: 0; border: 1px solid #d1d5db; border-radius: 8px; background: #f3f4f6; }
.captcha-image:hover { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, .1); }
.captcha-image img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; background: #f4f8fb; }
#captcha-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #6b7280; font-size: 11px; }
#captcha-loading[hidden] { display: none; }
.form-message { min-height: 20px; margin: -4px 0 10px; color: #dc2626; font-size: 12px; line-height: 1.6; }
.form-message.success { color: #059669; }
.primary-button { display: flex; width: 100%; height: 48px; gap: 10px; align-items: center; justify-content: center; border: 0; border-radius: 8px; color: #fff; background: var(--primary); font-size: 13px; font-weight: 700; transition: .2s ease; }
.primary-button:hover { background: var(--primary-dark); }
.primary-button:disabled { opacity: .65; }
.primary-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.login-help { margin: 25px 0 0 !important; color: #9ca3af !important; font-size: 11px !important; line-height: 1.7 !important; }
.copyright { margin: 24px 0 0; color: #9ca3af; font-size: 11px; }

/* Admin panel template layout. */
.dashboard-page { background: var(--canvas); }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; display: flex; width: 232px; flex-direction: column; color: #f9fafb; background: var(--sidebar); transition: transform .2s ease, width .2s ease; }
.sidebar-top { padding: 22px 16px; }
.sidebar-brand { display: flex; gap: 11px; align-items: center; min-height: 42px; margin: 0 8px 31px; }
.sidebar-brand .template-logo { flex: 0 0 34px; margin: 0; }
.sidebar-brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.sidebar-brand small { display: block; margin-top: 3px; color: #6b7280; font-size: 8px; font-weight: 700; letter-spacing: .13em; }
.sidebar-section-title { margin: 0 10px 10px; color: #6b7280; font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-section-secondary { margin-top: 27px; }
.sidebar-nav { display: grid; gap: 3px; }
.nav-item { display: flex; width: 100%; min-height: 40px; gap: 11px; align-items: center; padding: 0 10px; border: 0; border-radius: 8px; color: var(--sidebar-muted); background: transparent; font-size: 12px; text-align: left; transition: .2s ease; }
.nav-item:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-item.active { color: #fff; background: rgba(99, 102, 241, .22); box-shadow: inset 3px 0 0 var(--primary); }
.nav-item.unavailable { opacity: .54; }
.nav-symbol { display: grid; width: 20px; height: 20px; place-items: center; color: #9ca3af; font-size: 16px; line-height: 1; }
.nav-item.active .nav-symbol { color: #a5b4fc; }
.nav-item em { margin-left: auto; color: #6b7280; font-size: 9px; font-style: normal; white-space: nowrap; }
.sidebar-footer { display: flex; gap: 10px; align-items: center; margin-top: auto; padding: 17px 23px; border-top: 1px solid rgba(255,255,255,.08); }
.health-light { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .12); }
.sidebar-footer strong, .sidebar-footer small { display: block; }
.sidebar-footer strong { color: #d1d5db; font-size: 10px; }
.sidebar-footer small { margin-top: 4px; color: #6b7280; font-size: 9px; }
.sidebar-overlay { position: fixed; z-index: 35; inset: 0; background: rgba(17, 24, 39, .42); }
.dashboard-main { min-height: 100vh; margin-left: 232px; }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; min-height: 75px; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 33px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); }
.topbar-left { display: flex; gap: 15px; align-items: center; }
.topbar-left h1 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
.topbar-toggle { width: 34px; height: 34px; font-size: 17px; }
.admin-menu { display: flex; gap: 10px; align-items: center; }
.admin-identity { min-width: 90px; }
.admin-identity strong, .admin-identity small { display: block; }
.admin-identity strong { max-width: 155px; overflow: hidden; color: #374151; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity small { margin-top: 3px; color: #9ca3af; font-size: 9px; }
.avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #4f46e5; background: #e0e7ff; font-size: 13px; font-weight: 700; }
.secondary-button { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; color: #4b5563; background: #fff; font-size: 11px; font-weight: 700; transition: .2s ease; }
.secondary-button:hover { border-color: #a5b4fc; color: var(--primary-dark); background: #eef2ff; }
.secondary-button:disabled { opacity: .65; }
.notification-wrap { position: relative; }
.notification-button { position: relative; width: 34px; height: 34px; margin-right: 4px; font-size: 20px; }
.notification-dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border: 1px solid #fff; border-radius: 50%; background: #ef4444; }
.notification-panel { position: absolute; top: 43px; right: 0; width: 312px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 14px 35px rgba(17, 24, 39, .13); }
.notification-heading { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.plain-icon { width: 23px; height: 23px; border: 0; border-radius: 5px; color: #9ca3af; background: transparent; font-size: 18px; line-height: 1; }
.plain-icon:hover { color: #4b5563; background: #f3f4f6; }
.notification-item { display: flex; gap: 10px; padding: 13px 15px; border-bottom: 1px solid #f9fafb; }
.notification-status { display: grid; width: 22px; height: 22px; flex: 0 0 22px; place-items: center; margin-top: 1px; border-radius: 50%; font-size: 11px; font-weight: 700; }
.notification-status.success { color: #059669; background: #d1fae5; }
.notification-status.info { color: #4f46e5; background: #e0e7ff; }
.notification-item strong { display: block; color: #374151; font-size: 11px; }
.notification-item p { margin: 4px 0; color: #6b7280; font-size: 10px; line-height: 1.55; }
.notification-item small { color: #9ca3af; font-size: 9px; }
.page-content { max-width: 1280px; margin: 0 auto; padding: 31px 33px 55px; }
.welcome-card { display: flex; min-height: 158px; gap: 30px; align-items: center; justify-content: space-between; margin-bottom: 30px; padding: 29px 33px; border-radius: 12px; color: #eef2ff; background: linear-gradient(115deg, #312e81 0%, #4f46e5 100%); box-shadow: 0 16px 30px rgba(79, 70, 229, .2); }
.status-pill { display: inline-flex; gap: 7px; align-items: center; padding: 6px 10px; border-radius: 20px; color: #bbf7d0; background: rgba(167, 243, 208, .13); font-size: 10px; }
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: #6ee7b7; }
.welcome-card h2 { margin: 15px 0 7px; font-size: 24px; letter-spacing: -.035em; }
.welcome-card p { margin: 0; color: #c7d2fe; font-size: 11px; }
.session-stat { min-width: 190px; padding-left: 28px; border-left: 1px solid rgba(224, 231, 255, .25); }
.session-stat span, .session-stat small { display: block; color: #c7d2fe; font-size: 10px; }
.session-stat strong { display: block; margin: 8px 0 4px; font-size: 25px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 0 0 14px; }
.section-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
.section-hint { color: #9ca3af; font-size: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 30px; }
.metric-card { display: flex; min-height: 115px; gap: 13px; align-items: flex-start; padding: 20px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); transition: transform .2s ease, box-shadow .2s ease; }
.metric-card:hover { transform: translateY(-2px); box-shadow: 0 9px 22px rgba(17, 24, 39, .06); }
.metric-icon { display: grid; width: 33px; height: 33px; flex: 0 0 33px; place-items: center; border-radius: 8px; font-size: 15px; font-weight: 700; }
.metric-icon.blue { color: #4f46e5; background: #e0e7ff; }.metric-icon.green { color: #059669; background: #d1fae5; }.metric-icon.orange { color: #d97706; background: #fef3c7; }.metric-icon.purple { color: #7c3aed; background: #ede9fe; }
.metric-card small, .metric-card strong, .metric-card p { display: block; }.metric-card small { margin-bottom: 7px; color: #6b7280; font-size: 10px; }.metric-card strong { font-size: 14px; }.metric-card p { margin: 7px 0 0; color: #9ca3af; font-size: 10px; line-height: 1.4; }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.content-card { padding: 27px 29px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.card-title { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding-bottom: 19px; border-bottom: 1px solid var(--line-soft); }
.card-title h2 { margin: 0; font-size: 17px; }.complete-badge, .account-badge { padding: 6px 9px; border-radius: 5px; color: #059669; background: #ecfdf5; font-size: 9px; font-weight: 700; white-space: nowrap; }.account-badge { color: #4f46e5; background: #eef2ff; }
.check-list { display: grid; gap: 20px; margin: 23px 0 0; padding: 0; list-style: none; }.check-list li { display: flex; gap: 12px; }.check-list li > span { display: grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; border-radius: 50%; color: #059669; background: #d1fae5; font-size: 12px; font-weight: 700; }.check-list strong { font-size: 11px; }.check-list p { margin: 5px 0 0; color: #9ca3af; font-size: 10px; line-height: 1.55; }
.account-card dl { margin: 21px 0; }.account-card dl div { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }.account-card dt { color: #9ca3af; font-size: 10px; }.account-card dd { max-width: 65%; margin: 0; color: #374151; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; text-align: right; }.account-note { margin: 0; padding: 11px 12px; border-radius: 6px; color: #6b7280; background: #f9fafb; font-size: 10px; line-height: 1.65; }
.info-strip { display: flex; gap: 11px; align-items: flex-start; margin-top: 20px; padding: 15px 17px; border: 1px solid #e0e7ff; border-radius: 9px; color: #4b5563; background: #f5f7ff; }.info-icon { display: grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; border-radius: 50%; color: #4f46e5; background: #e0e7ff; font-size: 11px; font-weight: 700; }.info-strip strong { display: block; color: #374151; font-size: 11px; }.info-strip p { margin: 4px 0 0; color: #6b7280; font-size: 10px; line-height: 1.55; }
.toast { position: fixed; z-index: 60; right: 25px; bottom: 25px; display: none; max-width: 330px; padding: 13px 17px; border: 1px solid #fecaca; border-radius: 8px; color: #b91c1c; background: #fff7f7; box-shadow: 0 10px 25px rgba(17, 24, 39, .12); font-size: 12px; }.toast.show { display: block; }
@media (max-width: 1050px) { .login-shell { grid-template-columns: 1fr; }.login-brand { display: none; }.login-panel { min-height: 100vh; }.mobile-brand { display: flex; gap: 11px; align-items: center; margin-bottom: 42px; color: var(--ink); }.mobile-brand .brand-mark { margin: 0; }.metric-grid { grid-template-columns: repeat(2, 1fr); }.dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .login-panel { padding: 24px 16px; }.login-card { padding: 31px 23px 27px; }.login-heading { margin-bottom: 19px; }.login-card h2 { font-size: 28px; }.captcha-row { grid-template-columns: 1fr 112px; }.sidebar { width: 232px; transform: translateX(-100%); box-shadow: 15px 0 35px rgba(17, 24, 39, .2); }.sidebar.is-open { transform: translateX(0); }.dashboard-main { margin-left: 0; }.topbar { align-items: flex-start; flex-direction: column; gap: 15px; padding: 17px 16px; }.topbar-left { width: 100%; }.admin-menu { width: 100%; }.notification-wrap { margin-left: auto; }.secondary-button { margin-left: 3px; }.page-content { padding: 24px 16px 40px; }.welcome-card { align-items: flex-start; flex-direction: column; padding: 25px 23px; }.session-stat { width: 100%; padding: 16px 0 0; border-top: 1px solid rgba(224, 231, 255, .25); border-left: 0; }.metric-grid { grid-template-columns: 1fr; }.content-card { padding: 23px 19px; }.section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }.notification-panel { position: fixed; top: 76px; right: 16px; left: 16px; width: auto; } }

/* Registration code management */
.primary-button{border:0;border-radius:7px;padding:11px 16px;color:#fff;background:#4f46e5;font:inherit;font-size:12px;font-weight:700;cursor:pointer}.primary-button:hover{background:#4338ca}.registration-heading{align-items:end}.code-toolbar{margin-bottom:20px;padding:16px 20px}.code-toolbar form{display:flex;gap:14px;align-items:end;flex-wrap:wrap}.code-toolbar label,.modal-card label{display:grid;gap:7px;color:#6b7280;font-size:10px;font-weight:700}.code-toolbar input,.code-toolbar select,.modal-card input,.modal-card textarea{border:1px solid #dbe1ef;border-radius:6px;padding:10px;color:#374151;background:#fff;font:inherit;font-size:12px;min-width:150px}.text-button{border:0;background:transparent;color:#4f46e5;font:inherit;font-size:11px;font-weight:700;cursor:pointer}.table-summary{margin:5px 0 0;color:#9ca3af;font-size:10px}.table-scroll{overflow-x:auto}.code-table{width:100%;border-collapse:collapse;font-size:11px}.code-table th{padding:14px 10px;color:var(--ink);background:#fafbff;text-align:left;font-size:10px;font-weight:700;white-space:nowrap}.code-table td{padding:15px 10px;border-top:1px solid #eef0f6;vertical-align:middle;white-space:nowrap}.code-table td small{display:block;margin-top:4px;color:#9ca3af;font-size:10px}.code-table code{font-size:13px;letter-spacing:1px;color:#374151}.code-status{display:inline-block;padding:5px 8px;border-radius:5px;font-size:10px;font-weight:700}.status-unused{color:#047857;background:#ecfdf5}.status-used{color:#4f46e5;background:#eef2ff}.status-expired{color:#b45309;background:#fffbeb}.status-invalidated{color:#b91c1c;background:#fef2f2}.table-action{border:0;background:transparent;color:#4f46e5;font:inherit;font-size:10px;font-weight:700;cursor:pointer;margin-right:8px}.table-action.danger{color:#b91c1c}.table-action:disabled{color:#cbd5e1;cursor:not-allowed}.muted,.empty-cell{color:#9ca3af}.pagination{display:flex;gap:14px;align-items:center;justify-content:flex-end;padding-top:18px;color:#6b7280;font-size:11px}.pagination button:disabled{opacity:.45;cursor:not-allowed}.modal{position:fixed;z-index:50;inset:0;display:grid;place-items:center}.modal[hidden]{display:none}.modal-backdrop{position:absolute;inset:0;background:rgba(17,24,39,.35)}.modal-card{position:relative;width:min(620px,calc(100% - 30px));max-height:90vh;overflow:auto;padding:26px;border-radius:12px;background:#fff;box-shadow:0 22px 60px rgba(17,24,39,.22)}.modal-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.modal-title h2{margin:0;font-size:20px}.plain-icon{border:0;background:transparent;color:#6b7280;font-size:23px;cursor:pointer}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:15px}.modal-card label{margin-bottom:15px}.modal-card textarea{resize:vertical;min-width:0}.modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:20px}.form-error{min-height:18px;color:#b91c1c;font-size:11px}.generated-result{padding-top:10px}.generated-result h3{margin:0 0 7px;font-size:16px}.generated-result p{color:#6b7280;font-size:11px}.toast.error{color:#b91c1c}
@media(max-width:700px){.registration-heading{align-items:flex-start}.form-grid{grid-template-columns:1fr}.code-toolbar form{align-items:stretch;flex-direction:column}.code-toolbar form label input,.code-toolbar form label select{width:100%;box-sizing:border-box}.modal-card{padding:21px}}
/* Registration code interaction refinements */
.permissions-fieldset { margin: 0 0 15px; padding: 14px 15px 2px; border: 1px solid #e5e7eb; border-radius: 8px; }
.permissions-fieldset legend { padding: 0 6px; color: #374151; font-size: 12px; font-weight: 700; }
.field-hint { margin: -2px 0 13px; color: #9ca3af; font-size: 10px; line-height: 1.6; }
.permissions-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 15px; }
.permission-item { min-width: 0; margin-bottom: 0 !important; }
.permission-label { overflow: hidden; color: #374151; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.permission-control { width: 100%; min-width: 0 !important; }
.permission-checkbox { width: 18px; height: 18px; margin: 2px 0 0; accent-color: #4f46e5; }
.permission-description { color: #9ca3af; font-size: 10px; font-weight: 400; line-height: 1.5; }
.permissions-loading { padding: 10px 0; color: #9ca3af; font-size: 11px; }
.required-mark { margin-left: 3px; color: #dc2626; }
.modal-actions { align-items: center; }
.modal-cancel-button { display: inline-flex; min-width: 64px; height: 36px; align-items: center; justify-content: center; padding: 0 14px; white-space: nowrap; line-height: 1; }
.modal-actions .primary-button { display: inline-flex; height: 36px; align-items: center; justify-content: center; white-space: nowrap; }
.code-display { display: inline-flex; gap: 7px; align-items: center; }
.visibility-button { display: inline-flex; width: 25px; height: 25px; align-items: center; justify-content: center; padding: 0; border: 1px solid #dbe1ef; border-radius: 5px; color: #6366f1; background: #fff; font-size: 15px; line-height: 1; }
.visibility-button:hover { border-color: #a5b4fc; background: #eef2ff; } .visibility-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.code-toolbar input, .code-toolbar select { min-width: 135px; }
@media(max-width:900px) { .permissions-fields { grid-template-columns: 1fr; } }
@media(max-width:700px) { .code-toolbar form { display: grid; grid-template-columns: 1fr 1fr; align-items: end; } .code-toolbar form label { min-width: 0; } .code-toolbar form label input, .code-toolbar form label select { width: 100%; min-width: 0; } .code-toolbar form > button { align-self: end; } .permissions-fields { grid-template-columns: 1fr; } }


/* Registration code layout and expiry refinements */
.code-toolbar form { align-items: center; }
.code-toolbar form > button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; align-self: center; margin: 0; box-sizing: border-box; }
.code-toolbar form > .text-button { padding: 0 4px; }
.field-label { display: inline-block; line-height: 1.2; }
.required-mark { display: inline; margin-left: 3px; color: #dc2626; }
.modal-title .plain-icon { display: inline-flex; width: 32px; height: 32px; flex: 0 0 32px; align-items: center; justify-content: center; margin: 0; padding: 0; box-sizing: border-box; border: 0; border-radius: 6px; line-height: 1; }
.account-expiry-field { min-width: 0; }
.never-expiry-option { display: inline-flex; width: fit-content; gap: 6px; align-items: center; color: #6b7280; font-size: 10px; font-weight: 400; line-height: 1.2; cursor: pointer; }
.never-expiry-option input { width: 15px; min-width: 15px; height: 15px; margin: 0; padding: 0; accent-color: #4f46e5; }
.never-expiry-option.is-selected { color: #4f46e5; }
@media(max-width:700px) {
  .code-toolbar form { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
  .code-toolbar form label { min-width: 0; }
  .code-toolbar form label input, .code-toolbar form label select { width: 100%; min-width: 0; }
  .code-toolbar form > button { align-self: center; }
}
/* Keep the complete filter row aligned on desktop; query/reset share one baseline. */
@media(min-width:1101px) {
  .code-toolbar form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto auto; align-items: center; }
  .code-toolbar form label { min-width: 0; }
  .code-toolbar form label input, .code-toolbar form label select { width: 100%; min-width: 0; box-sizing: border-box; }
  .code-toolbar form > button { align-self: center; }
}

/* Registration code filter actions: keep search fields on the first row and buttons on the next row. */
.code-toolbar form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.code-toolbar form label { min-width: 0; }
.code-toolbar form label input,
.code-toolbar form label select { width: 100%; min-width: 0; box-sizing: border-box; }
.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  min-height: 36px;
}
.filter-actions .secondary-button,
.filter-actions .text-button { align-self: center; margin: 0; }
.filter-actions .text-button { padding: 0 4px; }
.generated-result { display: grid; gap: 10px; }
.generated-result p { margin: 0; line-height: 1.6; }
.generated-codes {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid #b7ebe3;
  border-radius: 8px;
  color: #0f9f93;
  background: #f0fdfa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1.7;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.generated-result .secondary-button { width: fit-content; }
@media (max-width: 1100px) {
  .code-toolbar form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .code-toolbar form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .code-toolbar form { grid-template-columns: 1fr; }
}
.generated-result[hidden],
#code-form[hidden] { display: none; }

/* Registration code record details and row actions. */
.code-note-cell {
  min-width: 140px;
  max-width: 240px;
  white-space: normal !important;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.code-action-cell { min-width: 90px; white-space: nowrap !important; }
@media (max-width: 480px) {
  .generated-codes {
    min-height: 68px;
    padding: 12px 10px;
    font-size: 21px;
    letter-spacing: 2px;
  }
}/* Phase 3 user management */
.users-toolbar { margin-bottom: 20px; }
.users-table { width: 100%; min-width: 880px; table-layout: fixed; }
.users-table th, .users-table td { white-space: nowrap; }
.users-table th:nth-child(1) { width: 13%; }
.users-table th:nth-child(2) { width: 8%; }
.users-table th:nth-child(3) { width: 8%; }
.users-table th:nth-child(4) { width: 17%; }
.users-table th:nth-child(5) { width: 11%; }
.users-table th:nth-child(6) { width: 21%; }
.users-table th:nth-child(7) { width: 11%; }
.users-table th:nth-child(8) { width: 11%; }
.users-table td:nth-child(6), .users-table td:nth-child(7) { white-space: normal; overflow-wrap: anywhere; }
.users-table .code-note-cell { min-width: 0; max-width: none; }
.users-table .code-action-cell { min-width: 0; }
.users-table .table-action { margin-right: 5px; }
.users-table .table-action:last-child { margin-right: 0; }
.users-table th:last-child, .users-table td:last-child { position: sticky; right: 0; z-index: 1; }
.users-table th:last-child { background: #fafbff; }
.users-table td:last-child { background: #fff; box-shadow: -10px 0 14px -12px rgba(15, 23, 42, .35); }
.status-active { color: #047857; background: #ecfdf5; }
.status-disabled { color: #b91c1c; background: #fef2f2; }
.permission-list { display: grid; gap: 5px; min-width: 0; }
.permission-list span { display: block; color: #9ca3af; font-size: 10px; font-weight: 400; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name-cell { max-width: 100%; }
.user-name-cell strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.users-modal { width: min(720px, calc(100% - 30px)); }
.reason-modal { width: min(520px, calc(100% - 30px)); }
.field-help { color: #9ca3af; font-size: 10px; font-weight: 400; }
.users-modal .form-grid { align-items: start; }
.users-modal .form-grid label { min-width: 0; }
.users-modal .form-grid input, .users-modal .form-grid select { min-width: 0; width: 100%; box-sizing: border-box; }
.users-modal .permissions-fieldset { max-height: 360px; overflow: auto; }
@media (max-width: 700px) { .users-toolbar form { grid-template-columns: 1fr; } .users-modal .form-grid { grid-template-columns: 1fr; } }

/* Resource management */
.resource-subnav { display: grid; gap: 2px; margin: -1px 0 5px 40px; }
.resource-subnav a { padding: 7px 9px; border-radius: 6px; color: #9ca3af; font-size: 11px; }
.resource-subnav a:hover, .resource-subnav a.active { color: #fff; background: rgba(99,102,241,.18); }
.resource-tabs { display: flex; gap: 8px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.resource-tabs a { padding: 11px 19px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.resource-tabs a:hover, .resource-tabs a.active { border-color: var(--primary); color: var(--primary-dark); }
.resource-create-link { width: auto; padding: 0 18px; }
.resource-filters { margin-bottom: 20px; }
.resource-filters form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.resource-filters form label { display: grid; min-width: 150px; flex: 1; gap: 6px; color: #374151; font-size: 12px; font-weight: 600; }
.resource-filters form label:first-child { flex: 2; }
.resource-filters input, .resource-filters select { width: 100%; height: 37px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; }
.resource-filters button { height: 37px; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 18px; margin-top: 20px; }
.resource-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 5px 16px rgba(15,23,42,.04); }
.resource-card-image { position: relative; display: grid; height: 158px; place-items: center; overflow: hidden; background: #eef2f7; }
.resource-card-image img { width: 100%; height: 100%; object-fit: cover; }
.resource-image-empty { color: #94a3b8; font-size: 12px; }
.resource-status { position: absolute; top: 10px; right: 10px; padding: 4px 7px; border-radius: 5px; color: #475569; background: rgba(255,255,255,.9); font-size: 10px; font-weight: 700; }
.resource-status.published { color: #047857; }
.resource-card-body { display: grid; gap: 7px; padding: 15px; }
.resource-card h3 { margin: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.resource-card small { overflow: hidden; color: #94a3b8; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.resource-card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 5px 0; }
.resource-card-metrics div { display: grid; gap: 4px; min-width: 0; }
.resource-card-metrics span { color: var(--muted); font-size: 10px; }
.resource-card-metrics strong { overflow-wrap: anywhere; font-size: 12px; }
.resource-edit-button { width: 100%; justify-content: center; }
.resource-empty { grid-column: 1/-1; padding: 45px 15px; color: var(--muted); text-align: center; }
.resource-upload { max-width: 870px; }
.resource-upload form, .resource-modal-card form { display: grid; gap: 15px; }
.resource-upload label, .resource-modal-card form label { display: grid; gap: 7px; color: #374151; font-size: 12px; font-weight: 600; }
.resource-upload input, .resource-upload select, .resource-upload textarea, .resource-modal-card form input, .resource-modal-card form select, .resource-modal-card form textarea { min-width: 0; width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; font: inherit; font-weight: 400; }
.resource-upload .form-grid, .resource-modal-card .form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.resource-form-actions { display: flex; justify-content: flex-end; }
.resource-form-actions .primary-button { width: auto; padding: 0 24px; }
.resource-upload-progress { display: grid; width: 100%; gap: 7px; padding: 11px 12px; border: 1px solid #c7d2fe; border-radius: 8px; color: #4338ca; background: #eef2ff; font-size: 12px; }
.resource-upload-progress progress { display: block; width: 100%; height: 10px; accent-color: var(--primary); }
.resource-modal-card { display: flex; width: min(790px, calc(100% - 24px)); max-height: min(90vh, 920px); flex-direction: column; overflow: hidden; }
.resource-modal-card .modal-title { flex: 0 0 auto; }
.resource-modal-card .modal-title small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.resource-modal-card form { min-height: 0; flex: 1; grid-template-rows: minmax(0, 1fr) auto auto; gap: 0; }
.resource-modal-scroll { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; align-content: start; min-height: 0; gap: 14px; overflow: auto; padding: 2px 2px 14px; }
.resource-edit-preview { display: flex; width: 100%; height: 225px; min-width: 0; min-height: 0; flex: 0 0 auto; align-items: center; justify-content: center; overflow: hidden; border-radius: 8px; color: #94a3b8; background: #eef2f7; }
.resource-edit-preview img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.resource-tag-options { display: flex; align-content: flex-start; align-items: flex-start; flex-wrap: wrap; gap: 8px; width: 100%; min-height: 46px; max-height: clamp(130px, 28vh, 220px); overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; margin-top: -7px; padding: 9px; border: 1px solid #e0e7ff; border-radius: 8px; background: #fafbff; }
.resource-tag-options button { flex: 0 0 auto; min-height: 28px; padding: 4px 10px; border: 1px solid #c7d2fe; border-radius: 15px; color: #4338ca; background: #eef2ff; font-size: 11px; cursor: pointer; }
.resource-tag-options button:hover { border-color: #818cf8; background: #e0e7ff; }
.resource-tag-options span { color: var(--muted); font-size: 11px; }
.resource-modal-card .resource-upload-progress { flex: 0 0 auto; margin-top: 12px; }
.resource-modal-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 9px; justify-content: flex-end; padding-top: 15px; border-top: 1px solid var(--line); }
.resource-modal-actions button { width: auto; min-height: 38px; padding: 0 15px; }
.resource-modal-actions .danger-button { margin-right: auto; border: 1px solid #fecaca; border-radius: 7px; color: #b91c1c; background: #fff5f5; font-size: 12px; font-weight: 700; }
.resource-modal-actions .danger-button:hover { background: #fee2e2; }
.resource-modal-actions .danger-button:disabled { opacity: .55; }
.resources-page [hidden] { display: none !important; }
@media (max-width: 700px) { .resource-filters form label, .resource-filters form label:first-child { flex: 1 1 100%; } .resource-upload .form-grid, .resource-modal-card .form-grid { grid-template-columns: 1fr; } .resource-tabs a { padding: 10px 12px; } }
