* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #e8eaf6; padding: 10px; font-size: 13px; }
.container { max-width: 900px; margin: 0 auto; background: #fff; border-radius: 6px; box-shadow: 0 1px 5px rgba(0,0,0,0.15); }
header { background: #1a237e; color: #fff; padding: 12px 20px; border-radius: 6px 6px 0 0; }
header h1 { font-size: 16px; }

.top-bar { display: flex; gap: 8px; padding: 10px 15px; background: #f5f5f5; border-bottom: 1px solid #ddd; align-items: center; }
.top-bar select { flex: 1; padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }
.btn-sm { padding: 6px 12px; border: 1px solid #1a237e; border-radius: 4px; background: #fff; color: #1a237e; font-size: 12px; cursor: pointer; white-space: nowrap; }
.btn-sm:hover { background: #e8eaf6; }

.status-block { margin: 10px 15px; padding: 12px 15px; border-radius: 6px; border: 1px solid #e0e0e0; }
.status-new { background: #f5f5f5; border-color: #bdbdbd; }
.status-generated { background: #fff3e0; border-color: #ff9800; }
.status-signed { background: #e8f5e9; border-color: #4caf50; }
.status-info { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.5; }
.status-icon { font-size: 20px; flex-shrink: 0; }
.status-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; color: #fff; }
.badge-зеленый { background: #4caf50; }
.badge-оранжевый { background: #ff9800; }
.badge-красный { background: #f44336; }

.groups-container { padding: 10px; }
.group { margin-bottom: 8px; border: 1px solid #e0e0e0; border-radius: 5px; }
.group-header { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: #e8eaf6; font-weight: 600; font-size: 13px; border-radius: 5px 5px 0 0; }
.weight { background: #1a237e; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: normal; }

.indicator { display: flex; align-items: center; padding: 5px 12px 5px 38px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.15s; gap: 6px; }
.indicator:last-child { border-bottom: none; border-radius: 0 0 5px 5px; }
.indicator:hover { background: #fafafa; }
.indicator input[type="checkbox"] { position: absolute; opacity: 0; margin-left: -26px; }
.checkmark { width: 18px; height: 18px; border: 2px solid #bbb; border-radius: 3px; transition: all 0.2s; flex-shrink: 0; margin-left: -26px; margin-right: 8px; }
.indicator input:checked ~ .checkmark { background: #4caf50; border-color: #4caf50; }
.indicator input:checked ~ .checkmark:after { content: "✓"; display: block; color: #fff; font-size: 14px; font-weight: bold; text-align: center; line-height: 16px; }
.text { flex: 1; margin-right: 4px; font-size: 12px; line-height: 1.3; }

.help-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.help { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: #1a237e; color: #fff; border-radius: 50%; font-size: 11px; font-weight: bold; cursor: pointer; transition: background 0.2s; }
.help:hover { background: #ff6f00; }
.help-tip { display: none; position: fixed; background: #fff; color: #333; padding: 14px 18px; border-radius: 10px; font-size: 13px; font-weight: normal; white-space: normal; width: 400px; max-width: calc(100vw - 40px); line-height: 1.5; text-align: left; box-shadow: 0 10px 40px rgba(0,0,0,0.4); border: 1px solid #ccc; pointer-events: none; z-index: 999999; }
.help-tip::before { content: ""; position: absolute; bottom: -10px; left: 20px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; }
.help-wrap.active .help-tip { display: block; }

.kval { background: #e8f5e9; color: #2e7d32; padding: 1px 7px; border-radius: 8px; font-size: 11px; font-weight: 600; min-width: 38px; text-align: center; flex-shrink: 0; }

.extra-fields { padding: 8px 12px; }
.field-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f5f5f5; }
.field-row:last-child { border-bottom: none; }
.field-num { font-weight: 600; min-width: 20px; color: #1a237e; }
.field-label { flex: 1; font-size: 12px; }
.field-input { width: 60px; padding: 4px 8px; border: 1px solid #ccc; border-radius: 3px; font-size: 13px; text-align: center; }
.field-input-wide { flex: 1; padding: 6px 10px; border: 1px solid #ccc; border-radius: 3px; font-size: 13px; min-width: 200px; }

.result-bar { display: flex; gap: 20px; margin: 10px; padding: 12px 15px; background: #1a237e; color: #fff; border-radius: 5px; font-size: 14px; }
.result-bar strong { font-size: 16px; }

.actions { display: flex; justify-content: center; gap: 10px; padding: 10px 15px 15px; }
.btn { padding: 8px 18px; border: 1px solid #1a237e; border-radius: 4px; background: #fff; color: #1a237e; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn:hover { background: #e8eaf6; }
.btn.primary { background: #1a237e; color: #fff; }
.btn.primary:hover { background: #283593; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(26,35,126,0.85); z-index: 999999; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border-radius: 2px; padding: 0; width: 460px; max-width: 90vw; box-shadow: 0 8px 32px rgba(0,0,0,0.3); overflow: hidden; }
.modal-header { background: #1a237e; padding: 16px 24px; display: flex; align-items: center; gap: 12px; }
.modal-header-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.modal-header-title { color: #fff; font-size: 15px; font-weight: 600; }
.modal-content { padding: 24px; }
.modal-status-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.modal-status-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.modal-status-icon.processing { background: #e8eaf6; color: #1a237e; animation: pulse 1.5s infinite; }
.modal-status-icon.success { background: #e8f5e9; color: #2e7d32; }
.modal-status-icon.error { background: #fbe9e7; color: #c62828; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.modal-status-text { flex: 1; }
.modal-status-title { font-size: 14px; font-weight: 600; color: #212121; margin-bottom: 4px; }
.modal-status-desc { font-size: 12px; color: #757575; line-height: 1.5; }
.modal-status-desc p { margin-bottom: 6px; }
.modal-progress-section { margin-bottom: 16px; }
.modal-progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 11px; color: #616161; font-weight: 500; }
.modal-progress-bar { width: 100%; height: 4px; background: #e0e0e0; border-radius: 2px; overflow: hidden; }
.modal-progress-fill { height: 100%; background: #1a237e; width: 0%; border-radius: 2px; transition: width 0.4s ease; }
.modal-footer { border-top: 1px solid #e0e0e0; padding: 12px 24px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-btn { padding: 8px 20px; border: 1px solid #1a237e; border-radius: 2px; background: #fff; color: #1a237e; font-size: 13px; font-weight: 500; cursor: pointer; }
.modal-btn:hover { background: #e8eaf6; }
.modal-btn.primary { background: #1a237e; color: #fff; }
.modal-btn.primary:hover { background: #283593; }
@keyframes modalIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-overlay.active .modal-box { animation: modalIn 0.25s ease; }

@media (max-width: 600px) { 
    .top-bar { flex-wrap: wrap; } 
    .result-bar { flex-direction: column; gap: 5px; } 
    .modal-box { width: 95vw; }
    .modal-header { padding: 12px 16px; }
    .modal-content { padding: 16px; }
    .modal-footer { padding: 10px 16px; }
    .status-actions { flex-direction: column; }
    .status-actions .btn { width: 100%; }
}
.status-actions .btn {
    display: inline-block !important;
}
.warning-banner {
    background: #fff3e0;
    border: 1px solid #ff9800;
    border-left: 4px solid #ff9800;
    border-radius: 4px;
    padding: 10px 15px;
    margin: 10px 15px;
    font-size: 12px;
    color: #e65100;
}
.welcome-block {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-left: 4px solid #1a237e;
    border-radius: 4px;
    padding: 20px 25px;
    margin: 10px 15px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
}
.welcome-block h2 {
    font-size: 16px;
    color: #1a237e;
    margin-bottom: 10px;
}
.welcome-block h3 {
    font-size: 14px;
    color: #1a237e;
    margin: 15px 0 8px;
}
.welcome-block ol, .welcome-block ul {
    padding-left: 25px;
}
.welcome-block li {
    margin-bottom: 5px;
}