:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    
    --success: #15803d;
    --success-border: #86efac;
    --success-bg: #f0fdf4;
    --danger: #dc2626;
    --danger-hover: #991b1b;
    --danger-bg: #fef2f2;
    --warning: #d97706;
    --warning-hover: #b45309;
    --warning-bg: #fffbeb;

    --text-heading: #111;
    --text-body: #111;
    --text-muted: #646d79;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #f8fafc;
    --bg-darkgrey: #e6e8eb;
    --input-bg: #f1f5f9;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --darkgrey-border: #d0d6dd;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.04), 0 8px 10px -6px rgba(15, 23, 42, 0.02);
    --shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Roboto", Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-body);
    font-size: .9rem;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--text-body);
}

.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
}

.brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-heading);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.brand span {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.95rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.profile-dropdown-container {
    position: relative;
    display: inline-block;
}

.user-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 0px solid transparent;
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    font-family: inherit;
    color: var(--text-heading);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.user-profile-btn:hover,
.user-profile-btn.active {
    background: var(--bg-card, #ffffff);
    border-color: var(--border, #e2e8f0);
}

.dropdown-arrow {
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.user-profile-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-badge-pill {
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 9999px;
    line-height: 1.2;
}

.profile-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 220px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow: hidden;
    animation: fadeInDropdown 0.15s ease;
}

.profile-dropdown-menu.show {
    display: flex;
    flex-direction: column;
}

.profile-dropdown-header {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-sidebar, #f8fafc);
}

.dropdown-divider {
    height: 1px;
    background: var(--border, #e2e8f0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-body);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}

.dropdown-item:hover {
    background: var(--bg-sidebar, #f8fafc);
    color: var(--primary);
}

.dropdown-item:hover i {
    color: var(--primary);
}

.dropdown-item.text-danger:hover {
    color: var(--danger, #ef4444);
    background: rgba(239, 68, 68, 0.05);
}

.dropdown-item.text-danger:hover i {
    color: var(--danger, #ef4444);
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.avatar-fallback {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
}

.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 30px auto;
    padding: 0 28px;
}

h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-heading);
    margin-bottom: 8px;
    line-height: 1.25;
}

p.subtitle {
    color: var(--text-muted);
    font-size: .95rem;
    line-height: 1.5;
}

.card-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    overflow: hidden;
    margin-bottom: 32px;
}

.card-main {
    flex: 1.4;
    padding: 32px;
}

.card-sidebar {
    flex: 1;
    padding: 32px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
}

.card-main-quiz {
    flex: 1.2;
    padding: 32px;
}

.card-sidebar-quiz {
    flex: 1.2;
    padding: 32px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
}

.info-dashed {
    padding: 15px;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
}

.whitebg {background: var(--bg-card)}

.greybg {background: var(--bg-sidebar)}
.darkgreybg {background: color-mix(in srgb, var(--bg-sidebar), var(--bg-darkgrey) 50%)}
.grey-border {border: 1.5px solid var(--border);}
.darkgrey-border {border: 1.5px solid var(--darkgrey-border);}

.successbg {background: var(--success-bg)}
.success-border {border: 1.5px solid var(--success-border);}

@media (max-width: 860px) {
    .card-container, .card-container-quiz { flex-direction: column; }
    .card-sidebar, .card-sidebar-quiz {
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 20px;
    }
    .card-main { padding: 20px; }
}

.form-group {
    margin-bottom: 10px;
}

.form-label {
    display: block;
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 8px;
}

.form-input, 
.form-select, 
.form-textarea {
    width: 100%;
    min-height: 24px;
    padding: 7px 12px;
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-heading);
    font-size: .85rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-textarea {
    min-height: 90px;
    line-height: 1.5;
    resize: vertical;
}

.form-input:focus, 
.form-select:focus, 
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.form-input-readonly {
    width: 100%;
    min-height: 24px;
    padding: 7px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    outline: none;
}

.btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    height: 34px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary { 
    background: var(--primary); 
    color: #ffffff; 
}
.btn-primary:hover { 
    background: var(--primary-hover); 
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.btn-secondary { 
    background: #f1f5f9; 
    color: var(--text-body); 
    border-color: #e2e8f0;
}
.btn-secondary:hover { 
    background: #e2e8f0; 
    color: var(--text-heading);
}

.btn-danger { 
    background: var(--danger); 
    color: #ffffff; 
}
.btn-danger:hover { 
    background: var(--danger-hover); 
}

.btn-warning { 
    background: var(--warning); 
    color: #ffffff; 
}
.btn-warning:hover { 
    background: var(--warning-hover); 
}

.btn-sm { 
    min-height: 34px;
    height: 34px; 
    padding: 0 12px; 
    font-size: .8rem; 
    border-radius: 6px;
}

.btn-xsm { 
    min-height: 24px;
    height: 24px; 
    padding: 0 5px; 
    font-size: .8rem; 
    border-radius: 6px;
}

.btn:disabled,
button:disabled {
    cursor: not-allowed !important;
    opacity: 0.65;
    pointer-events: none;
}

.btn.btn-success {
    background-color: var(--success) !important;
    color: #ffffff !important;
    border-color: var(--success) !important;
}

.btn .fa-solid,
.btn .fa-regular {
    line-height: inherit;
    display: inline-flex;
    align-items: center;
}

.badge { 
    display: inline-flex; 
    align-items: center;
    cursor: default;
    gap: 6px;
    padding: 4px 12px; 
    font-size: 0.8rem; 
    font-weight: 600; 
    border-radius: var(--radius-full); 
    line-height: 1.3;
}

.badge-private {
    background: #e2e8f0; 
    color: #475569; 
}

.badge-group { 
    background: var(--primary-light); 
    color: var(--primary); 
}

.badge-questions { 
    background: var(--success-bg); 
    color: var(--success); 
    border: 1px solid var(--success-border);
}

.badge-disabled { 
    background: color-mix(in srgb, var(--bg-sidebar), #e2e8f0 20%);
    color: #475569;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.option-label:hover {
    background: #f8fafc;
    border-color: var(--border-hover);
    transform: translateX(2px);
}

.option-label input[type="radio"] {
    width: 12px;
    height: 12px;
    accent-color: var(--primary);
    cursor: pointer;
}

.option-label.is-correct {
    background: var(--success-bg);
    border-color: var(--success);
    color: #14532d;
    font-weight: 600;
}

.option-label.is-wrong {
    background: var(--danger-bg) !important;
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

.status-box {
    align-items: center;
    padding: 20px;
    border-radius: var(--radius-md);
    user-select: none;
    -webkit-user-select: none;
}

.info-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.info-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.info-item h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 2px;
}

.info-item p {
    font-size: .85rem;
    color: var(--text-muted);
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-subtle);
    width: 100%;
}

table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
    text-align: left;
}

tbody tr:nth-child(even) {
    background-color: var(--bg-sidebar);
}

tbody tr.clickable-row:hover {
    background-color: var(--input-bg) !important;
}

th, td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
}

th {
    background: #fafbfc;
    font-weight: 700;
    color: var(--text-heading);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

.link-locked-box {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .95rem;
    filter: blur(4px);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    cursor: not-allowed;
}

.tooltip-fast {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-fast::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    
    white-space: pre-line;
    width: max-content;
    max-width: 220px;
    text-align: center;
    word-break: break-word;
    
    background-color: #1e293b;
    color: #ffffff;
    font-size: .8rem !important;
    font-weight: 500;
    line-height: 1.35 !important;
    padding: 7px 11px;
    border-radius: 6px;
    text-transform: none;
    letter-spacing: normal;
    
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tooltip-fast::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    
    width: 0;
    height: 0;
    line-height: 0;
    font-size: 0;
    
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #1e293b;
    border-bottom: 0 none;
    
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 9999;
}

.tooltip-fast:hover::after,
.tooltip-fast:hover::before {
    opacity: 1;
    visibility: visible;
}

.tooltip-fast:active::after,
.tooltip-fast:active::before {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: none !important;
}

.tooltip-align-left::after {
    left: 0 !important;
    transform: none !important;
    text-align: left !important;
}
.tooltip-align-left::before {
    left: 12px !important;
    transform: none !important;
}

.tooltip-align-right::after {
    left: auto !important;
    right: 0 !important;
    transform: none !important;
    text-align: right !important;
}
.tooltip-align-right::before {
    left: auto !important;
    right: 12px !important;
    transform: none !important;
}

.tooltip-bottom::after {
    top: 100% !important;
    bottom: auto !important;
    margin-top: 6px !important;
    margin-bottom: 0 !important;
}

.tooltip-bottom::before {
    top: 100% !important;
    bottom: auto !important;
    margin-top: 2px !important;
    margin-bottom: 0 !important;
    border-top: 0 none !important;
    border-bottom: 5px solid #1e293b !important;
}

.footer {
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 24px 0;
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--text-heading);
}

.m-0 { margin: 0; }
.mr-3 { margin-right: 3px; }
.mr-5 { margin-right: 5px; }
.mr-10 { margin-right: 10px; }
.mr-20 { margin-right: 20px; }
.mr-25 { margin-right: 25px; }
.mr-30 { margin-right: 30px; }
.ml-3 { margin-left: 3px; }
.ml-5 { margin-left: 5px; }
.ml-10 { margin-left: 10px; }
.ml-15 { margin-left: 15px; }
.ml-20 { margin-left: 20px; }
.ml-25 { margin-left: 25px; }
.ml-30 { margin-left: 30px; }
.mt-3 { margin-top: 3px; }
.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-25 { margin-top: 25px; }
.mt-30 { margin-top: 30px; }
.mb-5 { margin-bottom: 3px; }
.mb-5 { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-25 { margin-bottom: 25px; }
.mb-30 { margin-bottom: 30px; }

.pointer {cursor:pointer}
.context-menu {cursor:context-menu}

.sidebar-title {font-size: 1.1rem}
.h2-title {font-size: 1.25rem}
.h3-title {font-size: 1.15rem}

.text-muted {color:var(--text-muted)}
.text-body {color:var(--text-body)}
.text-heading {color:var(--text-heading)}
.text-primary {color:var(--primary)}
.text-primary-hover {color:var(--primary-hover)}
.text-primary-light {color:var(--primary-light)}
.text-success {color:var(--success)}
.text-danger {color:var(--danger)}
.text-warning {color:var(--warning)}

.text-center{text-align:center}

.text-xs{font-size:.7rem}
.text-s{font-size:.8rem}
.text-m{font-size:.9rem}
.text-l{font-size:1.0rem}
.text-xl{font-size:1.1rem}
.text-xxl{font-size:1.2rem}

.btn,
.badge,
.navbar,
.user-profile,
.info-icon-box,
.no-copy,
.badge-disabled,
.footer {
    user-select: none;
    -webkit-user-select: none;
}

.clickable-row {
    position: relative;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-row:hover {
    background: color-mix(in srgb, var(--bg-sidebar), #e2e8f0 40%);
}

.stretched-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.clickable-row button,
.clickable-row a:not(.stretched-link) {
    position: relative;
    z-index: 2;
}

.group {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: inherit;
    color: var(--text-body);
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.group:hover {
    background-color: var(--input-bg);
    border-color: var(--border-hover);
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.quiz-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.quiz-item-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-subtle);
    transform: translateY(-1px);
}

.quiz-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quiz-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.quiz-q-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-weight: 500;
}

.quiz-item-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
    line-height: 1.3;
}

.quiz-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.faq-item:hover {
    border-color: var(--border-hover);
}

.faq-item[open] {
    border-color: var(--border-hover);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-heading);
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-user-select: none;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-chevron {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.faq-item[open] .faq-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.faq-answer {
    padding: 15px;
    color: var(--text-body);
    font-size: 0.85rem;
    line-height: 1.6;
    border-top: 1px solid transparent;
}

.faq-item[open] .faq-answer {
    border-top-color: var(--input-bg);
}