* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; font-size: 12px; }
.hidden { display: none !important; }
.page { min-height: 100vh; }

/* Login */
.login-box { max-width: 340px; margin: 15vh auto; background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.login-box h1 { text-align: center; margin-bottom: 1.2rem; color: #1a73e8; font-size: 1.2rem; }
.form-group { margin-bottom: 0.7rem; }
.form-group label { display: block; margin-bottom: 3px; font-weight: 500; font-size: 11px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 5px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; }
.form-group select { background: #fff; }
.error { color: #d32f2f; margin-top: 0.4rem; font-size: 11px; }

/* Buttons */
.btn { padding: 5px 12px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; font-size: 11px; background: #fff; }
.btn:hover { background: #f5f5f5; }
.btn-primary { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.btn-primary:hover { background: #1557b0; }
.btn-danger { color: #d32f2f; border-color: #d32f2f; }
.btn-danger:hover { background: #fce4e4; }
.btn-sm { padding: 2px 8px; font-size: 10px; }
.btn-success { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.btn-success:hover { background: #1b5e20; }

/* Header */
header { background: #fff; padding: 8px 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
header h1 { font-size: 1rem; color: #1a73e8; }
.header-right { display: flex; align-items: center; gap: 8px; }
#user-info { font-size: 11px; color: #666; }

/* Toolbar */
.toolbar { padding: 8px 16px; display: flex; gap: 8px; }

/* Unified table style — used for main, modal, and settings tables */
.table-wrapper { padding: 0 16px 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); font-size: 11px; }
th { background: #f8f9fa; padding: 5px 4px; text-align: left; font-weight: 600; white-space: nowrap; border-bottom: 2px solid #dee2e6; font-size: 10px; }
td { padding: 3px 4px; border-bottom: 1px solid #eee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
tr:hover { background: #f8f9ff; }

/* Nomenclature column — widest */
.col-nom { min-width: 250px; max-width: 400px; white-space: normal; word-break: break-word; }
th.col-nom { white-space: normal; }

/* Table inputs (for modal and settings editable tables) */
td input, td select { width: 100%; padding: 3px 4px; border: 1px solid #ddd; border-radius: 3px; font-size: 11px; box-sizing: border-box; background: #fff; }
td input:focus, td select:focus { border-color: #1a73e8; outline: none; }
td input[type="number"] { width: 65px; }
td .del-row { cursor: pointer; color: #d32f2f; font-size: 14px; text-align: center; border: none; background: none; padding: 0 4px; }
td .del-row:hover { color: #b71c1c; }
.row-num { width: 28px; text-align: center; color: #999; font-size: 10px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: #fff; padding: 1.5rem; border-radius: 8px; max-height: 90vh; overflow-y: auto; width: 500px; }
.modal-wide { width: 92vw; max-width: 1200px; }
.form-actions { margin-top: 1rem; display: flex; gap: 8px; justify-content: flex-end; }
.modal-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 0.8rem; border-bottom: 2px solid #dee2e6; }
.tab { padding: 6px 14px; border: none; background: none; cursor: pointer; font-size: 12px; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { border-bottom-color: #1a73e8; color: #1a73e8; font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Settings */
.settings-toolbar { display: flex; gap: 8px; margin-bottom: 0.8rem; align-items: center; }
.settings-toolbar input { padding: 5px 8px; border: 1px solid #ddd; border-radius: 4px; flex: 1; font-size: 12px; }
