:root {
    --primary: #2E8B57; /* Forest Green */
    --primary-dark: #1E5E3A;
    --secondary: #2C3E50; /* Dark Grey */
    --bg: #F4F7F6;
    --surface: #FFFFFF;
    --text: #333333;
    --text-light: #666666;
    --border: #D1D5DB;
    --error: #DC2626;
    --success: #059669;
    --warning: #D97706;
    --font-mono: 'Courier New', monospace;
    --font-sans: system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    background: var(--surface);
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.logo { height: 40px; }
.app-header h1 { font-size: 1.2rem; color: var(--secondary); }

/* Navigation */
.top-nav {
    display: flex;
    background: var(--secondary);
    padding: 4px 10px;
    gap: 4px;
}

.nav-btn {
    background: transparent;
    color: #ccc;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-btn.active { background: var(--primary); color: white; font-weight: bold; }

/* Content Area */
.content-area {
    flex: 1;
    padding: 10px;
    overflow: hidden;
    position: relative;
}

/* Screen Management */
.screen { display: none; height: 100%; width: 100%; }
.screen.active { display: flex; flex-direction: column; }

/* Main Screen Layout */
.main-grid {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

/* Weight Display */
.weight-display-container {
    background: var(--secondary);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border: 3px solid #444;
}

.weight-display {
    font-family: var(--font-mono);
    font-size: 3.5rem;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0,255,0,0.5);
    line-height: 1;
}

.weight-label { color: #888; font-size: 0.8rem; margin-top: 5px; }

.weight-details {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 1.2rem;
}

.weight-detail-item { display: flex; flex-direction: column; align-items: center; }
.weight-detail-item span { color: #888; font-size: 0.7rem; }
.weight-detail-item strong { color: #00FF00; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-row { display: flex; gap: 8px; align-items: center; }
.form-row label { width: 80px; font-size: 0.85rem; color: var(--text-light); }

input, select {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
}

input:focus, select:focus { outline: none; border-color: var(--primary); }
input.valid { border-color: var(--success); background: #F0FFF4; }
input.invalid { border-color: var(--error); background: #FEF2F2; }

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 10px; font-size: 1.1rem; }

/* Tables */
.table-container {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    min-height: 150px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    background: var(--secondary);
    color: white;
    padding: 8px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

tr:hover { background: #F8FAFC; }
tr.selected { background: #E0F2F1; }

/* Lists */
.list-widget {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #FAFAFA;
    max-height: 150px;
}

.list-item {
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid #EEE;
}
.list-item:hover { background: #E0F2F1; }
.list-item:last-child { border-bottom: none; }

/* Radio Group */
.radio-group { display: flex; gap: 15px; }
.radio-group label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

/* Action Button */
.action-btn {
    background: linear-gradient(135deg, #4ADE80, #22C55E);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.1s;
}
.action-btn:active { transform: scale(0.98); }
.action-btn:disabled { background: #CCC; cursor: not-allowed; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--surface);
    border-radius: 8px;
    padding: 20px;
    min-width: 400px;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-header { font-size: 1.2rem; font-weight: bold; margin-bottom: 15px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Checkbox */
.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input { width: auto; }

/* Config Screen */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    overflow-y: auto;
}

.config-section {
    background: var(--surface);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.config-section h3 { margin-bottom: 10px; color: var(--secondary); border-bottom: 1px solid var(--border); padding-bottom: 5px; }

/* Inventory */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding: 10px 0;
}

.inventory-card {
    background: var(--surface);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border);
    text-align: center;
}

.inventory-card h4 { color: var(--primary); margin-bottom: 5px; }
.inventory-card .stock { font-size: 1.5rem; font-weight: bold; }
.inventory-card .unit { color: var(--text-light); font-size: 0.8rem; }

/* Utility */
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mt-1 { margin-top: 5px; }
.mb-1 { margin-bottom: 5px; }
.gap-1 { gap: 5px; }
.hidden { display: none !important; }
