* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5; color: #222; line-height: 1.5; height: 100vh; overflow: hidden;
}
#login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: #f5f5f5;
}
.login-card {
  background: white; padding: 40px; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08); width: 100%; max-width: 400px;
}
.login-card h1 { margin-bottom: 8px; font-size: 28px; color: #1a73e8; }
.login-card .subtitle { color: #666; margin-bottom: 24px; font-size: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-group input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 15px; }
.form-group input:focus { outline: none; border-color: #1a73e8; }
.btn { background: #1a73e8; color: white; border: none; padding: 10px 20px; border-radius: 4px; font-size: 15px; cursor: pointer; width: 100%; }
.btn:hover { background: #1557b0; }
.btn:disabled { background: #999; cursor: not-allowed; }
.error-msg { background: #fee; color: #c00; padding: 10px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; }
#app-view { display: none; flex-direction: column; height: 100vh; }
.header { background: white; border-bottom: 1px solid #e0e0e0; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; height: 50px; }
.header h1 { font-size: 18px; color: #1a73e8; font-weight: 700; }
.user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.user-info .username { color: #444; font-weight: 500; }
.btn-logout { background: transparent; color: #1a73e8; border: 1px solid #1a73e8; width: auto; padding: 4px 12px; font-size: 13px; border-radius: 4px; cursor: pointer; }
.btn-logout:hover { background: #f0f6ff; }
.header-search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 500px; margin: 0 20px; }
.header-search input { flex: 1; padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; outline: none; }
.header-search input:focus { border-color: #1a73e8; }
.btn-search { background: #1a73e8; color: white; border: none; padding: 6px 14px; border-radius: 4px; font-size: 13px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-search:hover { background: #1557b0; }
.main-panel { display: flex; flex: 1; overflow: hidden; }
.sidebar { width: 280px; min-width: 280px; background: #1e2a38; color: #c8d3dd; display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0; }
.sidebar-project { padding: 14px 16px; background: #151f2b; border-bottom: 1px solid #2d3d4f; font-size: 13px; font-weight: 700; color: #7db8f7; letter-spacing: 0.5px; text-transform: uppercase; }
.sidebar-actions { padding: 8px 12px; background: #151f2b; border-bottom: 1px solid #2d3d4f; }
.btn-new-package { background: #1a3a5c; color: #7db8f7; border: 1px solid #2d5a8c; border-radius: 4px; padding: 5px 10px; font-size: 11px; cursor: pointer; width: 100%; text-align: left; font-weight: 600; }
.btn-new-package:hover { background: #1e4a73; }
.tree { padding: 8px 0; flex: 1; }
.tree-root { padding: 8px 16px; font-size: 12px; font-weight: 700; color: #8a9bb0; text-transform: uppercase; letter-spacing: 0.8px; cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none; }
.tree-root:hover { color: #c8d3dd; }
.tree-category { cursor: pointer; user-select: none; }
.tree-category-header { padding: 7px 16px 7px 24px; font-size: 12px; font-weight: 600; color: #a0b0c0; display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.tree-category-header:hover { background: #253447; color: #c8d3dd; }
.tree-subcategory { cursor: pointer; user-select: none; }
.tree-subcategory-header { padding: 6px 16px 6px 36px; font-size: 12px; color: #8a9bb0; display: flex; align-items: center; gap: 6px; }
.tree-subcategory-header:hover { background: #253447; color: #c8d3dd; }
.tree-package { padding: 5px 16px 5px 48px; font-size: 11px; color: #7a8fa3; cursor: pointer; display: flex; align-items: center; gap: 6px; border-left: 2px solid transparent; line-height: 1.4; }
.tree-package:hover { background: #253447; color: #c8d3dd; }
.tree-package.active { background: #1a3a5c; color: #7db8f7; border-left-color: #1a73e8; }
.chevron { font-size: 10px; transition: transform 0.15s; flex-shrink: 0; color: #5a7a99; }
.chevron.open { transform: rotate(90deg); }
.tree-children { display: none; }
.tree-children.open { display: block; }
.sidebar-msg { padding: 16px; font-size: 12px; color: #5a7a99; }
.workspace { flex: 1; overflow-y: auto; padding: 24px; background: #f5f5f5; }
.workspace-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #aaa; text-align: center; }
.workspace-welcome .welcome-icon { font-size: 48px; margin-bottom: 16px; }
.workspace-welcome h2 { font-size: 18px; color: #888; margin-bottom: 8px; }
.workspace-welcome p { font-size: 14px; }
.workspace-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #e0e0e0; }
.workspace-header .pkg-code { font-size: 12px; font-weight: 700; color: #1a73e8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.workspace-header .pkg-name { font-size: 20px; font-weight: 600; color: #222; }
.workspace-header .pkg-meta { font-size: 13px; color: #888; margin-top: 4px; }
.doc-placeholder { background: white; border: 2px dashed #ddd; border-radius: 8px; padding: 60px 40px; text-align: center; color: #aaa; }
.doc-placeholder .ph-icon { font-size: 40px; margin-bottom: 12px; }
.doc-placeholder h3 { font-size: 16px; color: #888; margin-bottom: 8px; }
.doc-placeholder p { font-size: 13px; }
.doc-table-wrap { background: white; border-radius: 8px; border: 1px solid #e0e0e0; overflow: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table thead th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-weight: 600; color: #555; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid #e0e0e0; white-space: nowrap; }
.doc-table tbody tr { border-bottom: 1px solid #f0f0f0; }
.doc-table tbody tr:last-child { border-bottom: none; }
.doc-table tbody tr:hover { background: #f8f9ff; }
.doc-table td { padding: 9px 12px; vertical-align: middle; color: #333; }
.doc-table td.doc-number { font-family: monospace; font-size: 12px; color: #1a73e8; white-space: nowrap; }
.doc-table td.doc-title { min-width: 200px; }
.doc-table td.doc-center { text-align: center; white-space: nowrap; color: #555; }
.doc-table td.rc-1 { color: #1e7e34; font-weight: 600; }
.doc-table td.rc-2 { color: #e6a817; font-weight: 600; }
.doc-table td.rc-3 { color: #c0392b; font-weight: 600; }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: flex-start; justify-content: center; padding-top: 80px; }
.modal-overlay.open { display: flex; }
.modal-box { background: white; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.18); width: 480px; padding: 24px; }
.modal-box h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: #222; }
.modal-box p { font-size: 12px; color: #888; margin-bottom: 12px; }
.modal-box textarea { width: 100%; height: 220px; border: 1px solid #ddd; border-radius: 4px; padding: 10px; font-size: 12px; font-family: monospace; resize: none; outline: none; line-height: 1.6; }
.modal-box textarea:focus { border-color: #1a73e8; }
.modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.modal-counter { font-size: 12px; color: #888; }
.modal-actions { display: flex; gap: 8px; }
.btn-modal-cancel { background: transparent; border: 1px solid #ddd; border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: #555; }
.btn-modal-cancel:hover { background: #f5f5f5; }
.btn-bulk { background: transparent; border: 1px solid #1a73e8; color: #1a73e8; border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-bulk:hover { background: #f0f6ff; }
.btn-export { background: #1e7e34; color: white; border: none; border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-export:hover { background: #155724; }
.modal-form-row { margin-bottom: 12px; }
.modal-form-row label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }
.modal-form-row input, .modal-form-row select { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; outline: none; }
.modal-form-row input:focus, .modal-form-row select:focus { border-color: #1a73e8; }
.modal-form-row .hint { font-size: 11px; color: #999; margin-top: 3px; }
.modal-error { background: #fee; color: #c00; padding: 8px 10px; border-radius: 4px; font-size: 12px; margin-bottom: 10px; display: none; }
.detail-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: flex-start; }
.detail-header .doc-info .doc-num { font-family: monospace; font-size: 13px; color: #1a73e8; font-weight: 700; margin-bottom: 4px; }
.detail-header .doc-info .doc-title-large { font-size: 18px; font-weight: 600; color: #222; margin-bottom: 4px; }
.detail-header .doc-info .doc-meta { font-size: 12px; color: #888; }
.btn-back { background: transparent; border: 1px solid #ddd; border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: #555; white-space: nowrap; width: auto; }
.btn-back:hover { background: #f5f5f5; }
.section-title { font-size: 12px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin: 20px 0 8px 0; }
.rev-row-current td { font-weight: 700; }
.rev-badge { display: inline-block; background: #1a73e8; color: white; font-size: 10px; padding: 1px 6px; border-radius: 10px; margin-left: 6px; font-weight: 600; vertical-align: middle; }
.rev-row { cursor: pointer; }
.rev-row:hover { background: #f0f6ff !important; }
.rev-row.selected { background: #e8f0fe !important; }
.files-section { margin-top: 16px; background: white; border-radius: 8px; border: 1px solid #e0e0e0; overflow: hidden; }
.files-section-header { padding: 10px 14px; background: #f8f9fa; border-bottom: 1px solid #e0e0e0; font-size: 12px; font-weight: 600; color: #555; }
.file-row { display: flex; align-items: center; padding: 9px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13px; gap: 12px; }
.file-row:last-child { border-bottom: none; }
.file-type-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 3px; text-transform: uppercase; flex-shrink: 0; }
.file-type-primary { background: #e8f0fe; color: #1a73e8; }
.file-type-attachment { background: #f0f0f0; color: #666; }
.file-name { flex: 1; font-family: monospace; font-size: 12px; color: #333; }
.file-size { font-size: 12px; color: #888; white-space: nowrap; }
.file-date { font-size: 12px; color: #888; white-space: nowrap; }
.no-files { padding: 16px 14px; font-size: 13px; color: #aaa; }
.pkg-link { color: #1a73e8; cursor: pointer; font-size: 11px; }
.pkg-link:hover { text-decoration: underline; }
.btn-upload { background: #e8f5e9; color: #1e7e34; border: 1px solid #1e7e34; border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-upload:hover { background: #d4edda; }
.upload-drop-zone { border: 2px dashed #1a73e8; border-radius: 8px; background: #f0f6ff; padding: 32px; text-align: center; cursor: pointer; transition: background 0.15s; margin-bottom: 16px; }
.upload-drop-zone.drag-over { background: #dceeff; border-color: #1557b0; }
.upload-drop-zone p { color: #555; font-size: 14px; margin-bottom: 8px; }
.upload-drop-zone small { color: #888; font-size: 12px; }
.upload-drop-zone input[type="file"] { display: none; }
.upload-queue { background: white; border-radius: 8px; border: 1px solid #e0e0e0; overflow: hidden; margin-bottom: 16px; }
.upload-queue-header { padding: 10px 14px; background: #f8f9fa; border-bottom: 1px solid #e0e0e0; font-size: 12px; font-weight: 600; color: #555; display: flex; justify-content: space-between; align-items: center; }
.upload-item { display: grid; grid-template-columns: 1fr 80px 120px 180px 80px; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f0f0f0; font-size: 12px; }
.upload-item:last-child { border-bottom: none; }
.upload-item.status-ok { background: #f6ffed; }
.upload-item.status-error { background: #fff6f6; }
.upload-item.status-uploading { background: #fffbf0; }
.upload-item.status-done { background: #f0fff4; }
.upload-item .ui-filename { font-family: monospace; font-size: 11px; color: #333; word-break: break-all; }
.upload-item .ui-rev { font-size: 12px; color: #555; text-align: center; }
.upload-item .ui-status { font-size: 11px; font-weight: 600; }
.ui-status.ok { color: #1e7e34; }
.ui-status.error { color: #c00; }
.ui-status.uploading { color: #e6a817; }
.ui-status.done { color: #1e7e34; }
.upload-item select { padding: 4px 6px; border: 1px solid #ddd; border-radius: 4px; font-size: 11px; width: 100%; }
.upload-item select:disabled { background: #f5f5f5; color: #aaa; }
.btn-start-upload { background: #1e7e34; color: white; border: none; border-radius: 4px; padding: 8px 20px; font-size: 14px; cursor: pointer; width: auto; }
.btn-start-upload:hover { background: #155724; }
.btn-start-upload:disabled { background: #999; cursor: not-allowed; }
.upload-summary { font-size: 13px; color: #555; margin-top: 8px; }
.btn-download { background: transparent; border: 1px solid #1a73e8; color: #1a73e8; border-radius: 4px; padding: 3px 10px; font-size: 11px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-download:hover { background: #f0f6ff; }
.btn-delete-rev { background: transparent; border: 1px solid #c00; color: #c00; border-radius: 4px; padding: 3px 10px; font-size: 11px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-delete-rev:hover { background: #fff0f0; }
.btn-ddm { background: transparent; border: 1px solid #6a1fb5; color: #6a1fb5; border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-ddm:hover { background: #f5eeff; }
.btn-add-doc { background: #fff3e0; color: #e65100; border: 1px solid #e65100; border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; width: auto; }
.btn-add-doc:hover { background: #ffe0b2; }

/* ===== RETURN CODE MODAL ===== */
.rc-option-btn {
  background: white; border: 2px solid #e0e0e0; border-radius: 8px;
  padding: 14px 8px; cursor: pointer; text-align: center;
  transition: border-color 0.15s, background 0.15s; width: 100%;
}
.rc-option-btn:hover { border-color: #1a73e8; background: #f0f6ff; }
.rc-option-btn.selected { border-color: #1a73e8; background: #e8f0fe; }
.rc-num { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.rc-num.rc-1 { color: #1e7e34; }
.rc-num.rc-2 { color: #e6a817; }
.rc-num.rc-3 { color: #c0392b; }
.rc-desc { font-size: 11px; color: #666; line-height: 1.3; }
.btn-give-rc {
  background: #1a3a5c; color: #7db8f7; border: 1px solid #2d5a8c;
  border-radius: 4px; padding: 3px 10px; font-size: 11px;
  cursor: pointer; white-space: nowrap; width: auto;
}
.btn-give-rc:hover { background: #1e4a73; }
