/* ============================================================
   Nexa UI — Shared Dark Theme Stylesheet
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset & Box Model ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: #07090F;
    color: #F0F2FF;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }
ul { list-style: none; }

/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
    --bg-base:        #07090F;
    --bg-surface:     #0F1320;
    --bg-elevated:    #161A2A;
    --bg-hover:       #1C2035;
    --border:         #2A2F45;
    --border-light:   #1C2035;
    --text-primary:   #F0F2FF;
    --text-secondary: #9BA3C2;
    --text-muted:     #7B85A8;
    --accent-blue:    #C8A84B; /* gold primary — var name kept for minimal diff */
    --accent-green:   #3fb950;
    --accent-orange:  #d29922;
    --accent-red:     #f85149;
    --accent-purple:  #bc8cff;
    --accent-cyan:    #E8C876; /* light gold highlight */
    --accent-gold:    #C8A84B;
    --grad-warm:      linear-gradient(135deg, #C8A84B 0%, #D4A853 50%, #E8C876 100%);
    --sidebar-width:  220px;
    --topbar-height:  56px;
    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      14px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.4);
    --shadow-md:      0 4px 12px rgba(0,0,0,.5);
    --transition:     .18s ease;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
    width: 34px; height: 34px;
    background: var(--grad-warm);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; color: #0a0a0a;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: .3px;
}

.sidebar-logo .logo-version {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.sidebar-section-label {
    padding: 16px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(88, 166, 255, .12);
    color: var(--accent-blue);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: .7;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

.nav-badge.blue { background: var(--accent-blue); }
.nav-badge.orange { background: var(--accent-orange); }
.nav-badge.green { background: var(--accent-green); }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C8A84B55, #E8C87655);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.avatar-info .avatar-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.avatar-info .avatar-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Main Layout ────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0;
    z-index: 50;
}

.topbar-left .page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-left .breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 12px;
    display: flex; align-items: center; gap: 6px;
    transition: all var(--transition);
}

.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(63,185,80,.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(63,185,80,.2); }
    50% { box-shadow: 0 0 0 5px rgba(63,185,80,.08); }
}

/* ── Page Content ───────────────────────────────────────────── */
.content { padding: 24px; flex: 1; }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, var(--accent-blue));
}

.stat-card:hover { border-color: var(--card-accent, var(--accent-blue)); }

.stat-card.blue  { --card-accent: var(--accent-blue); }
.stat-card.green { --card-accent: var(--accent-green); }
.stat-card.red   { --card-accent: var(--accent-red); }
.stat-card.orange{ --card-accent: var(--accent-orange); }
.stat-card.purple{ --card-accent: var(--accent-purple); }

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.05);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.stat-delta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.stat-delta.up   { color: var(--accent-green); }
.stat-delta.down { color: var(--accent-red); }
.stat-delta.neutral { color: var(--text-muted); }

/* ── Section Layout ─────────────────────────────────────────── */
.section-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    margin-bottom: 24px;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent-blue);
}

/* ── Pipeline ───────────────────────────────────────────────── */
.pipeline-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pipeline-stage {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color var(--transition);
    cursor: default;
}

.pipeline-stage:hover { border-color: var(--accent-blue); }

.stage-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stage-count {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.stage-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    width: fit-content;
}

.stage-badge.blue   { background: rgba(200,168,75,.15); color: var(--accent-blue); }
.stage-badge.green  { background: rgba(63,185,80,.15);  color: var(--accent-green); }
.stage-badge.orange { background: rgba(210,153,34,.15); color: var(--accent-orange); }
.stage-badge.red    { background: rgba(248,81,73,.15);  color: var(--accent-red); }
.stage-badge.purple { background: rgba(188,140,255,.15);color: var(--accent-purple); }
.stage-badge.cyan   { background: rgba(57,211,83,.15);  color: var(--accent-cyan); }
.stage-badge.gray   { background: rgba(139,148,158,.12);color: var(--text-secondary); }

/* ── Activity Feed ──────────────────────────────────────────── */
.activity-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-y: auto;
    max-height: 400px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-dot.blue   { background: var(--accent-blue); }
.activity-dot.green  { background: var(--accent-green); }
.activity-dot.orange { background: var(--accent-orange); }
.activity-dot.red    { background: var(--accent-red); }
.activity-dot.purple { background: var(--accent-purple); }

.activity-body .activity-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.activity-body .activity-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.activity-body .activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-header .section-title { margin-bottom: 0; }

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child { border-bottom: none; }

tbody td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody td .td-primary {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}

tbody td .td-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Status Badges ──────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .8;
}

.status-badge.created             { background: rgba(139,148,158,.12); color: #8b949e; }
.status-badge.submitted           { background: rgba(200,168,75,.12);  color: #C8A84B; }
.status-badge.matching            { background: rgba(200,168,75,.15);  color: #79c0ff; }
.status-badge.offers_received     { background: rgba(210,153,34,.12);  color: #e3b341; }
.status-badge.offer_selected      { background: rgba(210,153,34,.18);  color: #d29922; }
.status-badge.awaiting_initial    { background: rgba(188,140,255,.12); color: #bc8cff; }
.status-badge.contract_active     { background: rgba(63,185,80,.15);   color: #3fb950; }
.status-badge.sample_in_progress  { background: rgba(63,185,80,.18);   color: #56d364; }
.status-badge.sample_review       { background: rgba(200,168,75,.18);  color: #C8A84B; }
.status-badge.sample_approved     { background: rgba(63,185,80,.22);   color: #3fb950; }
.status-badge.awaiting_final      { background: rgba(188,140,255,.15); color: #bc8cff; }
.status-badge.production          { background: rgba(200,168,75,.2);   color: #C8A84B; }
.status-badge.delivery            { background: rgba(210,153,34,.2);   color: #f0883e; }
.status-badge.completed           { background: rgba(63,185,80,.2);    color: #3fb950; }
.status-badge.rated               { background: rgba(188,140,255,.2);  color: #bc8cff; }
.status-badge.dispute             { background: rgba(248,81,73,.15);   color: #f85149; }
.status-badge.cancelled           { background: rgba(139,148,158,.12); color: #6e7681; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.btn-primary:hover { background: #79c0ff; border-color: #79c0ff; }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(248,81,73,.15);
    color: var(--accent-red);
    border-color: rgba(248,81,73,.3);
}

.btn-danger:hover {
    background: rgba(248,81,73,.25);
}

.btn-success {
    background: rgba(63,185,80,.15);
    color: var(--accent-green);
    border-color: rgba(63,185,80,.3);
}

.btn-success:hover {
    background: rgba(63,185,80,.25);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* ── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    background: rgba(200,168,75,.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.search-input {
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    width: 200px;
    transition: border-color var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent-blue); }

.filter-spacer { flex: 1; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}

.page-btn:hover, .page-btn.active {
    background: rgba(200,168,75,.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* ── Order Detail ───────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
}

.detail-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
}

.detail-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Timeline ───────────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 22px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px; top: 8px; bottom: 8px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -19px; top: 3px;
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    background: var(--text-muted);
    z-index: 1;
}

.timeline-dot.done   { background: var(--accent-green); }
.timeline-dot.active { background: var(--accent-blue); box-shadow: 0 0 0 4px rgba(200,168,75,.2); }
.timeline-dot.warn   { background: var(--accent-orange); }
.timeline-dot.error  { background: var(--accent-red); }

.timeline-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Sponsor / Payment Card ─────────────────────────────────── */
.sponsor-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sponsor-avatar {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(200,168,75,.3), rgba(188,140,255,.3));
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800;
    color: var(--text-primary);
    flex-shrink: 0;
}

.sponsor-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.sponsor-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.payment-amount-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 14px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 4px 0;
}

.payment-row .label { color: var(--text-muted); }
.payment-row .value { color: var(--text-secondary); font-weight: 600; }
.payment-row .value.highlight { color: var(--accent-blue); font-size: 16px; font-weight: 800; }
.payment-row.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; }

.action-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-group .btn { width: 100%; justify-content: center; }

/* ── Workflow Page ───────────────────────────────────────────── */
.workflow-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.workflow-canvas {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    overflow-x: auto;
}

.workflow-info {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

/* ── SVG State Machine ──────────────────────────────────────── */
.state-svg { display: block; width: 100%; min-width: 680px; }

.wf-node rect {
    rx: 8;
    stroke-width: 1.5;
    transition: all .2s;
}

.wf-node:hover rect { stroke-width: 2.5; filter: brightness(1.15); cursor: default; }

.wf-node text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 10px;
    font-weight: 700;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.wf-node .state-count {
    font-size: 14px;
    font-weight: 800;
}

.wf-edge {
    stroke-width: 1.5;
    fill: none;
    stroke: #30363d;
    marker-end: url(#arrowhead);
}

.wf-edge.active { stroke: #C8A84B; stroke-width: 2; }

/* ── Deadline Pill ──────────────────────────────────────────── */
.deadline-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(210,153,34,.12);
    color: var(--accent-orange);
    font-weight: 600;
}

/* ── Info Rows ──────────────────────────────────────────────── */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
}

.info-row:last-child { border-bottom: none; }
.info-row .info-label { color: var(--text-muted); }
.info-row .info-value { color: var(--text-primary); font-weight: 600; text-align: right; max-width: 60%; }

/* ── Misc ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state .empty-text { font-size: 14px; }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.tag.blue   { background: rgba(200,168,75,.1); border-color: rgba(200,168,75,.3); color: var(--accent-blue); }
.tag.green  { background: rgba(63,185,80,.1);  border-color: rgba(63,185,80,.3);  color: var(--accent-green); }
.tag.orange { background: rgba(210,153,34,.1); border-color: rgba(210,153,34,.3); color: var(--accent-orange); }
.tag.red    { background: rgba(248,81,73,.1);  border-color: rgba(248,81,73,.3);  color: var(--accent-red); }

.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ════════════════════════════════════════════════════════════
   API-Connected UI Extensions — Dashboard Layer
   ════════════════════════════════════════════════════════════ */

/* ── Skeleton Loading ────────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 400px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
    display: block;
}
.skeleton-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
}

/* ── Error State ─────────────────────────────────────────── */
.api-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    gap: 10px;
}
.api-error-icon  { font-size: 40px; }
.api-error-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.api-error-msg   { font-size: 12px; color: var(--text-muted); max-width: 380px; line-height: 1.6; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state     { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 48px; }
.empty-icon      { font-size: 36px; }
.empty-text      { font-size: 13px; color: var(--text-muted); }

/* ── Deadline Pills ──────────────────────────────────────── */
.deadline-pill.urgent   { background: rgba(210,153,34,.18); border-color: rgba(210,153,34,.45); color: var(--accent-orange); animation: pulse-orange 1.8s ease-in-out infinite; }
.deadline-pill.expired  { background: rgba(248,81,73,.18);  border-color: rgba(248,81,73,.45);  color: var(--accent-red); }
@keyframes pulse-orange {
    0%, 100% { box-shadow: none; }
    50%       { box-shadow: 0 0 0 3px rgba(210,153,34,.2); }
}

/* ── Dispute Badge ───────────────────────────────────────── */
.dispute-badge {
    display: inline-block;
    background: rgba(248,81,73,.18);
    border: 1px solid rgba(248,81,73,.4);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-red);
    letter-spacing: .3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ── Arabic Status Label ─────────────────────────────────── */
.status-ar {
    display: block;
    font-size: 9px;
    font-weight: 400;
    opacity: .75;
    direction: rtl;
    text-align: right;
    margin-top: 1px;
    line-height: 1.2;
}

/* ── Logout Button ───────────────────────────────────────── */
.logout-btn {
    width: calc(100% - 24px);
    margin: 8px 12px 0;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}
.logout-btn:hover { border-color: var(--accent-red); color: var(--accent-red); }

/* ── Loading Overlay Pulse ───────────────────────────────── */
.loading-pulse {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 32px;
    color: var(--text-muted);
    font-size: 12px;
}
.loading-pulse::before {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stats skeleton placeholder ──────────────────────────── */
.stat-value.loading { color: transparent; }
.stat-value.loading::after {
    content: '';
    display: inline-block;
    width: 80px; height: 28px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 400px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

/* ── Pagination live ──────────────────────────────────────── */
.pagination-controls .page-btn.hidden { display: none; }

/* ── Status badge arabic sub-label tweak ─────────────────── */
.status-badge { line-height: 1.3; }

/* ── Order detail: payment row highlight ─────────────────── */
.payment-row .value.paid   { color: var(--accent-green); }
.payment-row .value.pending { color: var(--accent-orange); }
.payment-row .value.refunded { color: var(--text-muted); text-decoration: line-through; }

/* ── Transition arrow cards ──────────────────────────────── */
.transition-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    transition: border-color var(--transition);
}
.transition-card:hover { border-color: var(--accent-blue); }
.transition-card.dispute-transition:hover { border-color: var(--accent-red); }
.transition-arrow { font-size: 16px; }
.transition-name  { font-size: 12px; font-weight: 700; color: var(--accent-blue); }
.transition-name.dispute { color: var(--accent-red); }
.transition-desc  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════════════════════
   DESIGN INTELLIGENCE — Shared Styles
   Covers: Quality Layer, Integration Layer, Tech Pack, Factory Execution
   ─────────────────────────────────────────────────────────────────────────
   EXTEND ONLY — nothing above this line is touched.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Quality Status Badges (3 levels) ───────────────────────────────────── */
.quality-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: .3px;
    white-space: nowrap;
    text-transform: uppercase;
}
.quality-badge.incomplete {
    background: rgba(248,81,73,.13);
    color: #f85149;
    border: 1px solid rgba(248,81,73,.3);
}
.quality-badge.ready {
    background: rgba(210,153,34,.13);
    color: #f0b429;
    border: 1px solid rgba(210,153,34,.3);
}
.quality-badge.production_ready {
    background: rgba(63,185,80,.13);
    color: #3fb950;
    border: 1px solid rgba(63,185,80,.3);
}

/* ── Factory Confidence Badge ────────────────────────────────────────────── */
.confidence-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.confidence-badge.low    { background:rgba(248,81,73,.1);  color:#f85149; }
.confidence-badge.medium { background:rgba(210,153,34,.1); color:#f0b429; }
.confidence-badge.high   { background:rgba(63,185,80,.1);  color:#3fb950; }

/* ── Quality Progress Bar ────────────────────────────────────────────────── */
.quality-progress-wrap {
    height: 6px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    flex: 1;
}
.quality-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .4s ease, background .4s ease;
}
.quality-progress-bar.incomplete   { background: #f85149; }
.quality-progress-bar.ready        { background: #f0b429; }
.quality-progress-bar.production_ready { background: #3fb950; }

/* Inline mini progress (inside table cells, order cards) */
.quality-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.quality-mini .quality-progress-wrap { min-width: 48px; }
.quality-mini .q-score { font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }

/* ── Warning Box (Arabic + English) ─────────────────────────────────────── */
.quality-warning-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(248,81,73,.08);
    border: 1.5px solid rgba(248,81,73,.28);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 12px;
}
.quality-warning-box .warn-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.quality-warning-box .warn-body { flex: 1; }
.quality-warning-box .warn-title {
    font-weight: 700;
    color: #f85149;
    margin-bottom: 4px;
    font-size: 12px;
}
.quality-warning-box .warn-ar {
    direction: rtl;
    text-align: right;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
}
.quality-warning-box .warn-list {
    color: var(--text-muted);
    font-size: 11px;
    padding-left: 14px;
    margin: 4px 0 0;
}
.quality-warning-box .warn-list li { margin-bottom: 2px; }

/* ── Source Type Badge (manual / ai / import) ───────────────────────────── */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}
.source-badge.manual_upload   { background:rgba(200,168,75,.1);  color:#C8A84B;  border:1px solid rgba(200,168,75,.25); }
.source-badge.ai_generated    { background:rgba(63,185,80,.1);   color:#3fb950;  border:1px solid rgba(63,185,80,.25); }
.source-badge.external_import { background:rgba(210,153,34,.1);  color:#f0b429;  border:1px solid rgba(210,153,34,.25); }

/* ── Suggestion List ─────────────────────────────────────────────────────── */
.suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
}
.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border-radius: 4px;
    padding: 6px 10px;
    border-left: 2px solid var(--accent-orange);
}
.suggestion-item .sug-icon { flex-shrink: 0; }

/* ── Tech Pack Panel ─────────────────────────────────────────────────────── */
.techpack-panel {
    background: rgba(200,168,75,.04);
    border: 1px solid rgba(200,168,75,.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 0;
}
.techpack-panel-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.techpack-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.techpack-preview-box {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 12px;
    color: var(--text-muted);
    min-height: 60px;
}

/* ── Factory Execution Panel ─────────────────────────────────────────────── */
.factory-panel {
    background: rgba(63,185,80,.04);
    border: 1px solid rgba(63,185,80,.2);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.factory-panel-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.factory-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.factory-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .16s;
}
.factory-action-btn.start {
    background: rgba(63,185,80,.15);
    color: #3fb950;
    border-color: rgba(63,185,80,.3);
}
.factory-action-btn.start:hover { background: rgba(63,185,80,.25); }
.factory-action-btn.clarify {
    background: rgba(210,153,34,.12);
    color: #f0b429;
    border-color: rgba(210,153,34,.3);
}
.factory-action-btn.clarify:hover { background: rgba(210,153,34,.22); }

/* ── Submit button disabled state ───────────────────────────────────────── */
.btn.btn-primary:disabled,
.btn.btn-primary[disabled] {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}
.btn.btn-primary.blocked {
    background: rgba(248,81,73,.15) !important;
    color: #f85149 !important;
    border-color: rgba(248,81,73,.35) !important;
    cursor: not-allowed;
}

/* ── Design quality column in orders table ──────────────────────────────── */
.td-quality { min-width: 110px; }

/* ── Score field rows (design-upload quality card) ──────────────────────── */
.score-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 3px 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}
.score-field-row:last-child { border-bottom: none; }
.score-field-row.done { color: var(--accent-green); }
.score-field-row.done::before { content: '✓'; color: var(--accent-green); }
.score-field-row:not(.done)::before { content: '○'; color: var(--text-muted); }

/* ── Loading / empty state refinements ──────────────────────────────────── */
.state-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
}
.state-loading::before {
    content: '';
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}
.state-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 12px;
}
.state-empty .icon { font-size: 28px; }
.state-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 20px;
    color: var(--accent-red);
    font-size: 12px;
    text-align: center;
}
.state-error .icon { font-size: 24px; }

/* ── Quality gate indicator (workflow page) ─────────────────────────────── */
.quality-gate-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: rgba(248,81,73,.07);
    border: 1px solid rgba(248,81,73,.22);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 10px;
}
.quality-gate-note.pass {
    background: rgba(63,185,80,.07);
    border-color: rgba(63,185,80,.22);
}
.quality-gate-note .icon { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   DEV AUTH BYPASS — Role Switcher Styles
   EXTEND ONLY — never touch production UI styles.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Role switcher bar in topbar */
#devRoleSwitcher {
    animation: devPulse 3s ease-in-out infinite;
}
@keyframes devPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248,81,73,0); }
    50%       { box-shadow: 0 0 0 4px rgba(248,81,73,.12); }
}

/* Active role button within the switcher */
#devRoleSwitcher .dev-role-btn.active {
    background: rgba(248,81,73,.25) !important;
    color: #f85149 !important;
    border-color: rgba(248,81,73,.4) !important;
}
#devRoleSwitcher .dev-role-btn:hover:not(.active) {
    background: rgba(255,255,255,.06) !important;
    color: var(--text-primary) !important;
}

/* Dev banner in sidebar avatar area */
.sidebar-footer .avatar[style*="rgba(248,81,73"] {
    box-shadow: 0 0 0 2px rgba(248,81,73,.4);
}

/* Logout button when in dev mode */
.logout-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 7px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, color .15s;
}
.logout-btn:hover {
    border-color: rgba(248,81,73,.4);
    color: #f85149;
}
