/* Image Studio page. Reuses the global card / table / btn / toggle styles;
   these is-* helpers are the page-specific layout + status bits. */

.image-studio-root { display: block; }
.image-panel { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }

/* Generate tab: numbered prompts on the left, character panel on the right. */
.image-generate {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 900px) {
    .image-generate { grid-template-columns: 1fr; }
}

.is-coming-soon {
    background: var(--surface-2, #f5f6f8);
    border: 1px dashed var(--border, #d7dbe0);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Settings / fields */
.is-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.is-field { display: flex; flex-direction: column; gap: 6px; }
.is-field-full { grid-column: 1 / -1; }
.is-field-label { font-size: 12px; color: var(--text-muted, #6b7280); font-weight: 600; }
.is-field-input {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border, #d7dbe0);
    border-radius: 6px; font-size: 13px; background: var(--surface, #fff); color: inherit;
}
.is-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border, #eceef1); }

/* Profiles */
.is-card-wide { width: 100%; }
.is-profile-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.is-row-actions { display: flex; gap: 6px; }
.is-inline-input {
    width: 100%; padding: 4px 8px; border: 1px solid transparent; border-radius: 4px;
    background: transparent; font-size: 13px; color: inherit;
}
.is-inline-input:focus { border-color: var(--border, #d7dbe0); background: var(--surface, #fff); }
.is-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Status badges */
.is-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.is-status.ok { background: #e6f6ec; color: #1a7f44; }
.is-status.bad { background: #fdecec; color: #c0392b; }
.is-status.pending { background: #eef1f6; color: #5a6472; }

.is-empty { text-align: center; padding: 22px; color: var(--text-muted, #8a93a0); font-size: 13px; }
.is-card-note { font-size: 12px; color: var(--text-muted, #6b7280); margin: 0 0 10px; }
.is-prompt-count { font-size: 12px; color: var(--text-muted, #6b7280); }
.is-prompt-count.over { color: #c0392b; font-weight: 700; }
.is-field-hint { font-weight: 500; color: var(--text-muted, #8a93a0); font-size: 11px; margin-left: 4px; }

/* ── Character / reference panel (Phase 3) ── */
.is-char-picker { display: inline-flex; align-items: center; cursor: pointer; margin-bottom: 12px; }
.is-char-picker input[type="file"] { display: none; }
.is-char-picker.is-disabled { opacity: 0.5; pointer-events: none; }

.is-char-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.is-char-card {
    position: relative; border: 1px solid var(--border, #d7dbe0); border-radius: 8px;
    padding: 6px; background: var(--surface, #fff); display: flex; flex-direction: column; gap: 6px;
}
.is-char-index { position: absolute; top: 4px; left: 6px; font-size: 10px; font-weight: 700; color: var(--text-muted, #8a93a0); }
.is-char-remove {
    position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: none;
    border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; display: flex;
    align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.is-char-remove:hover { background: #c0392b; }
.is-char-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 5px; display: block; }
.is-char-name {
    width: 100%; padding: 4px 6px; border: 1px solid var(--border, #d7dbe0); border-radius: 5px;
    font-size: 12px; background: var(--surface, #fff); color: inherit;
}
.is-char-name.is-char-dupe { border-color: #c0392b; background: #fdecec; }

.is-char-validation { margin: 10px 0 0; font-size: 12px; color: var(--text-muted, #6b7280); }
.is-char-validation.warn { color: #c0392b; font-weight: 600; }

.is-match-preview { margin-top: 12px; }
.is-match-table { font-size: 12px; }
.is-match-table td, .is-match-table th { padding: 4px 8px; }
.is-match-prompt { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-match-warn { color: #c0392b; font-size: 11px; }
.is-chip {
    display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px;
    background: #eaf2ff; color: #1b5fbf; margin: 1px 2px;
}

/* ── History clickable rows + task-detail modal ── */
.is-row-click { cursor: pointer; }
.is-row-click:hover { background: var(--surface-2, #f5f6f8); }

.is-modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.is-modal {
    background: var(--surface, #fff); border-radius: 12px; width: min(820px, 100%);
    max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.is-modal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--border, #eceef1);
}
.is-modal-header h2 { margin: 0; font-size: 16px; }
.is-modal-sub { font-size: 12px; color: var(--text-muted, #6b7280); margin-top: 3px; }
.is-modal-body { overflow: auto; padding: 0; }
.is-detail-prompt { max-width: 420px; }
.is-detail-chars { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.is-detail-char { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--text-muted, #6b7280); }
.is-detail-char img { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border, #d7dbe0); }
