:root { --bg: #0f1117; --card-bg: #1a1d24; --border: #D4AF37; --text: #fff; --text-soft: #aaa; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { font-family: 'Inter', sans-serif; background: #fff; color: #0a0a0a; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; display: block; }
input[type="text"] { border: none; background: transparent; outline: none; font-family: inherit; margin: 0; padding: 0; }

.app-bar { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid #e5e7eb; }
.app-bar-inner { width: 100%; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; }
.app-bar-brand { display: flex; align-items: center; gap: 12px; }
.app-bar-brand img { height: 34px; }
.brand-name { font-size: 15px; font-weight: 700; }
.brand-sub { font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em; }
.btn-logout { background:transparent; border:1px solid #e5e7eb; padding: 8px 14px; border-radius: 6px; cursor:pointer; font-family:inherit; color: #0a0a0a; text-decoration: none; display: inline-flex; align-items: center; font-size: 13px; }

.grid-container { display: block; width: 100%; margin: 0; padding: 0; }
.grid-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid #e5e7eb; background: #fff; }
.toolbar-left { display: flex; align-items: center; gap: 20px; }
.toolbar-left h1 { margin: 0; font-size: 20px; font-weight: 700; }
.toolbar-right { display: flex; gap: 12px; }

.btn-toggle-scan { background: transparent; color: #0a0a0a; border: 1px solid #0a0a0a; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn-grid-action { background: #fff; color: #0a0a0a; border: 1px solid #d1d5db; padding: 8px 14px; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 13px; }
.btn-grid-action:hover { background: #f9fafb; }
.btn-save { background: #0a0a0a; color: #D4AF37; border: 1px solid #0a0a0a; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: 700; font-size: 13px; }
.btn-print { background: #D4AF37; color: #000; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: 700; font-size: 13px; }

.scan-panel { background: #fff; border-bottom: 1px solid #e5e7eb; padding: 24px; display: none; }
.scan-panel h2 { margin: 0 0 16px; font-size: 16px; }
.upload-area { display: flex; gap: 12px; }
.btn-upload { background: #0a0a0a; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 13px; }
.btn-read { background: #D4AF37; color: #000; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: 700; font-size: 13px; }
.btn-read:disabled { background: #ccc; cursor: not-allowed; }
.image-preview-container { margin-top: 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
#image-preview-list img { width: 100px; height: 100px; object-fit: cover; border-radius: 4px; border: 1px solid #e5e7eb; }
#scan-status { font-weight: 600; color: #6b7280; font-size: 13px; }

.progress-container { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
#scan-status-text { font-weight: 600; color: #0a0a0a; font-size: 13px; }
.progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: #D4AF37; border-radius: 4px; transition: width 0.2s ease-out; }

.details-panel { background: #fff; padding: 24px; border-bottom: 1px solid #e5e7eb; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 1200px; margin: 0 auto; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-family: inherit; font-size: 14px; background: #fff; color: #0a0a0a; outline: none; }
.form-group input:focus { border-color: #0a0a0a; }

.search-bar { padding: 16px 24px; background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 16px; }
.search-bar input { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 4px; font-family: inherit; font-size: 14px; width: 300px; }
#filter-indicator { font-size: 12px; color: #D4AF37; font-weight: 600; background: #0a0a0a; padding: 4px 8px; border-radius: 4px; }

.table-wrapper { overflow-x: auto; width: 100%; padding: 24px 0; background: #fff; }
.excel-grid { border-collapse: collapse; table-layout: fixed; width: 100%; min-width: 800px; display: table; border: 1px solid #d0d0d0; }
.excel-grid th, .excel-grid td { border: 1px solid #d0d0d0; padding: 0; margin: 0; height: auto; font-weight: normal; vertical-align: top; display: table-cell; }
.excel-grid thead th { background: #f1f3f4; color: #444; font-weight: 600; text-align: center; font-size: 12px; position: sticky; top: 0; z-index: 2; min-width: 40px; }
.excel-grid th.row-header, .excel-grid td.row-header { background: #f1f3f4; color: #444; font-weight: 600; text-align: center; font-size: 12px; position: sticky; left: 0; z-index: 1; min-width: 40px; width: 40px; }
.excel-grid thead th.corner { position: sticky; top: 0; left: 0; z-index: 3; min-width: 40px; width: 40px; }

.resize-handle { position: absolute; top: 0; right: 0; width: 5px; height: 100%; cursor: col-resize; user-select: none; z-index: 10; }
.resize-handle:hover { background: #0a0a0a; }

.cell-content { width: 100%; min-height: 32px; padding: 6px 8px; font: inherit; font-size: 13px; color: #0a0a0a; box-sizing: border-box; outline: none; white-space: pre-wrap; word-break: break-word; }
.cell-content:focus { outline: 2px solid #D4AF37; outline-offset: -2px; background: #fff; box-shadow: inset 0 0 0 1px #D4AF37; position: relative; z-index: 1; }

.excel-grid tfoot td { background: #f3f4f6; font-weight: 800; border-top: 2px solid #0a0a0a; padding: 8px; font-size: 14px; display: table-cell; }

.total-bar { padding: 12px 24px; background: #0a0a0a; color: #fff; display: flex; align-items: center; gap: 16px; border-top: 2px solid #D4AF37; }
.total-bar select { padding: 6px 10px; border-radius: 4px; border: 1px solid #D4AF37; background: #0a0a0a; color: #D4AF37; font-weight: 700; }
.total-display { margin-left: auto; font-size: 18px; font-weight: 800; color: #D4AF37; }