
.rac-cl {
    --rac-blue: #0a67c7;
    --rac-blue-2: #079bc9;
    --rac-red: #ff5c67;
    --rac-line: #d7d7d7;
    --rac-head: #d6d6d6;
    width: min(1720px, calc(100vw - 32px));
    max-width: 100%;
    min-height: 650px;
    margin: 8px auto 0;
    overflow: hidden;
    border: 1px solid #dedede;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 0 2px rgba(0,0,0,.18);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #252525;
    position: relative;
}
.rac-cl *, .rac-cl *::before, .rac-cl *::after { box-sizing: border-box; }
.rac-cl input, .rac-cl select, .rac-cl button { font-family: inherit; }

.rac-cl__toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 12px 14px;
    border-radius: 24px 24px 0 0;
    background: #fff;
}
.rac-cl__toolbar-spacer { flex: 1 1 auto; }
.rac-cl__search-wrap { position: relative; flex: 0 1 285px; }
.rac-cl__search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:15px; height:15px; color:#8a8a8a; pointer-events:none; }
.rac-cl__search-icon svg { width:100%; height:100%; fill:currentColor; }
input.rac-cl__search {
    width:100% !important; min-height:40px; height:40px; padding:7px 12px 7px 36px !important;
    border:1px solid #d0d0d0 !important; border-radius:8px !important; background:#fff !important; color:#333 !important;
    box-shadow:0 1px 3px rgba(0,0,0,.05) !important; outline:none; font-size:12px !important; font-weight:500 !important;
    margin:0 !important;
}
input.rac-cl__search:focus { border-color:#9cc8ee !important; box-shadow:0 0 0 3px rgba(10,103,199,.09) !important; }
select.rac-cl__sort,
.rac-cl__page-size select {
    min-height:40px !important; height:40px !important; border:1px solid #d0d0d0 !important; border-radius:8px !important; background:#fff !important; color:#333 !important;
    box-shadow:0 1px 3px rgba(0,0,0,.05) !important; outline:none; font-size:12px !important; font-weight:500 !important; margin:0 !important;
}
select.rac-cl__sort { width:275px; padding:7px 36px 7px 12px !important; }

button.rac-cl__add {
    appearance: none; -webkit-appearance: none;
    min-width: 286px !important; min-height: 54px !important; height:54px !important; padding: 10px 26px !important;
    border:0 !important; border-radius:20px !important;
    background:var(--rac-blue) !important; color:#fff !important; display:inline-flex !important; align-items:center !important; justify-content:center !important; gap:10px !important;
    font-size:17px !important; line-height:1.1 !important; font-weight:700 !important; cursor:pointer; box-shadow:0 3px 10px rgba(0,0,0,.12) !important;
    transition:transform .15s ease, filter .15s ease, box-shadow .15s ease;
    text-decoration:none !important; margin:0 !important;
}
button.rac-cl__add:hover { filter:brightness(1.04); transform:translateY(-1px); box-shadow:0 5px 14px rgba(0,0,0,.16) !important; }
button.rac-cl__add .rac-cl__add-icon { width:25px; height:25px; display:inline-flex; }
button.rac-cl__add .rac-cl__add-icon svg { width:100%; height:100%; fill:currentColor; }

.rac-cl__divider { height:5px; background:#d6d6d6; }
.rac-cl__statusbar {
    display:flex; align-items:center; justify-content:space-between; gap:16px;
    min-height:48px; padding:8px 12px; background:#fbfbfb; border-bottom:1px solid #ececec;
}
.rac-cl__count { font-size:11px; color:#646464; }
.rac-cl__page-size { display:flex; align-items:center; gap:8px; font-size:11px; font-weight:600; color:#555; }
.rac-cl__page-size select { width:116px; padding:5px 30px 5px 10px !important; }

.rac-cl__table-host { width:100%; position:relative; }
.rac-cl__table-scroller { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
table.rac-cl__table { width:100%; min-width:1360px; border-collapse:separate; border-spacing:0; table-layout:fixed; font-size:11px; }
.rac-cl__table thead th {
    height:32px; padding:5px 6px; background:var(--rac-head); color:#252525; font-weight:500;
    text-align:center; white-space:nowrap; border-right:1px solid #c9c9c9; border-bottom:1px solid #c9c9c9;
}
.rac-cl__table thead th:last-child { border-right:0; }
.rac-cl__table tbody td {
    height:36px; padding:4px 6px; background:#fff; color:#262626; font-weight:400; vertical-align:middle;
    border-right:1px solid var(--rac-line); border-bottom:1px solid var(--rac-line); text-align:center;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.rac-cl__table tbody tr:hover td { background:#fbfdff; }
.rac-cl__table tbody td:last-child { border-right:0; }
.rac-cl__actions-col { width:42px; }
.rac-cl__id-col { width:66px; }
.rac-cl__name-col { width:300px; }
.rac-cl__table th:nth-child(5), .rac-cl__table td:nth-child(5) { width:210px; }
.rac-cl__table th:nth-child(6), .rac-cl__table td:nth-child(6) { width:210px; }
.rac-cl__table th:nth-child(7), .rac-cl__table td:nth-child(7) { width:120px; }
.rac-cl__table th:nth-child(8), .rac-cl__table td:nth-child(8) { width:170px; }
.rac-cl__table th:nth-child(9), .rac-cl__table td:nth-child(9) { width:240px; }
.rac-cl__table th:nth-child(10), .rac-cl__table td:nth-child(10) { width:160px; }
.rac-cl__table th:nth-child(11), .rac-cl__table td:nth-child(11) { width:190px; }
.rac-cl__action-cell { padding:0 !important; text-align:center; }
button.rac-cl__icon-btn {
    appearance:none; -webkit-appearance:none;
    width:30px !important; height:30px !important; min-width:30px !important; min-height:30px !important;
    margin:0 auto !important; border:0 !important; border-radius:8px !important; background:transparent !important;
    display:flex !important; align-items:center !important; justify-content:center !important; cursor:pointer; padding:0 !important; box-shadow:none !important;
}
button.rac-cl__icon-btn svg { width:15px; height:15px; fill:currentColor; }
button.rac-cl__icon-btn--edit { color:#079bc9 !important; }
button.rac-cl__icon-btn--trash { color:var(--rac-red) !important; }
button.rac-cl__icon-btn:hover { background:rgba(0,0,0,.04) !important; }
.rac-cl__empty { height:88px !important; text-align:center !important; color:#777 !important; font-size:12px; }

.rac-cl.is-show-all .rac-cl__table thead th {
    position:sticky;
    top:0;
    z-index:20;
    box-shadow:0 1px 0 rgba(0,0,0,.12);
}

.rac-cl__footer { display:flex; justify-content:flex-end; min-height:54px; padding:10px 12px 12px; }
.rac-cl__pagination { display:flex; justify-content:flex-end; width:100%; }
.rac-cl__pager { display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
button.rac-cl__pager-btn {
    appearance:none; -webkit-appearance:none;
    min-width:32px; height:32px; padding:0 10px; border:1px solid #d8d8d8 !important; border-radius:7px !important; background:#fff !important; color:#3d3d3d !important;
    cursor:pointer; font-size:11px !important; font-weight:600 !important; box-shadow:none !important;
}
button.rac-cl__pager-btn:hover:not(:disabled) { border-color:#9cc8ee !important; background:#f6fbff !important; }
button.rac-cl__pager-btn.is-active { background:var(--rac-blue) !important; color:#fff !important; border-color:var(--rac-blue) !important; }
button.rac-cl__pager-btn:disabled { opacity:.42; cursor:default; }
.rac-cl__pager-dots { padding:0 4px; color:#777; font-size:12px; }

.rac-cl__loading {
    position:absolute; inset:0; z-index:40; display:flex; align-items:center; justify-content:center; gap:10px;
    background:rgba(255,255,255,.58); backdrop-filter:blur(1px); color:#3c3c3c; font-size:12px; font-weight:700;
    border-radius:24px;
}
.rac-cl__loading[hidden] { display:none !important; }
.rac-cl__loading span { width:18px; height:18px; border:2px solid #cbd7e2; border-top-color:var(--rac-blue); border-radius:50%; animation:racclspin .7s linear infinite; }
@keyframes racclspin { to { transform:rotate(360deg); } }

@media (max-width: 1200px) {
    .rac-cl { width:calc(100vw - 16px); }
    .rac-cl__search-wrap { flex-basis:230px; }
    select.rac-cl__sort { width:230px; }
    button.rac-cl__add { min-width:240px !important; min-height:50px !important; height:50px !important; font-size:16px !important; }
}
@media (max-width: 900px) {
    .rac-cl { width:100%; margin-top:4px; border-radius:0; border-left:0; border-right:0; }
    .rac-cl__toolbar { flex-wrap:wrap; border-radius:0; }
    .rac-cl__toolbar-spacer { display:none; }
    .rac-cl__search-wrap { flex:1 1 240px; }
    select.rac-cl__sort { flex:1 1 220px; width:auto; }
    button.rac-cl__add { flex:1 1 100%; min-width:0 !important; }
}
@media (max-width: 600px) {
    .rac-cl__toolbar { padding:9px 8px; gap:8px; }
    .rac-cl__search-wrap, select.rac-cl__sort, button.rac-cl__add { flex:1 1 100%; width:100%; }
    button.rac-cl__add { min-height:48px !important; height:48px !important; border-radius:18px !important; font-size:15px !important; }
    .rac-cl__statusbar { align-items:flex-start; flex-direction:column; }
    .rac-cl__page-size { width:100%; justify-content:space-between; }
    .rac-cl__footer, .rac-cl__pagination { justify-content:center; }
}

/* v0.2.4: compact primary action + real Show All sticky-header clone */
button.rac-cl__add {
    min-width: 150px !important;
    width: 150px !important;
    min-height: 40px !important;
    height: 40px !important;
    padding: 7px 12px !important;
    border-radius: 12px !important;
    gap: 7px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}
button.rac-cl__add .rac-cl__add-icon {
    width: 18px !important;
    height: 18px !important;
}

/* The cloned header is fixed to the viewport, because CSS sticky is broken
   by the table's horizontal overflow container. */
.rac-cl__sticky-clone {
    position: fixed;
    z-index: 10050;
    overflow: hidden;
    display: none;
    pointer-events: none;
    background: transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,.12);
}
.rac-cl__sticky-clone.is-visible { display: block; }
.rac-cl__sticky-clone-inner {
    position: relative;
    min-width: 100%;
}
.rac-cl__sticky-clone table {
    margin: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-family: inherit;
    font-size: 11px;
    background: var(--rac-head);
}
.rac-cl__sticky-clone th {
    height: 32px;
    padding: 5px 6px;
    background: var(--rac-head);
    color: #252525;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    border-right: 1px solid #c9c9c9;
    border-bottom: 1px solid #c9c9c9;
    box-sizing: border-box;
}
.rac-cl__sticky-clone th:last-child { border-right: 0; }

/* Disable the old CSS-only sticky implementation; the JS clone is authoritative. */
.rac-cl.is-show-all .rac-cl__table thead th {
    position: static;
    top: auto;
    z-index: auto;
    box-shadow: none;
}

@media (max-width: 1200px) {
    button.rac-cl__add {
        min-width: 145px !important;
        width: 145px !important;
        min-height: 40px !important;
        height: 40px !important;
        font-size: 12px !important;
    }
}
@media (max-width: 900px) {
    button.rac-cl__add {
        width: auto !important;
        min-width: 150px !important;
        flex: 0 0 auto !important;
    }
}
@media (max-width: 600px) {
    button.rac-cl__add {
        width: 150px !important;
        min-width: 150px !important;
        min-height: 40px !important;
        height: 40px !important;
        border-radius: 12px !important;
        font-size: 12px !important;
    }
}


/* v0.2.5: sticky cloned header must be fully opaque, not transparent */
.rac-cl__sticky-clone {
    background: #d6d6d6 !important;
    border-top: 1px solid #c9c9c9;
    border-left: 1px solid #c9c9c9;
    border-right: 1px solid #c9c9c9;
    box-shadow: 0 2px 6px rgba(0,0,0,.14) !important;
}
.rac-cl__sticky-clone-inner {
    background: #d6d6d6 !important;
}
.rac-cl__sticky-clone table,
.rac-cl__sticky-clone thead,
.rac-cl__sticky-clone tr {
    background: #d6d6d6 !important;
}
.rac-cl__sticky-clone th {
    background: #d6d6d6 !important;
    opacity: 1 !important;
}


/* v0.2.8: content-aware native column sizing. JS now owns actual widths. */
table.rac-cl__table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
}
.rac-cl table.rac-cl__table th,
.rac-cl table.rac-cl__table td {
    width: auto !important;
}
.rac-cl table.rac-cl__table th.rac-cl__actions-col,
.rac-cl table.rac-cl__table td.rac-cl__action-cell,
.rac-cl table.rac-cl__table th.rac-cl__id-col,
.rac-cl table.rac-cl__table td.rac-cl__id-col,
.rac-cl table.rac-cl__table th.rac-cl__name-col,
.rac-cl table.rac-cl__table td.rac-cl__name-col {
    width: auto !important;
}
.rac-cl__table td {
    max-width: 0; /* enables clean ellipsis inside JS-sized fixed columns */
}
.rac-cl__sticky-clone table.rac-cl__table {
    table-layout: fixed !important;
}


/* v0.2.9: true intrinsic content-aware sizing. */
.rac-cl__table-scroller {
    overflow-x: auto;
}
.rac-cl table.rac-cl__table {
    table-layout: fixed !important;
    min-width: 0 !important;
    max-width: none !important;
}
.rac-cl table.rac-cl__table th,
.rac-cl table.rac-cl__table td {
    box-sizing: border-box !important;
}
/* Empty values must not create artificial column width. */
.rac-cl table.rac-cl__table td:empty {
    padding-left: 4px;
    padding-right: 4px;
}


/* v0.2.10: hybrid content-aware sizing fills the table viewport when intrinsic
   content is narrower, while JS preserves intrinsic widths when content is wider. */
.rac-cl__table-scroller {
    display: block;
    width: 100%;
}
.rac-cl table.rac-cl__table {
    margin-left: 0 !important;
    margin-right: 0 !important;
}


/* v0.2.12: customer name opens the customer card */
.rac-cl__customer-link {
    color: #087b86 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
}
.rac-cl__customer-link:hover,
.rac-cl__customer-link:focus {
    color: #079bc9 !important;
    text-decoration: underline !important;
}
