/* ==========================================================================
   BrikPanel - Coupons List
   Modern, AJAX-powered coupon management interface
   ========================================================================== */

/* ---------- Variables ---------- */
.brikpanel-cp {
    --bg: #f1f1f1;
    --card: #ffffff;
    --text: #303030;
    --text-secondary: #616161;
    --text-placeholder: #8a8a8a;
    --border: #e3e3e3;
    --input-border: #8a8a8a;
    --input-focus: #303030;
    --primary: #303030;
    --primary-hover: #1a1a1a;
    --success: #1a8917;
    --error: #d72c0d;
    --hover-bg: #f7f7f7;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text);
    max-width: none;
    margin: 0;
    padding: 0;
}

/* ---------- Header ----------
   Levels set by brikpanel-fit-row.js (the PHP lists them): one line while it
   fits (title, search, Add coupon); `is-two-rows` puts the title and Add
   coupon on top and the search under them; `is-icon-add` shows Add coupon as
   its icon (last resort). The main group is `display: contents` on one line,
   so the search can sit between the title and the button. */
.brikpanel-cp-header {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    padding: 0 0 1.25rem; /* the page shell gives the top */
    gap: 1rem;
}

.brikpanel-cp-header-main {
    display: contents;
}

.brikpanel-cp-header-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: none;
    order: 0;
}

.brikpanel-cp-header-left h1 {
    font-size: var(--brikpanel-title-size, 1.125rem);
    font-weight: var(--brikpanel-title-weight, 600);
    line-height: var(--brikpanel-title-line, 1.3);
    padding: 0;
    margin: 0;
    color: var(--text);
}

.brikpanel-cp-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.375rem;
    padding: 0 0.5rem;
    border-radius: 1rem;
    background: var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.brikpanel-cp-header-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: none;
    order: 2;
}

/* ---------- Search ---------- */
/* On one line the box may shrink, but not below 12rem: a narrower row is the
   helper's cue to take the next level instead. */
.brikpanel-cp-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    order: 1;
    flex: 0 1 240px;
    min-width: 12rem;
    margin-inline-start: auto;
}

.brikpanel-cp-header.is-two-rows {
    flex-wrap: wrap;
    row-gap: 0.75rem;
}

.brikpanel-cp-header.is-two-rows .brikpanel-cp-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex: 1 1 100%;
    min-width: 0;
}

.brikpanel-cp-header.is-two-rows .brikpanel-cp-search-wrap {
    flex: 1 1 100%;
    min-width: 0;
    margin-inline-start: 0;
}

.brikpanel-cp-header.is-icon-add .brikpanel-cp-add-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.brikpanel-cp-header.is-icon-add #bpc-add-new {
    padding: 0.5rem;
}

.brikpanel-cp-search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-placeholder);
    pointer-events: none;
}

/* The box is the shared quiet .brikpanel-control; only room for the icon here. */
.brikpanel-cp input[type="text"].brikpanel-cp-search {
    width: 100%;
    min-width: 0;
    padding-inline-start: 36px;
}

/* ---------- Buttons ---------- */
.brikpanel-cp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
}

.brikpanel-cp-btn.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

.brikpanel-cp-btn.primary:hover {
    background: var(--primary-hover);
}

.brikpanel-cp-btn.secondary {
    background: var(--card);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--border), 0 1px 0 rgba(0,0,0,0.05);
}

.brikpanel-cp-btn.secondary:hover {
    background: var(--hover-bg);
}

.brikpanel-cp-btn.danger {
    background: var(--card);
    color: var(--error);
    box-shadow: inset 0 0 0 1px var(--border), 0 1px 0 rgba(0,0,0,0.05);
}

.brikpanel-cp-btn.danger:hover {
    background: #fef2f2;
}

.brikpanel-cp-btn.small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.brikpanel-cp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- Filters Bar ---------- */
.brikpanel-cp-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

/* ---------- Status Tabs ----------
   One line that scrolls inside itself when it runs out of room (data-bp-strip,
   the shared strip helper): it never widens the page. */
.brikpanel-cp-tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    flex: 0 1 auto;
}

.brikpanel-cp-tab {
    display: inline-flex;
    align-items: center;
    flex: none;
    white-space: nowrap;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.brikpanel-cp-tab:hover {
    background: rgba(0,0,0,0.05);
}

.brikpanel-cp-tab.active {
    background: rgba(0,0,0,0.08);
    color: var(--text);
    font-weight: 600;
}

/* Counts read at 4.5:1 or more: the muted gray was 3:1 on a tab and 2.5:1 on
   the selected one. */
.brikpanel-cp-tab-count {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.brikpanel-cp-tab.active .brikpanel-cp-tab-count {
    color: inherit;
}

/* ---------- Filter Selects ---------- */
.brikpanel-cp-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* The box itself is the shared .brikpanel-control (front-end/shared/brikpanel-ui.css),
   quiet in the filter row, 40px like every filter box (field test D1).
   WordPress 7.1 caps every select at 25rem with a (0,1,1) rule, so the width cap
   needs the same weight. */
.wp-core-ui select.brikpanel-cp-select {
    max-width: 180px;
}

.brikpanel-cp-select.full {
    max-width: none;
    width: 100%;
}

/* ---------- Bulk Bar ---------- */
.brikpanel-cp-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    background: #f0f4ff;
    border: 1px solid #d0daf7;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.brikpanel-cp-bulk-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 550;
    color: var(--text);
}

.brikpanel-cp-bulk-link {
    background: none;
    border: none;
    color: #4a6cf7;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.brikpanel-cp-bulk-link:hover {
    color: #3451d1;
}

.brikpanel-cp-bulk-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------- Card ---------- */
.brikpanel-cp-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* ---------- Table ---------- */
.brikpanel-cp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* No min-width: brikpanel-fit-table.js measures what the columns need and
   stacks the rows into cards when the card is narrower (field test C4; the
   rows used to hide four columns and their buttons in a sideways scroll). */
.brikpanel-cp-table {
    width: 100%;
    border-collapse: collapse;
}

.brikpanel-cp-table thead {
    background: var(--hover-bg);
    border-bottom: 1px solid var(--border);
}

/* Headings of two words ("Usage / Limit", "Expiry date") may take two lines;
   the columns are as wide as their content, with no fixed floors, so the
   table fits the card as long as it can (brikpanel-fit-table.js measures). */
.brikpanel-cp-table thead th {
    padding: 0.75rem;
    text-align: start;
    font-size: var(--brikpanel-th-size, 0.75rem);
    font-weight: var(--brikpanel-th-weight, 600);
    color: #616161;
    text-transform: var(--brikpanel-caps-case, none);
    letter-spacing: var(--brikpanel-caps-track, normal);
    user-select: none;
}

.brikpanel-cp-table thead th:first-child {
    padding-inline-start: 1.25rem;
}

.brikpanel-cp-th-check {
    width: 40px;
}

/* ---------- Table Rows ---------- */
.brikpanel-cp-row {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.1s;
    cursor: default;
}

.brikpanel-cp-row:last-child {
    border-bottom: none;
}

.brikpanel-cp-row:hover {
    background: var(--hover-bg);
}

.brikpanel-cp-row td {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    vertical-align: middle;
    color: var(--text);
}

.brikpanel-cp-row td:first-child {
    padding-inline-start: 1.25rem;
}

.brikpanel-cp-row-deleting {
    opacity: 0.4;
    pointer-events: none;
}

/* ---------- Checkbox ---------- */
.brikpanel-cp-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ---------- Coupon Code ---------- */
/* Capitals come from the script (asciiUpper), not from text-transform: CSS
   capitals follow the page language and wrote "BRİK" on a Turkish dashboard. */
.brikpanel-cp-code-text {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.02em;
    cursor: pointer;
}

.brikpanel-cp-code-text:hover {
    color: var(--primary-hover);
}

/* ---------- Type Badge ---------- */
.brikpanel-cp-type-badge {
    display: inline-block;
    padding: 0.0625rem 0.5rem;
    border-radius: 0.25rem;
    background: #f0f0f0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ---------- Amount Cell ---------- */
.brikpanel-cp-amount-cell {
    font-weight: 550;
    white-space: nowrap;
}

/* ---------- Description Cell ----------
   A block, so the long text ends in "..." at 180px instead of widening the
   column (an inline span ignored both the cap and the ellipsis). */
.brikpanel-cp-desc-cell {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

/* ---------- Usage Cell ---------- */
.brikpanel-cp-usage-cell {
    white-space: nowrap;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ---------- Expiry Cell ---------- */
.brikpanel-cp-expiry-cell {
    font-size: 0.8125rem;
}

.brikpanel-cp-expiry-expired {
    color: var(--error);
    font-weight: 550;
}

/* ---------- Status Badge ---------- */
.brikpanel-cp-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.brikpanel-cp-status-badge.published {
    background: #e8f5e9;
    color: #1b5e20;
}

.brikpanel-cp-status-badge.draft {
    background: #f5f5f5;
    color: var(--text-secondary, #616161);
}

.brikpanel-cp-status-badge.trashed {
    background: #fce4e4;
    color: #c62828;
}

.brikpanel-cp-status-badge:hover {
    box-shadow: 0 0 0 2px var(--primary);
}

.brikpanel-cp-status-saving {
    opacity: 0.5;
    pointer-events: none;
}

/* ---------- Actions ---------- */
.brikpanel-cp-actions-cell {
    text-align: end;
    padding-inline-end: 1.25rem !important;
}

.brikpanel-cp-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

/* Row buttons wait for the pointer only where there is a pointer that hovers:
   on a touch screen they were invisible and still took taps (field test C4).
   Keyboard focus shows them too. */
@media (hover: hover) and (pointer: fine) {
    .brikpanel-cp-table:not(.is-stacked) .brikpanel-cp-actions {
        opacity: 0;
        transition: opacity 0.15s;
    }

    .brikpanel-cp-table .brikpanel-cp-row:hover .brikpanel-cp-actions,
    .brikpanel-cp-table .brikpanel-cp-row:focus-within .brikpanel-cp-actions {
        opacity: 1;
    }
}

/* ---------- Stacked rows ----------
   The table did not fit its card (brikpanel-fit-table.js set `is-stacked`):
   each coupon is a card. The checkbox and the code share the first line, the
   figures follow as label-over-value tiles, the row buttons close the card. */
.brikpanel-cp-table.brikpanel-fit-table.is-stacked > tbody > tr.brikpanel-cp-row:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.625rem 1.25rem;
    padding: 0.875rem 1rem;
}

.brikpanel-cp-table.is-stacked > tbody > tr.brikpanel-cp-row > td {
    flex: 0 1 auto;
    padding: 0;
}

.brikpanel-cp-table.is-stacked > tbody > tr.brikpanel-cp-row > td.brikpanel-cp-cell-check {
    order: -3;
    flex: none;
    padding-top: 0.125rem;
}

.brikpanel-cp-table.is-stacked > tbody > tr.brikpanel-cp-row > td.brikpanel-fit-lead {
    order: -2;
    flex: 1 1 0;
    min-width: 0;
    align-self: center;
}

/* The status badge closes the first line, across from the code; its label is
   not needed there. The row's ::after ends that line. */
.brikpanel-cp-table.is-stacked > tbody > tr.brikpanel-cp-row > td.brikpanel-cp-cell-status {
    order: -2;
    flex: none;
    align-self: center;
}

.brikpanel-cp-table.is-stacked > tbody > tr.brikpanel-cp-row > td.brikpanel-cp-cell-status::before {
    display: none;
}

.brikpanel-cp-table.brikpanel-fit-table.is-stacked > tbody > tr.brikpanel-cp-row:not([hidden])::after {
    content: "";
    order: -2;
    flex: 0 0 100%;
    height: 0;
    margin-top: -0.625rem;
}

.brikpanel-cp-table.is-stacked > tbody > tr.brikpanel-cp-row > td.brikpanel-fit-full {
    order: 9;
    flex: 1 1 100%;
}

.brikpanel-cp-table.is-stacked td.brikpanel-cp-actions-cell {
    padding: 0 !important;
    text-align: start;
}

.brikpanel-cp-table.is-stacked .brikpanel-cp-actions {
    justify-content: flex-start;
    margin-inline-start: -0.375rem;
}

/* The amount's edit box keeps its padding; its figure lines up with the label. */
.brikpanel-cp-table.is-stacked .brikpanel-cp-editable {
    margin-inline-start: -0.375rem;
}

.brikpanel-cp-table.is-stacked .brikpanel-cp-desc-cell {
    max-width: none;
    white-space: normal;
}

.brikpanel-cp-actions button,
.brikpanel-cp-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.1s;
    text-decoration: none;
}

.brikpanel-cp-actions button:hover,
.brikpanel-cp-actions a:hover {
    background: var(--border);
    color: var(--text);
}

.brikpanel-cp-action-delete:hover {
    color: var(--error) !important;
    background: #fef2f2 !important;
}

/* ---------- Editable Cells ---------- */
.brikpanel-cp-editable {
    cursor: text;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s;
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
}

.brikpanel-cp-editable:hover {
    background: rgba(0,0,0,0.04);
    box-shadow: 0 0 0 1px var(--border);
}

.brikpanel-cp-editable.saving {
    opacity: 0.5;
    pointer-events: none;
}

.brikpanel-cp-inline-input {
    width: 80px;
    padding: 0.25rem 0.375rem;
    border: 1px solid var(--input-focus);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--text);
    outline: none;
    box-shadow: 0 0 0 1px var(--input-focus);
    background: var(--card);
}

.brikpanel-cp-inline-input:focus {
    border-color: var(--input-focus);
}

/* ---------- Pagination ---------- */
.brikpanel-cp-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.brikpanel-cp-showing {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.brikpanel-cp-page-btns {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.brikpanel-cp-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--card);
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.brikpanel-cp-page-btn:hover:not(.disabled):not(.active) {
    background: var(--hover-bg);
    border-color: var(--text-placeholder);
}

.brikpanel-cp-page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.brikpanel-cp-page-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.brikpanel-cp-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    color: var(--text-placeholder);
    font-size: 0.8125rem;
}

/* ---------- Empty State ---------- */
.brikpanel-cp-empty {
    text-align: center;
    padding: 3rem 1rem !important;
}

.brikpanel-cp-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.brikpanel-cp-empty-state p {
    color: var(--text-secondary, #616161);
    font-size: 0.875rem;
    margin: 0;
}

/* ---------- Loading Spinner ---------- */
.brikpanel-cp-loading-row td {
    text-align: center;
    padding: 3rem 1rem !important;
}

.brikpanel-cp-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: bpc-spin 0.6s linear infinite;
}

@keyframes bpc-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Drawer Overlay ---------- */
.brikpanel-cp-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.brikpanel-cp-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Drawer ---------- */
.brikpanel-cp-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 90vw;
    background: var(--card);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brikpanel-cp-drawer.open {
    transform: translateX(0);
}

.brikpanel-cp-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brikpanel-cp-drawer-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.brikpanel-cp-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.brikpanel-cp-drawer-close:hover {
    background: var(--hover-bg);
    color: var(--text);
}

.brikpanel-cp-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.brikpanel-cp-drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ---------- Drawer Sections ---------- */
.brikpanel-cp-drawer-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.brikpanel-cp-drawer-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.brikpanel-cp-drawer-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.25rem 0;
    padding: 0;
    text-transform: none;
    letter-spacing: normal;
}

/* ---------- Drawer Fields ---------- */
.brikpanel-cp-qe-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.brikpanel-cp-qe-field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

.brikpanel-cp-qe-field input[type="text"],
.brikpanel-cp-qe-field input[type="number"],
.brikpanel-cp-qe-field input[type="date"],
.brikpanel-cp-qe-field textarea,
.brikpanel-cp-qe-field select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    background: var(--card);
    font-family: inherit;
}

.brikpanel-cp-qe-field input:focus,
.brikpanel-cp-qe-field textarea:focus,
.brikpanel-cp-qe-field select:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 1px var(--input-focus);
}

.brikpanel-cp-qe-field textarea {
    resize: vertical;
    min-height: 48px;
}

.brikpanel-cp-qe-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ---------- Code Row ---------- */
.brikpanel-cp-code-row {
    display: flex;
    gap: 0.5rem;
}

.brikpanel-cp-code-row input[type="text"] {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.brikpanel-cp-code-row input[type="text"]:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 1px var(--input-focus);
}

/* The coupon link: read-only, a URL as it is (no code styling), and it may
   shrink next to its button on a phone. */
.brikpanel-cp-code-row input[type="text"].brikpanel-cp-link-input {
    min-width: 0;
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-secondary, #616161);
    background: #f7f7f7;
}

/* "Auto" next to an automatic coupon's code in the list. */
.brikpanel-cp-auto-badge {
    margin-inline-start: 0.375rem;
}

/* Other plugins' settings live on WooCommerce's coupon screen: a note at
   the top of the drawer with the link there. */
.brikpanel-cp-plugin-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #f7f7f7;
    color: var(--text-secondary, #616161);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.brikpanel-cp-plugin-note[hidden] {
    display: none;
}

.brikpanel-cp-plugin-note svg {
    flex: 0 0 auto;
    margin-top: 0.15rem;
}

.brikpanel-cp-plugin-note a {
    color: var(--text);
    font-weight: 550;
}

/* ---------- Input Group ---------- */
.brikpanel-cp-input-group {
    display: flex;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.brikpanel-cp-input-group:focus-within {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 1px var(--input-focus);
}

.brikpanel-cp-input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.625rem;
    background: #f7f7f7;
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.brikpanel-cp-input-group input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none !important;
    box-shadow: none !important;
    font-size: 0.875rem;
    outline: none;
    min-width: 0;
    background: var(--card);
}

/* ---------- Toggle Switch ---------- */
.brikpanel-cp-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.brikpanel-cp-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.brikpanel-cp-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.brikpanel-cp-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.15s ease;
    border-radius: 22px;
}

.brikpanel-cp-toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.15s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.brikpanel-cp-toggle input:checked + .brikpanel-cp-toggle-slider {
    background-color: var(--primary);
}

.brikpanel-cp-toggle input:checked + .brikpanel-cp-toggle-slider::before {
    transform: translateX(18px);
}

/* ---------- Field Hint ---------- */
.brikpanel-cp-field-hint {
    font-size: 0.75rem;
    color: var(--text-secondary, #616161);
    margin-top: -0.125rem;
}

/* ---------- Token Picker (Products / Categories) ---------- */
.brikpanel-cp-token-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.brikpanel-cp-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.brikpanel-cp-tokens:empty {
    display: none;
}

.brikpanel-cp-token {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.25rem 0.25rem 0.625rem;
    background: #f1f1f1;
    border: 1px solid var(--border);
    border-radius: 1rem;
    font-size: 0.75rem;
    color: var(--text);
    line-height: 1.2;
    max-width: 100%;
}

.brikpanel-cp-token-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

/* Secondary line inside a token (the email behind a user name). */
.brikpanel-cp-token-sub {
    color: var(--text-secondary, #616161);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.brikpanel-cp-token-sub::before {
    content: "\00b7";
    margin-inline-end: 0.25rem; /* logical: flips with the writing direction on RTL admins */
}

.brikpanel-cp-token-remove {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-placeholder);
    cursor: pointer;
    width: 1.125rem;
    height: 1.125rem;
    line-height: 1;
    font-size: 1rem;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.brikpanel-cp-token-remove:hover {
    background: #303030;
    color: #fff;
}

.brikpanel-cp-token-input-wrap {
    position: relative;
}

.brikpanel-cp-qe-field input.brikpanel-cp-token-input {
    width: 100%;
}

.brikpanel-cp-token-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    max-height: 240px;
    overflow-y: auto;
    z-index: 10;
    padding: 0.25rem;
}

.brikpanel-cp-token-suggestions[hidden] {
    display: none;
}

.brikpanel-cp-token-suggestion {
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--text);
    border-radius: 0.375rem;
    cursor: pointer;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brikpanel-cp-token-suggestion:hover {
    background: var(--hover-bg);
}

/* Two-line suggestion: display name on top, email underneath. */
.brikpanel-cp-token-suggestion-label,
.brikpanel-cp-token-suggestion-sub {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brikpanel-cp-token-suggestion-sub {
    font-size: 0.75rem;
    color: var(--text-secondary, #616161);
    margin-top: 0.0625rem;
}

.brikpanel-cp-token-empty {
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #616161);
}

/* ---------- Usage Count Display ---------- */
.brikpanel-cp-usage-count-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.25rem 0.625rem;
    border-radius: 1rem;
    background: #f0f0f0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 550;
}

/* ---------- Toast Notifications ---------- */
.brikpanel-cp-toast-container {
    position: fixed;
    top: 44px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.brikpanel-cp-toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateX(110%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    max-width: 360px;
}

.brikpanel-cp-toast.show {
    transform: translateX(0);
}

/* State classes are is-*: a bare `error` makes WordPress style the toast as an
   admin notice (div.error padding and margin, no shadow). */
.brikpanel-cp-toast.is-success {
    background: #e4f5e1;
    color: #1a6b15;
    border: 1px solid #b7e1b0;
}

.brikpanel-cp-toast.is-error {
    background: #fce4e4;
    color: #c62828;
    border: 1px solid #f1b0b0;
}

.brikpanel-cp-toast.is-info {
    background: #e8f0fe;
    color: #1a56db;
    border: 1px solid #bdd3f7;
}

.brikpanel-cp-toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.125rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
}

.brikpanel-cp-toast-close:hover {
    opacity: 1;
}

/* ---------- Misc ---------- */
.brikpanel-cp-text-muted {
    color: var(--text-secondary, #616161);
}

/* ---------- Responsive ---------- */
@media screen and (max-width: 782px) {
    /* Without the fit helper (a caching plugin dropped it) the header takes
       its two-row layout on phones. */
    .brikpanel-cp-header:not([data-bp-fit-level]) {
        flex-wrap: wrap;
        row-gap: 0.75rem;
    }

    .brikpanel-cp-header:not([data-bp-fit-level]) .brikpanel-cp-header-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        flex: 1 1 100%;
        min-width: 0;
    }

    .brikpanel-cp-header:not([data-bp-fit-level]) .brikpanel-cp-search-wrap {
        flex: 1 1 100%;
        min-width: 0;
        margin-inline-start: 0;
    }

    .brikpanel-cp-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .brikpanel-cp-tabs {
        width: 100%;
    }

    .brikpanel-cp-filter-group {
        width: 100%;
    }

    /* WordPress keeps its 16px text here so iOS does not zoom in. */
    .wp-core-ui .brikpanel-cp-filter-group select.brikpanel-cp-select {
        flex: 1;
        max-width: none;
        min-height: 2.5rem;
    }

    .brikpanel-cp-bulk-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .brikpanel-cp-bulk-right {
        width: 100%;
    }

    .brikpanel-cp-bulk-right .brikpanel-cp-btn {
        flex: 1;
    }

    .brikpanel-cp-pagination {
        flex-direction: column;
        align-items: center;
    }

    .brikpanel-cp-drawer {
        width: 100vw;
        max-width: 100vw;
    }

    .brikpanel-cp-qe-row {
        grid-template-columns: 1fr;
    }
}

/* ---------- Hide WP Admin defaults ---------- */
/* Red errors stay on screen. Both flavours must be named: WordPress core and
   WooCommerce still emit the legacy `error` class alongside `notice`
   (`<div id="woocommerce_errors" class="error notice">`), so guarding only
   `.notice-error` swallowed those with no trace. */
body.brikpanel-screen-coupons .screen-meta-links,
body.brikpanel-screen-coupons .notice:not(.brikpanel-notice):not(.notice-error):not(.error),
body.brikpanel-screen-coupons #screen-meta {
    display: none;
}

body.brikpanel-screen-coupons #wpbody-content {
    padding-bottom: 2rem;
    margin: 0 !important;
}

/* Width and gutters: the wide page shell (front-end/shared/brikpanel-ui.css,
   `brikpanel-shell__page` on the .wrap). */

/* Lock body scroll when drawer open */
body.brikpanel-cp-drawer-open {
    overflow: hidden;
}

/* ── Third-party (ASE) extra columns ─────────────────────────────────── */
.brikpanel-cp-th-ase {
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: start;
    color: #303030;
    white-space: nowrap;
}

.brikpanel-cp-cell-ase {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    color: #303030;
    vertical-align: middle;
    max-width: 17rem;
    white-space: normal;
}

.brikpanel-cp-cell-ase .last-modified-timestamp {
    font-size: 0.75rem;
    color: #616161;
    line-height: 1.3;
}

/* Plugin columns are display-only here — same reasoning as the products list
   (see brikpanel-products-list.css): the originating plugin binds its handlers
   at DOM-ready against .wp-list-table rows that this AJAX-rendered table never
   produces, so every control it emits is inert. */
.brikpanel-cp-cell-ase input,
.brikpanel-cp-cell-ase select,
.brikpanel-cp-cell-ase textarea,
.brikpanel-cp-cell-ase button,
.brikpanel-cp-cell-ase a[href="#"],
.brikpanel-cp-cell-ase a[href=""] {
    display: none !important;
}

.brikpanel-cp-cell-ase label {
    color: var(--text-secondary, #616161);
    font-size: 0.75rem;
}

/* Line, size and color: the shared row links (.brikpanel-row-links). */
.brikpanel-cp-row-actions .asenha-list-table-item-id {
    background: #f1f1f1;
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    color: #616161;
    font-weight: 500;
}
