/* ── Burton Software AI · BUIH Brand Theme ── */

:root {
    --buih-gradient: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #9333EA 100%);
    --buih-glow: 0 0 24px rgba(124, 58, 237, 0.25);
}

/* Sidebar brand gradient */
.fi-sidebar-header {
    background: var(--buih-gradient) !important;
}

.fi-sidebar-header .fi-brand-name {
    color: #fff !important;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Nav group labels */
.fi-sidebar-group-label {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.6;
}

/* Active nav item accent */
.fi-sidebar-item-active .fi-sidebar-item-button {
    background: rgba(124, 58, 237, 0.12) !important;
    border-left: 3px solid #7C3AED;
}

/* Top header */
.fi-topbar {
    border-bottom: 1px solid rgba(124, 58, 237, 0.15);
}

/* Stats card hover */
.fi-wi-stats-overview-stat {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.fi-wi-stats-overview-stat:hover {
    box-shadow: var(--buih-glow);
    transform: translateY(-1px);
}

/* Status badge pill refinement */
.fi-badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* Pipeline progress bar */
.buih-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
}

.buih-pipeline-step {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.05);
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
    transition: all 0.2s;
}

.buih-pipeline-step:first-child {
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
    border-radius: 4px 0 0 4px;
}

.buih-pipeline-step:last-child {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%);
    border-radius: 0 4px 4px 0;
}

.buih-pipeline-step.active {
    background: var(--buih-gradient);
    color: #fff;
}

.buih-pipeline-step.done {
    background: rgba(124, 58, 237, 0.4);
    color: rgba(255,255,255,0.9);
}

.buih-pipeline-step.cancelled {
    background: rgba(239, 68, 68, 0.3);
    color: rgba(255,255,255,0.7);
}

/* ── Locale Switcher ── */
.buih-locale-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    border-right: 1px solid rgba(124,58,237,0.2);
}
.buih-locale-btn {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 4px;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: all 0.15s;
}
.buih-locale-btn:hover { color: rgba(255,255,255,0.85); }
.buih-locale-btn.buih-locale-active {
    background: rgba(124,58,237,0.6);
    color: #fff;
}
.buih-locale-sep {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.2);
}

/* ── Pipeline Flow Widget (Orders page header) ── */
.buih-flow-container {
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(124, 58, 237, 0.15);
    background: rgba(255,255,255,0.03);
}

.dark .buih-flow-container {
    background: rgba(0,0,0,0.15);
}

.buih-flow-title {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(124, 58, 237, 0.7);
    margin-bottom: 0.75rem;
}

.buih-flow-track {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 2px;
}

.buih-flow-item {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.buih-flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    min-width: 100px;
    border: 1px solid rgba(124, 58, 237, 0.2);
    background: rgba(124, 58, 237, 0.04);
    gap: 2px;
}

.buih-flow-label {
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    color: inherit;
}

.buih-flow-sub {
    font-size: 0.62rem;
    white-space: nowrap;
    opacity: 0.55;
}

.buih-flow-count {
    font-size: 0.6rem;
    font-weight: 600;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    white-space: nowrap;
}

.buih-flow-arrow {
    color: rgba(124, 58, 237, 0.35);
    padding: 0 6px;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Flow step color variants */
.buih-flow-info    { border-color: rgba(59,130,246,0.35);  background: rgba(59,130,246,0.07);  color: #3b82f6; }
.buih-flow-violet  { border-color: rgba(124,58,237,0.4);   background: rgba(124,58,237,0.09);  color: #7c3aed; }
.buih-flow-warning { border-color: rgba(245,158,11,0.35);  background: rgba(245,158,11,0.07);  color: #d97706; }
.buih-flow-primary { border-color: rgba(79,70,229,0.35);   background: rgba(79,70,229,0.07);   color: #4f46e5; }
.buih-flow-purple  { border-color: rgba(147,51,234,0.35);  background: rgba(147,51,234,0.07);  color: #9333ea; }
.buih-flow-success { border-color: rgba(34,197,94,0.35);   background: rgba(34,197,94,0.07);   color: #16a34a; }
.buih-flow-danger  { border-color: rgba(239,68,68,0.35);   background: rgba(239,68,68,0.07);   color: #dc2626; }

.dark .buih-flow-info    { color: #60a5fa; }
.dark .buih-flow-violet  { color: #a78bfa; }
.dark .buih-flow-warning { color: #fbbf24; }
.dark .buih-flow-primary { color: #818cf8; }
.dark .buih-flow-purple  { color: #c084fc; }
.dark .buih-flow-success { color: #4ade80; }
.dark .buih-flow-danger  { color: #f87171; }

/* ── Wayfair Log Viewer ── */
.buih-log-ctrl {
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(124, 58, 237, 0.25);
    background: transparent;
    font-size: 0.75rem;
    color: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.buih-log-ctrl:focus { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,0.15); }

.buih-log-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(124, 58, 237, 0.3);
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.buih-log-btn:hover { background: rgba(124, 58, 237, 0.18); }
.buih-log-btn-danger { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.07); color: #ef4444; }
.buih-log-btn-danger:hover { background: rgba(239,68,68,0.18); }

.buih-log-th {
    padding: 0.4rem 0.75rem;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    border-bottom: 1px solid rgba(124,58,237,0.15);
}

.buih-log-td {
    padding: 0.3rem 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dark .buih-log-td { border-bottom-color: rgba(255,255,255,0.04); }

.buih-log-row { transition: background 0.1s; }
.buih-log-row:hover { background: rgba(124, 58, 237, 0.04); }
.buih-log-row-error    { background: rgba(239, 68,  68,  0.04); }
.buih-log-row-critical { background: rgba(239, 68,  68,  0.08); }
.buih-log-row-warning  { background: rgba(245, 158, 11,  0.04); }

.buih-log-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.buih-log-badge-info     { background: rgba(59,130,246,0.15);  color: #3b82f6; }
.buih-log-badge-debug    { background: rgba(107,114,128,0.15); color: #6b7280; }
.buih-log-badge-warning  { background: rgba(245,158,11,0.18);  color: #d97706; }
.buih-log-badge-error    { background: rgba(239,68,68,0.15);   color: #ef4444; }
.buih-log-badge-critical { background: rgba(239,68,68,0.25);   color: #dc2626; font-weight: 900; }

.buih-log-card {
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: 0.9rem;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}
.dark .buih-log-card {
    background: rgba(17,24,39,0.92);
    border-color: rgba(124,58,237,0.16);
}
.buih-log-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem 0.6rem;
    border-bottom: 1px solid rgba(124,58,237,0.08);
}
.buih-log-card-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.buih-log-source {
    font-size: 0.72rem;
    font-weight: 700;
    color: #4b5563;
}
.dark .buih-log-source { color: #d1d5db; }
.buih-log-time {
    font-size: 0.72rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #9ca3af;
}
.buih-log-toggle {
    border: 1px solid rgba(124,58,237,0.18);
    background: rgba(124,58,237,0.06);
    color: #7c3aed;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}
.buih-log-card-body { padding: 0.85rem 1rem 1rem; }
.buih-log-message {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.78rem;
    line-height: 1.55;
    color: #1f2937;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.dark .buih-log-message { color: #e5e7eb; }
.buih-log-card-detail {
    padding: 0 1rem 1rem;
    display: grid;
    gap: 0.85rem;
}
.buih-log-detail-block {
    border: 1px solid rgba(99,102,241,0.12);
    background: rgba(99,102,241,0.04);
    border-radius: 0.75rem;
    overflow: hidden;
}
.buih-log-detail-title {
    padding: 0.55rem 0.8rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6366f1;
    border-bottom: 1px solid rgba(99,102,241,0.1);
}
.buih-log-detail-pre {
    margin: 0;
    padding: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 26rem;
    overflow: auto;
    font-size: 0.74rem;
    line-height: 1.55;
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.dark .buih-log-detail-pre { color: #cbd5e1; }

/* ── Wayfair Orders table ── */
.buih-pipeline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.buih-pipeline-step {
    border: 1px solid rgba(148,163,184,0.24);
    background: rgba(148,163,184,0.08);
    color: #64748b;
    border-radius: 999px;
    padding: 0.16rem 0.55rem;
    font-size: 0.67rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.buih-pipeline-step.done {
    border-color: rgba(34,197,94,0.24);
    background: rgba(34,197,94,0.10);
    color: #16a34a;
}
.buih-pipeline-step.active {
    border-color: rgba(124,58,237,0.24);
    background: rgba(124,58,237,0.10);
    color: #7c3aed;
}
.buih-pipeline-step.cancelled {
    border-color: rgba(239,68,68,0.20);
    background: rgba(239,68,68,0.08);
    color: #dc2626;
}
.dark .buih-pipeline-step { color: #cbd5e1; }
.dark .buih-pipeline-step.done { color: #4ade80; }
.dark .buih-pipeline-step.active { color: #c084fc; }
.dark .buih-pipeline-step.cancelled { color: #f87171; }
.buih-orders-col-po, .buih-orders-col-shipto { vertical-align: top; }
