:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #121214;
    --bg-card: #18181b;
    --bg-hover: #1f1f23;
    --border: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-green: #22c55e;
    --accent-green-dim: rgba(34, 197, 94, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    --accent-blue: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Scrollbar — тёмная тема */
* {
    scrollbar-color: var(--border) transparent;
    scrollbar-width: thin;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sidebar-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border);
}

.sidebar-logout {
    width: 100%;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.sidebar-logout:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: color var(--transition), background var(--transition);
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-link.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.12);
}

.sidebar-link-icon {
    font-size: 1.1rem;
    opacity: 0.9;
}

.app {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    margin-bottom: 1.5rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Status card */
.status-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.status-card.connected {
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.status-card.error {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.1);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.25rem;
    animation: pulse 2s ease-in-out infinite;
}

.status-card.connected .status-indicator {
    background: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green-dim);
}

.status-card.error .status-indicator {
    background: var(--accent-red);
    box-shadow: 0 0 12px var(--accent-red-dim);
}

.status-card.loading .status-indicator {
    background: var(--text-muted);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-content {
    flex: 1;
    min-width: 0;
}

.status-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.status-detail {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Events section */
.events-section {
    flex: 1;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.events-log {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 320px;
}

.events-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: none;
}

.events-placeholder.visible {
    display: block;
}

.events-list {
    padding: 1rem;
    padding-top: 0.75rem;
}

.events-list:empty + .events-placeholder.visible {
    display: block;
}

.event-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    animation: eventFadeIn 0.3s ease;
    transition: background var(--transition);
}

.event-item:hover {
    background: var(--bg-hover);
}

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

.event-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.event-text {
    flex: 1;
    min-width: 0;
    padding: 0.1rem 0;
    word-break: break-word;
}

.event-type {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    font-weight: 500;
}

.event-type.chat {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.event-type.message {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.event-type.chats {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.event-type.order,
.event-type.new_order {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

.event-type.orders {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

.event-type.status {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.event-type.unknown {
    background: var(--accent-red-dim);
    color: var(--text-muted);
}

/* Page actions (PUBG Mobile etc.) */
.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 10;
}

.page-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

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

.page-btn-primary {
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.1);
}

.page-btn-primary:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: var(--accent-blue);
}

.page-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-height: 200px;
}

.page-placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Goods ID form */
.goods-id-form {
    max-width: none;
}

.goods-id-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.goods-id-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.goods-id-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.goods-id-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.goods-id-field label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.goods-id-field input {
    width: 100px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.goods-id-field input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.goods-id-list-wrap {
    margin-top: 1.5rem;
}

.goods-id-saved {
    margin-top: 0.75rem;
}

.goods-id-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 1rem 0;
}

.goods-id-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.goods-id-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: var(--accent-blue);
    flex: 0 0 auto;
}

.goods-id-nominal {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.goods-id-row .page-btn {
    margin-left: auto;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.goods-id-del {
    color: var(--text-muted) !important;
    border-color: transparent !important;
    min-width: 28px;
    padding: 0.35rem !important;
}

.goods-id-del:hover {
    color: var(--accent-red) !important;
}

/* Lots view */
.lots-view-form {
    max-width: none;
}

.lots-view-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.lots-view-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.lots-view-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.lots-view-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.lots-view-field label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.lots-view-field input {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.lots-view-field input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.lot-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.lot-info-row {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.lot-info-row:last-child {
    margin-bottom: 0;
}

.lot-desc {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.lot-code {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.lot-info-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lot-error {
    color: var(--accent-red);
    font-size: 0.9rem;
}

.lot-success {
    color: var(--accent-green);
    font-size: 0.9rem;
}

.lot-info-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.lots-view-list-header, .lots-saved-wrap .lots-view-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.lot-saved-clickable {
    cursor: pointer;
    transition: background var(--transition);
}

.lot-saved-clickable:hover {
    background: var(--bg-hover);
}

.lot-detail-view {
    max-width: none;
}

.lot-detail-back {
    margin-bottom: 1rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.lot-detail-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.lot-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.lot-detail-title {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.lot-detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem 1.5rem;
}

.lot-meta-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lot-meta-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

.lot-detail-section {
    margin-bottom: 1.5rem;
}

.lot-section-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.lot-mapping-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
    max-width: 400px;
}

.lot-mapping-input {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.lot-mapping-btns {
    display: flex;
    gap: 0.5rem;
}

.lot-only-priority-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lot-only-priority-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex: 1;
    min-width: 200px;
}

.lot-status-section {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.lot-detail-status {
    margin: 0;
}

.lot-status-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.lot-status-text + .lot-status-text {
    margin-top: 0.5rem;
}

.lot-status-priority {
    color: var(--accent-blue);
}

.lot-status-mapping {
    color: var(--accent-green);
}

.lot-products-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.lot-products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.lot-products-table th,
.lot-products-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.lot-products-table th {
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lot-products-table td {
    color: var(--text-primary);
}

.lot-products-table tbody tr:hover {
    background: var(--bg-hover);
}

.lot-table-product-id {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lot-table-qty {
    text-align: center;
}

.lot-table-price {
    text-align: right;
    font-weight: 500;
}

.lot-empty-msg {
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lot-product-total {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 0.75rem 0;
    margin-top: 0.5rem;
    border-top: 2px solid var(--border);
}

.lot-detail-products {
    margin-bottom: 0;
}

.lot-detail-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.lot-saved-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.lot-saved-title {
    font-weight: 500;
    color: var(--accent-blue);
}

.lot-saved-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.lot-saved-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.lot-saved-actions .page-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.goods-id-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.goods-id-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.goods-id-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.goods-id-item {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent-blue);
}

/* FazerCards games */
.fc-games-view {
    max-width: none;
}

.fc-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.fc-block-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.fc-add-game {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.fc-input {
    flex: 1;
    min-width: 180px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.fc-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.fc-game-card {
    margin-bottom: 1rem;
}

.fc-game-card:last-child {
    margin-bottom: 0;
}

.fc-game-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.fc-game-name {
    font-weight: 500;
    color: var(--text-primary);
}

.fc-game-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.fc-game-fields {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.fc-settings-list {
    margin-bottom: 1rem;
}

.fc-setting-row {
    margin-bottom: 1rem;
}

.fc-setting-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.fc-setting-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
}

.fc-setting-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.35rem 0 0 1.6rem;
}

.fc-pubg-settings .fc-setting-label {
    display: block;
    margin-bottom: 0.25rem;
}

.fc-waiting-row .fc-setting-label {
    min-width: 4rem;
    margin-bottom: 0.25rem;
}
.fc-waiting-textarea {
    min-width: 100%;
    min-height: 4rem;
    resize: vertical;
}
.fc-waiting-msg-grid .fc-setting-row {
    margin-bottom: 1rem;
}

.fc-source-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.fc-source-table { width: 100%; border-collapse: collapse; }
.fc-source-table th, .fc-source-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.fc-source-table th { color: var(--text-muted); font-weight: 500; }
.fc-source-game-id { font-family: var(--font-mono, monospace); font-size: 0.9em; }
.fc-source-warn { background: var(--accent-red-dim); }
.fc-source-current { margin-bottom: 1rem; color: var(--text-secondary); }

.fc-pubg-settings .fc-setting-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.pubg-orders-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.pubg-orders-header .fc-block-title {
    margin: 0;
}

.pubg-orders-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pubg-orders-filter {
    width: 140px;
    padding: 0.4rem 0.6rem;
}

.pubg-orders-search {
    width: 180px;
    padding: 0.4rem 0.6rem;
}

.pubg-orders-pagination {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.pubg-pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pubg-pagination-btn {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
}

.pubg-pagination-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.08);
}

.pubg-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pubg-pagination-btn.active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb, 99, 102, 241), 0.2);
}

.pubg-pagination-ellipsis {
    padding: 0 0.25rem;
    color: var(--text-muted);
}

.pubg-orders-list {
    overflow-x: auto;
}

.pubg-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.pubg-orders-table thead th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.06);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.pubg-orders-table tbody tr.pubg-order-row {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.pubg-orders-table tbody tr.pubg-order-row:hover {
    background: rgba(255,255,255,0.04);
}

.pubg-orders-table tbody tr.pubg-order-row:last-child {
    border-bottom: none;
}

.pubg-order-card-clickable {
    cursor: pointer;
}

.pubg-orders-table td {
    padding: 0.6rem 0.75rem;
    vertical-align: middle;
}

.pubg-col-nominal {
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.pubg-col-id {
    color: var(--text-secondary);
}

.pubg-col-price {
    font-weight: 500;
}

.pubg-col-time {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.pubg-col-status {
    white-space: nowrap;
}

.pubg-col-actions {
    text-align: right;
    white-space: nowrap;
}

.pubg-order-status {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
}

.pubg-order-status.pubg-status-ok {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.pubg-order-status.pubg-status-err {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.pubg-order-status.pubg-status-stop {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.pubg-order-status.pubg-status-wait {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.pubg-order-status.pubg-status-proc {
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
}

.pubg-order-stop {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.pubg-order-detail {
    margin-top: 1rem;
}

.pubg-order-detail .page-btn {
    margin-bottom: 1rem;
}

.pubg-order-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.pubg-order-detail-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.pubg-order-detail-status {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.pubg-status-ok {
    background: rgba(34, 197, 94, 0.25);
    color: #4ade80;
}

.pubg-status-err {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.pubg-status-stop {
    background: rgba(234, 179, 8, 0.25);
    color: #facc15;
}

.pubg-status-pending {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
}

.pubg-order-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.pubg-detail-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.pubg-detail-block-wide {
    grid-column: 1 / -1;
}

.pubg-detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.pubg-detail-value {
    font-size: 0.95rem;
}

.pubg-detail-value-mono {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

.pubg-profit-plus {
    color: #4ade80;
    font-weight: 600;
}

.pubg-profit-minus {
    color: #f87171;
    font-weight: 600;
}

.pubg-detail-fc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.pubg-order-logs {
    margin-top: 1.5rem;
}

.pubg-order-logs .fc-section-label {
    margin-bottom: 0.5rem;
}

.pubg-logs-pre {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.8rem;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.fc-game-header .fc-toggle,
.fc-game-header .fc-sync {
    margin-left: auto;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.fc-products-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.fc-products-list {
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.fc-product-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.35rem 0;
    font-size: 0.9rem;
}

.fc-product-row span:first-child {
    min-width: 60px;
}

.fc-stock {
    color: var(--text-muted);
}

.fc-stock-ok {
    color: var(--accent-green);
}

.fc-product-with-del .page-btn {
    margin-left: auto;
}

.fc-products-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.fc-priority-clickable {
    cursor: pointer;
}

.fc-priority-clickable:hover {
    opacity: 0.95;
}

.fc-game-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fc-game-btn {
    padding: 0.5rem 1rem;
}

.fc-game-detail-view {
    max-width: none;
}

.fc-game-back {
    margin-bottom: 1rem;
}

.fc-game-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.fc-game-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.fc-game-products-section,
.fc-game-hidden-section {
    margin-bottom: 1.5rem;
}

.fc-section-label {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.fc-product-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.fc-product-card .fc-product-name {
    font-weight: 500;
    min-width: auto;
}

.fc-product-card .fc-product-nominal {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.fc-product-card .fc-product-price {
    font-size: 0.9rem;
}


.fc-product-card-clickable {
    cursor: pointer;
    transition: background var(--transition);
}

.fc-product-card-clickable:hover {
    background: var(--bg-hover);
}

.fc-product-name {
    min-width: 100px;
}

.fc-product-edit-name {
    width: 90px;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
}

.fc-product-edit-nominal {
    width: 60px;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
}

.fc-product-edit-nominal::-webkit-inner-spin-button,
.fc-product-edit-nominal::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fc-product-edit-nominal {
    -moz-appearance: textfield;
}

.fc-hidden-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.fc-restore-product {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Product modal */
.fc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.fc-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-width: 360px;
    max-width: 90vw;
}

.fc-modal-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.fc-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.fc-modal-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.fc-modal-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.fc-modal-readonly {
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: default;
}

.fc-modal-input[type="number"]::-webkit-inner-spin-button,
.fc-modal-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fc-modal-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fc-modal-hide {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.fc-modal-hide:hover {
    background: rgba(239, 68, 68, 0.25);
}

.fc-other-card {
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.fc-lot-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.fc-lot-clickable {
    cursor: pointer;
    transition: background var(--transition);
}

.fc-lot-clickable:hover {
    background: var(--bg-hover);
}

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

.fc-lot-title {
    font-weight: 500;
    min-width: 140px;
}

.fc-lot-mapping {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.fc-mapping-input {
    width: 100px;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
}

.fc-save-mapping {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

/* Codes delivery cards */
.fc-codes-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}
.fc-code-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.fc-code-nominal {
    font-weight: 600;
    color: var(--text-primary);
}
.fc-code-placeholder,
.fc-code-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.fc-code-card-clickable {
    cursor: pointer;
}
.fc-code-card-clickable:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.fc-codes-detail {
    margin-top: 1rem;
}
.fc-codes-detail-header {
    margin-bottom: 1rem;
}
.fc-codes-price-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.fc-codes-add-section {
    margin-bottom: 1.5rem;
}
.fc-codes-add-section textarea {
    display: block;
    margin: 0.5rem 0;
    width: 100%;
    max-width: 400px;
}
.fc-codes-section {
    margin-bottom: 1.5rem;
}
.fc-codes-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}
.fc-codes-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
}
.fc-code-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.9rem;
}
.fc-code-checkbox {
    flex-shrink: 0;
}
.fc-code-value {
    font-family: monospace;
    flex: 1;
}
.fc-code-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Statistics page */
.stats-section {
    margin-bottom: 2rem;
}
.stats-periods {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.stats-period-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
}
.stats-period-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}
.stats-period-range {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.stats-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.stats-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}
.stats-metric-label {
    color: var(--text-secondary);
}
.stats-metric-value {
    font-weight: 500;
}
.stats-metric-value.ok {
    color: var(--accent-green);
}
.stats-metric-value.err {
    color: var(--accent-red);
}
.stats-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}
