/* SnipePrice operator pages (CF-011): API & Quota, Scan runs, Hotels, Workspaces and the dashboard block.
   Loaded after admin-brand.css; every class is prefixed core- so nothing here touches the template pages.
   Colours come from the brand tokens (--color-primary*, --color-ink*) in admin-brand.css; semantic colours stay
   AntD's (success green, warning gold, error red). */

.core-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.core-row {
    margin: 0;
}

.core-loading {
    display: flex;
    justify-content: center;
    padding: 64px 0;
}

.core-alert {
    margin: 0;
}

.core-header-tag {
    font-size: 13px;
    line-height: 26px;
    padding: 0 10px;
}

.core-header-tag .anticon {
    margin-right: 4px;
}

/* ---------- Cards & KPI tiles ---------- */
.core-card {
    height: 100%;
    border-radius: 10px;
}

.core-card .ant-card-head {
    min-height: 48px;
}

.core-card .ant-card-head-title {
    font-weight: 600;
}

.core-card-note {
    margin-top: 12px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
}

.core-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    height: 100%;
}

.core-kpi-grid--wide {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    height: auto;
}

.core-kpi .ant-card-body {
    padding: 16px 18px;
}

.core-kpi .ant-statistic-title {
    font-size: 13px;
    margin-bottom: 2px;
}

.core-kpi .ant-statistic-content {
    font-size: 24px;
    font-variant-numeric: tabular-nums;
}

/* AntDesign Blazor renders a decimal's int and fraction spans with template whitespace inside them ("2 .61");
   as flex items they drop it (F-229 views per visit). */
.core-kpi .ant-statistic-content-value {
    display: inline-flex;
}

.core-kpi-foot {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.core-kpi--accent {
    border-top: 3px solid var(--color-primary);
}

.core-kpi--warn {
    border-top: 3px solid #faad14;
}

.core-kpi--danger {
    border-top: 3px solid #ff4d4f;
}

/* ---------- Quota gauge ---------- */
.core-gauge {
    position: relative;
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.core-gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%);
    text-align: center;
    pointer-events: none;
}

.core-gauge-value {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-ink);
    font-variant-numeric: tabular-nums;
}

.core-gauge-label {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.core-gauge-caption {
    text-align: center;
    margin-top: 4px;
    color: rgba(0, 0, 0, 0.65);
}

.core-reserve-bar {
    display: flex;
    height: 8px;
    margin-top: 16px;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
}

.core-reserve-bar-used {
    background: var(--color-primary);
}

.core-reserve-bar-free {
    background: var(--color-primary-100);
}

.core-reserve-bar-reserve {
    background: repeating-linear-gradient(135deg, #d9d9d9 0 4px, #f0f0f0 4px 8px);
}

.core-reserve-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 8px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.55);
}

.core-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: -1px;
}

.core-swatch--used {
    background: var(--color-primary);
}

.core-swatch--free {
    background: var(--color-primary-100);
}

.core-swatch--reserve {
    background: repeating-linear-gradient(135deg, #bfbfbf 0 3px, #f0f0f0 3px 6px);
}

/* ---------- Chart ---------- */
.core-chart {
    min-height: 300px;
}

/* ---------- Filters ---------- */
.core-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.core-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.75);
    user-select: none;
}

/* ---------- Text utilities ---------- */
.core-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.core-num {
    font-variant-numeric: tabular-nums;
}

.core-muted {
    color: rgba(0, 0, 0, 0.45);
}

.core-text-error {
    color: #cf1322;
}

.core-text-success {
    color: #389e0d;
}

.core-ellipsis {
    display: inline-block;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.core-link-strong {
    font-weight: 600;
}

.core-subline {
    display: block;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
}

.core-back {
    margin-bottom: 8px;
    padding-left: 0;
}

/* ---------- Targets progress (scan runs) ---------- */
.core-targets {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.core-targets-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: #f0f0f0;
}

.core-targets-bar-ok {
    background: #52c41a;
}

.core-targets-bar-failed {
    background: #ff4d4f;
}

.core-targets-label {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.65);
    font-variant-numeric: tabular-nums;
}

/* ---------- Rate strip (hotel detail: next 30 nights) ---------- */
.core-rate-strip {
    display: grid;
    grid-template-columns: repeat(30, minmax(0, 1fr));
    align-items: end;
    gap: 3px;
    height: 120px;
    padding: 8px 0 0;
    border-bottom: 1px solid #f0f0f0;
}

.core-rate-strip-bar {
    position: relative;
    background: var(--color-primary-200);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: background 0.15s ease;
}

.core-rate-strip-bar:hover {
    background: var(--color-primary);
}

.core-rate-strip-bar--weekend {
    background: var(--color-primary-light);
}

.core-rate-strip-bar--soldout {
    background: repeating-linear-gradient(135deg, #ff7875 0 3px, #fff1f0 3px 6px);
    height: 100%;
    opacity: 0.6;
}

.core-rate-strip-bar--empty {
    background: #f5f5f5;
    height: 100%;
}

.core-rate-strip-axis {
    display: grid;
    grid-template-columns: repeat(30, minmax(0, 1fr));
    gap: 3px;
    margin-top: 4px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.45);
    text-align: center;
}

.core-rate-summary-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-bottom: 4px;
}

.core-rate-figure {
    display: flex;
    flex-direction: column;
}

.core-rate-figure-label {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
}

.core-rate-figure-value {
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-ink);
}

.core-rate-block + .core-rate-block {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px dashed #f0f0f0;
}

/* ---------- Hotel header ---------- */
.core-hotel-hero {
    display: flex;
    gap: 16px;
    align-items: center;
}

.core-hotel-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f5f5f5;
    color: var(--color-ink);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* ---------- Plan picker (workspace detail) ---------- */
.core-plan-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}

.core-plan-option {
    border: 1px solid #d9d9d9;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    background: #fff;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font: inherit;
}

.core-plan-option:hover {
    border-color: var(--color-primary-light);
}

.core-plan-option--selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.core-plan-option--current {
    cursor: default;
    background: #fafafa;
}

.core-plan-option-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-ink);
}

.core-plan-option-note {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
}

/* ---------- Dashboard block ---------- */
.core-dash {
    margin: 8px 0 0;
}

.core-dash-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.core-dash-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-ink);
}

.core-dash-title::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    vertical-align: 1px;
}

.core-dash-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 13px;
}

@media (max-width: 768px) {
    .core-kpi-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .core-plan-options {
        grid-template-columns: minmax(0, 1fr);
    }

    .core-rate-strip-axis span:nth-child(odd) {
        visibility: hidden;
    }
}

.core-dash-run {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    line-height: 38px;
}

.core-text-warn {
    color: #d48806;
}

.core-row-failing > td {
    background: #fff7f6;
}

.core-row-archived > td {
    color: rgba(0, 0, 0, 0.45);
    background: #fafafa;
}

.core-notes {
    margin: 0;
    padding-left: 18px;
}

.core-notes li + li {
    margin-top: 4px;
}

.core-search {
    width: 320px;
    max-width: 100%;
}

/* ---------- Member email settings and digest preview (CF-012) ---------- */
.core-email-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.core-email-tags .ant-tag {
    margin-right: 0;
}

.core-member-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.core-member-actions .core-email-edit {
    padding-left: 0;
}

.core-email-intro {
    margin-top: 0;
}

.core-email-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.core-email-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.core-email-field > label {
    font-weight: 600;
    color: var(--color-ink);
}

.core-email-field--inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.core-digest-frame {
    display: block;
    width: 100%;
    min-height: 900px;
    border: 1px solid var(--color-ink-2);
    border-radius: 10px;
    /* The email layout's own dark page colour, so the frame has no light edge while it loads */
    background: var(--color-ink-3);
}

/* ---------- Markets (CF-015) ---------- */
/* An empty list inherits from the parent market: the inherited value reads muted and italic under its label */
.core-inherited {
    margin-top: 6px;
    font-size: 13px;
    font-style: italic;
    color: rgba(0, 0, 0, 0.45);
}

.core-inherited-label {
    font-style: normal;
    font-weight: 600;
    margin-right: 4px;
}

/* Tree table: a guide line on each indent level so deep sub-markets stay readable */
.core-markets-tree .ant-table-row-indent {
    position: relative;
    height: 22px;
    vertical-align: middle;
}

.core-markets-tree .ant-table-row-indent:not(.indent-level-0)::before {
    content: "";
    position: absolute;
    top: -6px;
    bottom: -6px;
    right: 8px;
    border-left: 1px dashed rgba(0, 0, 0, 0.15);
}

.core-markets-tree .core-market-link {
    margin-left: 2px;
}

/* Market form: open-month tags, guest-country and calendar rows */
.core-month-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.core-month-tags .ant-tag {
    margin-right: 0;
    min-width: 46px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* AntD's checkable tag is blue; the brand primary fill takes ink text (5.9:1) */
.core-month-tags .ant-tag-checkable-checked {
    color: var(--text-on-primary);
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.core-month-tags .ant-tag-checkable:not(.ant-tag-checkable-checked):hover {
    color: var(--color-primary-text);
}

.core-market-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.core-market-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.core-area-count {
    margin: -8px 0 16px;
}

.core-market-error {
    margin-bottom: 16px;
}

/* The delete button's wrapper: a disabled button swallows the pointer events its tooltip needs */
.core-market-delete {
    display: inline-block;
}

/* ---------- AI usage (CF-019) ---------- */
.core-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.core-budget {
    margin-top: 12px;
}

.core-budget-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.65);
}

/* AntD's progress bar is blue; the budget bars turn warning gold from 80 % and error red from 100 % */
.core-budget--warn .ant-progress-bg {
    background-color: #faad14;
}

.core-budget--danger .ant-progress-bg {
    background-color: #cf1322;
}

.core-spend {
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.core-status-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 12px;
}

/* JSON and text of a request, shown as text — never as HTML */
.core-pre {
    margin: 0;
    padding: 12px;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
}

.core-brief-text h4 {
    margin: 12px 0 4px;
}
