* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
}

/* ── App Layout (sidebar + content) ──────────────────────────── */

html, body {
    height: 100%;
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────── */

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #0a0a0a;
    border-right: 1px solid #292929;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 22px 20px;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 1px solid #292929;
    letter-spacing: 0.01em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 10px;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #6b6b6b;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
    background: #1a1a1a;
    color: #e0e0e0;
}

.nav-btn.active {
    background: rgba(0, 192, 86, 0.1);
    color: #00c056;
}

.nav-icon {
    font-size: 15px;
}

/* ── Page content area ────────────────────────────────────────── */

.page-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.view {
    display: none;
    flex-direction: column;
    flex: 1;
}

.view.active {
    display: flex;
}

/* ── Container (home view inner wrapper) ──────────────────────── */

.container {
    max-width: 100%;
    padding: 20px 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────── */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 32px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 16px;
}

.home-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.status-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #ff4444;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background-color: #00ff4c;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 15px #00ff4c; }
    50% { box-shadow: 0 0 8px #00ff4c; }
}

.client-count {
    font-size: 18px;
    font-weight: bold;
    color: #6b6b6b;
}

/* ── Clients section ──────────────────────────────────────────── */

.clients-section {
    margin-top: 20px;
}

.clients-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.client-card {
    background: #1a1a1a;
    border: 2px solid #292929;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.client-id {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
}

.client-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #00c056;
    background: rgba(0, 192, 86, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #00c056;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Empty state ──────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    grid-column: 1 / -1;
}

.empty-state-image {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.4;
}

.empty-state-text {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state-subtext {
    font-size: 14px;
    color: #555;
}

/* ── Spinner ──────────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #00d4ff;
    margin: 0 2px;
    animation: spinner 1.4s infinite;
}

.spinner:nth-child(1) { animation-delay: -0.32s; }
.spinner:nth-child(2) { animation-delay: -0.16s; }

@keyframes spinner {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* ── Create Order Button ──────────────────────────────────────── */

.create-order-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    background: #00c056;
    color: #000000;
    border: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background 0.15s, transform 0.1s;
}

.create-order-btn:hover {
    background: #00d962;
    transform: translateY(-1px);
}

.create-order-btn:active {
    transform: translateY(0);
}

/* ── Inventory View ───────────────────────────────────────────── */

.inventory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 0;
}

.inventory-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
}

.inv-tabs {
    display: flex;
    gap: 6px;
    padding: 16px 28px 0;
}

.inv-tab {
    padding: 6px 16px;
    border: 1px solid #292929;
    background: transparent;
    color: #6b6b6b;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.inv-tab:hover:not(.active) {
    border-color: #444;
    color: #e0e0e0;
}

.inv-tab.active {
    background: rgba(0, 192, 86, 0.1);
    border-color: #00c056;
    color: #00c056;
}

.inventory-body {
    padding: 16px 28px 32px;
    flex: 1;
    overflow-y: auto;
}

.inv-panel { display: none; }
.inv-panel.active { display: block; }

/* ── Inventory Table ──────────────────────────────────────────── */

.inv-table-wrap {
    overflow-x: auto;
    border: 2px solid #292929;
}

table.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

table.inv-table thead tr {
    background: #1a1a1a;
}

table.inv-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid #292929;
    white-space: nowrap;
}

table.inv-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #1e1e1e;
    color: #e0e0e0;
}

table.inv-table tbody tr:last-child td {
    border-bottom: none;
}

table.inv-table tbody tr:hover td {
    background: #1a1a1a;
}

.badge-amount {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(0, 192, 86, 0.1);
    color: #00c056;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid rgba(0, 192, 86, 0.2);
}

.badge-owner {
    display: inline-block;
    padding: 2px 8px;
    background: #1a1a1a;
    border: 1px solid #292929;
    color: #6b6b6b;
    font-size: 12px;
    margin-right: 4px;
    margin-bottom: 2px;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid #292929;
    background: transparent;
    color: #6b6b6b;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.refresh-btn:hover {
    border-color: #00c056;
    color: #00c056;
}

/* ── Modal ────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: #111111;
    border: 2px solid #292929;
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 24px;
}

/* ── Form elements ────────────────────────────────────────────── */

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.form-input {
    padding: 9px 12px;
    background: #1a1a1a;
    border: 1px solid #292929;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: #00c056;
}

.form-input::placeholder {
    color: #444;
}

/* ── Order item rows ──────────────────────────────────────────── */

.items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.item-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.item-row .form-input {
    flex: 1;
    margin: 0;
}

.item-row .qty-input {
    width: 72px;
    flex-shrink: 0;
}

.remove-item-btn {
    background: transparent;
    border: 1px solid #292929;
    color: #555;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 10px;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}

.remove-item-btn:hover {
    border-color: #ff4444;
    color: #ff4444;
}

.add-item-btn {
    background: transparent;
    border: 1px dashed #292929;
    color: #555;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.15s;
}

.add-item-btn:hover {
    border-color: #00c056;
    color: #00c056;
}

/* Searchable item dropdown */
.item-combo { position: relative; flex: 1; }
.item-combo-input { width: 100%; box-sizing: border-box; }
.item-dropdown {
    display: none; position: absolute;
    top: 100%; left: 0; right: 0;
    background: #1e1e2c;
    border: 1px solid rgba(255,255,255,0.12);
    border-top: none;
    z-index: 999;
    max-height: 200px; overflow-y: auto;
    box-shadow: 0 12px 28px rgba(0,0,0,0.6);
}
.item-dropdown::-webkit-scrollbar { width: 4px; }
.item-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
.item-dropdown.open { display: block; }
.item-dropdown-opt {
    padding: 8px 12px; font-size: 0.84rem;
    color: rgba(255,255,255,0.65); cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    transition: background 0.12s;
}
.item-dropdown-opt:hover, .item-dropdown-opt.focused { background: rgba(255,255,255,0.06); color: #fff; }
.item-dropdown-opt .opt-cat  { font-size: 0.72rem; color: rgba(255,255,255,0.2); margin-left: 6px; }
.item-dropdown-opt .opt-owners { font-size: 0.72rem; color: rgba(255,255,255,0.25); }
.item-dropdown-empty { padding: 10px 12px; font-size: 0.82rem; color: rgba(255,255,255,0.2); }

/* ── Seller match results ─────────────────────────────────────── */

.match-result {
    margin: 18px 0 0;
    border: 2px solid #292929;
}

.match-result-header {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: #1a1a1a;
    color: #6b6b6b;
    border-bottom: 1px solid #292929;
}

.match-seller-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #1e1e1e;
    cursor: pointer;
    transition: background 0.1s;
}

.match-seller-row:last-child {
    border-bottom: none;
}

.match-seller-row:hover {
    background: #1a1a1a;
}

.match-seller-row.selected {
    background: rgba(0, 192, 86, 0.08);
    border-left: 3px solid #00c056;
}

.match-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 3px;
}

.match-score {
    font-size: 12px;
    color: #6b6b6b;
}

.match-score.full    { color: #00c056; }
.match-score.partial { color: #f0c85a; }
.match-score.none    { color: #ff4444; }

.no-match {
    padding: 16px 14px;
    text-align: center;
    color: #ff4444;
    font-size: 14px;
    font-weight: 600;
}

/* ── Modal footer buttons ─────────────────────────────────────── */

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #292929;
}

.btn-secondary {
    padding: 9px 18px;
    background: transparent;
    border: 1px solid #292929;
    color: #6b6b6b;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-secondary:hover {
    border-color: #555;
    color: #e0e0e0;
}

.btn-primary {
    padding: 9px 20px;
    background: #00c056;
    border: none;
    color: #000000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover { background: #00d962; }
.btn-primary:disabled {
    background: #1a1a1a;
    color: #444;
    cursor: not-allowed;
    border: 1px solid #292929;
}

.btn-find {
    padding: 9px 18px;
    background: transparent;
    border: 1px solid #00c056;
    color: #00c056;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-find:hover {
    background: rgba(0, 192, 86, 0.1);
}

/* ── Toast notification ───────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    z-index: 200;
    transform: translateY(60px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: none;
    border-left: 3px solid transparent;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #111;
    border: 1px solid #292929;
    border-left-color: #00c056;
    color: #00c056;
}

.toast.error {
    background: #111;
    border: 1px solid #292929;
    border-left-color: #ff4444;
    color: #ff4444;
}

.toast.info {
    background: #111;
    border: 1px solid #292929;
    border-left-color: #6b6b6b;
    color: #e0e0e0;
}