*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --primary-soft: #dbeafe;
    --surface: #f6f8fb;
    --surface-card: #fff;
    --border-soft: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--surface);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

p {
    margin: 0 0 0.85rem;
    color: var(--text-muted);
}

.lead {
    font-size: clamp(1rem, 0.9rem + 0.3vw, 1.15rem);
    color: var(--text-muted);
    line-height: 1.65;
}

.micro {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.hidden {
    display: none !important;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2.5rem clamp(1.5rem, 4vw, 4rem);
    background: #0d1b2a;
    color: #f8fafc;
    gap: 1rem;
}

.app-header h1 {
    margin: 0.5rem 0 0;
    font-size: clamp(1.75rem, 4vw, 2.8rem);
    color: #fef08a;
}

.app-header .lead {
    margin: 0.75rem 0 0;
    color: #cbd5f5;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: #61dafb;
}

.source {
    color: #fcd34d;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

button {
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    background: var(--surface-card);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 40px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.15);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.primary {
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.primary:hover:not(:disabled) {
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.32);
}

.secondary {
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-color: transparent;
}

.ghost {
    background: transparent;
    border: 1px dashed rgba(148, 163, 184, 0.7);
    color: var(--text-main);
    box-shadow: none;
}

.ghost.danger {
    border-color: rgba(248, 113, 113, 0.75);
    color: #b91c1c;
}

.ghost.danger:hover:not(:disabled) {
    background: rgba(254, 226, 226, 0.5);
    color: #991b1b;
}

.ghost.small {
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
}

.primary.ghost {
    color: var(--primary-strong);
    border-style: solid;
    border-color: rgba(37, 99, 235, 0.5);
    background: rgba(37, 99, 235, 0.08);
}

.export-summary-btn {
    background: linear-gradient(135deg, #facc15, #f97316);
    color: #0b1021;
    border-color: #fed7aa;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 14px 28px rgba(234, 88, 12, 0.35);
}

.export-summary-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #fbbf24, #ea580c);
    color: #06122e;
    box-shadow: 0 16px 32px rgba(234, 88, 12, 0.45);
}

.export-summary-btn:focus-visible {
    outline: 3px solid rgba(250, 204, 21, 0.5);
    outline-offset: 2px;
}

.open-backup-btn {
    background: linear-gradient(135deg, #34d399, #22c55e);
    color: #052e16;
    border-color: #bbf7d0;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 14px 28px rgba(34, 197, 94, 0.35);
}

.open-backup-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2dd4bf, #16a34a);
    color: #031d10;
    box-shadow: 0 16px 32px rgba(22, 163, 74, 0.45);
}

.open-backup-btn:focus-visible {
    outline: 3px solid rgba(52, 211, 153, 0.5);
    outline-offset: 2px;
}

.ghost-button {
    background: transparent;
    border: 1px solid rgba(248, 250, 252, 0.6);
    color: #f8fafc;
    box-shadow: none;
}

#reset-app {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    border-color: #991b1b;
    box-shadow: 0 10px 22px rgba(239, 68, 68, 0.35);
}

#reset-app:hover:not(:disabled) {
    box-shadow: 0 12px 26px rgba(185, 28, 28, 0.4);
}

#reset-app:focus-visible {
    outline: 3px solid rgba(239, 68, 68, 0.35);
    outline-offset: 2px;
}

#toggle-knowledge {
    background: linear-gradient(135deg, #facc15, #f59e0b);
    color: #0f172a;
    border-color: #d97706;
    box-shadow: 0 10px 22px rgba(245, 158, 11, 0.28);
}

#toggle-knowledge:hover:not(:disabled) {
    box-shadow: 0 12px 26px rgba(234, 179, 8, 0.32);
}

#toggle-knowledge:focus-visible {
    outline: 3px solid rgba(250, 204, 21, 0.5);
    outline-offset: 2px;
}

.knowledge-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    padding: 1.5rem clamp(1.5rem, 4vw, 4rem);
}

.knowledge-cards article {
    background: #fff;
    padding: 1.25rem;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.knowledge-cards h2 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.knowledge-cards ul {
    padding-left: 1.2rem;
    margin: 0;
    color: #475569;
}

.steps-nav {
    padding: 0 clamp(1.5rem, 4vw, 4rem);
    margin-top: 1.5rem;
}

.steps-nav ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
    counter-reset: wizard-step;
}

.steps-nav li {
    counter-increment: wizard-step;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.steps-nav li::before {
    content: counter(wizard-step);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex: 0 0 auto;
}

.steps-nav li.active {
    background: linear-gradient(135deg, var(--primary), #1e40af);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

.steps-nav li.active::before {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

@media (max-width: 900px) {
    .steps-nav ol {
        display: flex;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        scroll-snap-type: x proximity;
        gap: 0.5rem;
    }

    .steps-nav li {
        min-width: 220px;
        flex: 0 0 auto;
        scroll-snap-align: start;
    }
}

#wizard {
    padding: 2rem clamp(1.5rem, 4vw, 4rem) 4rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.wizard-step {
    display: none;
    gap: 1.5rem;
}

.wizard-step.active {
    display: flex;
    flex-direction: column;
}

.wizard-step header h2 {
    margin: 0;
    color: #0f172a;
}

.wizard-step header p {
    margin: 0.25rem 0 0;
    color: #475569;
}

.card,
.card-grid {
    background: #fff;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    color: #000000;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 0 0 1px transparent;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    background: #fff;
}

textarea {
    min-height: 120px;
}

.form-actions.full {
    grid-column: 1 / -1;
    text-align: right;
}

.dynamic-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.dynamic-list.stacked {
    grid-template-columns: 1fr;
}

.card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.card header h3 {
    margin: 0;
}

.card header .micro {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
}

.tag {
    font-size: 0.7rem;
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-weight: 600;
}

.inline-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

#kisi-table th,
#kisi-table td {
    vertical-align: middle;
}

#kisi-table th:first-child,
#kisi-table td:first-child {
    width: 15ch;
    max-width: 15ch;
    white-space: nowrap;
}

#kisi-table th:nth-child(2),
#kisi-table td:nth-child(2),
#kisi-table th:nth-child(3),
#kisi-table td:nth-child(3) {
    width: 35ch;
    max-width: 35ch;
    white-space: nowrap;
}

#kisi-table th:nth-child(4),
#kisi-table td:nth-child(4) {
    width: 12ch;
    max-width: 12ch;
    white-space: nowrap;
}

#kisi-table td.jumlah-cell {
    width: 60px;
}

#kisi-table th:nth-child(5),
#kisi-table td:nth-child(5) {
    width: 8ch;
    max-width: 8ch;
    white-space: nowrap;
}

#kisi-table td.jumlah-cell input {
    width: 100%;
    text-align: center;
}

#kisi-table th,
#kisi-table td {
    vertical-align: middle;
}

#kisi-table td.jumlah-cell {
    width: 60px;
}

#kisi-table td.jumlah-cell input {
    width: 100%;
    text-align: center;
}

#kisi-table td.row-actions {
    text-align: center;
}

.row-actions .danger-button {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.row-actions .danger-button:hover {
    background: #fecaca;
}

th,
td {
    padding: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

th {
    background: #f8fafc;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #475569;
}

td textarea,
td input,
td select {
    width: 100%;
    min-height: auto;
    font-size: 0.9rem;
    padding: 0.45rem 0.65rem;
}

.step-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.question-panel {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.placeholder {
    padding: 2rem;
    border: 1px dashed #94a3b8;
    border-radius: 16px;
    text-align: center;
    color: #1f2937;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
}

.placeholder.error {
    border-color: #f87171;
    color: #7f1d1d;
    background: #fff5f5;
}

.question-editor textarea {
    min-height: 140px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.option-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.option-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.option-block-header label {
    margin-bottom: 0;
}

.option-block label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #475569;
}

.options-grid label {
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: inline-block;
}

.question-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.option-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.option-controls .micro {
    margin: 0;
}

.preview {
    max-height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.preview ol {
    padding-left: 1.25rem;
    margin: 0;
}

.preview li {
    margin-bottom: 1rem;
}

.preview-options {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.preview-options.pg li,
.preview-options.mcma li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.preview-options .radio,
.preview-options .checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    text-align: center;
    font-weight: bold;
    line-height: 1;
}

.preview-options .option-text {
    flex: 1;
    color: #000;
    line-height: 1.5;
}

.pgkk-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.pgkk-table th,
.pgkk-table td {
    border: 1px solid #000;
    padding: 0.4rem;
    text-align: center;
    vertical-align: top;
}

.pgkk-table td:first-child {
    text-align: left;
}

.mcmapgkk-checkbox {
    display: inline-block;
    background-color: #fff;
    margin: 0;
    font: inherit;
    color: #000;
    width: 1.1em;
    height: 1.1em;
    border: 0.12em solid currentColor;
    border-radius: 0.15em;
    vertical-align: middle;
}

.export-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.export-actions button {
    background: #e2e8f0;
    color: #0f172a;
}

#question-preview-card .export-actions {
    justify-content: flex-start;
}

#question-preview-card .export-actions label {
    color: #0f172a;
    font-weight: 600;
    margin-right: 0.35rem;
}

#question-preview-card .export-actions button {
    width: 48px;
    height: 48px;
    min-height: 0;
    padding: 0;
    border-radius: 4px;
    background: #16a34a;
    border-color: #15803d;
    color: #f0fdf4;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: none;
}

#question-preview-card .export-actions button:hover:not(:disabled) {
    background: #15803d;
    color: #ecfdf5;
}

#question-preview-card .export-actions button:disabled {
    opacity: 0.5;
}

#preview-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 60vh;
}

#preview-list > li {
    list-style: none;
}

.question-preview-item {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 1rem 1.1rem;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.question-preview-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #475569;
}

.question-preview-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.75rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.question-preview-pill.subtle {
    background: #e4e5e7;
    color: #011033;
}

.question-preview-text,
.question-preview-explanation {
    color: #000 !important;
    font-size: 0.95rem;
    overflow-x: auto;
    text-shadow: none;
    filter: none;
}

.question-preview-options,
.question-preview-text,
.question-preview-explanation {
    color: #000 !important;
    text-shadow: none;
    filter: none;
}

.question-preview-explanation {
    padding-top: 0.6rem;
    border-top: 1px dashed #e2e8f0;
}

.question-preview-key {
    margin: 0;
    font-size: 0.9rem;
    color: #000;
}

.student-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    line-height: 1.5;
}

#student-modal-content {
    color: #000;
}

.student-modal-meta {
    margin-bottom: 1rem;
}

.student-identity-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    box-shadow: none;
    color: #000;
}

.student-school-name {
    font-family: "Times New Roman", "Georgia", serif;
    font-weight: 900;
    font-size: 2.25rem;
    text-align: center;
    color: #000;
    letter-spacing: 0.02em;
}

.student-identity-divider {
    border-top: 3px double #000;
    height: 0;
    margin: 0.65rem 0 0.75rem;
}

.student-identity-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
    color: #000;
    font-weight: 600;
    font-size: 1.1rem;
}

.identity-line {
    margin: 0;
}

.student-identity-fields {
    margin-top: 0.85rem;
    display: grid;
    gap: 0.4rem;
}

.identity-field {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: center;
    column-gap: 0.5rem;
    color: #000;
    font-weight: 600;
    font-size: 1.05rem;
}

.field-label {
    white-space: nowrap;
}

.field-line {
    display: block;
    border-bottom: 1px solid #94a3b8;
    min-height: 1.25rem;
    width: 100%;
}

.student-guidelines {
    margin: 1rem 0 0.75rem;
    padding: 0.85rem 0;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #000;
    box-shadow: none;
}

.student-guidelines-title {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    color: #000;
}

.student-guidelines-list {
    margin: 0;
    padding-left: 1.1rem;
}

.student-guidelines-list li {
    margin: 0.25rem 0;
    line-height: 1.55;
}

.question-preview-item.student {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0.5rem 0;
    margin: 0.35rem 0;
}

.student-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.student-modal-actions {
    margin-left: auto;
}

.student-header-btn {
    border: 1px solid #0f172a;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    color: #0f172a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
}

.student-header-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
}

.student-header-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12);
}

.student-close-btn {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #0f172a;
    border-color: #cbd5e1;
}

.question-preview-item.student .question-preview-text,
.question-preview-item.student .question-preview-options {
    color: #000;
}

.question-preview-options {
    color: #000;
    margin-top: 0.25rem;
}

.student-modal-body .question-preview-text table,
.student-modal-body .question-preview-options table {
    border: none;
    background: transparent;
}

.student-modal-body .question-preview-text table:not(.pgkk-table),
.student-modal-body .question-preview-options table:not(.pgkk-table) {
    border: none;
    background: transparent;
}

.student-modal-body .question-preview-text table:not(.pgkk-table) th,
.student-modal-body .question-preview-text table:not(.pgkk-table) td,
.student-modal-body .question-preview-options table:not(.pgkk-table) th,
.student-modal-body .question-preview-options table:not(.pgkk-table) td {
    border: none;
    background: transparent;
}

@media print {
    @page {
        size: A4;
        margin: 1cm;
    }
    body {
        color: #000 !important;
        background: #fff !important;
        line-height: 1.5;
    }
    #student-modal-content,
    #student-modal-content * {
        color: #000 !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    #student-modal-content .question-preview-pill {
        background: transparent !important;
        color: #000 !important;
    }
    #student-modal-content .question-preview-item.student {
        page-break-inside: avoid;
        break-inside: avoid-page;
        margin-bottom: 0.75rem;
        padding: 0.35rem 0;
    }
    #student-modal-content .student-identity-card,
    #student-modal-content .student-guidelines {
        page-break-inside: avoid;
        break-inside: avoid-page;
    }
    #student-modal-content .question-preview-heading,
    #student-modal-content .question-preview-text,
    #student-modal-content .question-preview-options {
        line-height: 1.5;
    }
    #student-modal-content .pgkk-table {
        page-break-inside: avoid;
        break-inside: avoid-page;
        border-color: #000;
    }
    #student-modal-content .pgkk-table th,
    #student-modal-content .pgkk-table td {
        border-color: #000;
    }
}

.question-preview-item.student,
.question-preview-item.student .question-preview-text,
.question-preview-item.student .question-preview-options,
.question-preview-item.student .question-preview-heading {
    color: #000;
}

.detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    align-items: flex-start;
}

.detail-col textarea {
    min-height: 160px;
}

.detail-col.preview-col {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem;
    min-height: 160px;
}

.detail-preview .preview-title {
    margin-bottom: 0.35rem;
}

.qd-preview-content {
    max-height: 320px;
    overflow: auto;
    color: #000;
}

.detail-meta {
    margin-bottom: 1rem;
}

.detail-meta-list {
    list-style: none;
    margin: 0;
    padding-left: 0;
    display: grid;
    gap: 0.35rem;
}

.question-preview-options {
    margin-top: 0.35rem;
}

.question-table,
.question-preview-text table,
.question-preview-options table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.question-table caption,
.question-preview-text table caption {
    caption-side: top;
    text-align: left;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.35rem;
}

.question-table th,
.question-table td,
.question-preview-text table th,
.question-preview-text table td,
.question-preview-options table th,
.question-preview-options table td {
    border: 1px solid #cbd5f5;
    padding: 0.4rem 0.6rem;
    text-align: left;
    vertical-align: top;
    background: #fff;
}

.question-preview-item img,
.preview-options img,
.pgkk-table img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    margin-top: 0.35rem;
}

.knowledge-cards article ul li + li {
    margin-top: 0.15rem;
}

.step-actions .secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.card textarea {
    margin-bottom: 0.75rem;
}

.card textarea:last-of-type {
    margin-bottom: 0;
}

.cp-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cp-item button.remove-cp {
    background: #fee2e2;
    color: #b91c1c;
}

.cp-item button.remove-cp:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tp-item .tp-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tp-item button.remove-tp {
    background: #fee2e2;
    color: #b91c1c;
}

.tp-item button.remove-tp:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.kisi-preview-card {
    margin-top: 1rem;
}

.kisi-preview-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kisi-preview-item {
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fdfdfd;
}

.kisi-preview-item h4 {
    margin: 0 0 0.25rem;
}

.kisi-preview-item p {
    margin: 0.15rem 0;
    color: #475569;
}

.total-info {
    margin-top: 0.5rem;
    font-weight: 600;
}
.muted {
    color: #94a3b8;
}

.empty-state {
    padding: 1.25rem;
    border: 1px dashed #cbd5f5;
    border-radius: 16px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.95rem;
}

.indikator-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cp-cluster {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.cp-summary h3 {
    margin: 0 0 0.35rem;
    color: #0f172a;
}

.cp-summary p {
    margin: 0.25rem 0;
    color: #475569;
}

.tp-block {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
}

.tp-block:first-of-type {
    border-top: none;
    padding-top: 0.5rem;
}

.tp-header h4 {
    margin: 0 0 0.35rem;
}

.tp-header p {
    margin: 0.15rem 0;
    color: #475569;
}

.kkpt-block {
    margin-top: 0.5rem;
    color: #475569;
}

.kkpt-block ul {
    margin: 0.35rem 0 0;
    padding-left: 1.25rem;
}

.tp-indicator-list {
    margin-top: 1rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.image-control,
.richtext-control {
    margin: 0.35rem 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

.richtext-control.inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.richtext-control p {
    margin: 0;
}

.table-builder-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.table-builder-controls .caption-group {
    grid-column: 1 / -1;
}

.table-builder-grid {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 0.75rem;
    background: #f8fafc;
    max-height: 420px;
    overflow: auto;
}

.table-builder-preview {
    width: 100%;
    border-collapse: collapse;
}

.table-builder-preview th,
.table-builder-preview td {
    border: 1px solid #cbd5f5;
    padding: 0.35rem;
    background: #fff;
    vertical-align: top;
}

.table-cell-input {
    width: 100%;
    min-height: 52px;
    border: 1px solid #cbd5f5;
    border-radius: 8px;
    padding: 0.35rem 0.45rem;
    font-size: 0.9rem;
    resize: vertical;
    background: #fff;
}

.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    clip: rect(1px, 1px, 1px, 1px);
    overflow: hidden;
    white-space: nowrap;
}

#knowledgeModal .modal-dialog {
    width: min(96vw, 1600px);
    max-width: none;
    margin: 1rem auto;
}

#knowledgeModal .modal-content {
    border-radius: 24px;
}

#knowledgeModal .modal-body {
    padding: clamp(1rem, 2vw, 2rem);
}

@media (max-width: 960px) {
    .app-header {
        flex-direction: column;
    }

    .question-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .steps-nav li {
        font-size: 0.75rem;
    }

    button {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }
}
