/* =========================================
   CORE ERP SYSTEM VARIABLES & RESET
   ========================================= */
:root {
    --bg-app: #15171b; --bg-panel: #1e2329; --bg-header: #282e36;
    --bg-input: #121417; --bg-hover: #ffffff0d; --bg-active: #ffffff1a;
    --border-main: #343b45; --border-light: #464f5b; --border-dark: #111316;
    --border-focus: #38bdf8; --text-primary: #e2e8f0; --text-dim: #64748b;
    --text-label: #94a3b8; --text-inv: #1e2329;
    --shadow-depth: 0 10px 30px #00000080; --shadow-inset: inset 0 1px 3px #0006;
    --accent-blue: #38bdf8; --color-money: #4ade80;
    --color-warn: #fbbf24; --color-alert: #f87171;
    --header-height: 28px; --status-height: 24px; --sidebar-width: 350px;
    --font-ui: "Inter", -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", monospace;
    
    /* Order Intake Specifics */
    --card-radius: 3px;
}

*, *:before, *:after { box-sizing: border-box; }

body {
    background-color: var(--bg-app); color: var(--text-primary);
    font-family: var(--font-ui); margin: 0; padding: 0;
    font-size: 11px; -webkit-font-smoothing: antialiased;
}


/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb { background: var(--border-main); border: 2px solid var(--bg-panel); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
::-webkit-scrollbar-corner { background: var(--bg-panel); }

/* Inputs & Form Elements (Global) */
/* UPDATED: Switched to font-ui for readability, retained mono for numbers */
input[type="text"], select, textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-main);
    color: var(--text-primary);
    font-family: var(--font-ui); /* Human readable */
    font-size: 11px;
    padding: 6px 8px;
    border-radius: 2px;
    outline: none;
    transition: border-color 0.1s;
}
input[type="number"] { font-family: var(--font-mono); background-color: var(--bg-input); }

input:focus, select:focus, textarea:focus {
    border-color: var(--border-focus);
    background-color: var(--bg-active);
}
label {
    display: block; margin-bottom: 4px; 
    color: var(--text-label); font-weight: 500; font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.5px;
    font-family: var(--font-ui);
}

/* Buttons (Global) */
button, .btn {
    appearance: none; background: var(--bg-panel); border: 1px solid var(--border-main);
    color: var(--text-primary); font-family: var(--font-ui); cursor: pointer;
    display: inline-flex; border-radius: 2px; justify-content: center; align-items: center;
    padding: 6px 12px; transition: all .1s; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
button:hover, .btn:hover { background: var(--bg-header); border-color: var(--text-dim); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }


/* =========================================
   MODULE: ORDER INTAKE TOOL
   ========================================= */

/* Layout Grid */
.intake-grid {
    display: grid;
    gap: 6px; /* UPDATED: Distinct separation between panels */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
    padding: 8px;
}

/* Widget/Card Styling */
.widget-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-main);
    border-radius: var(--card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); /* Added subtle depth */
}

/* The Header (Summary) */
.widget-card summary {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-header);
    height: var(--header-height);
    padding: 0 10px;
    cursor: pointer; list-style: none; outline: none;
    font-family: var(--font-mono); /* Keep header mono for that "System" feel */
    font-weight: 700; color: var(--text-dim);
    font-size: 10px; text-transform: uppercase;
    border-bottom: 1px solid var(--border-dark);
    transition: color 0.2s;
}
.widget-card summary:hover { color: var(--text-primary); background: var(--bg-hover); }
.widget-card summary::-webkit-details-marker { display: none; }

/* The Arrow */
/*.widget-card summary::after {
    content: '[ + ]'; font-family: var(--font-mono); opacity: 0.5;
}
.widget-card[open] > summary::after { content: '[ - ]'; opacity: 1; color: var(--accent-blue); }*/
.widget-card[open] > summary { border-bottom: 1px solid var(--border-main); color: var(--text-primary); }

/* Content Area */
.widget-content {
    padding: 12px;
    display: flex; flex-direction: column; gap: 12px;
}

/* Specialized Inputs */
.data-field { font-family: var(--font-ui); } /* UPDATED to UI font */
.split-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Item Grid (The "What" Panel) */
#item-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 4px;
    margin-bottom: 12px;
}
.item-btn {
    position: relative;
    background-color: var(--bg-input);
    border: 1px solid var(--border-main);
    border-radius: 3px;
    padding: 8px;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 80px; transition: all 0.1s;
    color: var(--text-dim);
}
.item-btn:hover { background-color: var(--bg-hover); color: var(--text-primary); border-color: var(--text-dim); }
.item-btn.selected { 
    background-color: var(--bg-active); 
    border-color: var(--accent-blue); 
    color: var(--accent-blue);
    box-shadow: inset 0 0 0 1px var(--accent-blue);
}
.item-btn svg { width: 32px; height: 32px; margin-bottom: 4px; fill: currentColor; }
.item-btn .item-name { 
    font-size: 9px; font-weight: 600; text-transform: uppercase; 
    font-family: var(--font-ui); /* UPDATED: Easier to read */
}

.quantity-badge {
    position: absolute; top: 2px; right: 2px;
    background-color: var(--accent-blue); color: var(--text-inv);
    border-radius: 2px;
    min-width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; font-family: var(--font-mono);
}

/* UPDATED REMOVE BUTTON STYLING */
.remove-btn {
    position: absolute; bottom: 2px; right: 2px;
    color: var(--color-alert); 
    background: rgba(0,0,0,0.3); /* Slight dim background for contrast */
    border: 1px solid var(--color-alert); /* Hard border for visibility */
    border-radius: 2px;
    width: 16px; height: 16px;
    cursor: pointer; 
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-ui);
    font-size: 12px; 
    line-height: 1;
    font-weight: 900;
    padding: 0;
}
.remove-btn:hover { 
    background: var(--color-alert); 
    color: var(--bg-panel);
}

/* Item Details List */
#item-details-list {
    border-top: 1px solid var(--border-main);
    margin-top: 8px; padding-top: 8px;
    display: flex; flex-direction: column; gap: 4px;
}
.detail-row {
    display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 4px;
    align-items: center;
    background: var(--bg-input);
    padding: 4px;
    border: 1px solid var(--border-dark);
    border-radius: 2px;
}
.detail-row-title { font-family: var(--font-mono); font-size: 10px; padding-left: 4px; color: var(--text-primary); }

/* Map & Location */
#map-container, #street-view {
    height: 200px;
    border-radius: 2px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-main);
    margin-bottom: 8px;
    filter: grayscale(80%) invert(0%); /* Tech-noir map look */
    transition: filter 0.3s;
}
#map-container:hover { filter: grayscale(0%); }

/* File Drop */
.file-drop-area {
    border: 1px dashed var(--border-light);
    border-radius: 3px;
    padding: 16px; text-align: center;
    color: var(--text-dim);
    background-color: var(--bg-input);
    font-size: 10px;
}
.file-drop-area:hover { border-color: var(--accent-blue); color: var(--accent-blue); cursor: copy; }

/* Totals & Submit */
.total-display {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border-main);
    font-family: var(--font-mono); font-weight: 700; color: var(--accent-blue);
}
.total-display input { 
    width: 60px; text-align: right; background: transparent; border: none; 
    color: var(--accent-blue); font-size: 14px; 
}

.submit-btn {
    width: 100%; margin-top: 16px;
    background: var(--bg-active);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 10px;
    height: auto;
}
.submit-btn:hover:not(:disabled) {
    background: var(--accent-blue);
    color: var(--text-inv);
}
.submit-btn:disabled {
    border-color: var(--border-main);
    color: var(--text-dim);
    background: var(--bg-input);
}

/* Utility */
.mode-toggle {
    background: none; border: none; color: var(--accent-blue);
    font-size: 9px; font-family: var(--font-mono); cursor: pointer;
    /*text-decoration: underline; padding: 0;*/
}
.hidden { display: none !important; }

select option {
    background-color: var(--bg-panel); /* Forces the menu background to be dark (#1e2329) */
    color: var(--text-primary);        /* Forces the text to be light (#e2e8f0) */
}
