/**
 * Szilamer.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Commercial License
 * you can't distribute, modify or sell this code
 *
 * @author    Szilamer
 * @copyright Szilamer
 * @license   commercial
 */

/* One place for the colours, so the dashboard panel and the configuration page
   stay in step and a restyle is a handful of edits rather than a search. */

.szts-panel,
.szts-config-panel {
    --szts-ink: #101828;
    --szts-muted: #667085;
    --szts-faint: #98a2b3;
    --szts-line: #eaecf0;
    --szts-line-soft: #f2f4f7;
    --szts-surface: #fff;
    --szts-surface-alt: #f9fafb;
    --szts-accent: #2563eb;
    --szts-accent-soft: #eff4ff;
    --szts-good: #067647;
    --szts-good-soft: #ecfdf3;
    --szts-warn: #b54708;
    --szts-warn-soft: #fffaeb;
    --szts-radius: 12px;
    --szts-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

/* ---------------------------------------------------------------- dashboard */

.szts-panel {
    max-width: 100%;
    background: var(--szts-surface);
    border: 1px solid var(--szts-line);
    border-radius: var(--szts-radius);
    box-shadow: var(--szts-shadow);
    overflow: hidden;
}

.szts-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--szts-surface);
    border: 0;
    border-bottom: 1px solid var(--szts-line);
    padding: 16px 20px;
}

/* A single accent stroke reads as branding without a heavy dark bar swallowing
   the top of the panel. */
.szts-panel-mark {
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: linear-gradient(180deg, #60a5fa, var(--szts-accent));
}

.szts-panel-title {
    color: var(--szts-ink);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.szts-panel-period {
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--szts-surface-alt);
    border: 1px solid var(--szts-line);
    color: var(--szts-muted);
    font-size: 11px;
    font-weight: 500;
}

.szts-panel-link {
    margin-left: auto;
    padding: 5px 12px;
    border: 1px solid var(--szts-line);
    border-radius: 8px;
    background: var(--szts-surface);
    color: var(--szts-muted);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.szts-panel-link:hover,
.szts-panel-link:focus {
    background: var(--szts-accent-soft);
    border-color: #c7d7fe;
    color: var(--szts-accent);
    text-decoration: none;
}

/* Period filter */

/* The attribute is the only thing hiding the spinner, so nothing here may give
   it a display of its own. */
.szts-panel-spinner[hidden] {
    display: none !important;
}

.szts-panel-spinner {
    color: var(--szts-muted);
    font-size: 11px;
}

/* Named apart from the configuration page's .szts-filter form: same idea, very
   different box, and one stylesheet serves both screens. */
.szts-period-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--szts-line);
    background: var(--szts-surface-alt);
}

.szts-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.szts-preset {
    padding: 5px 11px;
    border: 1px solid var(--szts-line);
    border-radius: 999px;
    background: var(--szts-surface);
    color: var(--szts-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.szts-preset:hover {
    border-color: #c7d7fe;
    color: var(--szts-accent);
}

.szts-preset-on {
    background: var(--szts-accent);
    border-color: var(--szts-accent);
    color: #fff;
}

.szts-range {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.szts-date {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--szts-line);
    border-radius: 8px;
    background: var(--szts-surface);
    color: var(--szts-ink);
    font-size: 12px;
}

.szts-date:focus {
    border-color: var(--szts-accent);
    outline: 0;
}

.szts-range-sep {
    color: var(--szts-faint);
}

.szts-apply {
    height: 30px;
    padding: 0 14px;
    border: 1px solid var(--szts-accent);
    border-radius: 8px;
    background: var(--szts-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.szts-apply:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* While a period is loading the old figures stay on screen, dimmed, rather than
   collapsing the panel to nothing. */
.szts-panel-busy .szts-columns,
.szts-panel-busy .szts-tiles,
.szts-panel-busy .szts-promotion {
    opacity: .45;
    transition: opacity .15s ease;
}

/* Stat tiles */

.szts-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--szts-line);
}

.szts-tile {
    position: relative;
    padding: 16px 18px;
    background: var(--szts-surface-alt);
    border: 1px solid var(--szts-line);
    border-radius: 10px;
    overflow: hidden;
}

.szts-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--szts-line-soft);
}

.szts-tile-accent::before {
    background: var(--szts-good);
}

.szts-tile-value {
    display: block;
    color: var(--szts-ink);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.szts-tile-label {
    display: block;
    margin-top: 6px;
    color: var(--szts-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.szts-tile-accent .szts-tile-value {
    color: var(--szts-good);
}

/* Three column body */

.szts-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.szts-column {
    min-width: 0;
    padding: 18px 20px;
    border-right: 1px solid var(--szts-line);
}

.szts-column:last-child {
    border-right: 0;
}

.szts-column-title {
    margin: 0 0 12px;
    color: var(--szts-ink);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -.01em;
    text-transform: none;
}

/* Fixed layout because the first column holds free text - a product name, an
   e-mail address - whose natural width would otherwise push the two number
   columns past the right edge of the panel and cut the amounts in half. With the
   widths set here the numbers always have their room and the text takes the
   rest. */
.szts-table {
    width: 100%;
    margin: 0;
    font-size: 13px;
}

/* Only the dashboard's three column lists need the fixed widths. Scoped to the
   panel because the configuration page reuses .szts-table for an eight column
   catalog table, where these would squeeze the product name into 56 pixels. */
.szts-panel .szts-table {
    table-layout: fixed;
}

.szts-panel .szts-table th:nth-child(2),
.szts-panel .szts-table td:nth-child(2) {
    width: 56px;
}

.szts-panel .szts-table th:nth-child(3),
.szts-panel .szts-table td:nth-child(3) {
    width: 90px;
}

.szts-table > thead > tr > th {
    border-bottom: 1px solid var(--szts-line);
    padding: 0 8px 8px;
    color: var(--szts-faint);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.szts-table > tbody > tr > td {
    border-top: 1px solid var(--szts-line-soft);
    padding: 10px 8px;
    vertical-align: middle;
}

.szts-table > tbody > tr:first-child > td {
    border-top: 0;
}

.szts-table > tbody > tr {
    transition: background .12s ease;
}

.szts-table > tbody > tr:hover > td {
    background: var(--szts-surface-alt);
}

/* Name and rank sit side by side so a wrapping product name keeps its own
   column instead of running back under the badge. */
.szts-panel .szts-table > tbody > tr > td:first-child {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.szts-cell {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.szts-name {
    color: var(--szts-ink);
    font-weight: 500;
    text-decoration: none;
    overflow-wrap: anywhere;
}

a.szts-name:hover {
    color: var(--szts-accent);
    text-decoration: underline;
}

.szts-num {
    color: var(--szts-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.szts-rank {
    flex: 0 0 auto;
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--szts-line-soft);
    color: var(--szts-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* The podium, so the top of each list is readable at a glance. */
.szts-rank-1 {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #fff;
    box-shadow: 0 1px 2px rgba(217, 119, 6, .35);
}

.szts-rank-2 {
    background: #e4e7ec;
    color: #475467;
}

.szts-rank-3 {
    background: #f4e3d3;
    color: #b45309;
}

.szts-sub {
    display: block;
    margin-top: 2px;
    color: var(--szts-faint);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Marks a line that merged several customer records sharing one e-mail. */
.szts-merge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--szts-accent-soft);
    color: var(--szts-accent);
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    cursor: help;
}

.szts-code {
    margin-left: 6px;
    padding: 1px 6px;
    background: var(--szts-line-soft);
    border: 1px solid var(--szts-line);
    border-radius: 5px;
    color: var(--szts-muted);
    font-size: 11px;
}

.szts-empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--szts-line);
    border-radius: 10px;
    background: var(--szts-surface-alt);
    color: var(--szts-muted);
    font-size: 13px;
    text-align: center;
}

/* Five columns do not always fit the width the dashboard gives this panel, so
   the table scrolls inside its own section rather than stretching the panel past
   the column it lives in. */
.szts-promotion {
    padding: 18px 20px;
    border-top: 1px solid var(--szts-line);
    background: var(--szts-surface-alt);
    overflow-x: auto;
}

.szts-table-wide {
    min-width: 480px;
}

/* The promotion table is the one full width table; it keeps a plain first
   column rather than the rank/name flex layout. */
.szts-panel .szts-table-wide {
    table-layout: auto;
}

.szts-panel .szts-table-wide th:nth-child(2),
.szts-panel .szts-table-wide td:nth-child(2),
.szts-panel .szts-table-wide th:nth-child(3),
.szts-panel .szts-table-wide td:nth-child(3) {
    width: auto;
}

.szts-panel .szts-table-wide > tbody > tr > td:first-child {
    display: table-cell;
}

.szts-table-wide > tbody > tr:hover > td {
    background: var(--szts-surface);
}

.szts-conversion {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--szts-line-soft);
    color: var(--szts-muted);
    font-size: 12px;
    font-weight: 700;
}

.szts-conversion-good {
    background: var(--szts-good-soft);
    color: var(--szts-good);
}

/* ------------------------------------------------------- configuration tabs */
.szts-config-panel,
.szts-category-panel {
    border: 1px solid var(--szts-line);
    border-radius: var(--szts-radius);
    box-shadow: var(--szts-shadow);
    overflow: hidden;
}

/* The short explanation at the top of a tab. Amber rather than blue: it is a
   note about what you are looking at, not a warning about something wrong. */
.szts-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 13px 16px;
    border: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
    border-radius: 10px;
    background: linear-gradient(180deg, #fffbeb, #fffdf5);
    color: #854d0e;
    font-size: 13px;
    line-height: 1.55;
}

.szts-note-icon {
    flex: 0 0 auto;
    margin-top: 2px;
    color: #d97706;
    font-size: 15px;
}

/* Tabs */

.szts-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid var(--szts-line);
    border-radius: 12px;
    background: var(--szts-surface-alt);
}

.szts-tabs > li {
    float: none;
    margin: 0;
}

.szts-tabs > li > a,
.szts-tabs > li > a:hover,
.szts-tabs > li > a:focus {
    margin: 0;
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--szts-muted);
    font-size: 13px;
    font-weight: 600;
    transition: background .15s ease, color .15s ease;
}

.szts-tabs > li > a:hover {
    background: var(--szts-surface);
    color: var(--szts-accent);
}

.szts-tabs > li.active > a,
.szts-tabs > li.active > a:hover,
.szts-tabs > li.active > a:focus {
    background: var(--szts-accent);
    border: 0;
    color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, .35);
}

.szts-tabs > li > a > i {
    margin-right: 6px;
    opacity: .85;
}

.szts-tab-content {
    padding-top: 0;
}

/* Panel headings */

.szts-config-panel > .panel-heading,
.szts-category-panel > .panel-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    border: 0;
    border-bottom: 1px solid var(--szts-line);
    background: var(--szts-surface);
    color: var(--szts-ink);
    font-size: 13px;
    font-weight: 700;
}

.szts-config-panel > .panel-heading > i,
.szts-category-panel > .panel-heading > i {
    color: var(--szts-accent);
}

.szts-category-id {
    color: var(--szts-faint);
    font-size: 12px;
    font-weight: 400;
}

.szts-category-count {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--szts-accent-soft);
    color: var(--szts-accent);
    font-size: 11px;
    font-weight: 700;
}

/* Filter form */

.szts-filter {
    padding: 16px;
}

.szts-filter .row > div {
    margin-bottom: 10px;
}

.szts-filter label {
    margin-bottom: 4px;
    color: var(--szts-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.szts-filter .form-control {
    height: 34px;
    border: 1px solid var(--szts-line);
    border-radius: 8px;
    box-shadow: none;
    font-size: 13px;
}

.szts-filter .form-control:focus {
    border-color: var(--szts-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.szts-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--szts-line-soft);
    margin-top: 8px;
    padding-top: 14px;
}

.szts-filter-actions .btn {
    border-radius: 8px;
    font-weight: 600;
}

.szts-filter-note {
    display: block;
    flex: 1 1 240px;
    margin: 0;
    color: var(--szts-faint);
    font-size: 12px;
}

/* Catalog and report tables */

.szts-catalog-table,
.szts-report-table {
    margin: 0;
    font-size: 13px;
}

.szts-catalog-table > thead > tr > th,
.szts-report-table > thead > tr > th {
    border-bottom: 1px solid var(--szts-line);
    padding: 10px 12px;
    background: var(--szts-surface-alt);
    color: var(--szts-faint);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.szts-catalog-table > tbody > tr > td,
.szts-report-table > tbody > tr > td {
    border-top: 1px solid var(--szts-line-soft);
    padding: 10px 12px;
    vertical-align: middle;
}

.szts-catalog-table > tbody > tr,
.szts-report-table > tbody > tr {
    transition: background .12s ease;
}

.szts-catalog-table > tbody > tr:hover > td,
.szts-report-table > tbody > tr:hover > td {
    background: var(--szts-surface-alt);
}

.szts-catalog-table .szts-col-rank {
    width: 46px;
    text-align: center;
}

.szts-catalog-table code {
    padding: 2px 7px;
    border: 1px solid var(--szts-line);
    border-radius: 5px;
    background: var(--szts-line-soft);
    color: var(--szts-muted);
    font-size: 11px;
}

/* The rows that actually reach the front office, marked on the edge so the
   effect of a setting is visible without reading the status column. */
.szts-row-promoted > td {
    background: var(--szts-accent-soft);
}

.szts-row-promoted > td:first-child {
    box-shadow: inset 3px 0 0 var(--szts-accent);
}

.szts-catalog-table > tbody > tr.szts-row-promoted:hover > td {
    background: #e3ecfd;
}

/* The totals sit apart from the rows they sum, not as one more line among them. */
.szts-report-total > th {
    border-top: 2px solid var(--szts-line) !important;
    padding: 12px !important;
    background: var(--szts-surface-alt);
    color: var(--szts-ink);
    font-size: 13px;
    font-weight: 700;
}

/* Status pills */

.szts-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--szts-line-soft);
    color: var(--szts-muted);
    font-size: 11px;
    font-weight: 700;
}

.szts-status-ok {
    background: var(--szts-good-soft);
    color: var(--szts-good);
}

.szts-status-stale {
    background: var(--szts-warn-soft);
    color: var(--szts-warn);
}

.szts-status-pinned {
    background: var(--szts-accent-soft);
    color: var(--szts-accent);
}

.szts-sub-inline {
    margin-left: 6px;
    color: var(--szts-faint);
    font-size: 11px;
}

/* Settings tab odds and ends */

.szts-config-panel .szts-intro {
    color: var(--szts-muted);
    margin: 0 0 16px;
}

/* clear: the .form-group rows above end in floated .col-lg-* columns that the
   admin theme never closes, and display:flex makes this form a block formatting
   context. Without the clear it refuses to overlap those floats, shrinks into
   the strip of space left beside them and renders both buttons as a squeezed
   column hanging off the right edge of the panel. */
.szts-actions {
    clear: both;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--szts-line);
    margin-top: 6px;
    padding-top: 14px;
}

.szts-action-end {
    margin-left: auto;
}

.szts-copy-source {
    font-family: Menlo, Consolas, monospace;
    font-size: 12px;
}

.szts-id-field {
    max-width: 420px;
    font-family: Menlo, Consolas, monospace;
}

.szts-multiselect {
    min-height: 150px;
}

.szts-preview {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--szts-line);
    border-radius: 10px;
}

@media (max-width: 991px) {
    .szts-column {
        border-right: 0;
        border-bottom: 1px solid var(--szts-line);
    }

    .szts-column:last-child {
        border-bottom: 0;
    }
}
