*, *::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: 16px; font-weight: 700; letter-spacing: 0; color: var(--text); }
.header-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.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], .field input[type=date] {
  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, .field textarea: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; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(26,26,24,0.28); display: flex; align-items: center; justify-content: center; padding: 24px; }
.confirm-modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: 0 18px 50px rgba(0,0,0,0.18); padding: 20px; }
.confirm-modal-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.confirm-modal-body { font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.confirm-doc-number { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text); word-break: break-all; margin-bottom: 6px; }
.confirm-doc-title { color: var(--text-muted); margin-bottom: 12px; }
.confirm-warning { color: var(--danger); background: var(--danger-bg); border-radius: var(--radius); padding: 8px 10px; }
.confirm-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.confirm-modal-actions .btn { width: auto; }
.confirm-delete-btn { font-size: 13px; padding: 9px 14px; }
.status-reason-modal { width: min(520px, 100%); }
.register-modal { width: min(920px, 100%); max-height: min(820px, calc(100vh - 48px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: 0 18px 50px rgba(0,0,0,0.18); display: flex; flex-direction: column; overflow: hidden; }
.register-modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px; border-bottom: 1px solid var(--border); }
.register-modal-title { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--text); word-break: break-word; }
.register-modal-doc-title { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.register-current-revision { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); font-size: 11px; color: var(--text-muted); }
.register-current-revision strong { font-family: var(--mono); font-size: 12px; color: var(--text); }
.register-modal-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.register-close-btn { width: auto; flex: 0 0 auto; }
.register-modal-body { min-height: 160px; padding: 16px 20px 20px; overflow-y: auto; }
.register-entry-list { display: grid; gap: 10px; }
.register-entry-group { display: grid; gap: 8px; }
.register-entry-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 2px 2px 0; color: var(--text); font-size: 12px; font-weight: 700; }
.register-entry-group-title small { color: var(--text-faint); font-size: 11px; font-weight: 500; }
.register-entry-group-items { display: grid; gap: 10px; }
.register-entry { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface); }
.register-entry.inactive { background: var(--bg); opacity: 0.82; }
.register-entry-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.register-entry-title { font-size: 14px; font-weight: 600; color: var(--text); }
.register-entry-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.register-chip { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 600; }
.register-chip-muted { background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); font-weight: 500; }
.register-entry-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.register-entry-details { display: grid; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.register-entry-audit { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 11px; color: var(--text-faint); }
.register-entry-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.register-entry-deactivated { margin-top: 8px; padding: 7px 9px; border-radius: var(--radius); background: var(--warning-bg); color: var(--warning); font-size: 12px; }
.register-create-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); margin-bottom: 12px; }
.register-create-title { font-size: 13px; font-weight: 600; color: var(--text); }
.register-create-sub, .register-readonly-note { font-size: 12px; color: var(--text-muted); }
.register-readonly-note { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 10px 12px; margin-bottom: 12px; }
.register-entry-toggle { width: auto; min-width: 112px; }
.register-entry-form { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.register-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.register-inherited-value { min-height: 36px; display: flex; align-items: center; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text-muted); font-size: 13px; }
.register-warning { margin-top: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--warning-bg); color: var(--warning); font-size: 12px; }
.register-comment-field { grid-column: 1 / -1; }
.register-comment-field textarea { width: 100%; min-height: 78px; resize: vertical; font-size: 13px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; line-height: 1.45; }
.register-form-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.register-form-actions .btn { width: auto; min-width: 120px; }
.confirm-reason-text { width: 100%; min-height: 100px; resize: vertical; font-size: 13px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; line-height: 1.45; }
.confirm-reason-text:focus { outline: none; border-color: var(--border-strong); }
.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; }
.tools-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); gap:14px; }
.tool-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:18px; }
.tool-title { font-size:15px; font-weight:700; color:var(--text); margin-bottom:4px; }
.tool-description { font-size:13px; color:var(--text-muted); line-height:1.4; }
.tool-badge { font-size:10px; padding:3px 8px; border-radius:12px; background:var(--bg); color:var(--text-muted); border:1px solid var(--border); white-space:nowrap; }
.tool-meta { font-size:11px; color:var(--text-faint); margin-top:10px; }
.tool-path { font-family:var(--mono); font-size:11px; color:var(--text-muted); background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:7px 9px; margin-top:6px; word-break:break-all; }
.tool-hint { font-size:11px; color:var(--text-faint); margin-top:6px; }
.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:260px; 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; }
.log-register-cell { display: grid; gap: 3px; align-items: start; }
.log-register-summary { display: flex; flex-wrap: wrap; gap: 3px; max-width: 110px; white-space: normal; }
.log-register-badge { display: inline-flex; align-items: center; min-height: 16px; padding: 1px 5px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 9px; font-weight: 600; line-height: 1.1; }
.log-register-badge-ready { background: var(--bg); color: var(--text-muted); }
.log-register-badge-rev-done { background: var(--success-bg); color: var(--success); border-color: var(--success-bg); }
.log-register-badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bg); }
.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); }
.report-metric-card {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}
.report-metric-card:disabled {
  cursor: default;
  opacity: 1;
}
.report-metric-card:not(:disabled):hover {
  border-color: var(--text-muted);
}
.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: 768px) {
  body { font-size: 14px; overflow-x: hidden; }
  .app { width: 100%; max-width: 100%; padding: 1rem 0.75rem 3rem; }
  .header { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 1rem; padding-bottom: 0.75rem; }
  .header > div:first-child { min-width: 0; }
  .header-title { font-size: 15px; line-height: 1.25; }
  .header-sub { font-size: 11px; }
  .header-right { width: 100%; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 6px; }
  .user-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .project-switcher { width: 100%; justify-content: space-between; padding: 8px 10px; border-radius: var(--radius); }
  .project-switcher select { max-width: 100%; min-width: 0; flex: 1; }
  .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; overflow: visible; margin: 0 0 1rem; padding: 0; border-bottom: none; }
  .tab { min-width: 0; padding: 9px 6px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 0; }
  .tab.active { border-color: var(--text); background: var(--bg); }
  .card { padding: 1rem; border-radius: var(--radius); }
  .grid2 { grid-template-columns: 1fr; gap: 10px; }
  .field select,
  .field input[type=text],
  .field input[type=email],
  .field input[type=password],
  .field input[type=date],
  .search-row input { font-size: 16px; min-height: 42px; }
  .btn,
  .btn-logout,
  .pagination-btns button { min-height: 38px; }
  .top-actions { justify-content: flex-start; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
  .top-actions .btn,
  .top-actions select,
  .batch-actions .btn { width: 100%; flex: 1 1 100%; }
  div:has(> #hist-orig) { display: grid !important; grid-template-columns: 1fr; gap: 8px !important; align-items: stretch !important; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 12px !important; }
  div:has(> #hist-orig) select,
  div:has(> #hist-orig) input,
  div:has(> #hist-orig) button { width: 100% !important; min-width: 0 !important; min-height: 42px; font-size: 16px !important; }
  .batch-actions { flex-direction: column; }
  .proj-row { flex-direction: column; }
  .proj-row button { min-height: 38px; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card { padding: 14px; }
  .drop-zone { padding: 1.5rem 1rem; }
  .preview-box,
  .result-box { padding: 1rem; }
  .result-number { font-size: 16px; }
  .preview-number { font-size: 15px; }
  .auth-wrap { max-width: none; margin: 2rem auto; }
  .auth-card { padding: 1.25rem; }
  .modal-backdrop { align-items: flex-start; padding: 12px; overflow-y: auto; }
  .confirm-modal { max-height: calc(100vh - 24px); overflow-y: auto; padding: 16px; }
  .register-modal { max-height: calc(100vh - 24px); border-radius: var(--radius); }
  .register-modal-header { flex-direction: column; padding: 16px; }
  .register-modal-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .register-modal-actions .btn { width: 100%; }
  .register-close-btn { width: 100%; }
  .register-modal-body { padding: 12px 16px 16px; }
  .register-entry-head { flex-direction: column; gap: 6px; }
  .register-entry-date { white-space: normal; }
  .register-create-bar { flex-direction: column; align-items: stretch; }
  .register-entry-toggle,
  .register-form-actions .btn { width: 100%; }
  .register-entry-actions .btn { width: 100%; }
  .register-form-grid { grid-template-columns: 1fr; }
  .register-comment-field textarea { font-size: 16px; min-height: 110px; }
  .confirm-modal-actions { flex-direction: column-reverse; }
  .confirm-modal-actions .btn { width: 100%; }
  .confirm-reason-text { min-height: 120px; font-size: 16px; }
  .log-table-wrap,
  .batch-preview { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .batch-table { min-width: 920px; }
  .log-table-wrap { overflow-x: visible; }
  .log-table,
  .log-table thead,
  .log-table tbody,
  .log-table tr,
  .log-table td { display: block; width: 100%; }
  .log-table { min-width: 0; border-collapse: separate; border-spacing: 0; table-layout: auto; }
  .log-table thead { display: none; }
  .log-table tbody { display: grid; gap: 10px; }
  .log-table tbody tr { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px; }
  .log-table tbody tr:hover td { background: transparent; }
  .log-table tr:last-child td { border-bottom: 1px solid var(--border); }
  .log-table td { border-bottom: 1px solid var(--border); padding: 7px 0; }
  .log-table td:last-child { border-bottom: none; padding-bottom: 0; }
  .log-table td::before { display: block; margin-bottom: 2px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
  .log-table .col-check { width: 100%; padding-top: 0; }
  .log-table .col-check::before { content: "Select"; }
  .log-table .col-num { width: 100%; white-space: normal; overflow: visible; text-overflow: clip; font-size: 12px; word-break: break-word; }
  .log-table .col-num::before { content: "Doc Number"; }
  .log-table .col-title { min-width: 0; }
  .log-table .col-title::before { content: "Title"; }
  .log-table .col-title-inner { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
  .log-table .col-orig { width: 100%; font-size: 12px; white-space: normal; overflow: visible; }
  .log-table .col-orig::before { content: "Originator"; }
  .log-table .col-pkg { width: 100%; font-size: 12px; white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
  .log-table .col-pkg::before { content: "Package"; }
  .log-table .col-user { width: 100%; font-size: 12px; white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
  .log-table .col-user::before { content: "Created By"; }
  .log-table .col-date { width: 100%; font-size: 12px; white-space: normal; }
  .log-table .col-date::before { content: "Date"; }
  .log-table .col-re { width: 100%; font-size: 12px; white-space: normal; overflow: visible; }
  .log-table .col-re::before { content: "RE"; }
  .log-table .col-status { width: 100%; font-size: 12px; white-space: normal; }
  .log-table .col-status::before { content: "Status"; }
  .log-table .col-actions { width: 100%; position: static; white-space: normal; background: transparent; box-shadow: none; }
  .log-table .col-actions::before { content: "Actions"; }
  .log-table .col-actions > div { flex-wrap: wrap; gap: 6px !important; }
  .log-register-cell { width: 100%; }
  .log-register-summary { max-width: none; }
  .log-table .col-actions .btn,
  .log-table .col-actions button { min-height: 34px; }
  .pagination { flex-direction: column; align-items: stretch; gap: 10px; }
  .pagination-btns { justify-content: space-between; }
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.activity-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;
}

.activity-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.activity-table th:nth-child(3),
.activity-table td:nth-child(3) {
  width: 170px;
}

.activity-table th:nth-child(4),
.activity-table td:nth-child(4) {
  width: 110px;
}

.activity-table th:nth-child(5),
.activity-table td:nth-child(5) {
  width: 170px;
}

.activity-table th:nth-child(6),
.activity-table td:nth-child(6) {
  width: 140px;
}

.pwa-status-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(520px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0,0,0,0.16);
  font-size: 12px;
}

.pwa-status-banner[hidden] {
  display: none;
}

.pwa-status-banner strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.pwa-status-banner span {
  color: var(--text-muted);
}

.pwa-status-banner button {
  flex: 0 0 auto;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pwa-status-banner-offline {
  border-color: var(--warning-bg);
  background: #fff8e1;
}

.pwa-status-banner-update {
  border-color: #bfdbfe;
  background: #eff6ff;
}

@media (max-width: 768px) {
  .activity-table {
    table-layout: auto;
  }
  .activity-table th,
  .activity-table td,
  .activity-table th:nth-child(3),
  .activity-table td:nth-child(3),
  .activity-table th:nth-child(4),
  .activity-table td:nth-child(4),
  .activity-table th:nth-child(5),
  .activity-table td:nth-child(5),
  .activity-table th:nth-child(6),
  .activity-table td:nth-child(6) {
    width: 100%;
  }
  .activity-table td {
    padding: 7px 0;
  }
  .activity-table td:nth-child(1)::before { content: "Date / Time"; }
  .activity-table td:nth-child(2)::before { content: "User"; }
  .activity-table td:nth-child(3)::before { content: "Action"; }
  .activity-table td:nth-child(4)::before { content: "Project"; }
  .activity-table td:nth-child(5)::before { content: "Entity"; }
  .activity-table td:nth-child(6)::before { content: "Entity ID"; }
  .activity-table td:nth-child(7)::before { content: "Details"; }
  .pwa-status-banner {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
    align-items: stretch;
    flex-direction: column;
  }
  .pwa-status-banner button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .app { padding-left: 0.6rem; padding-right: 0.6rem; }
  .tabs { gap: 5px; }
  .header-right .admin-badge,
  .header-right .btn-logout { flex: 0 0 auto; }
  .header-right .user-badge { flex: 1 1 180px; }
  .card { padding: 0.85rem; }
  .btn-primary { padding: 11px 12px; }
  .section-label { line-height: 1.25; }
  .batch-table { min-width: 860px; }
}
