*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f8f8f6; --surface: #ffffff; --border: #e2e2de; --border-strong: #c8c8c2;
  --text: #1a1a18; --text-muted: #6b6b66; --text-faint: #9f9f9a;
  --accent: #1a1a18; --accent-text: #ffffff;
  --success: #166534; --success-bg: #dcfce7;
  --danger: #991b1b; --danger-bg: #fee2e2;
  --warning-bg: #fef3c7; --warning: #92400e;
  --mono: 'Courier New', Courier, monospace;
  --radius: 8px; --radius-lg: 12px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; }
.app { max-width: 1600px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.header-title { font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.header-sub { font-size: 12px; color: var(--text-muted); }
.header-right { display: flex; align-items: center; gap: 8px; }
.user-badge { font-size: 12px; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-strong); color: var(--text-muted); background: var(--surface); }
.project-switcher { display:flex; align-items:center; gap:8px; padding:7px 16px; border-radius:20px; border:1px solid var(--border-strong); background:var(--surface); font-size:13px; font-weight:500; color:var(--text); font-family:inherit; cursor:pointer; transition:background 0.15s; }
.project-switcher:hover { background:var(--bg); }
.project-switcher select { border:none; background:transparent; font-size:13px; font-weight:500; color:var(--text); font-family:inherit; cursor:pointer; outline:none; max-width:220px; }
.btn-logout { font-size: 12px; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); color: var(--text-muted); background: transparent; cursor: pointer; }
.project-switcher-label { font-size:10px; color:var(--text-faint); text-transform:uppercase; letter-spacing:0.06em; margin-right:2px; }
.project-switcher-name { font-weight:600; max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.project-dropdown { position:absolute; top:calc(100% + 6px); right:0; background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--radius-lg); box-shadow:0 4px 16px rgba(0,0,0,0.10); min-width:220px; z-index:100; overflow:hidden; }
.project-dropdown-item { padding:9px 16px; font-size:13px; cursor:pointer; display:flex; align-items:center; gap:10px; }
.project-dropdown-item:hover { background:var(--bg); }
.project-dropdown-item.active { font-weight:600; color:var(--text); }
.project-dropdown-item .proj-id { font-family:var(--mono); font-size:11px; color:var(--text-faint); }
.project-dropdown-divider { height:1px; background:var(--border); margin:4px 0; }
.project-switcher-wrap { position:relative; }
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab { font-size: 13px; padding: 8px 16px; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.field select, .field input[type=text], .field input[type=email], .field input[type=password] {
  font-size: 13px; padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 100%; font-family: inherit;
}
.field select:focus, .field input:focus { outline: none; border-color: var(--border-strong); }
.preview-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.preview-number { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--text); word-break: break-all; }
.preview-number .seq { color: var(--text-faint); }
.preview-range { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.btn { font-size: 13px; padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer; font-family: inherit; font-weight: 500; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); width: 100%; font-size: 14px; padding: 11px; }
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text-muted); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); font-size: 11px; padding: 3px 10px; }
.btn-danger:hover { opacity: 0.8; }
.result-box { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-top: 1.25rem; background: var(--surface); }
.result-number { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--text); word-break: break-all; margin-bottom: 5px; }
.result-title { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.result-meta { font-size: 11px; color: var(--text-faint); }
.btn-copy { margin-top: 10px; font-size: 12px; padding: 5px 14px; }
.btn-copy.copied { color: var(--success); border-color: var(--success); background: var(--success-bg); }
.error { font-size: 12px; color: var(--danger); margin-top: 6px; background: var(--danger-bg); padding: 6px 10px; border-radius: var(--radius); }
.info { font-size: 12px; color: var(--warning); background: var(--warning-bg); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 1rem; }
.history-item { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.history-item:last-child { border-bottom: none; }
.history-number { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.history-title { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.history-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.history-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; }
.history-time { font-size: 11px; color: var(--text-faint); }
.btn-sm { font-size: 11px; padding: 3px 10px; }
.empty { font-size: 13px; color: var(--text-faint); text-align: center; padding: 2rem 0; }
.search-row { margin-bottom: 12px; }
.search-row input { width: 100%; font-size: 13px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border); font-family: inherit; color: var(--text); background: var(--surface); }
.search-row input:focus { outline: none; border-color: var(--border-strong); }
.top-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; }
.auth-wrap { max-width: 380px; margin: 4rem auto; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; }
.auth-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 1rem; }
.auth-link { font-size: 12px; color: var(--text-muted); cursor: pointer; text-decoration: underline; background: none; border: none; font-family: inherit; display: block; text-align: center; margin-top: 12px; }
.admin-badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; background: #fef3c7; color: #92400e; font-weight: 600; }
.proj-row { display: flex; gap: 8px; margin-top: 8px; }
.proj-row input { flex: 1; font-size: 12px; padding: 6px 8px; border-radius: var(--radius); border: 1px solid var(--border); font-family: inherit; }
.proj-row button { font-size: 12px; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-family: inherit; }
.loading-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #ffffff40; border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }
.loading-spinner-dark { display: inline-block; width: 14px; height: 14px; border: 2px solid #1a1a1840; border-top-color: #1a1a18; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.drop-zone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 2.5rem; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--bg); }
.drop-zone-icon { font-size: 32px; margin-bottom: 8px; }
.drop-zone-text { font-size: 13px; color: var(--text-muted); }
.drop-zone-sub { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.batch-preview { margin-top: 1rem; }
.batch-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.batch-table th { background: var(--bg); padding: 6px 10px; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border); font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; }
.batch-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.batch-table tr:last-child td { border-bottom: none; }
.batch-table .doc-num { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--success); }
.log-table-wrap { overflow-x:auto; }
.log-table { width:100%; border-collapse:collapse; font-size:12px; table-layout:fixed; }
.log-table th { background:var(--bg); padding:8px 10px; text-align:left; font-weight:600; border-bottom:2px solid var(--border); font-size:11px; color:var(--text-muted); letter-spacing:0.04em; white-space:nowrap; overflow:hidden; }
.log-table td { padding:7px 10px; border-bottom:1px solid var(--border); vertical-align:middle; }
.log-table tr:last-child td { border-bottom:none; }
.log-table tbody tr:hover td { background:var(--bg); }
.log-table .col-check { width:32px; }
.log-table .col-num { width:230px; font-family:var(--mono); font-size:11px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.log-table .col-title { min-width:200px; }
.log-table .col-title-inner { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-muted); }
.log-table .col-orig { width:45px; font-size:11px; color:var(--text-faint); white-space:nowrap; overflow:hidden; }
.log-table .col-pkg { width:170px; font-family:var(--mono); font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer; }
.log-table .col-pkg span:hover { color:var(--text); }
.log-table .col-user { width:155px; font-size:11px; color:var(--text-faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.log-table .col-date { width:105px; font-size:11px; color:var(--text-faint); white-space:nowrap; }
.log-table .col-actions { width:150px; white-space:nowrap; position:sticky; right:0; z-index:3; background:var(--surface); box-shadow:-2px 0 6px rgba(0,0,0,0.10); }
.log-table .col-status { width:70px; font-size:11px; white-space:nowrap; }
.log-table .col-re { width:80px; font-size:11px; white-space:nowrap; overflow:visible; text-overflow:ellipsis; }
.status-badge { font-size:10px; padding:2px 7px; border-radius:10px; font-weight:600; }
.status-active { background:var(--success-bg); color:var(--success); }
.status-voided { background:var(--danger-bg); color:var(--danger); }
.batch-table .doc-num.pending { color: var(--text-faint); }
.batch-table .row-error { color: var(--danger); font-size: 11px; }
.progress-bar { background: var(--border); border-radius: 4px; height: 6px; margin: 8px 0; overflow: hidden; }
.progress-bar-inner { background: var(--accent); height: 100%; border-radius: 4px; transition: width 0.3s; }
.progress-text { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.batch-actions { display: flex; gap: 8px; margin-top: 1rem; }
.batch-actions .btn { flex: 1; }
.success-box { background: var(--success-bg); border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 12px 16px; margin-top: 1rem; }
.success-box-title { font-size: 13px; font-weight: 600; color: var(--success); margin-bottom: 4px; }
.success-box-sub { font-size: 12px; color: var(--success); }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pagination-info { font-size: 12px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 6px; align-items: center; }
.pagination-btns button { font-size: 12px; padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-family: inherit; color: var(--text-muted); }
.pagination-btns button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination-btns button:not(:disabled):hover { background: var(--bg); }
.pagination-btns .page-current { font-size: 12px; color: var(--text-faint); padding: 0 4px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } .app { padding: 1rem 1rem 3rem; } }
