/* ===================================================
   Freelance Radar — Design Engineered UI (frontend-craft)
   Aesthetic: Linear / Dark Tech, Emil Kowalski Physics
   =================================================== */

:root {
    --canvas: var(--tg-theme-bg-color, #090d16);
    --surface: var(--tg-theme-secondary-bg-color, #131b2e);
    --surface-card: rgba(19, 27, 46, 0.78);
    --surface-hover: rgba(30, 41, 59, 0.85);
    --text-primary: var(--tg-theme-text-color, #f8fafc);
    --text-secondary: var(--tg-theme-hint-color, #94a3b8);
    --text-muted: #64748b;
    
    --primary: var(--tg-theme-button-color, #0284c7);
    --primary-glow: rgba(56, 189, 248, 0.28);
    --accent-cyan: #38bdf8;
    --accent-emerald: #10b981;
    --accent-emerald-bg: rgba(16, 185, 129, 0.14);
    --accent-amber: #f59e0b;
    --accent-amber-bg: rgba(245, 158, 11, 0.14);
    --accent-purple: #a855f7;
    --accent-purple-bg: rgba(168, 85, 247, 0.14);
    
    --hairline: rgba(255, 255, 255, 0.08);
    --hairline-focus: rgba(56, 189, 248, 0.45);
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 10px 30px -4px rgba(0, 0, 0, 0.5);

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 9999px;

    --ease-snappy: cubic-bezier(0.16, 1, 0.3, 1);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--canvas);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13.5px;
    line-height: 1.45;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 72px;
    -webkit-font-smoothing: antialiased;
}

/* Tabular figures for all stats, numbers, budgets */
.counter-badge, .seg-pill, .order-budget, .kpi-val, .feed-counter, .sources-card-count {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.app-container {
    max-width: 620px;
    margin: 0 auto;
    position: relative;
}

/* ===================================================
   Phase 1: Compact Top Bar (Zero Wasted Space)
   =================================================== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: 48px;
    background: rgba(9, 13, 22, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--hairline);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radar-glyph {
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.3), rgba(56, 189, 248, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-xs);
}

.radar-brand {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: #fff;
}

.sources-pill {
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform 140ms var(--ease-snappy), background 140ms ease;
}

.sources-pill:active {
    transform: scale(0.95);
    background: var(--surface-hover);
}

.status-pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-emerald);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent-emerald);
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.85); }
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.counter-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--hairline);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
}

.icon-refresh {
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 160ms var(--ease-snappy);
}

.icon-refresh:active {
    transform: scale(0.9);
}

.icon-refresh.spinning svg {
    animation: iconSpin 0.75s linear infinite;
}

@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===================================================
   Phase 2: Segmented Mode Switcher (IT vs All)
   =================================================== */
.segment-wrapper {
    padding: 10px 14px 6px 14px;
}

.segment-control {
    background: rgba(19, 27, 46, 0.6);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    padding: 3px;
    display: flex;
    gap: 4px;
    position: relative;
}

.segment-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 160ms var(--ease-snappy);
}

.segment-btn:active {
    transform: scale(0.98);
}

.segment-btn.active {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.9), rgba(14, 165, 233, 0.95));
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}

.seg-icon {
    font-size: 13px;
}

.seg-pill {
    font-size: 10.5px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 6px;
    border-radius: var(--radius-pill);
}

.segment-btn.active .seg-pill {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* ===================================================
   Search Bar & Category Chips
   =================================================== */
.search-bar-wrap {
    padding: 4px 14px 8px 14px;
}

.search-input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-ico {
    position: absolute;
    left: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-box input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    padding: 8px 30px 8px 34px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-input-box input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
}

.chips-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 14px 10px 14px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chips-scroll::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 500;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 140ms var(--ease-snappy);
}

.filter-chip:active {
    transform: scale(0.95);
}

.filter-chip.active {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    color: #fff;
    font-weight: 600;
}

/* ===================================================
   Sources Drawer (Interactive Dashboard)
   =================================================== */
.sources-drawer {
    margin: 0 14px 12px 14px;
    background: rgba(19, 27, 46, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-elevated);
    transition: max-height 250ms var(--ease-snappy), opacity 200ms ease, padding 200ms ease;
    max-height: 400px;
    opacity: 1;
    overflow: hidden;
}

.sources-drawer.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 12px;
    margin-bottom: 0;
    border-color: transparent;
    pointer-events: none;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.drawer-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
}

.drawer-sub {
    font-size: 10.5px;
    color: var(--accent-emerald);
}

.sources-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.source-item-card {
    background: rgba(11, 15, 25, 0.7);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    transition: all 140ms var(--ease-snappy);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.source-item-card:active {
    transform: scale(0.97);
    border-color: var(--accent-cyan);
}

.source-item-card.active-filter {
    border-color: var(--accent-cyan);
    background: rgba(2, 132, 199, 0.2);
}

.source-info-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.source-icon {
    font-size: 14px;
}

.source-name {
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
}

.source-badge-status {
    font-size: 9.5px;
    color: var(--text-muted);
}

.sources-card-count {
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    color: #fff;
}

/* ===================================================
   Main Views & Controls
   =================================================== */
.views-container {
    padding: 0 14px;
}

.view-panel {
    display: none;
    animation: panelEnter 180ms var(--ease-snappy);
}

.view-panel.active {
    display: block;
}

@keyframes panelEnter {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.feed-sub-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

.feed-filters-group {
    display: flex;
    gap: 6px;
}

.glass-select {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    padding: 5px 8px;
    outline: none;
    cursor: pointer;
}

.feed-counter {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===================================================
   Phase 3: Order Cards (Anti-Slop Design)
   =================================================== */
.orders-stream {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-card {
    background: var(--surface-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    padding: 13px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    transition: border-color 160ms ease, transform 140ms var(--ease-snappy);
}

.order-card:active {
    border-color: rgba(56, 189, 248, 0.3);
}

.order-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.platform-pill {
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.platform-pill.fl { background: rgba(249, 115, 22, 0.14); color: #fb923c; }
.platform-pill.kwork { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.platform-pill.freelanceru { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
.platform-pill.laborx { background: rgba(168, 85, 247, 0.14); color: #c084fc; }
.platform-pill.tg { background: rgba(34, 211, 238, 0.14); color: #22d3ee; }

.head-badges-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.free-indicator {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.free-indicator.free {
    background: var(--accent-emerald-bg);
    color: var(--accent-emerald);
}

.free-indicator.pro {
    background: var(--accent-amber-bg);
    color: var(--accent-amber);
}

.order-budget {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    padding: 3px 7px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.order-headline {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1.35;
    letter-spacing: -0.015em;
    text-wrap: balance;
    margin-bottom: 6px;
}

.order-tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.tag-bubble {
    font-size: 10px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.07);
    color: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
}

.order-text-desc {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.45;
    max-height: 54px;
    overflow: hidden;
    position: relative;
    transition: max-height 250ms var(--ease-snappy);
    margin-bottom: 8px;
}

.order-text-desc.open {
    max-height: 450px;
}

.desc-toggle-btn {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-cyan);
    background: none;
    border: none;
    cursor: pointer;
    margin-bottom: 8px;
}

.order-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--hairline);
    padding-top: 10px;
    gap: 8px;
}

.foot-time {
    font-size: 10.5px;
    color: var(--text-muted);
}

.foot-actions {
    display: flex;
    gap: 6px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    border-radius: var(--radius-xs);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 120ms var(--ease-snappy), opacity 120ms ease;
}

.btn-action:active {
    transform: scale(0.96);
}

.btn-action-ai {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--hairline);
}

.btn-action-open {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

/* ===================================================
   Craft Cards (Settings / Chats / Stats)
   =================================================== */
.craft-card {
    background: var(--surface-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-soft);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
    text-wrap: balance;
}

.card-subtitle {
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.card-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.sources-full-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-full-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.source-full-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-full-icon {
    font-size: 18px;
}

.source-full-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.source-full-type {
    font-size: 11px;
    color: var(--text-secondary);
}

.source-full-right {
    text-align: right;
}

.source-full-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-emerald);
}

.source-full-count {
    font-size: 11px;
    color: var(--text-muted);
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }

/* Inline Add Forms */
.inline-add-form {
    display: flex;
    gap: 6px;
}

.inline-add-form input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    padding: 9px 12px;
    outline: none;
}

.btn-craft-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 12.5px;
    font-weight: 600;
    padding: 9px 14px;
    cursor: pointer;
    transition: opacity 140ms ease, transform 120ms var(--ease-snappy);
}

.btn-craft-primary:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.btn-craft-secondary {
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--text-primary);
    border-radius: var(--radius-xs);
    font-size: 12.5px;
    font-weight: 600;
    padding: 9px 14px;
    cursor: pointer;
}

.btn-craft-secondary:active {
    transform: scale(0.97);
}

/* Chats List Box */
.chats-list-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-bubble {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    padding: 9px 12px;
}

.chat-bubble-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
}

.chat-bubble-id {
    font-size: 11px;
    color: var(--text-secondary);
}

.btn-del-chat {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

/* Settings Toggle Rows */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--hairline);
}

.toggle-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.toggle-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.toggle-hint {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

.craft-num-input {
    width: 80px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 8px;
    text-align: right;
    outline: none;
}

/* Craft Switch */
.craft-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.craft-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.craft-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--surface);
    border: 1px solid var(--hairline);
    transition: 200ms var(--ease-snappy);
    border-radius: var(--radius-pill);
}

.craft-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: #fff;
    transition: 200ms var(--ease-snappy);
    border-radius: 50%;
}

input:checked + .craft-slider {
    background-color: var(--accent-emerald);
    border-color: transparent;
}

input:checked + .craft-slider:before {
    transform: translateX(20px);
}

/* Tags Cluster */
.tags-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
    min-height: 18px;
}

.tag-pill-removable {
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--text-primary);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tag-pill-removable button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
}

.add-tag-inline {
    display: flex;
    gap: 6px;
}

.add-tag-inline input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    color: #fff;
    font-size: 12px;
    padding: 7px 10px;
    outline: none;
}

/* KPI Metrics */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.kpi-card {
    background: var(--surface-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kpi-card.accent {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.2), rgba(56, 189, 248, 0.1));
    border-color: rgba(56, 189, 248, 0.35);
}

.kpi-val {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 2px;
}

.kpi-lbl {
    font-size: 10.5px;
    color: var(--text-secondary);
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 12.5px;
}

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

/* ===================================================
   Phase 4: Bottom Navigation Dock
   =================================================== */
.nav-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(9, 13, 22, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--hairline);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    max-width: 620px;
    margin: 0 auto;
}

.nav-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 140ms ease, transform 120ms var(--ease-snappy);
    width: 25%;
}

.nav-tab:active {
    transform: scale(0.94);
}

.nav-tab.active {
    color: var(--accent-cyan);
    font-weight: 600;
}

/* Floating Toast */
.craft-toast {
    position: fixed;
    bottom: 68px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: rgba(16, 185, 129, 0.96);
    color: #fff;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: all 220ms var(--ease-snappy);
    z-index: 250;
}

.craft-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Loading & Empty States */
.loading-box, .empty-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 14px;
    color: var(--text-secondary);
    text-align: center;
    gap: 10px;
}

.craft-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: iconSpin 0.75s linear infinite;
}

/* ===================================================
   Triage & Card Actions (Star, Hide, Read State)
   =================================================== */
.dock-badge {
    position: absolute;
    top: 5px;
    right: 20%;
    background: #f59e0b;
    color: #000;
    font-size: 9px;
    font-weight: 800;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.order-card {
    transition: opacity 220ms ease, transform 220ms var(--ease-snappy), max-height 260ms ease, margin 260ms ease;
}

.order-card.is-read {
    opacity: 0.74;
}

.order-card.is-read .order-card-title {
    color: #94a3b8;
}

.order-card.hiding {
    opacity: 0;
    transform: translateX(-40px) scale(0.95);
    max-height: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
    pointer-events: none;
}

.btn-action-star {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--hairline);
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1;
}

.btn-action-star.active {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.btn-action-hide {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid var(--hairline);
    padding: 7px 9px;
    font-size: 11px;
}

.btn-action-hide:hover {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Toast with Undo */
.toast-undo-btn {
    background: #fff;
    color: #0f172a;
    border: none;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    cursor: pointer;
}

.craft-toast {
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto !important;
}

/* ===================================================
   AI Proposal Bottom Sheet Modal
   =================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-sheet {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 620px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 12px 16px 24px;
    transform: translateY(100%);
    transition: transform 280ms var(--ease-snappy);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
}

.modal-backdrop.open .modal-sheet {
    transform: translateY(0);
}

.sheet-handle-bar {
    display: flex;
    justify-content: center;
    padding-bottom: 10px;
}

.sheet-pill {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sheet-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-glyph {
    font-size: 20px;
}

.sheet-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.sheet-order-sub {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sheet-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
}

.tone-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tone-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--hairline);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    white-space: nowrap;
    transition: all 140ms ease;
}

.tone-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.sheet-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.sheet-textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.45;
    padding: 10px;
    resize: none;
    box-sizing: border-box;
    outline: none;
}

.sheet-textarea:focus {
    border-color: var(--accent-cyan);
}

.textarea-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 14px;
}

.ai-guarantee {
    color: #10b981;
    font-weight: 600;
}

.sheet-actions {
    display: flex;
    gap: 8px;
}

.sheet-actions .btn-craft-primary,
.sheet-actions .btn-craft-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px;
    font-size: 13px;
}

