/* --- Japanese Style (Blue & White / 藍白配色) --- */
:root {
    --bg-main: #f5f8fa;          /* 和紙灰白底色 */
    --bg-card: #ffffff;          /* 乾淨白 */
    --border-color: #d1dbe5;     /* 淡鋼藍線條 */
    
    --primary: #0f2c59;          /* 深靛藍 (Traditional Indigo) */
    --primary-light: #e6eef8;    /* 淺靛藍背景 */
    --secondary: #3b6998;        /* 鋼藍 (Steel Blue) */
    --text-dark: #1f2d3d;        /* 墨黑 (Charcoal) */
    --text-muted: #5e6d82;       /* 灰藍 (Slate Grey) */
    
    --success: #2d8c55;          /* 抹茶綠 */
    --success-light: #eef7f2;
    --danger: #c0392b;           /* 朱紅 */
    --danger-light: #fdf2f2;
    --warning: #d35400;          /* 橙 */
    
    --font-stack: 'Noto Sans TC', 'Inter', -apple-system, sans-serif;
    --radius: 4px;               /* 偏向日式硬朗微圓角，非大圓角 */
    --transition: all 0.2s ease-in-out;
}

/* --- Global Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: var(--font-stack);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- App Header (Aizome Theme / 藍染頂欄) --- */
.app-header {
    background-color: var(--primary);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 40px;
    border-bottom: 3px solid var(--secondary);
    z-index: 10;
    box-shadow: 0 2px 10px rgba(15, 44, 89, 0.15);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ffffff;
}

.logo-subtext {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 300;
}

.header-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: #ffffff;
}

.nav-btn.active {
    background: #ffffff;
    color: var(--primary);
    border-color: #ffffff;
}

.nav-btn.btn-login {
    background: var(--secondary);
    color: white;
    border: none;
}

.nav-btn.btn-login:hover {
    background: #477cae;
}

.nav-btn.btn-logout {
    background: #95a5a6;
    color: white;
    border: none;
}

.nav-btn.btn-logout:hover {
    background: #7f8c8d;
}

/* --- Main Layout --- */
.main-container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* --- Public Form View / 首頁問卷填寫 --- */
.form-wrapper {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 5px solid var(--primary);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 900px;
    margin: 0 auto 30px auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.form-title-block {
    text-align: center;
    border-bottom: 1px double var(--border-color);
    padding-bottom: 25px;
    margin-bottom: 30px;
}

.form-title-block h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.form-title-block p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-item label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.req {
    color: var(--danger);
    margin-left: 2px;
}

.item-tip {
    font-size: 12px;
    color: var(--text-muted);
}

input[type="text"],
input[type="date"],
input[type="password"],
select,
textarea {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 4px rgba(59, 105, 152, 0.2);
}

/* --- Japanese Tables Style (和風精緻格線) --- */
.metric-container {
    margin-top: 40px;
}

.metric-container h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: 10px;
    margin-bottom: 6px;
}

.metric-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.table-outer {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.jp-rating-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    background: #ffffff;
}

.jp-rating-table th,
.jp-rating-table td {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
}

.jp-rating-table th {
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.jp-rating-table td:first-child {
    text-align: left;
    width: 40%;
}

.jp-rating-table .lbl strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    display: block;
}

.jp-rating-table .lbl span {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

.jp-rating-table input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.highlight-row {
    background-color: rgba(230, 238, 248, 0.35);
}

.highlight-row td {
    border-top: 2px solid var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
}

.highlight-row td:first-child {
    color: var(--primary);
}

/* --- Admin Panel --- */
.admin-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--primary);
}

.tab-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-bottom: none;
    color: var(--text-muted);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    margin-right: 4px;
    transition: var(--transition);
}

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

.tab-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- Dashboard Tab --- */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-box {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.kpi-val {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.kpi-lbl {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

.chart-box {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.chart-box h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    border-left: 3px solid var(--primary);
    padding-left: 8px;
    margin-bottom: 20px;
}

.canvas-holder {
    position: relative;
    height: 320px;
    width: 100%;
}

/* --- Filters & Tables in Admin --- */
.filter-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

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

.badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 20px;
    font-weight: 700;
}

.jp-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 13px;
}

.jp-table th,
.jp-table td {
    padding: 12px 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.jp-table th {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.jp-table tr:hover td {
    background-color: #f7fafd;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-box input {
    padding-left: 34px;
    width: 100%;
}

.grade-pill {
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 2px;
    display: inline-block;
    text-align: center;
    min-width: 24px;
}

.grade-pill.A { background-color: var(--success-light); color: var(--success); }
.grade-pill.B { background-color: #e3f2fd; color: #1e88e5; }
.grade-pill.C { background-color: #fff8e1; color: #f57f17; }
.grade-pill.D { background-color: #fff3e0; color: #e65100; }
.grade-pill.E { background-color: var(--danger-light); color: var(--danger); }

/* --- Report Setup Page --- */
.report-settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .report-settings-grid {
        grid-template-columns: 1fr;
    }
}

.settings-box {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    height: fit-content;
}

.settings-box h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfe;
}

.hist-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.hist-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    gap: 10px;
}

.backup-lbl {
    font-weight: 700;
}

.backup-lbl.ok { color: var(--success); }
.backup-lbl.fail { color: var(--warning); }

/* --- Matrix Table Preview --- */
.preview-box {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
}

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

.preview-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.preview-header p {
    font-size: 12px;
    color: var(--text-muted);
}

.preview-actions {
    display: flex;
    gap: 10px;
}

.jp-matrix-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 12px;
    text-align: center;
}

.jp-matrix-table th,
.jp-matrix-table td {
    border: 1px solid var(--text-muted);
    padding: 8px;
    color: var(--text-dark);
}

.jp-matrix-table th {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.jp-matrix-table td:first-child {
    text-align: left;
    font-weight: 700;
    background: var(--primary-light);
}

.jp-matrix-table tfoot td {
    background-color: #fafbfc;
}

.jp-matrix-table tfoot td.no-border {
    border: none;
    background: transparent;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

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

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.btn-icon {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.btn-icon.del:hover {
    background-color: var(--danger-light);
    color: var(--danger);
}

/* --- Modals (和風彈窗) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateY(-20px);
    transition: var(--transition);
}

.modal-overlay.open .modal-box {
    transform: translateY(0);
}

.modal-box.compact {
    width: 400px;
}

.modal-box.large {
    width: 800px;
    max-width: 90%;
}

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

.modal-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.btn-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.max-height-60 {
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- Form Layout Modifiers --- */
.margin-top-15 { margin-top: 15px; }
.margin-top-20 { margin-top: 20px; }
.margin-bottom-15 { margin-bottom: 15px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.bold { font-weight: 700; }
.hidden { display: none !important; }

/* --- Toast Notification System --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
}

.toast {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--secondary);
    border-radius: var(--radius);
    padding: 12px 20px;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--secondary); }

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--secondary); }

/* --- Switch Toggle (Premium Minimalist) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* --- Thank You / Appreciation Letter --- */
.thankyou-wrapper {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 650px;
    margin: 40px auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    animation: fadeIn 0.4s ease-out;
}

.thankyou-box {
    text-align: center;
}

.thankyou-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-light);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
}

.thankyou-box h2 {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 24px;
    font-weight: 700;
}

.thankyou-subtitle {
    text-align: left;
    font-size: 15px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.thankyou-text {
    text-align: left;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.8;
    margin-bottom: 16px;
    text-indent: 28px;
}

.thankyou-closing {
    text-align: right;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.8;
    margin-top: 32px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Dynamic Enhancements --- */
.account-select-banner {
    background-color: var(--primary-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease-out;
}
#auth-tab-login, #auth-tab-register {
    transition: var(--transition);
}
#auth-tab-login:hover, #auth-tab-register:hover {
    color: var(--primary) !important;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* --- Workspace Breadcrumbs & Topic Selection Grid --- */
.workspace-breadcrumbs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.workspace-breadcrumbs .text-muted {
    color: var(--text-muted);
}

/* --- Topics Grids --- */
.topics-grid, .admin-topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

/* Card layout with Japanese Indigo & white theme, smooth animations and transitions */
.topic-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.topic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(15, 44, 89, 0.08);
    border-color: var(--secondary);
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.topic-card-body {
    flex-grow: 1;
    margin-bottom: 16px;
}

.topic-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.topic-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    border-top: 1px solid #f0f4f8;
    padding-top: 12px;
    margin-top: auto;
}

.topic-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Anonymity Mode Badges */
.badge.identified {
    background-color: #e6eef8;
    color: #0f2c59;
    border: 1px solid #d0e0f5;
}

.badge.pseudonymous {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
}

.badge.anonymous {
    background-color: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.badge.inactive {
    background-color: #f5f5f5;
    color: #9e9e9e;
    border: 1px solid #e0e0e0;
}

/* --- Status Pills for Email tracking --- */
.status-pill {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 12px;
    display: inline-block;
    text-align: center;
    border: 1px solid transparent;
}

.status-pill.pending {
    background-color: #f5f5f5;
    color: #616161;
    border-color: #e0e0e0;
}

.status-pill.sent {
    background-color: #e3f2fd;
    color: #1e88e5;
    border-color: #bbdefb;
}

.status-pill.failed {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: #ffcdd2;
}

.status-pill.completed {
    background-color: var(--success-light);
    color: var(--success);
    border-color: #c8e6c9;
}

/* --- Dynamic Question Cards --- */
.qnr-question-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(15, 44, 89, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.qnr-question-card:hover {
    border-color: var(--secondary);
    box-shadow: 0 6px 18px rgba(15, 44, 89, 0.08);
}

.qnr-question-card.highlight-row {
    border-left: 5px solid var(--primary);
}

.qnr-question-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qnr-question-title span.sub-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
    margin-top: 4px;
}

.qnr-question-title .type-badge {
    font-size: 11px;
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.qnr-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* Horizontal display for radio options on desktop */
@media (min-width: 600px) {
    .qnr-options-container.horizontal {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
    }
}

.qnr-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark);
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background-color 0.15s ease;
}

.qnr-option-item:hover {
    background-color: var(--primary-light);
}

.qnr-option-item input[type="radio"],
.qnr-option-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.qnr-essay-textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    font-family: var(--font-stack);
    font-size: 14px;
    color: var(--text-dark);
    background-color: #fafbfc;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.qnr-essay-textarea:focus {
    outline: none;
    border-color: var(--secondary);
    background-color: #ffffff;
}

/* Grading specific styles */
.grade-badge-score {
    font-weight: 700;
    color: var(--primary);
}

.grade-badge-override {
    color: var(--danger);
    font-size: 12px;
    font-style: italic;
}

/* --- Public Question Cards (New Multi-type Design) --- */
.public-question-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(15, 44, 89, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.public-question-card:hover {
    border-color: var(--secondary);
    box-shadow: 0 4px 14px rgba(15, 44, 89, 0.06);
}

.public-question-card.highlight-card {
    border-left: 5px solid var(--primary);
}

.question-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-color);
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}

.question-title-area {
    flex: 1;
}

.question-title-en {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.question-title-cn {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.question-type-badge {
    font-size: 11px;
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.question-body {
    padding-left: 38px;
}

.question-options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.option-radio-label,
.option-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark);
    transition: background-color 0.15s ease, border-color 0.15s ease;
    min-width: 80px;
}

.option-radio-label:hover,
.option-checkbox-label:hover {
    background-color: var(--primary-light);
    border-color: var(--secondary);
}

.option-radio-label input[type="radio"],
.option-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.option-label-text {
    font-weight: 500;
}

/* --- Option Editor Rows (Design Modal) --- */
.option-editor-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-editor-row input[type="text"],
.option-editor-row input[type="number"] {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.option-editor-row input[type="text"]:focus,
.option-editor-row input[type="number"]:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 3px rgba(59, 105, 152, 0.15);
}

.btn-remove-option {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.btn-remove-option:hover {
    background-color: var(--danger-light);
    color: var(--danger);
}

/* --- Option Tags (Design Table) --- */
.opt-tag {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px;
    font-size: 12px;
    font-weight: 600;
    background-color: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    border: 1px solid #d0e0f5;
    white-space: nowrap;
}

/* --- Distribution Cards (Report Preview) --- */
.distribution-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(15, 44, 89, 0.03);
}

.dist-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-color);
}

.dist-card-header strong {
    font-size: 14px;
    color: var(--text-dark);
}

.dist-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dist-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dist-bar-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    width: 100px;
    flex-shrink: 0;
    text-align: right;
}

.dist-bar-track {
    flex: 1;
    height: 22px;
    background: #f0f4f8;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.dist-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.dist-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    width: 110px;
    flex-shrink: 0;
    text-align: left;
}

/* --- Answer Pill (Questionnaire List) --- */
.answer-pill {
    display: inline-block;
    padding: 1px 6px;
    font-size: 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 3px;
    font-weight: 500;
}

/* --- Edit Question Card (Admin Edit Modal) --- */
.edit-question-card {
    background: #fafbfc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 18px;
}

/* --- Form action row alignment --- */
.form-btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* --- Input types for email and number --- */
input[type="email"],
input[type="number"],
input[type="url"] {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

input[type="email"]:focus,
input[type="number"]:focus,
input[type="url"]:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 4px rgba(59, 105, 152, 0.2);
}

/* --- Responsive adjustments for small screens --- */
@media (max-width: 600px) {
    .question-body {
        padding-left: 0;
    }
    .question-options-row {
        flex-direction: column;
    }
    .dist-bar-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .dist-bar-label {
        text-align: left;
        width: 100%;
    }
    .dist-bar-value {
        width: 100%;
    }
    .option-editor-row {
        flex-wrap: wrap;
    }
}
