﻿/* ================================================================
   configs-subpage.css  —  csp-* reusable for ALL /configs/* pages
   ================================================================ */

/* ── Page container ─────────────────────────────────────────── */
.csp-page {
    display: flex; flex-direction: column;
    margin: 20px;
    border: 1px solid var(--sc-border);
    border-radius: 12px;
    /* แนวตั้งต้องเลื่อนได้ · กล่องนี้สูงตายตัวตาม 100vh และเดิมเป็น overflow: hidden ทั้งสองแกน
       สัญญาของเลย์เอาต์คือเนื้อหาต้องอยู่ใน .csp-body ซึ่งเลื่อนเอง แต่ 175 จาก 235 หน้าที่ใช้
       คลาสนี้ไม่มี .csp-body (และไม่มี .csp-table-wrap) หน้าไหนที่เนื้อหายาวเกินกล่องจึงถูกตัดทิ้ง
       เงียบ ๆ — ไม่มีแถบเลื่อน ไม่มีอะไรบอก เช่นหน้าแผนเปลี่ยนเครื่องที่มี 100 แถว แต่เข้าถึงได้ 13

       แกนนอนยังเป็น hidden เหมือนเดิม ตารางกว้าง ๆ มีคอนเทนเนอร์ของตัวเองสำหรับเลื่อนอยู่แล้ว
       หน้าที่มี .csp-body อยู่แล้วไม่เปลี่ยนพฤติกรรม: body กิน flex:1 พอดีกล่อง ตัวนอกจึงไม่เคยล้น
       จึงไม่มีแถบเลื่อนซ้อนกัน */
    overflow: hidden auto;
    height: calc(100vh - var(--sc-header-h, 60px) - 40px);
    background: var(--sc-surface);
    box-sizing: border-box;
}

/* ── Full-bleed modifier ────────────────────────────────────────
   STANDARD for top-level console pages (e.g. /Helpdesk, /Assets/list,
   /patchmanagement). Drops the floating-card look (20px margin + border +
   radius) so the content fills edge-to-edge and matches the other console
   pages. Use `class="csp-page csp-flush"` on the outermost page div.
   Note: pages that live INSIDE .asset-shell already get this for free via
   itam-sidebar.css — only add csp-flush on pages rendered directly in
   MainLayout. */
.csp-page.csp-flush {
    margin: 0;
    border: none;
    border-radius: 0;
    height: calc(100vh - var(--sc-header-h, 60px));
}

/* ── Header ─────────────────────────────────────────────────── */
.csp-header {
    display: flex; align-items: center; gap: 10px;
    /* จอแคบ: ปล่อยให้ปุ่ม/ช่องค้นหาไหลลงบรรทัดใหม่ แทนที่จะบีบกันจนหัวข้อฉีกเป็นสองบรรทัด
       และ dropdown โดนตัดหายนอกขอบ (เดิมเป็น nowrap โดยปริยาย) */
    flex-wrap: wrap;
    padding: 12px 20px;
    border-bottom: 1px solid var(--sc-border);
    background: var(--sc-surface);
    flex-shrink: 0;
}
/* ช่องค้นหาย่อได้แต่ไม่หายไป แล้วกินเต็มบรรทัดเมื่อไหลลงมาเอง */
.csp-header .csp-search { flex: 1 1 190px; min-width: 150px; }
.csp-back-btn {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 7px;
    border: 1px solid var(--sc-border);
    background: none; cursor: pointer; color: var(--sc-text-2);
    transition: background 0.15s, color 0.15s; flex-shrink: 0;
}
.csp-back-btn:hover { background: var(--sc-surface-2); color: var(--sc-text-1); }

.csp-title { font-size: 14px; font-weight: 600; color: var(--sc-text-1); }

.csp-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* หัวข้อ/ปุ่มห้ามฉีกกลางคำ — ไม่งั้นพอจอแคบ flex จะเลือกบีบตัวอักษรจนขึ้นบรรทัดใหม่กลางคำ
   ("รายการ / สินทรัพย์", "เพิ่มสิน / ทรัพย์") แทนที่จะห่อทั้งปุ่มลงบรรทัดถัดไป */
.csp-title { white-space: nowrap; }
.csp-btn { white-space: nowrap; }

/* ── Search ─────────────────────────────────────────────────── */
.csp-search {
    display: flex; align-items: center; gap: 7px;
    background: var(--sc-surface-2); border: 1px solid var(--sc-border);
    border-radius: 7px; padding: 0 10px; height: 32px; width: 200px;
}
.csp-search:focus-within { border-color: var(--sc-primary); }
.csp-search svg { flex-shrink: 0; color: var(--sc-text-3); }
.csp-search input {
    background: none; border: none; outline: none;
    font-size: 12px; color: var(--sc-text-1); width: 100%; font-family: inherit;
}
.csp-search input::placeholder { color: var(--sc-text-3); }

/* ── Buttons ─────────────────────────────────────────────────── */
.csp-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 0 12px; height: 32px; border-radius: 7px;
    font-size: 12px; font-weight: 500; cursor: pointer;
    border: 1px solid transparent; transition: all 0.15s; font-family: inherit;
}
.csp-btn-primary  { background: var(--sc-primary); color: #fff; }
.csp-btn-primary:hover  { background: var(--sc-primary-dark); }
.csp-btn-danger   { background: color-mix(in srgb, var(--sc-error) 12%, transparent); color: var(--sc-error); border-color: color-mix(in srgb, var(--sc-error) 30%, transparent); }
.csp-btn-danger:hover   { background: color-mix(in srgb, var(--sc-error) 20%, transparent); }
.csp-btn-ghost    { background: var(--sc-surface-2); color: var(--sc-text-2); border-color: var(--sc-border); }
.csp-btn-ghost:hover    { color: var(--sc-text-1); }

/* ── Table ───────────────────────────────────────────────────── */
/* Scrollable page body with the standard gutter. Pages used to repeat
   style="padding:20px;overflow:auto;" inline on every .csp-body because the class
   itself had no rule - so any page that forgot it rendered flush to the frame. */
.csp-body { flex: 1 1 auto; overflow: auto; padding: 20px; min-height: 0; }

.csp-table-wrap { flex: 1; overflow-y: auto; background: var(--sc-surface); }
.csp-table-wrap::-webkit-scrollbar { width: 5px; }
.csp-table-wrap::-webkit-scrollbar-thumb { background: var(--sc-border); border-radius: 3px; }

.csp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.csp-table thead { position: sticky; top: 0; z-index: 2; }
.csp-table thead tr { background: var(--sc-surface-2); }
.csp-table th {
    padding: 10px 14px; text-align: left;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--sc-text-3);
    border-bottom: 1px solid var(--sc-border); white-space: nowrap;
}
.csp-table td {
    padding: 11px 14px; color: var(--sc-text-1);
    border-bottom: 1px solid var(--sc-border); vertical-align: middle;
}
.csp-table tbody tr:hover td { background: var(--sc-surface-2); }
.csp-table tbody tr.selected td { background: color-mix(in srgb, var(--sc-primary) 8%, transparent); }
.csp-table tbody tr:last-child td { border-bottom: none; }

.csp-link { color: var(--sc-primary); cursor: pointer; font-weight: 500; }
.csp-link:hover { text-decoration: underline; }
.csp-text-muted { color: var(--sc-text-3); font-size: 12px; }
.csp-empty { text-align: center; padding: 48px; color: var(--sc-text-3); font-size: 13px; }
/* Explanatory text under a control — the same muted tone as an empty state, set inline. */
.csp-hint { color: var(--sc-text-3); font-size: 12px; line-height: 1.5; }

/* ── Row action buttons ──────────────────────────────────────── */
.csp-actions { display: flex; justify-content: center; gap: 4px; }
.csp-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px;
    border: 1px solid var(--sc-border); background: none; cursor: pointer;
    color: var(--sc-text-2); transition: all 0.15s;
}
.csp-icon-btn:hover              { background: var(--sc-surface-2); color: var(--sc-text-1); }
.csp-icon-btn-danger:hover       { background: color-mix(in srgb, var(--sc-error) 10%, transparent); color: var(--sc-error); border-color: color-mix(in srgb, var(--sc-error) 30%, transparent); }

/* ── Checkbox ────────────────────────────────────────────────── */
.csp-checkbox { width: 15px; height: 15px; cursor: pointer; accent-color: var(--sc-primary); }

/* ── Footer ──────────────────────────────────────────────────── */
.csp-footer {
    display: flex; align-items: center; justify-content: space-between;
    /* เดิมข้อความ "แสดง x - y จาก N รายการ" ถูกบีบจนแตกเป็น 4 บรรทัด (footer สูง 113px)
       ให้ห่อทั้งบล็อกลงบรรทัดใหม่แทน */
    flex-wrap: wrap; gap: 8px 12px;
    padding: 8px 20px; border-top: 1px solid var(--sc-border);
    background: var(--sc-surface); font-size: 12px; color: var(--sc-text-3); flex-shrink: 0;
}
.csp-selected-count { color: var(--sc-primary); font-weight: 500; }

/* ── Loading ─────────────────────────────────────────────────── */
.csp-loading { display: flex; align-items: center; justify-content: center; height: 200px; }
.csp-spinner {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2.5px solid var(--sc-border); border-top-color: var(--sc-primary);
    animation: csp-spin 0.7s linear infinite;
}
@keyframes csp-spin { to { transform: rotate(360deg); } }

/* ── Modal ───────────────────────────────────────────────────── */
.csp-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1050; }
.csp-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 1051; background: var(--sc-surface);
    border: 1px solid var(--sc-border); border-radius: 12px;
    max-width: 95vw; max-height: 90vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.csp-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--sc-border);
    font-size: 14px; font-weight: 600; color: var(--sc-text-1); flex-shrink: 0;
}
.csp-modal-close {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px;
    border: none; background: none; cursor: pointer; color: var(--sc-text-3); transition: all 0.15s;
}
.csp-modal-close:hover { background: var(--sc-surface-2); color: var(--sc-text-1); }
.csp-modal-body    { padding: 18px; overflow-y: auto; flex: 1; }
.csp-modal-footer  { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--sc-border); flex-shrink: 0; }

/* ── Members of a role (Roles → view) ─────────────────────────── */
.csp-members-modal { width: 520px; }
.csp-members-modal .csp-modal-body { padding: 8px 0; min-height: 120px; }
.csp-members-search { margin: 4px 18px 8px; }
.csp-member-list { list-style: none; margin: 0; padding: 0; }
.csp-member {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 18px; border-bottom: 1px solid var(--sc-border);
}
.csp-member:last-child { border-bottom: none; }
.csp-member-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--sc-surface-2); color: var(--sc-text-2);
    font-size: 11px; font-weight: 600;
}
.csp-member-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.csp-member-name, .csp-member-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csp-member-name { font-size: 13px; font-weight: 500; color: var(--sc-text-1); }
.csp-member-sub  { font-size: 11.5px; color: var(--sc-text-3); }
.csp-members-count { margin-right: auto; align-self: center; font-size: 12px; color: var(--sc-text-3); }

/* ── Form ────────────────────────────────────────────────────── */
.csp-form-row  { display: flex; flex-wrap: wrap; gap: 16px; }
.csp-form-group { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.csp-form-group.csp-half { width: calc(50% - 8px); }
.csp-form-group.csp-third { width: calc(33.333% - 11px); }
@media (max-width: 768px) { .csp-form-group.csp-third { width: 100%; } }
.csp-form-group label {
    font-size: 11px; font-weight: 600; color: var(--sc-text-2);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.csp-input {
    width: 100%; padding: 7px 10px;
    background: var(--sc-surface-2); border: 1px solid var(--sc-border); border-radius: 7px;
    font-size: 13px; color: var(--sc-text-1); font-family: inherit;
    transition: border-color 0.15s; box-sizing: border-box;
}
.csp-input:focus { outline: none; border-color: var(--sc-primary); }
.csp-input::placeholder { color: var(--sc-text-3); }

/* ช่องที่กรอกไม่ได้ต้องดูออกตั้งแต่ยังไม่คลิก — เดิม :disabled ไม่มี style เลย ช่องที่ถูกล็อก
   ไว้ตามเช็คบ็อกซ์จึงหน้าตาเหมือนช่องที่พิมพ์ได้ทุกประการ คนกรอกจะรู้ก็ต่อเมื่อคลิกแล้วพิมพ์ไม่ติด
   ใช้ทั้งพื้น เส้นขอบ สีตัวอักษร และ cursor พร้อมกัน เพราะอย่างใดอย่างเดียวยังอ่านเป็น
   "ช่องว่างที่ยังไม่ได้กรอก" ได้อยู่ */
.csp-input:disabled,
.csp-input[disabled] {
    background: var(--sc-surface);
    border-color: var(--sc-border-2, var(--sc-border));
    border-style: dashed;
    color: var(--sc-text-3);
    cursor: not-allowed;
    opacity: 0.7;
}
.csp-input:disabled::placeholder,
.csp-input[disabled]::placeholder { color: var(--sc-text-3); }

/* ป้ายกำกับเหนือช่องที่ถูกล็อก จางไปด้วยกัน จะได้อ่านเป็นก้อนเดียวว่าทั้งบล็อกนี้ยังไม่เปิดใช้ */
.csp-label-disabled { opacity: 0.55; }
textarea.csp-input { resize: vertical; }
select.csp-input option { background: var(--sc-surface); color: var(--sc-text-1); }
/* A list box (select multiple) shows its choices in place, and the rule above painted the chosen ones
   exactly like the rest — on the technician page every account looked as though it held no role and
   no group. The gradient is what keeps the colour while the box has focus: Chrome paints its own
   selection colour over a plain background-color there, but not over a background-image. */
select.csp-input[multiple] option:checked {
    background: var(--sc-primary-light) linear-gradient(0deg, var(--sc-primary-light), var(--sc-primary-light));
    color: var(--sc-text-1);
    font-weight: 600;
}

/* ── Badge ───────────────────────────────────────────────────── */
/* ป้ายสถานะห้ามฉีกกลางคำ — คอลัมน์สถานะแคบ (73px) ทำให้ "กำลังใช้งาน" ถูกหั่นเป็น 3 บรรทัด
   สูง 39px ดันความสูงแถวทั้งตาราง ปล่อยให้ป้ายดันคอลัมน์กว้างขึ้นเองแทน */
.csp-badge { white-space: nowrap; }
.csp-badge {
    display: inline-block; padding: 2px 8px; border-radius: 100px;
    font-size: 11px; font-weight: 600; background: var(--sc-primary-light, #dbeafe); color: var(--sc-primary);
}
.csp-badge-success { background: var(--ops-success-soft, #dcfce7); color: var(--ops-success, #16a34a); }
.csp-badge-muted   { background: var(--ops-border, #e5e7eb); color: var(--ops-text-2, #374151); border: 1px solid var(--ops-border-strong, #d1d5db); }
.csp-badge-warn    { background: var(--ops-warning-soft, #fef3c7); color: var(--ops-warning, #b45309); }
.csp-badge-info    { background: var(--ops-accent-soft, #dbeafe); color: var(--ops-accent, #2563eb); }
.csp-badge-danger  { background: var(--ops-danger-soft, #fee2e2); color: var(--ops-danger, #dc2626); }
[data-theme="dark"] .csp-badge-success { background: #14532d; color: #4ade80; }
[data-theme="dark"] .csp-badge-muted   { background: #374151; color: #d1d5db; border-color: #4b5563; }
[data-theme="dark"] .csp-badge-warn    { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .csp-badge-info    { background: #1e3a8a; color: #93c5fd; }
[data-theme="dark"] .csp-badge-danger  { background: #7f1d1d; color: #fca5a5; }

.csp-row-danger td { background: var(--ops-danger-soft, #fef2f2); }
[data-theme="dark"] .csp-row-danger td { background: #3f1d1d; }

/* ── Stat cards (operation dashboards) ───────────────────────── */
.csp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.csp-stat { display: flex; align-items: center; gap: 12px; background: var(--sc-surface); border: 1px solid var(--sc-border); border-radius: 10px; padding: 14px 16px; }
.csp-stat-ic { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--sc-surface-2); color: var(--sc-primary); }
.csp-stat-label { font-size: 12px; color: var(--sc-text-2); }
.csp-stat-value { font-size: 21px; font-weight: 700; color: var(--sc-text-1); line-height: 1.2; }

/* ── Tabs ────────────────────────────────────────────────────── */
.csp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--sc-border); margin-bottom: 14px; }
.csp-tab { padding: 9px 16px; font-size: 13px; font-weight: 500; color: var(--sc-text-2); background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.15s; }
.csp-tab:hover { color: var(--sc-text-1); }
.csp-tab.active { color: var(--sc-primary); border-bottom-color: var(--sc-primary); font-weight: 600; }

/* ── Detail / Form page layout ───────────────────────────────── */
.csp-detail {
    flex: 1; overflow-y: auto; padding: 20px 24px;
    background: var(--sc-surface-2);
}
/* ฟอร์มหลักใน csp-page (EditForm → <form>) ต้องเป็น flex column ที่เติมความสูง เพื่อให้ .csp-detail (flex:1)
   ข้างในยืดเต็ม + scroll ในตัว ไม่งั้นเนื้อหาลอยบน/ล้นออกล่าง — จัดผ่าน CSS ตรงๆ (EditForm อาจไม่ forward style) */
.csp-page > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.csp-detail::-webkit-scrollbar { width: 5px; }
.csp-detail::-webkit-scrollbar-thumb { background: var(--sc-border); border-radius: 3px; }

.csp-section {
    background: var(--sc-surface); border: 1px solid var(--sc-border);
    border-radius: 10px; padding: 20px 24px; margin-bottom: 14px;
}
.csp-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--sc-text-3);
    margin-bottom: 18px; padding-bottom: 10px;
    border-bottom: 1px solid var(--sc-border);
}
.csp-check-row { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.csp-check-item { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.csp-check-item input[type="checkbox"],
.csp-check-item input[type="radio"] { width: 15px; height: 15px; accent-color: var(--sc-primary); cursor: pointer; flex-shrink: 0; }
.csp-check-label { font-size: 13px; color: var(--sc-text-1); cursor: pointer; }
.csp-perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.csp-perm-card { border: 1px solid var(--sc-border); border-radius: 8px; padding: 12px 14px; background: var(--sc-surface-2); }
.csp-perm-card-title { font-size: 11px; font-weight: 700; color: var(--sc-text-2); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--sc-border); text-transform: uppercase; letter-spacing: 0.04em; }
.csp-perm-card .csp-check-item { margin-bottom: 4px; }
.csp-perm-card-toggle { padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--sc-border); width: 100%; }
.csp-perm-card-body { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.csp-perm-sub-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--sc-text-2); margin-bottom: 10px; }

/* ── Modern input-group: select ไร้ขอบใน + ไอคอนนำ + ปุ่ม quick-add แนบขวา + focus-glow.
   ใช้กับ dropdown ที่มีปุ่ม "เพิ่ม" (Vendor / Software Group / License Type ฯลฯ) ── */
/* จูนให้ตรงกับ .csp-input (พื้น surface-2, radius 7px, padding 7px) จะได้กลืนกับช่องอื่นในฟอร์ม */
.csp-ig { display: flex; align-items: stretch; border: 1px solid var(--sc-border); border-radius: 7px; background: var(--sc-surface-2); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.csp-ig:focus-within { border-color: var(--sc-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc-primary) 12%, transparent); }
.csp-ig-icon { display: flex; align-items: center; padding-left: 10px; color: var(--sc-text-3); flex-shrink: 0; }
.csp-ig > select { flex: 1; min-width: 0; border: none; background: transparent; padding: 7px 10px; font-size: 13px; color: var(--sc-text-1); outline: none; font-family: inherit; }
.csp-ig-add { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; border: none; border-left: 1px solid var(--sc-border); cursor: pointer; background: color-mix(in srgb, var(--sc-primary) 9%, transparent); color: var(--sc-primary); font-weight: 600; font-size: 12.5px; padding: 0 14px; white-space: nowrap; transition: background .15s; }
.csp-ig-add:hover { background: color-mix(in srgb, var(--sc-primary) 17%, transparent); }
.csp-ig-add:active { background: color-mix(in srgb, var(--sc-primary) 24%, transparent); }

/* ── Single-file upload ──────────────────────────────────────── */
/* A drop zone, not a filename box with buttons beside it. The file input is stretched invisibly
   over the whole card, so the card is both the click target and the drop target and the states
   below are the only thing left to style. */
.csp-drop {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border: 1px dashed var(--sc-border); border-radius: 10px;
    background: var(--sc-surface-2);
    transition: border-color .15s, background .15s;
    min-height: 60px;
}
.csp-drop:hover { border-color: var(--sc-primary); }

/* Something is there: a solid edge, because this is a thing now rather than a place to put one. */
.csp-drop-filled { border-style: solid; }

/* Mid-drag. */
.csp-drop-over {
    border-color: var(--sc-primary);
    background: color-mix(in srgb, var(--sc-primary) 8%, var(--sc-surface-2));
}

.csp-drop-input {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.csp-drop-input:focus-visible + .csp-drop-thumb { outline: 2px solid var(--sc-primary); outline-offset: 2px; }

.csp-drop-thumb {
    flex: 0 0 auto;
    width: 40px; height: 40px; border-radius: 8px;
    background: var(--sc-surface); border: 1px solid var(--sc-border);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; color: var(--sc-text-3);
}
.csp-drop-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.csp-drop-thumb-empty { border-style: dashed; background: transparent; }

.csp-drop-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.csp-drop-name {
    font-size: 13px; color: var(--sc-text-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.csp-drop-name-empty { color: var(--sc-text-2); font-weight: 500; }
.csp-drop-sub { font-size: 11px; color: var(--sc-text-3); }

/* Above the input, or it never receives the click. */
.csp-drop-remove {
    position: relative; z-index: 1;
    flex: 0 0 auto;
    width: 26px; height: 26px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 1px solid transparent; cursor: pointer;
    color: var(--sc-text-3);
}
.csp-drop-remove:hover {
    color: var(--sc-danger, #dc2626);
    background: color-mix(in srgb, var(--sc-danger, #dc2626) 10%, transparent);
}

/* One line under the card, for what went wrong or what the page falls back to. */
.csp-upload-foot { margin-top: 5px; }
.csp-upload-hint { font-size: 11px; color: var(--sc-text-3); }
.csp-upload-error { font-size: 11px; color: var(--sc-danger, #dc2626); }

/* ── Choice group ────────────────────────────────────────────── */
/* A short, fixed set of options laid out as cards instead of hidden in a select. The real radio is
   still there under each card — it carries the keyboard and the grouping — it just has nothing to
   draw. */
.csp-choice { display: flex; gap: 8px; }
.csp-choice-item {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 9px 6px;
    border: 1px solid var(--sc-border); border-radius: 9px;
    background: var(--sc-surface-2);
    color: var(--sc-text-2);
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.csp-choice-item:hover { border-color: var(--sc-primary); color: var(--sc-text-1); }
.csp-choice-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.csp-choice-item:focus-within { outline: 2px solid var(--sc-primary); outline-offset: 2px; }

.csp-choice-on {
    border-color: var(--sc-primary);
    background: color-mix(in srgb, var(--sc-primary) 10%, var(--sc-surface-2));
    color: var(--sc-primary);
}

.csp-choice-icon { display: block; }
.csp-choice-glyph {
    width: 46px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 700; line-height: 1;
}
.csp-choice-label { font-size: 12px; font-weight: 500; }
