/* Explanatory papers 242 (static/explanatory242.js).
 * Page tokens only (--surface, --text, ...), so the [data-theme="dark"]
 * switch needs nothing here. Monochrome: the only colour is the danger tone
 * on delete and on validation errors. */
#tab-explanatory242 {
    --e242-tint: color-mix(in srgb, var(--text) 6%, transparent);
    padding: 16px 22px;
}

.e242-icon { width: 16px; height: 16px; flex: none; }
.e242-icon-sm { width: 14px; height: 14px; }

/* ---- Toolbar ---- */
.e242-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px;
    padding: 10px 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.e242-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; margin-right: 6px; }
.e242-spacer { flex: 1; }
.e242-meta { font-size: 12px; color: var(--text-secondary); }

.e242-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.e242-btn:hover { background: var(--e242-tint); }
.e242-btn:disabled { opacity: .5; cursor: default; }
.e242-btn-primary { background: var(--text); color: var(--surface); border-color: var(--text); font-weight: 500; }
.e242-btn-primary:hover { background: var(--text); opacity: .88; }
.e242-btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 500; }
.e242-btn-danger:hover { background: var(--danger); opacity: .88; }

/* Active / Archive / All */
.e242-seg {
    display: inline-flex; height: 34px; padding: 2px; gap: 2px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.e242-seg button {
    padding: 0 12px; font: inherit; font-size: 13px; color: var(--text-secondary); cursor: pointer;
    background: transparent; border: none; border-radius: 6px;
}
.e242-seg button:hover { color: var(--text); }
.e242-seg button.active { background: var(--e242-tint); color: var(--text); font-weight: 600; }

/* ---- Grid ---- */
.e242-grid { height: calc(100vh - 210px); min-height: 360px; width: 100%; }
.e242-tag {
    display: inline-block; padding: 0 8px; line-height: 20px; font-size: 12px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--e242-tint);
}
.e242-tag-ok { display: inline-flex; align-items: center; gap: 4px; }
.e242-tag-miss { background: transparent; border-style: dashed; color: var(--text-secondary); }
.e242-files-count { display: inline-flex; align-items: center; gap: 4px; }
a.e242-btn { text-decoration: none; }

/* Photos in the form */
.e242-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.e242-file {
    position: relative; display: grid; place-items: center; width: 84px; height: 84px; overflow: hidden;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--e242-tint);
}
.e242-file a { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-secondary); text-decoration: none; }
.e242-file img { width: 100%; height: 100%; object-fit: cover; }
.e242-file small { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e242-file-pending { opacity: .75; border-style: dashed; }
.e242-file-x {
    position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
    border: none; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer;
}
.e242-overlay { --e242-tint: color-mix(in srgb, var(--text) 6%, transparent); }

.e242-actions { display: inline-flex; gap: 4px; align-items: center; height: 100%; }
.e242-icon-btn {
    display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
    color: var(--text-secondary); background: transparent; border: none; border-radius: 6px; cursor: pointer;
}
.e242-icon-btn:hover { color: var(--text); background: var(--e242-tint); }
.e242-icon-btn.e242-danger:hover { color: var(--danger); }
.e242-icon-btn .e242-icon { width: 16px; height: 16px; }

/* ---- Create / edit / delete modals (on top of the page's .modal) ---- */
.e242-overlay .e242-modal { width: 520px; max-width: calc(100vw - 32px); padding: 24px; }
.e242-overlay .e242-modal-sm { width: 420px; }
.e242-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.e242-modal-head h3, .e242-modal h3 { margin: 0; }
.e242-modal-sub { margin: 6px 0 18px; font-size: 13px; color: var(--text-secondary); }

.e242-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; position: relative; }
.e242-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.e242-field input, .e242-field select, .e242-field textarea {
    width: 100%; padding: 9px 12px; font: inherit; font-size: 14px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color-scheme: light dark;
}
.e242-field input, .e242-field select { height: 40px; }
.e242-field textarea { resize: vertical; min-height: 110px; }
.e242-field input:focus, .e242-field select:focus, .e242-field textarea:focus { outline: none; border-color: var(--text); }
.e242-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.e242-hint, .e242-count { font-size: 12px; color: var(--text-secondary); }
.e242-hint:empty { display: none; }
.e242-count { align-self: flex-end; }
.e242-error { display: none; font-size: 12px; color: var(--danger); }
.e242-field.invalid .e242-error { display: block; }
.e242-field.invalid input, .e242-field.invalid select, .e242-field.invalid textarea { border-color: var(--danger); }

@media (max-width: 700px) {
    #tab-explanatory242 { padding: 12px 16px; }
    .e242-spacer { display: none; }
    .e242-row { grid-template-columns: 1fr; gap: 0; }
}
